diff --git a/changelog b/changelog index 3f348a6ac..7ff9cd506 100644 --- a/changelog +++ b/changelog @@ -1,11 +1,10 @@ ## Changed -* Updated russian localization -* Safes now properly use the inventorytweaks API, allowing slot sorting via GUI -* The meltdown disabling dial now also affects meldown caused by breaking fuel channels while hot -* The dots on the grpahite moderator columns are now a lot darker to tell them apart from fuel channels much more easily +* Updated textures for some nuclear bomb GUIs +* RBMK fuel rods too hot to be taken out manually can now be removed by players in creative mode +* Updated the SILEX recycling recipe for MOX fuel to reflect the recent recipe change + * High-xenon MOX pellets now yield xenon-135 again +* Improved logging for incorrectly configured machine recipes ## Fixed -* Fixed RBMK fuel channel RoR not being properly parseable due to not being integers -* Potentially fixed a dupe regarding safes -* Moved the flow control pump's GUI code out of the block class which should hopefully fix an issue where spigot servers crash instantly when placed down -* Fixed RBMKs melting down when removing the covers from fuel channels with hot fuel in them \ No newline at end of file +* Fixed some damage categories not applying correctly, causing things like general energy resistance to not work against lasers +* Fixed RoR components not being able to be attached to the top of reasim fuel rods \ No newline at end of file diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index 38559a227..6d38a8ab9 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -1097,6 +1097,7 @@ public class ModBlocks { public static Block rbmk_console; public static Block rbmk_crane_console; public static Block rbmk_display; + public static Block rbmk_key_pad; public static Block rbmk_autoloader; public static Block rbmk_loader; public static Block rbmk_steam_inlet; @@ -2117,6 +2118,7 @@ public class ModBlocks { rbmk_console = new RBMKConsole().setBlockName("rbmk_console").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_console"); rbmk_crane_console = new RBMKCraneConsole().setBlockName("rbmk_crane_console").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_crane_console"); rbmk_display = new RBMKDisplay().setBlockName("rbmk_display").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_display"); + rbmk_key_pad = new RBMKKeyPad().setBlockName("rbmk_key_pad").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_display"); rbmk_autoloader = new RBMKAutoloader().setBlockName("rbmk_autoloader").setCreativeTab(MainRegistry.machineTab).setHardness(50.0F).setResistance(60.0F).setBlockTextureName(RefStrings.MODID + ":rbmk_autoloader"); rbmk_loader = new RBMKLoader(Material.iron).setBlockName("rbmk_loader").setCreativeTab(MainRegistry.machineTab).setHardness(50.0F).setResistance(60.0F).setBlockTextureName(RefStrings.MODID + ":rbmk_loader"); rbmk_steam_inlet = new RBMKInlet(Material.iron).setBlockName("rbmk_steam_inlet").setCreativeTab(MainRegistry.machineTab).setHardness(50.0F).setResistance(60.0F).setBlockTextureName(RefStrings.MODID + ":rbmk_steam_inlet"); @@ -3109,6 +3111,7 @@ public class ModBlocks { GameRegistry.registerBlock(rbmk_console, rbmk_console.getUnlocalizedName()); GameRegistry.registerBlock(rbmk_crane_console, rbmk_crane_console.getUnlocalizedName()); register(rbmk_display); + register(rbmk_key_pad); register(rbmk_autoloader); register(rbmk_loader); register(rbmk_steam_inlet); diff --git a/src/main/java/com/hbm/blocks/machine/rbmk/RBMKDisplay.java b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKDisplay.java index fae8a9e8c..a358ecbad 100644 --- a/src/main/java/com/hbm/blocks/machine/rbmk/RBMKDisplay.java +++ b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKDisplay.java @@ -1,57 +1,19 @@ package com.hbm.blocks.machine.rbmk; -import org.lwjgl.opengl.GL11; - -import com.hbm.render.block.ISBRHUniversal; -import com.hbm.render.util.RenderBlocksNT; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKDisplay; import api.hbm.block.IToolable; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.block.Block; -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.MathHelper; -import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -public class RBMKDisplay extends BlockContainer implements ISBRHUniversal, IToolable { - - public RBMKDisplay() { - super(Material.iron); - } - - @Override public int getRenderType() { return renderID; } - @Override public boolean isOpaqueCube() { return false; } - @Override public boolean renderAsNormalBlock() { return false; } - - @Override - @SideOnly(Side.CLIENT) - public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) { - return true; - } +public class RBMKDisplay extends RBMKMiniPanelBase implements IToolable { @Override public TileEntity createNewTileEntity(World world, int meta) { return new TileEntityRBMKDisplay(); } - @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { - int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - if(i == 0) world.setBlockMetadataWithNotify(x, y, z, 2, 2); - if(i == 1) world.setBlockMetadataWithNotify(x, y, z, 5, 2); - if(i == 2) world.setBlockMetadataWithNotify(x, y, z, 3, 2); - if(i == 3) world.setBlockMetadataWithNotify(x, y, z, 4, 2); - } - @Override public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) { if(tool != ToolType.SCREWDRIVER) @@ -64,33 +26,4 @@ public class RBMKDisplay extends BlockContainer implements ISBRHUniversal, ITool } return true; } - - @Override - public void renderInventoryBlock(Block block, int meta, int modelId, Object renderBlocks) { - - GL11.glPushMatrix(); - RenderBlocks renderer = (RenderBlocks) renderBlocks; - GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - - renderer.setRenderBounds(0.25D, 0D, 0D, 1D, 1D, 1D); - RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer); - GL11.glPopMatrix(); - } - - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, Object renderBlocks) { - RenderBlocksNT renderer = RenderBlocksNT.INSTANCE.setWorld(world); - - Tessellator tessellator = Tessellator.instance; - tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z)); - tessellator.setColorOpaque_F(1, 1, 1); - - int meta = world.getBlockMetadata(x, y, z); - - renderer.setRenderBounds(meta == 4 ? 0.25D : 0D, 0D, meta == 2 ? 0.25D : 0D, meta == 5 ? 0.75D : 1D, 1D, meta == 3 ? 0.75D : 1D); - renderer.renderStandardBlock(block, x, y, z); - - return true; - } } diff --git a/src/main/java/com/hbm/blocks/machine/rbmk/RBMKKeyPad.java b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKKeyPad.java new file mode 100644 index 000000000..9570978f0 --- /dev/null +++ b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKKeyPad.java @@ -0,0 +1,14 @@ +package com.hbm.blocks.machine.rbmk; + +import com.hbm.tileentity.machine.rbmk.TileEntityRBMKKeyPad; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public class RBMKKeyPad extends RBMKMiniPanelBase { + + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileEntityRBMKKeyPad(); + } +} diff --git a/src/main/java/com/hbm/blocks/machine/rbmk/RBMKMiniPanelBase.java b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKMiniPanelBase.java new file mode 100644 index 000000000..45a38c012 --- /dev/null +++ b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKMiniPanelBase.java @@ -0,0 +1,74 @@ +package com.hbm.blocks.machine.rbmk; + +import org.lwjgl.opengl.GL11; + +import com.hbm.render.block.ISBRHUniversal; +import com.hbm.render.util.RenderBlocksNT; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MathHelper; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public abstract class RBMKMiniPanelBase extends BlockContainer implements ISBRHUniversal { + + public RBMKMiniPanelBase() { + super(Material.iron); + } + + @Override public int getRenderType() { return renderID; } + @Override public boolean isOpaqueCube() { return false; } + @Override public boolean renderAsNormalBlock() { return false; } + + @Override + @SideOnly(Side.CLIENT) + public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) { + return true; + } + + @Override + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { + int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + if(i == 0) world.setBlockMetadataWithNotify(x, y, z, 2, 2); + if(i == 1) world.setBlockMetadataWithNotify(x, y, z, 5, 2); + if(i == 2) world.setBlockMetadataWithNotify(x, y, z, 3, 2); + if(i == 3) world.setBlockMetadataWithNotify(x, y, z, 4, 2); + } + + @Override + public void renderInventoryBlock(Block block, int meta, int modelId, Object renderBlocks) { + + GL11.glPushMatrix(); + RenderBlocks renderer = (RenderBlocks) renderBlocks; + GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + + renderer.setRenderBounds(0.25D, 0D, 0D, 1D, 1D, 1D); + RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer); + GL11.glPopMatrix(); + } + + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, Object renderBlocks) { + RenderBlocksNT renderer = RenderBlocksNT.INSTANCE.setWorld(world); + + Tessellator tessellator = Tessellator.instance; + tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z)); + tessellator.setColorOpaque_F(1, 1, 1); + + int meta = world.getBlockMetadata(x, y, z); + + renderer.setRenderBounds(meta == 4 ? 0.25D : 0D, 0D, meta == 2 ? 0.25D : 0D, meta == 5 ? 0.75D : 1D, 1D, meta == 3 ? 0.75D : 1D); + renderer.renderStandardBlock(block, x, y, z); + + return true; + } +} diff --git a/src/main/java/com/hbm/blocks/machine/rbmk/RBMKRodReaSim.java b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKRodReaSim.java index efd8e14f4..7017c895f 100644 --- a/src/main/java/com/hbm/blocks/machine/rbmk/RBMKRodReaSim.java +++ b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKRodReaSim.java @@ -1,6 +1,6 @@ package com.hbm.blocks.machine.rbmk; -import com.hbm.tileentity.TileEntityProxyInventory; +import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKRodReaSim; import net.minecraft.tileentity.TileEntity; @@ -14,13 +14,8 @@ public class RBMKRodReaSim extends RBMKRod { @Override public TileEntity createNewTileEntity(World world, int meta) { - - if(meta >= this.offset) - return new TileEntityRBMKRodReaSim(); - - if(hasExtra(meta)) - return new TileEntityProxyInventory(); - + if(meta >= this.offset) return new TileEntityRBMKRodReaSim(); + if(hasExtra(meta)) return new TileEntityProxyCombo().inventory(); return null; } } diff --git a/src/main/java/com/hbm/inventory/RecipesCommon.java b/src/main/java/com/hbm/inventory/RecipesCommon.java index 433735f9d..c7e8bfc0f 100644 --- a/src/main/java/com/hbm/inventory/RecipesCommon.java +++ b/src/main/java/com/hbm/inventory/RecipesCommon.java @@ -271,6 +271,11 @@ public class RecipesCommon { public List extractForNEI() { return Arrays.asList(new ItemStack[] {this.toStack()}); } + + @Override + public String toString() { + return this.stacksize + "x" + (this.item != null ? this.item.getUnlocalizedName() : "null") + "@" + this.meta; + } } public static class NBTStack extends ComparableStack { @@ -374,6 +379,11 @@ public class RecipesCommon { return 0; } + + @Override + public String toString() { + return this.stacksize + "x" + (this.item != null ? this.item.getUnlocalizedName() : "null") + "@" + this.meta + "?" + this.nbt; + } } public static class OreDictStack extends AStack { @@ -490,6 +500,11 @@ public class RecipesCommon { return false; return true; } + + @Override + public String toString() { + return this.stacksize + "x" + this.name; + } } public static class MetaBlock { diff --git a/src/main/java/com/hbm/inventory/container/ContainerRBMKRod.java b/src/main/java/com/hbm/inventory/container/ContainerRBMKRod.java index 73a8bc7b6..a8a7d1533 100644 --- a/src/main/java/com/hbm/inventory/container/ContainerRBMKRod.java +++ b/src/main/java/com/hbm/inventory/container/ContainerRBMKRod.java @@ -31,7 +31,7 @@ public class ContainerRBMKRod extends Container { @Override public ItemStack slotClick(int index, int button, int mode, EntityPlayer player) { - if(index == 0) { + if(index == 0 && !player.capabilities.isCreativeMode) { if(rbmk.coldEnoughForManual()) { return super.slotClick(index, button, mode, player); diff --git a/src/main/java/com/hbm/inventory/recipes/SILEXRecipes.java b/src/main/java/com/hbm/inventory/recipes/SILEXRecipes.java index 8fff7382f..4995f933e 100644 --- a/src/main/java/com/hbm/inventory/recipes/SILEXRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/SILEXRecipes.java @@ -274,20 +274,18 @@ public class SILEXRecipes { // MOX // recipes.put(new ComparableStack(ModItems.rbmk_pellet_mox, 1, i), new SILEXRecipe(600, 100, 1) .addOut(new ItemStack(ModItems.nugget_mox_fuel), 84 - i * 20) - .addOut(i < 1 ? new ItemStack(ModItems.nugget_pu239) : new ItemStack(ModItems.nugget_pu_mix), 6 + i * 4) + .addOut(new ItemStack(ModItems.nugget_pu_mix), 6 + i * 4) .addOut(new ItemStack(ModItems.nuclear_waste_long_tiny, 1, ItemWasteLong.WasteClass.URANIUM235.ordinal()), 2 + 3 * i) .addOut(new ItemStack(ModItems.nuclear_waste_short_tiny, 1, ItemWasteShort.WasteClass.URANIUM235.ordinal()), 3 + 5 * i) - .addOut(new ItemStack(ModItems.nuclear_waste_short_tiny, 1, ItemWasteShort.WasteClass.PLUTONIUM239.ordinal()), 3 + 5 * i) - .addOut(new ItemStack(ModItems.nuclear_waste_short_tiny, 1, ItemWasteShort.WasteClass.PLUTONIUM240.ordinal()), 2 + 3 * i) ); + .addOut(new ItemStack(ModItems.nuclear_waste_short_tiny, 1, ItemWasteShort.WasteClass.PLUTONIUM239.ordinal()), 5 + 8 * i) ); - //TODO: Readd xenon processing if/when the NEI handler can display more than 6 outputs properly - recipes.put(new ComparableStack(ModItems.rbmk_pellet_mox, 1, i + 5), new SILEXRecipe(600, 100, 1) //Plutonium processing isn't possible w/o fucking up the NEI handler or removing xenon - .addOut(new ItemStack(ModItems.nugget_mox_fuel), 84 - i * 20) //To prevent people from taking advantage of differing waste types, conform to the latter - .addOut(i < 1 ? new ItemStack(ModItems.nugget_pu239) : new ItemStack(ModItems.nugget_pu_mix), 6 + i * 4) + recipes.put(new ComparableStack(ModItems.rbmk_pellet_mox, 1, i + 5), new SILEXRecipe(600, 100, 1) + .addOut(new ItemStack(ModItems.powder_xe135_tiny), 1) + .addOut(new ItemStack(ModItems.nugget_mox_fuel), 83 - i * 20) + .addOut(new ItemStack(ModItems.nugget_pu_mix), 6 + i * 4) .addOut(new ItemStack(ModItems.nuclear_waste_long_tiny, 1, ItemWasteLong.WasteClass.URANIUM235.ordinal()), 2 + 3 * i) .addOut(new ItemStack(ModItems.nuclear_waste_short_tiny, 1, ItemWasteShort.WasteClass.URANIUM235.ordinal()), 3 + 5 * i) - .addOut(new ItemStack(ModItems.nuclear_waste_short_tiny, 1, ItemWasteShort.WasteClass.PLUTONIUM239.ordinal()), 3 + 5 * i) - .addOut(new ItemStack(ModItems.nuclear_waste_short_tiny, 1, ItemWasteShort.WasteClass.PLUTONIUM240.ordinal()), 2 + 3 * i) ); + .addOut(new ItemStack(ModItems.nuclear_waste_short_tiny, 1, ItemWasteShort.WasteClass.PLUTONIUM239.ordinal()), 5 + 8 * i) ); // LEAUS // recipes.put(new ComparableStack(ModItems.rbmk_pellet_leaus, 1, i), new SILEXRecipe(600, 100, 2) diff --git a/src/main/java/com/hbm/inventory/recipes/loader/GenericRecipe.java b/src/main/java/com/hbm/inventory/recipes/loader/GenericRecipe.java index f2be9414a..27f92cb14 100644 --- a/src/main/java/com/hbm/inventory/recipes/loader/GenericRecipe.java +++ b/src/main/java/com/hbm/inventory/recipes/loader/GenericRecipe.java @@ -74,17 +74,21 @@ public class GenericRecipe { public GenericRecipe setPools528(String... pools) { if(GeneralConfig.enable528) { this.blueprintPools = pools; for(String pool : pools) GenericRecipes.addToPool(pool, this); } return this; } public GenericRecipe setGroup(String autoSwitch, GenericRecipes set) { this.autoSwitchGroup = autoSwitch; set.addToGroup(autoSwitch, this); return this; } - public GenericRecipe inputItems(AStack... input) { this.inputItem = input; for(AStack stack : this.inputItem) if(exceedsStackLimit(stack)) throw new IllegalArgumentException("AStack in " + this.name + " exceeds stack limit!"); return this; } - public GenericRecipe inputItemsEx(AStack... input) { if(!GeneralConfig.enableExpensiveMode) return this; this.inputItem = input; for(AStack stack : this.inputItem) if(exceedsStackLimit(stack)) throw new IllegalArgumentException("AStack in " + this.name + " exceeds stack limit!"); return this; } + public GenericRecipe inputItems(AStack... input) { this.inputItem = input; for(AStack stack : this.inputItem) checkStackLimit(stack); return this; } + public GenericRecipe inputItemsEx(AStack... input) { if(!GeneralConfig.enableExpensiveMode) return this; this.inputItem = input; for(AStack stack : this.inputItem) checkStackLimit(stack); return this; } public GenericRecipe inputFluids(FluidStack... input) { this.inputFluid = input; return this; } public GenericRecipe inputFluidsEx(FluidStack... input) { if(!GeneralConfig.enableExpensiveMode) return this; this.inputFluid = input; return this; } public GenericRecipe outputItems(IOutput... output) { this.outputItem = output; return this; } public GenericRecipe outputFluids(FluidStack... output) { this.outputFluid = output; return this; } - private boolean exceedsStackLimit(AStack stack) { - if(stack instanceof ComparableStack && stack.stacksize > ((ComparableStack) stack).item.getItemStackLimit(((ComparableStack) stack).toStack())) return true; - if(stack.stacksize > 64) return true; - return false; + private void checkStackLimit(AStack stack) { + boolean exceeds = false; + int max = 64; + if(stack instanceof ComparableStack) { + ComparableStack comp = (ComparableStack) stack; + max = comp.item.getItemStackLimit(comp.toStack()); + } + if(stack.stacksize > max) throw new IllegalArgumentException("AStack " + stack + " in " + this.name + " exceeds stack limit of " + max + "!"); } public GenericRecipe outputItems(ItemStack... output) { diff --git a/src/main/java/com/hbm/main/ClientProxy.java b/src/main/java/com/hbm/main/ClientProxy.java index e97bca89e..4edc9909e 100644 --- a/src/main/java/com/hbm/main/ClientProxy.java +++ b/src/main/java/com/hbm/main/ClientProxy.java @@ -411,6 +411,7 @@ public class ClientProxy extends ServerProxy { ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCraneConsole.class, new RenderCraneConsole()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRBMKConsole.class, new RenderRBMKConsole()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRBMKDisplay.class, new RenderRBMKDisplay()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRBMKKeyPad.class, new RenderRBMKKeyPad()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRBMKRod.class, new RenderRBMKFuelChannel()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRBMKRodReaSim.class, new RenderRBMKFuelChannel()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRBMKAutoloader.class, new RenderRBMKAutoloader()); diff --git a/src/main/java/com/hbm/render/tileentity/RenderRBMKKeyPad.java b/src/main/java/com/hbm/render/tileentity/RenderRBMKKeyPad.java new file mode 100644 index 000000000..0b980fb1f --- /dev/null +++ b/src/main/java/com/hbm/render/tileentity/RenderRBMKKeyPad.java @@ -0,0 +1,31 @@ +package com.hbm.render.tileentity; + +import org.lwjgl.opengl.GL11; + +import com.hbm.tileentity.machine.rbmk.TileEntityRBMKKeyPad; + +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; + +public class RenderRBMKKeyPad extends TileEntitySpecialRenderer { + + @Override + public void renderTileEntityAt(TileEntity te, double x, double y, double z, float interp) { + + GL11.glPushMatrix(); + GL11.glTranslated(x + 0.5, y, z + 0.5); + GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glEnable(GL11.GL_LIGHTING); + + switch(te.getBlockMetadata()) { + case 2: GL11.glRotatef(90, 0F, 1F, 0F); break; + case 4: GL11.glRotatef(180, 0F, 1F, 0F); break; + case 3: GL11.glRotatef(270, 0F, 1F, 0F); break; + case 5: GL11.glRotatef(0, 0F, 1F, 0F); break; + } + + TileEntityRBMKKeyPad keypad = (TileEntityRBMKKeyPad) te; + + GL11.glPopMatrix(); + } +} diff --git a/src/main/java/com/hbm/tileentity/TileMappings.java b/src/main/java/com/hbm/tileentity/TileMappings.java index ea00242cb..d0d024b3b 100644 --- a/src/main/java/com/hbm/tileentity/TileMappings.java +++ b/src/main/java/com/hbm/tileentity/TileMappings.java @@ -403,6 +403,7 @@ public class TileMappings { put(TileEntityCraneConsole.class, "tileentity_rbmk_crane_console"); put(TileEntityRBMKConsole.class, "tileentity_rbmk_console"); put(TileEntityRBMKDisplay.class, "tileentity_rbmk_display"); + put(TileEntityRBMKKeyPad.class, "tileentity_rbmk_keypad"); put(TileEntityRBMKInlet.class, "tileentity_rbmk_inlet"); put(TileEntityRBMKOutlet.class, "tileentity_rbmk_outlet"); put(TileEntityRBMKAutoloader.class, "tileentity_rbmk_autoloader"); diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKKeyPad.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKKeyPad.java new file mode 100644 index 000000000..7788ec0d2 --- /dev/null +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKKeyPad.java @@ -0,0 +1,102 @@ +package com.hbm.tileentity.machine.rbmk; + +import com.hbm.tileentity.TileEntityLoadedBase; +import com.hbm.tileentity.network.RTTYSystem; +import com.hbm.util.BufferUtil; + +import io.netty.buffer.ByteBuf; + +public class TileEntityRBMKKeyPad extends TileEntityLoadedBase { + + /* __________ + * / /| + * /________ / | + * | __ __ | | + * ||__| |__|| | + * | __ __ | | + * ||__| |__|| / + * |_________|/ + */ + + public KeyUnit[] keys = new KeyUnit[4]; + + public TileEntityRBMKKeyPad() { + for(int i = 0; i < 4; i++) this.keys[i] = new KeyUnit(); + } + + @Override + public void updateEntity() { + + if(!worldObj.isRemote) { + + for(int i = 0; i < 4; i++) this.keys[i].update(); + + this.networkPackNT(50); + } + } + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + for(int i = 0; i < 4; i++) this.keys[i].serialize(buf); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + for(int i = 0; i < 4; i++) this.keys[i].deserialize(buf); + } + + public class KeyUnit { + + /** If the output should be per tick, allows the "is pressed" state */ + public boolean polling; + /** If the button is toggled, assuming polling is enabled */ + public boolean isPressed; + /** Color of the button as rendered on the panel */ + public int color; + /** Label on the button as rendered on the panel */ + public String label; + /** What channel to send the command over */ + public String rtty; + /** What to send when pressed */ + public String command; + + public void click() { + if(!polling) { + if(canSend()) RTTYSystem.broadcast(worldObj, rtty, command); + } else { + this.isPressed = !this.isPressed; + TileEntityRBMKKeyPad.this.markDirty(); + } + } + + public void update() { + if(polling && isPressed) { + if(canSend()) RTTYSystem.broadcast(worldObj, rtty, command); + } + } + + public boolean canSend() { + return rtty != null && !rtty.isEmpty() && command != null && !command.isEmpty(); + } + + public void serialize(ByteBuf buf) { + buf.writeBoolean(polling); + if(polling) buf.writeBoolean(isPressed); + buf.writeInt(color); + BufferUtil.writeString(buf, label); + BufferUtil.writeString(buf, rtty); + BufferUtil.writeString(buf, command); + } + + public void deserialize(ByteBuf buf) { + polling = buf.readBoolean(); + if(polling) isPressed = buf.readBoolean(); + color = buf.readInt(); + label = BufferUtil.readString(buf); + rtty = BufferUtil.readString(buf); + command = BufferUtil.readString(buf); + } + } +} diff --git a/src/main/java/com/hbm/util/DamageResistanceHandler.java b/src/main/java/com/hbm/util/DamageResistanceHandler.java index 03a69c6d9..2ef164282 100644 --- a/src/main/java/com/hbm/util/DamageResistanceHandler.java +++ b/src/main/java/com/hbm/util/DamageResistanceHandler.java @@ -8,6 +8,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Map.Entry; import com.google.gson.Gson; @@ -427,7 +428,7 @@ public class DamageResistanceHandler { @SubscribeEvent public void onEntityAttacked(LivingAttackEvent event) { if(event.source.isDamageAbsolute()) return; - + EntityLivingBase e = event.entityLiving; float amount = event.ammount; @@ -443,6 +444,7 @@ public class DamageResistanceHandler { @SubscribeEvent public void onEntityDamaged(LivingHurtEvent event) { + event.ammount = calculateDamage(event.entityLiving, event.source, event.ammount, currentPDT, currentPDR); if(event.entityLiving instanceof IResistanceProvider) { IResistanceProvider irp = (IResistanceProvider) event.entityLiving; @@ -454,10 +456,10 @@ public class DamageResistanceHandler { if(source.isExplosion()) return CATEGORY_EXPLOSION; if(source.isFireDamage()) return CATEGORY_FIRE; if(source.isProjectile()) return CATEGORY_PHYSICAL; - if(source.damageType.equals(DamageClass.LASER.name())) return CATEGORY_ENERGY; - if(source.damageType.equals(DamageClass.MICROWAVE.name())) return CATEGORY_ENERGY; - if(source.damageType.equals(DamageClass.SUBATOMIC.name())) return CATEGORY_ENERGY; - if(source.damageType.equals(DamageClass.ELECTRIC.name())) return CATEGORY_ENERGY; + if(source.damageType.toLowerCase(Locale.US).equals(DamageClass.LASER.name().toLowerCase(Locale.US))) return CATEGORY_ENERGY; + if(source.damageType.toLowerCase(Locale.US).equals(DamageClass.MICROWAVE.name().toLowerCase(Locale.US))) return CATEGORY_ENERGY; + if(source.damageType.toLowerCase(Locale.US).equals(DamageClass.SUBATOMIC.name().toLowerCase(Locale.US))) return CATEGORY_ENERGY; + if(source.damageType.toLowerCase(Locale.US).equals(DamageClass.ELECTRIC.name().toLowerCase(Locale.US))) return CATEGORY_ENERGY; if(source == DamageSource.cactus) return CATEGORY_PHYSICAL; if(source instanceof EntityDamageSource) return CATEGORY_PHYSICAL; return source.damageType; @@ -546,7 +548,7 @@ public class DamageResistanceHandler { return source.isUnblockable() ? null : otherResistance; } - public ResistanceStats addExact(String type, float threshold, float resistance) { exactResistances.put(type, new Resistance(threshold, resistance)); return this; } + public ResistanceStats addExact(String type, float threshold, float resistance) { exactResistances.put(type.toLowerCase(Locale.US), new Resistance(threshold, resistance)); return this; } public ResistanceStats addCategory(String type, float threshold, float resistance) { categoryResistances.put(type, new Resistance(threshold, resistance)); return this; } public ResistanceStats setOther(float threshold, float resistance) { otherResistance = new Resistance(threshold, resistance); return this; }