mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
geiger tick now uses new rad system, adjusted trefoil HUD symbol
This commit is contained in:
parent
347c0596a0
commit
3ecc2ff135
@ -6,6 +6,7 @@ import java.util.Random;
|
|||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.items.ModItems;
|
import com.hbm.items.ModItems;
|
||||||
|
import com.hbm.saveddata.RadiationSavedData;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
@ -14,6 +15,7 @@ import net.minecraft.item.Item;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
import scala.Int;
|
import scala.Int;
|
||||||
|
|
||||||
public class ItemGeigerCounter extends Item {
|
public class ItemGeigerCounter extends Item {
|
||||||
@ -35,17 +37,17 @@ public class ItemGeigerCounter extends Item {
|
|||||||
if(x > 0) {
|
if(x > 0) {
|
||||||
List<Integer> list = new ArrayList<Integer>();
|
List<Integer> list = new ArrayList<Integer>();
|
||||||
|
|
||||||
if(x < 30)
|
if(x < 10)
|
||||||
list.add(1);
|
list.add(1);
|
||||||
if(x > 10 && x < 40)
|
if(x > 5 && x < 15)
|
||||||
list.add(2);
|
list.add(2);
|
||||||
if(x > 30 && x < 60)
|
if(x > 10 && x < 20)
|
||||||
list.add(3);
|
list.add(3);
|
||||||
if(x > 50 && x < 80)
|
if(x > 15 && x < 25)
|
||||||
list.add(4);
|
list.add(4);
|
||||||
if(x > 70 && x < 100)
|
if(x > 20 && x < 30)
|
||||||
list.add(5);
|
list.add(5);
|
||||||
if(x > 90)
|
if(x > 25)
|
||||||
list.add(6);
|
list.add(6);
|
||||||
|
|
||||||
world.playSoundAtEntity(entity, "hbm:item.geiger" + list.get(rand.nextInt(list.size())), 1.0F, 1.0F);
|
world.playSoundAtEntity(entity, "hbm:item.geiger" + list.get(rand.nextInt(list.size())), 1.0F, 1.0F);
|
||||||
@ -70,92 +72,15 @@ public class ItemGeigerCounter extends Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int check(World world, int x, int y, int z, int radius) {
|
public static int check(World world, int x, int y, int z, int radius) {
|
||||||
int rads = 0;
|
|
||||||
int r = radius;
|
RadiationSavedData data = RadiationSavedData.getData(world);
|
||||||
int r2 = r * r;
|
|
||||||
int r22 = r2 / 2;
|
Chunk chunk = world.getChunkFromBlockCoords(x, z);
|
||||||
for (int xx = -r; xx < r; xx++) {
|
int rads = (int)Math.ceil(data.getRadNumFromCoord(chunk.xPosition, chunk.zPosition));
|
||||||
int X = xx + x;
|
|
||||||
int XX = xx * xx;
|
|
||||||
for (int yy = -r; yy < r; yy++) {
|
|
||||||
int Y = yy + y;
|
|
||||||
int YY = XX + yy * yy;
|
|
||||||
for (int zz = -r; zz < r; zz++) {
|
|
||||||
int Z = zz + z;
|
|
||||||
int ZZ = YY + zz * zz;
|
|
||||||
if(ZZ < r22 / 3) {
|
|
||||||
rads += getRad(world.getBlock(X, Y, Z), 3);
|
|
||||||
} else if(ZZ < r22 / 3 * 2) {
|
|
||||||
rads += getRad(world.getBlock(X, Y, Z), 2);
|
|
||||||
} else if(ZZ < r22) {
|
|
||||||
rads += getRad(world.getBlock(X, Y, Z), 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return rads;
|
return rads;
|
||||||
}
|
}
|
||||||
|
|
||||||
//level 1: farthest, 3: nearest
|
|
||||||
public static int getRad(Block b, int level) {
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
if(b == ModBlocks.waste_trinitite) {
|
|
||||||
i = 2;
|
|
||||||
}
|
|
||||||
if(b == ModBlocks.waste_trinitite_red) {
|
|
||||||
i = 2;
|
|
||||||
}
|
|
||||||
if(b == ModBlocks.ore_uranium) {
|
|
||||||
i = 1;
|
|
||||||
}
|
|
||||||
if(b == ModBlocks.ore_nether_plutonium) {
|
|
||||||
i = 10;
|
|
||||||
}
|
|
||||||
if(b == ModBlocks.block_trinitite) {
|
|
||||||
i = 20;
|
|
||||||
}
|
|
||||||
if(b == ModBlocks.block_waste) {
|
|
||||||
i = 25;
|
|
||||||
}
|
|
||||||
if(b == ModBlocks.waste_earth) {
|
|
||||||
i = 2;
|
|
||||||
}
|
|
||||||
if(b == ModBlocks.waste_mycelium) {
|
|
||||||
i = 7;
|
|
||||||
}
|
|
||||||
if(b == ModBlocks.block_uranium) {
|
|
||||||
i = 10;
|
|
||||||
}
|
|
||||||
if(b == ModBlocks.yellow_barrel) {
|
|
||||||
i = 30;
|
|
||||||
}
|
|
||||||
if(b == ModBlocks.block_yellowcake) {
|
|
||||||
i = 2;
|
|
||||||
}
|
|
||||||
if(b == ModBlocks.sellafield_0) {
|
|
||||||
i = 10;
|
|
||||||
}
|
|
||||||
if(b == ModBlocks.sellafield_1) {
|
|
||||||
i = 20;
|
|
||||||
}
|
|
||||||
if(b == ModBlocks.sellafield_2) {
|
|
||||||
i = 30;
|
|
||||||
}
|
|
||||||
if(b == ModBlocks.sellafield_3) {
|
|
||||||
i = 40;
|
|
||||||
}
|
|
||||||
if(b == ModBlocks.sellafield_4) {
|
|
||||||
i = 50;
|
|
||||||
}
|
|
||||||
if(b == ModBlocks.sellafield_core) {
|
|
||||||
i = 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
return i * level;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int i, float f0, float f1, float f2)
|
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int i, float f0, float f1, float f2)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -36,27 +36,13 @@ public class ModEventHandlerClient {
|
|||||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||||
|
|
||||||
if(player.inventory.hasItem(ModItems.geiger_counter)) {
|
if(player.inventory.hasItem(ModItems.geiger_counter)) {
|
||||||
|
|
||||||
float rads = 0;
|
float rads = 0;
|
||||||
|
float abs = 0;
|
||||||
for(int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
|
||||||
|
|
||||||
if(player.inventory.getStackInSlot(i) != null && player.inventory.getStackInSlot(i).getItem() == ModItems.geiger_counter) {
|
|
||||||
rads = ItemGeigerCounter.getInt(player.inventory.getStackInSlot(i), "ticker");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
////TEST
|
|
||||||
|
|
||||||
RadEntitySavedData data = RadEntitySavedData.getData(player.worldObj);
|
RadEntitySavedData data = RadEntitySavedData.getData(player.worldObj);
|
||||||
rads = data.getRadFromEntity(player);
|
rads = data.getRadFromEntity(player);
|
||||||
|
|
||||||
////TEST
|
|
||||||
|
|
||||||
//if(player.worldObj.rand.nextInt(100) == 0)
|
|
||||||
// System.out.println(rads);
|
|
||||||
|
|
||||||
RenderScreenOverlay.renderRadCounter(event.resolution, rads, Minecraft.getMinecraft().ingameGUI);
|
RenderScreenOverlay.renderRadCounter(event.resolution, rads, Minecraft.getMinecraft().ingameGUI);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,13 +53,13 @@ public class RenderScreenOverlay {
|
|||||||
gui.drawTexturedModalRect(posX, posY, 0, 0, 94, 18);
|
gui.drawTexturedModalRect(posX, posY, 0, 0, 94, 18);
|
||||||
gui.drawTexturedModalRect(posX + 1, posY + 1, 1, 19, bar, 16);
|
gui.drawTexturedModalRect(posX + 1, posY + 1, 1, 19, bar, 16);
|
||||||
|
|
||||||
if(radiation >= maxRad * 0.75) {
|
if(radiation >= 25) {
|
||||||
gui.drawTexturedModalRect(posX + length + 2, posY - 18, 36, 36, 18, 18);
|
gui.drawTexturedModalRect(posX + length + 2, posY - 18, 36, 36, 18, 18);
|
||||||
|
|
||||||
} else if(radiation >= maxRad * 0.5) {
|
} else if(radiation >= 10) {
|
||||||
gui.drawTexturedModalRect(posX + length + 2, posY - 18, 18, 36, 18, 18);
|
gui.drawTexturedModalRect(posX + length + 2, posY - 18, 18, 36, 18, 18);
|
||||||
|
|
||||||
} else if(radiation >= maxRad * 0.25) {
|
} else if(radiation >= 2.5) {
|
||||||
gui.drawTexturedModalRect(posX + length + 2, posY - 18, 0, 36, 18, 18);
|
gui.drawTexturedModalRect(posX + length + 2, posY - 18, 0, 36, 18, 18);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user