From ae21012d216df71f31aed6fbc9d76215fc24ceed Mon Sep 17 00:00:00 2001 From: Draknyte1 Date: Sat, 4 Mar 2017 12:58:47 +1000 Subject: + New texture for the slow builders ring. + Added the Alkalus Disk. $ Fixed Frame Box Assembler Recipes. $ Fixed Missing 7Li material. $ Fixed Tiered Tanks not showing their capacity in the tooltip. $ Fixed tooltips for alloys containing Bronze or Steel. $ Fixed Clay Pipe Extruder Recipes. - Removed a handful of Plasma cells for misc. materials. % Changed the Industrial Coke Oven's tooltip, to better describe the input/output requirements. % Cleaned up The Entire Project. --- .../core/block/machine/BlockGtFrameBox.java | 28 +- .../gtPlusPlus/core/block/machine/FishTrap.java | 96 +++---- .../core/block/machine/Machine_Workbench.java | 134 +++++----- .../block/machine/Machine_WorkbenchAdvanced.java | 32 +-- .../machine/heliumgen/block/HeliumGenerator.java | 286 +++++++++++---------- .../container/ContainerHeliumGenerator.java | 29 +-- .../machine/heliumgen/gui/GUIHeliumGenerator.java | 107 ++++---- .../machine/heliumgen/slots/InvSlotRadiation.java | 40 +-- .../tileentity/TileEntityHeliumGenerator.java | 247 +++++++++--------- 9 files changed, 505 insertions(+), 494 deletions(-) (limited to 'src/Java/gtPlusPlus/core/block/machine') diff --git a/src/Java/gtPlusPlus/core/block/machine/BlockGtFrameBox.java b/src/Java/gtPlusPlus/core/block/machine/BlockGtFrameBox.java index 6de87e522b..cab02f9db6 100644 --- a/src/Java/gtPlusPlus/core/block/machine/BlockGtFrameBox.java +++ b/src/Java/gtPlusPlus/core/block/machine/BlockGtFrameBox.java @@ -10,25 +10,25 @@ public class BlockGtFrameBox extends MetaBlock { private int[] colours; private int totalColours; - + public BlockGtFrameBox( - String unlocalizedName, Material material, - BlockTypes blockTypeENUM, boolean recolour, int... colour) { + final String unlocalizedName, final Material material, + final BlockTypes blockTypeENUM, final boolean recolour, final int... colour) { super(unlocalizedName, material, blockTypeENUM.getBlockSoundType()); - this.setBlockTextureName(CORE.MODID + ":" + "blockGtFrame"); - this.setHarvestLevel(blockTypeENUM.getHarvestTool(), 2); - if (recolour && (colour != null && colour.length > 0)){ - colours = colour; - totalColours = colours.length; - } + this.setBlockTextureName(CORE.MODID + ":" + "blockGtFrame"); + this.setHarvestLevel(blockTypeENUM.getHarvestTool(), 2); + if (recolour && ((colour != null) && (colour.length > 0))){ + this.colours = colour; + this.totalColours = this.colours.length; + } } @Override - public int colorMultiplier(IBlockAccess p_149720_1_, int p_149720_2_, - int p_149720_3_, int p_149720_4_) { - for (int i : colours){ - - } + public int colorMultiplier(final IBlockAccess p_149720_1_, final int p_149720_2_, + final int p_149720_3_, final int p_149720_4_) { + for (final int i : this.colours){ + + } return super.colorMultiplier(p_149720_1_, p_149720_2_, p_149720_3_, p_149720_4_); } diff --git a/src/Java/gtPlusPlus/core/block/machine/FishTrap.java b/src/Java/gtPlusPlus/core/block/machine/FishTrap.java index 089e63597b..a8e842f882 100644 --- a/src/Java/gtPlusPlus/core/block/machine/FishTrap.java +++ b/src/Java/gtPlusPlus/core/block/machine/FishTrap.java @@ -1,5 +1,9 @@ package gtPlusPlus.core.block.machine; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.common.registry.LanguageRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.GTplusplus; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; @@ -11,65 +15,63 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class FishTrap extends BlockContainer { - @SideOnly(Side.CLIENT) - private IIcon textureTop; - @SideOnly(Side.CLIENT) - private IIcon textureBottom; - @SideOnly(Side.CLIENT) - private IIcon textureFront; + @SideOnly(Side.CLIENT) + private IIcon textureTop; + @SideOnly(Side.CLIENT) + private IIcon textureBottom; + @SideOnly(Side.CLIENT) + private IIcon textureFront; + - @SuppressWarnings("deprecation") public FishTrap() - { - super(Material.wood); - this.setBlockName("blockFishTrap"); - this.setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerBlock(this, "blockFishTrap"); + { + super(Material.wood); + this.setBlockName("blockFishTrap"); + this.setCreativeTab(AddToCreativeTab.tabMachines); + GameRegistry.registerBlock(this, "blockFishTrap"); LanguageRegistry.addName(this, "Fish Catcher"); - - } - /** - * Gets the block's texture. Args: side, meta - */ - @Override + } + + /** + * Gets the block's texture. Args: side, meta + */ + @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(int p_149691_1_, int p_149691_2_) - { - return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : (p_149691_1_ != 2 && p_149691_1_ != 4 ? this.blockIcon : this.textureFront)); - } + public IIcon getIcon(final int p_149691_1_, final int p_149691_2_) + { + return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : ((p_149691_1_ != 2) && (p_149691_1_ != 4) ? this.blockIcon : this.textureFront)); + } - @Override + @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister p_149651_1_) - { - this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "fishtrap"); - this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "fishtrap"); - this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "fishtrap"); - this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "fishtrap"); - } + public void registerBlockIcons(final IIconRegister p_149651_1_) + { + this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "fishtrap"); + this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "fishtrap"); + this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "fishtrap"); + this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "fishtrap"); + } - /** - * Called upon block activation (right click on the block.) - */ - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz) + /** + * Called upon block activation (right click on the block.) + */ + @Override + public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float lx, final float ly, final float lz) { - if (world.isRemote) return true; + if (world.isRemote) { + return true; + } - TileEntity te = world.getTileEntity(x, y, z); - if (te != null && te instanceof TileEntityFishTrap){ - player.openGui(GTplusplus.instance, 5, world, x, y, z); - return true; - } + final TileEntity te = world.getTileEntity(x, y, z); + if ((te != null) && (te instanceof TileEntityFishTrap)){ + player.openGui(GTplusplus.instance, 5, world, x, y, z); + return true; + } return false; } @@ -84,8 +86,8 @@ public class FishTrap extends BlockContainer } @Override - public TileEntity createNewTileEntity(World world, int p_149915_2_) { + public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { return new TileEntityFishTrap(); } - + } \ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java b/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java index 9d33550bc3..64a5c5af8b 100644 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java +++ b/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java @@ -1,5 +1,10 @@ package gtPlusPlus.core.block.machine; +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.common.registry.LanguageRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.GTplusplus; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; @@ -17,81 +22,76 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import buildcraft.api.tools.IToolWrench; -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.Optional.Interface; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; @Optional.Interface(iface = "crazypants.enderio.api.tool.ITool", modid = "EnderIO") public class Machine_Workbench extends BlockContainer { - @SideOnly(Side.CLIENT) - private IIcon textureTop; - @SideOnly(Side.CLIENT) - private IIcon textureBottom; - @SideOnly(Side.CLIENT) - private IIcon textureFront; - - @SuppressWarnings("deprecation") + @SideOnly(Side.CLIENT) + private IIcon textureTop; + @SideOnly(Side.CLIENT) + private IIcon textureBottom; + @SideOnly(Side.CLIENT) + private IIcon textureFront; + + @SuppressWarnings("deprecation") public Machine_Workbench() - { - super(Material.iron); - this.setBlockName("blockWorkbenchGT"); - this.setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerBlock(this, "blockWorkbenchGT"); + { + super(Material.iron); + this.setBlockName("blockWorkbenchGT"); + this.setCreativeTab(AddToCreativeTab.tabMachines); + GameRegistry.registerBlock(this, "blockWorkbenchGT"); LanguageRegistry.addName(this, "Bronze Workbench"); - - } - /** - * Gets the block's texture. Args: side, meta - */ - @Override + } + + /** + * Gets the block's texture. Args: side, meta + */ + @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(int p_149691_1_, int p_149691_2_) - { - return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : (p_149691_1_ != 2 && p_149691_1_ != 4 ? this.blockIcon : this.textureFront)); - } + public IIcon getIcon(final int p_149691_1_, final int p_149691_2_) + { + return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : ((p_149691_1_ != 2) && (p_149691_1_ != 4) ? this.blockIcon : this.textureFront)); + } - @Override + @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister p_149651_1_) - { - this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_side_cabinet"); - this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_top_crafting"); - this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_side"); - this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_side_cabinet"); - } - - /** - * Called upon block activation (right click on the block.) - */ - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz) + public void registerBlockIcons(final IIconRegister p_149651_1_) + { + this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_side_cabinet"); + this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_top_crafting"); + this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_side"); + this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_side_cabinet"); + } + + /** + * Called upon block activation (right click on the block.) + */ + @Override + public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float lx, final float ly, final float lz) { ItemStack heldItem = null; - if (world.isRemote){ - heldItem = PlayerUtils.getItemStackInPlayersHand(); - } + if (world.isRemote){ + heldItem = PlayerUtils.getItemStackInPlayersHand(); + } boolean holdingWrench = false; if (heldItem != null){ - holdingWrench = isWrench(heldItem); + holdingWrench = isWrench(heldItem); } - if (world.isRemote) return true; + if (world.isRemote) { + return true; + } - TileEntity te = world.getTileEntity(x, y, z); - if (te != null && te instanceof TileEntityWorkbench) + final TileEntity te = world.getTileEntity(x, y, z); + if ((te != null) && (te instanceof TileEntityWorkbench)) { if (!holdingWrench){ player.openGui(GTplusplus.instance, 3, world, x, y, z); - return true; + return true; } Utils.LOG_INFO("Holding a Wrench, doing wrench things instead."); } @@ -99,11 +99,11 @@ public class Machine_Workbench extends BlockContainer } @Override - public TileEntity createNewTileEntity(World world, int p_149915_2_) { + public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { return new TileEntityWorkbench(); } - - public static boolean isWrench(ItemStack item){ + + public static boolean isWrench(final ItemStack item){ if (item.getItem() instanceof ItemToolWrench){ return true; } @@ -112,12 +112,12 @@ public class Machine_Workbench extends BlockContainer } if (LoadedMods.EnderIO){ return checkEnderIOWrench(item); - } + } return false; } - + @Optional.Method(modid = "EnderIO") - private static boolean checkEnderIOWrench(ItemStack item){ + private static boolean checkEnderIOWrench(final ItemStack item){ if (ReflectionUtils.doesClassExist("crazypants.enderio.api.tool.ITool")){ Class wrenchClass; try { @@ -126,15 +126,15 @@ public class Machine_Workbench extends BlockContainer return true; } } - catch (ClassNotFoundException e1) { + catch (final ClassNotFoundException e1) { return false; - } - } + } + } return false; } - + @Optional.Method(modid = "Buildcraft") - private static boolean checkBuildcraftWrench(ItemStack item){ + private static boolean checkBuildcraftWrench(final ItemStack item){ if (ReflectionUtils.doesClassExist("buildcraft.api.tools.IToolWrench")){ Class wrenchClass; try { @@ -143,11 +143,11 @@ public class Machine_Workbench extends BlockContainer return true; } } - catch (ClassNotFoundException e1) { + catch (final ClassNotFoundException e1) { return false; - } - } + } + } return false; } - + } \ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java b/src/Java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java index d634535699..436fc5bf39 100644 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java +++ b/src/Java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java @@ -1,5 +1,10 @@ package gtPlusPlus.core.block.machine; +import buildcraft.api.tools.IToolWrench; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.common.registry.LanguageRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.GTplusplus; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; @@ -15,11 +20,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import buildcraft.api.tools.IToolWrench; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class Machine_WorkbenchAdvanced extends BlockContainer { @@ -46,14 +46,14 @@ public class Machine_WorkbenchAdvanced extends BlockContainer */ @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(int p_149691_1_, int p_149691_2_) + public IIcon getIcon(final int p_149691_1_, final int p_149691_2_) { - return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : (p_149691_1_ != 2 && p_149691_1_ != 4 ? this.blockIcon : this.textureFront)); + return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : ((p_149691_1_ != 2) && (p_149691_1_ != 4) ? this.blockIcon : this.textureFront)); } @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister p_149651_1_) + public void registerBlockIcons(final IIconRegister p_149651_1_) { this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "machine_top"); this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "cover_crafting"); @@ -65,11 +65,13 @@ public class Machine_WorkbenchAdvanced extends BlockContainer * Called upon block activation (right click on the block.) */ @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz) + public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float lx, final float ly, final float lz) { - ItemStack heldItem = PlayerUtils.getItemStackInPlayersHand(player); - if (world.isRemote) return true; + final ItemStack heldItem = PlayerUtils.getItemStackInPlayersHand(player); + if (world.isRemote) { + return true; + } boolean holdingWrench = false; if (heldItem != null){ @@ -94,12 +96,12 @@ public class Machine_WorkbenchAdvanced extends BlockContainer } - TileEntity te = world.getTileEntity(x, y, z); - if (te != null && te instanceof TileEntityWorkbenchAdvanced) + final TileEntity te = world.getTileEntity(x, y, z); + if ((te != null) && (te instanceof TileEntityWorkbenchAdvanced)) { if (!holdingWrench){ player.openGui(GTplusplus.instance, 4, world, x, y, z); - return true; + return true; } Utils.LOG_INFO("Holding a Wrench, doing wrench things instead."); } @@ -107,7 +109,7 @@ public class Machine_WorkbenchAdvanced extends BlockContainer } @Override - public TileEntity createNewTileEntity(World world, int p_149915_2_) { + public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { return new TileEntityWorkbenchAdvanced(128000, 2); } } \ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/heliumgen/block/HeliumGenerator.java b/src/Java/gtPlusPlus/core/block/machine/heliumgen/block/HeliumGenerator.java index 7a76b09cca..ddfcf62306 100644 --- a/src/Java/gtPlusPlus/core/block/machine/heliumgen/block/HeliumGenerator.java +++ b/src/Java/gtPlusPlus/core/block/machine/heliumgen/block/HeliumGenerator.java @@ -1,12 +1,13 @@ package gtPlusPlus.core.block.machine.heliumgen.block; +import java.util.Random; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.GTplusplus; import gtPlusPlus.core.block.machine.heliumgen.tileentity.TileEntityHeliumGenerator; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; - -import java.util.Random; - import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; @@ -21,145 +22,152 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class HeliumGenerator extends BlockContainer { - private IIcon top, sides, front; - private Random randy = new Random(); - - public HeliumGenerator(){ - super(Material.iron); - setStepSound(Block.soundTypeMetal); - setHardness(20.0F); - setBlockName("helium_collector"); - setHarvestLevel("pickaxe", 3); - setCreativeTab(AddToCreativeTab.tabMachines); - } - - @SideOnly(Side.CLIENT) - @Override - public void registerBlockIcons (IIconRegister iconRegister) - { - this.top = iconRegister.registerIcon(CORE.MODID+":blockHeliumCollector_SIDE"); - this.sides = iconRegister.registerIcon(CORE.MODID+":blockHeliumCollector_SIDE"); - this.front = iconRegister.registerIcon(CORE.MODID+":blockHeliumCollector_FRONT"); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){ - if(side == 1) - return top; - int facing = 2; - TileEntityHeliumGenerator machine = (TileEntityHeliumGenerator)world.getTileEntity(x, y, z); - if(machine != null) - facing = machine.getFacing(); - if(side == facing) - return front; - else - return sides; - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon (int side, int metadata) - { - if(side == 1) - return top; - if(side == 3) - return front; - return sides; - } - - @Override - public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) - { - if (world.isRemote) - { - return true; - } + private IIcon top, sides, front; + private final Random randy = new Random(); + + public HeliumGenerator(){ + super(Material.iron); + this.setStepSound(Block.soundTypeMetal); + this.setHardness(20.0F); + this.setBlockName("helium_collector"); + this.setHarvestLevel("pickaxe", 3); + this.setCreativeTab(AddToCreativeTab.tabMachines); + } + + @SideOnly(Side.CLIENT) + @Override + public void registerBlockIcons (final IIconRegister iconRegister) + { + this.top = iconRegister.registerIcon(CORE.MODID+":blockHeliumCollector_SIDE"); + this.sides = iconRegister.registerIcon(CORE.MODID+":blockHeliumCollector_SIDE"); + this.front = iconRegister.registerIcon(CORE.MODID+":blockHeliumCollector_FRONT"); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side){ + if(side == 1) { + return this.top; + } + int facing = 2; + final TileEntityHeliumGenerator machine = (TileEntityHeliumGenerator)world.getTileEntity(x, y, z); + if(machine != null) { + facing = machine.getFacing(); + } + if(side == facing) { + return this.front; + } else { + return this.sides; + } + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon (final int side, final int metadata) + { + if(side == 1) { + return this.top; + } + if(side == 3) { + return this.front; + } + return this.sides; + } + + @Override + public boolean onBlockActivated (final World world, final int x, final int y, final int z, final EntityPlayer player, final int par6, final float par7, final float par8, final float par9) + { + if (world.isRemote) + { + return true; + } player.openGui(GTplusplus.instance, 2, world, x, y, z); return true; - } - - @Override - public TileEntity createNewTileEntity(World world, int meta) - { - return new TileEntityHeliumGenerator(); - } - - @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack item) - { - TileEntity tile = world.getTileEntity(x, y, z); - if(tile instanceof TileEntityHeliumGenerator) { - TileEntityHeliumGenerator machine = (TileEntityHeliumGenerator)tile; - int l = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; - - if (l == 0) - machine.setFacing((short) 2); - - if (l == 1) - machine.setFacing((short) 5); - - if (l == 2) - machine.setFacing((short) 3); - - if (l == 3) - machine.setFacing((short) 4); - } - - } - - @Override - public void breakBlock(World world, int x, int y, int z, Block block, int wut) - { - TileEntityHeliumGenerator collector = (TileEntityHeliumGenerator)world.getTileEntity(x, y, z); - - if (collector != null) - { - int i = 0; - for (i = 0; i < collector.getSizeInventory(); i++){ - - ItemStack itemstack = collector.getStackInSlot(i); - - if (itemstack != null) - { - float f = this.randy.nextFloat() * 0.8F + 0.1F; - float f1 = this.randy.nextFloat() * 0.8F + 0.1F; - float f2 = this.randy.nextFloat() * 0.8F + 0.1F; - - while (itemstack.stackSize > 0) - { - int j1 = this.randy.nextInt(21) + 10; - - if (j1 > itemstack.stackSize) - { - j1 = itemstack.stackSize; - } - - itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(world, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); - - if (itemstack.hasTagCompound()) - { - entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); - } - - float f3 = 0.05F; - entityitem.motionX = (double)((float)this.randy.nextGaussian() * f3); - entityitem.motionY = (double)((float)this.randy.nextGaussian() * f3 + 0.2F); - entityitem.motionZ = (double)((float)this.randy.nextGaussian() * f3); - world.spawnEntityInWorld(entityitem); - } - } - - world.func_147453_f(x, y, z, block); - } - } - - super.breakBlock(world, x, y, z, block, wut); - } + } + + @Override + public TileEntity createNewTileEntity(final World world, final int meta) + { + return new TileEntityHeliumGenerator(); + } + + @Override + public void onBlockPlacedBy(final World world, final int x, final int y, final int z, final EntityLivingBase player, final ItemStack item) + { + final TileEntity tile = world.getTileEntity(x, y, z); + if(tile instanceof TileEntityHeliumGenerator) { + final TileEntityHeliumGenerator machine = (TileEntityHeliumGenerator)tile; + final int l = MathHelper.floor_double((player.rotationYaw * 4.0F) / 360.0F + 0.5D) & 3; + + if (l == 0) { + machine.setFacing((short) 2); + } + + if (l == 1) { + machine.setFacing((short) 5); + } + + if (l == 2) { + machine.setFacing((short) 3); + } + + if (l == 3) { + machine.setFacing((short) 4); + } + } + + } + + @Override + public void breakBlock(final World world, final int x, final int y, final int z, final Block block, final int wut) + { + final TileEntityHeliumGenerator collector = (TileEntityHeliumGenerator)world.getTileEntity(x, y, z); + + if (collector != null) + { + int i = 0; + for (i = 0; i < collector.getSizeInventory(); i++){ + + final ItemStack itemstack = collector.getStackInSlot(i); + + if (itemstack != null) + { + final float f = (this.randy.nextFloat() * 0.8F) + 0.1F; + final float f1 = (this.randy.nextFloat() * 0.8F) + 0.1F; + final float f2 = (this.randy.nextFloat() * 0.8F) + 0.1F; + + while (itemstack.stackSize > 0) + { + int j1 = this.randy.nextInt(21) + 10; + + if (j1 > itemstack.stackSize) + { + j1 = itemstack.stackSize; + } + + itemstack.stackSize -= j1; + final EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + + if (itemstack.hasTagCompound()) + { + entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); + } + + final float f3 = 0.05F; + entityitem.motionX = (float)this.randy.nextGaussian() * f3; + entityitem.motionY = ((float)this.randy.nextGaussian() * f3) + 0.2F; + entityitem.motionZ = (float)this.randy.nextGaussian() * f3; + world.spawnEntityInWorld(entityitem); + } + } + + world.func_147453_f(x, y, z, block); + } + } + + super.breakBlock(world, x, y, z, block, wut); + } } diff --git a/src/Java/gtPlusPlus/core/block/machine/heliumgen/container/ContainerHeliumGenerator.java b/src/Java/gtPlusPlus/core/block/machine/heliumgen/container/ContainerHeliumGenerator.java index d701f6f125..4ce1238bde 100644 --- a/src/Java/gtPlusPlus/core/block/machine/heliumgen/container/ContainerHeliumGenerator.java +++ b/src/Java/gtPlusPlus/core/block/machine/heliumgen/container/ContainerHeliumGenerator.java @@ -1,11 +1,10 @@ package gtPlusPlus.core.block.machine.heliumgen.container; +import java.util.List; + import gtPlusPlus.core.block.machine.heliumgen.tileentity.TileEntityHeliumGenerator; import ic2.core.ContainerBase; import ic2.core.slot.SlotInvSlot; - -import java.util.List; - import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Slot; import net.minecraft.inventory.SlotFurnace; @@ -15,11 +14,11 @@ extends ContainerBase { public short size; - public ContainerHeliumGenerator(InventoryPlayer player, TileEntityHeliumGenerator machine) + public ContainerHeliumGenerator(final InventoryPlayer player, final TileEntityHeliumGenerator machine) { super(machine); //Utils.LOG_WARNING("containerHeliumGenerator"); - short sr = machine.getReactorSize(); + final short sr = machine.getReactorSize(); this.addSlotToContainer(new SlotFurnace(player.player, machine, 2, 80, 35)); this.size = sr; int startX = 16; @@ -27,31 +26,31 @@ extends ContainerBase int i = 0; for (i = 0; i < 9; i++) { - int x = i % this.size; - int y = i / this.size; + final int x = i % this.size; + final int y = i / this.size; - addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y)); + this.addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + (18 * x), startY + (18 * y))); } startX = 108; startY = 16; for (i = 9; i < 18; i++) { - int x = i % this.size; - int y = (i-9) / this.size; + final int x = i % this.size; + final int y = (i-9) / this.size; - addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y)); + this.addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + (18 * x), startY + (18 * y))); } for (i = 0; i < 3; ++i) { for (int j = 0; j < 9; ++j) { - this.addSlotToContainer(new Slot(player, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); + this.addSlotToContainer(new Slot(player, j + (i * 9) + 9, 8 + (j * 18), 84 + (i * 18))); } } for (i = 0; i < 9; ++i) { - this.addSlotToContainer(new Slot(player, i, 8 + i * 18, 142)); + this.addSlotToContainer(new Slot(player, i, 8 + (i * 18), 142)); } // addSlotToContainer(new SlotInvSlot(machine.coolantinputSlot, 0, 8, 25)); //addSlotToContainer(new SlotInvSlot(machine.hotcoolinputSlot, 0, 188, 25)); @@ -62,7 +61,7 @@ extends ContainerBase @Override public List getNetworkedFields() { - List ret = super.getNetworkedFields(); + final List ret = super.getNetworkedFields(); ret.add("heat"); ret.add("maxHeat"); @@ -71,5 +70,5 @@ extends ContainerBase ret.add("outputTank"); ret.add("fluidcoolreactor");*/ return ret; - } + } } \ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/heliumgen/gui/GUIHeliumGenerator.java b/src/Java/gtPlusPlus/core/block/machine/heliumgen/gui/GUIHeliumGenerator.java index 2106f144be..70e13d57e1 100644 --- a/src/Java/gtPlusPlus/core/block/machine/heliumgen/gui/GUIHeliumGenerator.java +++ b/src/Java/gtPlusPlus/core/block/machine/heliumgen/gui/GUIHeliumGenerator.java @@ -1,5 +1,9 @@ package gtPlusPlus.core.block.machine.heliumgen.gui; +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.block.machine.heliumgen.container.ContainerHeliumGenerator; import gtPlusPlus.core.block.machine.heliumgen.tileentity.TileEntityHeliumGenerator; import gtPlusPlus.core.lib.CORE; @@ -8,65 +12,60 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - @SideOnly(Side.CLIENT) public class GUIHeliumGenerator extends GuiContainer { - private static final ResourceLocation collectorGuiTexture = new ResourceLocation(CORE.MODID, "textures/gui/helium_collector_gui.png"); + private static final ResourceLocation collectorGuiTexture = new ResourceLocation(CORE.MODID, "textures/gui/helium_collector_gui.png"); + + public GUIHeliumGenerator(final InventoryPlayer player, final TileEntityHeliumGenerator machine) + { + super(new ContainerHeliumGenerator(player, machine)); + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items) + */ + @Override + protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) + { + final String s = StatCollector.translateToLocal("Helium Collector"); + this.fontRendererObj.drawString(s, (this.xSize / 2) - (this.fontRendererObj.getStringWidth(s) / 2), 6, 4210752); + this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, (this.ySize - 96) + 2, 4210752); + + this.fontRendererObj.drawString(StatCollector.translateToLocal("|"+-1), 80, 35, 2); - public GUIHeliumGenerator(InventoryPlayer player, TileEntityHeliumGenerator machine) - { - super(new ContainerHeliumGenerator(player, machine)); - } + final short sr = 3; + final int size = sr; + int startX = 16; + int startY = 16; + int i = 0; + for (i = 0; i < 9; i++) + { + final int x = i % size; + final int y = i / size; + this.fontRendererObj.drawString(StatCollector.translateToLocal("|"+i), startX + (18 * x), startY + (18 * y), 4210752); + //addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y)); + } + startX = 108; + startY = 16; + for (i = 9; i < 18; i++) + { + final int x = i % size; + final int y = (i-9) / size; + this.fontRendererObj.drawString(StatCollector.translateToLocal("|"+i), startX + (18 * x), startY + (18 * y), 4210752); + // addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y)); + } - /** - * Draw the foreground layer for the GuiContainer (everything in front of the items) - */ - @Override - protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) - { - String s = StatCollector.translateToLocal("Helium Collector"); - this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752); - this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752); - - this.fontRendererObj.drawString(StatCollector.translateToLocal("|"+-1), 80, 35, 2); - - short sr = 3; - int size = sr; - int startX = 16; - int startY = 16; - int i = 0; - for (i = 0; i < 9; i++) - { - int x = i % size; - int y = i / size; - this.fontRendererObj.drawString(StatCollector.translateToLocal("|"+i), startX + 18 * x, startY + 18 * y, 4210752); - //addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y)); - } - startX = 108; - startY = 16; - for (i = 9; i < 18; i++) - { - int x = i % size; - int y = (i-9) / size; - this.fontRendererObj.drawString(StatCollector.translateToLocal("|"+i), startX + 18 * x, startY + 18 * y, 4210752); - // addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y)); - } - - } + } - @Override - protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(collectorGuiTexture); - int k = (this.width - this.xSize) / 2; - int l = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); + @Override + protected void drawGuiContainerBackgroundLayer(final float p_146976_1_, final int p_146976_2_, final int p_146976_3_) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(collectorGuiTexture); + final int k = (this.width - this.xSize) / 2; + final int l = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); - } + } } \ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/heliumgen/slots/InvSlotRadiation.java b/src/Java/gtPlusPlus/core/block/machine/heliumgen/slots/InvSlotRadiation.java index 86507a2d64..d5c6ed5a96 100644 --- a/src/Java/gtPlusPlus/core/block/machine/heliumgen/slots/InvSlotRadiation.java +++ b/src/Java/gtPlusPlus/core/block/machine/heliumgen/slots/InvSlotRadiation.java @@ -6,15 +6,15 @@ import net.minecraft.item.ItemStack; public class InvSlotRadiation extends InvSlot { - public InvSlotRadiation(TileEntityHeliumGenerator base, String name1, int oldStartIndex1, int count) + public InvSlotRadiation(final TileEntityHeliumGenerator base, final String name1, final int oldStartIndex1, final int count) { super(base, name1, oldStartIndex1, InvSlot.Access.IO, count); - setStackSizeLimit(1); + this.setStackSizeLimit(1); } @Override - public boolean accepts(ItemStack itemStack) + public boolean accepts(final ItemStack itemStack) { return ((TileEntityHeliumGenerator)this.base).isUsefulItem(itemStack, true); } @@ -32,45 +32,45 @@ public class InvSlotRadiation extends InvSlot } @Override - public ItemStack get(int index) + public ItemStack get(final int index) { - return super.get(mapIndex(index)); + return super.get(this.mapIndex(index)); } - public ItemStack get(int x, int y) + public ItemStack get(final int x, final int y) { - return super.get(y * 9 + x); + return super.get((y * 9) + x); } @Override - public void put(int index, ItemStack content) + public void put(final int index, final ItemStack content) { - super.put(mapIndex(index), content); + super.put(this.mapIndex(index), content); } - public void put(int x, int y, ItemStack content) + public void put(final int x, final int y, final ItemStack content) { - super.put(y * 9 + x, content); + super.put((y * 9) + x, content); } private int mapIndex(int index) { - int size = size(); - int cols = size / 6; + final int size = this.size(); + final int cols = size / 6; if (index < size) { - int row = index / cols; - int col = index % cols; + final int row = index / cols; + final int col = index % cols; - return row * 9 + col; + return (row * 9) + col; } index -= size; - int remCols = 9 - cols; + final int remCols = 9 - cols; - int row = index / remCols; - int col = cols + index % remCols; + final int row = index / remCols; + final int col = cols + (index % remCols); - return row * 9 + col; + return (row * 9) + col; } private final int rows = 6; diff --git a/src/Java/gtPlusPlus/core/block/machine/heliumgen/tileentity/TileEntityHeliumGenerator.java b/src/Java/gtPlusPlus/core/block/machine/heliumgen/tileentity/TileEntityHeliumGenerator.java index ffc4745059..53d6f1d68f 100644 --- a/src/Java/gtPlusPlus/core/block/machine/heliumgen/tileentity/TileEntityHeliumGenerator.java +++ b/src/Java/gtPlusPlus/core/block/machine/heliumgen/tileentity/TileEntityHeliumGenerator.java @@ -1,5 +1,7 @@ package gtPlusPlus.core.block.machine.heliumgen.tileentity; +import java.util.List; + import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.block.machine.heliumgen.slots.InvSlotRadiation; import gtPlusPlus.core.item.ModItems; @@ -13,11 +15,7 @@ import ic2.core.*; import ic2.core.block.TileEntityInventory; import ic2.core.init.MainConfig; import ic2.core.item.reactor.ItemReactorHeatStorage; -import ic2.core.network.NetworkManager; import ic2.core.util.ConfigUtil; - -import java.util.List; - import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; @@ -43,28 +41,29 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II private int facing = 2; private int progress; - + public void update2Entity(){ Utils.LOG_WARNING("updateEntity"); - if(++progress >= 40){ + if(++this.progress >= 40){ //if(++progress >= 300){ - if(heliumStack == null) - heliumStack = ItemUtils.getSimpleStack(ModItems.itemHeliumBlob); - else if(heliumStack.getItem() == ModItems.itemHeliumBlob && heliumStack.stackSize < 64) - heliumStack.stackSize++; - progress = 0; - markDirty(); + if(this.heliumStack == null) { + this.heliumStack = ItemUtils.getSimpleStack(ModItems.itemHeliumBlob); + } else if((this.heliumStack.getItem() == ModItems.itemHeliumBlob) && (this.heliumStack.stackSize < 64)) { + this.heliumStack.stackSize++; + } + this.progress = 0; + this.markDirty(); } } @Override public short getFacing(){ - return (short) facing; + return (short) this.facing; } @Override - public void setFacing(short dir){ - facing = dir; + public void setFacing(final short dir){ + this.facing = dir; } /*@Override @@ -95,17 +94,17 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II @Override - public void readFromNBT(NBTTagCompound nbttagcompound) + public void readFromNBT(final NBTTagCompound nbttagcompound) { super.readFromNBT(nbttagcompound); //this.heliumStack = ItemStack.loadItemStackFromNBT(nbttagcompound.getCompoundTag("Helium")); - NBTTagList list = nbttagcompound.getTagList("Items", 10); - for (int i = 0; i < list.tagCount(); ++i) { - NBTTagCompound stackTag = list.getCompoundTagAt(i); - int slot = stackTag.getByte("Slot") & 255; - this.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(stackTag)); - } + final NBTTagList list = nbttagcompound.getTagList("Items", 10); + for (int i = 0; i < list.tagCount(); ++i) { + final NBTTagCompound stackTag = list.getCompoundTagAt(i); + final int slot = stackTag.getByte("Slot") & 255; + this.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(stackTag)); + } this.progress = nbttagcompound.getInteger("Progress"); this.facing = nbttagcompound.getShort("Facing"); this.heat = nbttagcompound.getInteger("heat"); @@ -114,14 +113,14 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II } @Override - public void writeToNBT(NBTTagCompound nbttagcompound) + public void writeToNBT(final NBTTagCompound nbttagcompound) { super.writeToNBT(nbttagcompound); nbttagcompound.setInteger("Progress", this.progress); nbttagcompound.setShort("Facing", (short) this.facing); nbttagcompound.setInteger("heat", this.heat); - nbttagcompound.setShort("output", (short)(int)getReactorEnergyOutput()); + nbttagcompound.setShort("output", (short)(int)this.getReactorEnergyOutput()); nbttagcompound.setBoolean("active", this.active); /*if(heliumStack != null) { NBTTagCompound produce = new NBTTagCompound(); @@ -130,30 +129,30 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II } else nbttagcompound.removeTag("Helium");*/ - NBTTagList list = new NBTTagList(); - for (int i = 0; i < this.getSizeInventory(); ++i) { - if (this.getStackInSlot(i) != null) { - NBTTagCompound stackTag = new NBTTagCompound(); - stackTag.setByte("Slot", (byte) i); - this.getStackInSlot(i).writeToNBT(stackTag); - list.appendTag(stackTag); - } - } - nbttagcompound.setTag("Items", list); + final NBTTagList list = new NBTTagList(); + for (int i = 0; i < this.getSizeInventory(); ++i) { + if (this.getStackInSlot(i) != null) { + final NBTTagCompound stackTag = new NBTTagCompound(); + stackTag.setByte("Slot", (byte) i); + this.getStackInSlot(i).writeToNBT(stackTag); + list.appendTag(stackTag); + } + } + nbttagcompound.setTag("Items", list); } @Override public Packet getDescriptionPacket() { - NBTTagCompound tag = new NBTTagCompound(); - writeToNBT(tag); - return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, tag); + final NBTTagCompound tag = new NBTTagCompound(); + this.writeToNBT(tag); + return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, -999, tag); } @Override - public void onDataPacket(net.minecraft.network.NetworkManager net, S35PacketUpdateTileEntity packet) { + public void onDataPacket(final net.minecraft.network.NetworkManager net, final S35PacketUpdateTileEntity packet) { super.onDataPacket(net, packet); - readFromNBT(packet.func_148857_g()); + this.readFromNBT(packet.func_148857_g()); } @@ -164,23 +163,25 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II } @Override - public ItemStack getStackInSlot(int slot){ - return heliumStack; + public ItemStack getStackInSlot(final int slot){ + return this.heliumStack; } @Override - public ItemStack decrStackSize(int slot, int decrement){ + public ItemStack decrStackSize(final int slot, final int decrement){ Utils.LOG_WARNING("decrStackSize"); - if(heliumStack == null) + if(this.heliumStack == null) { return null; - if(decrement < heliumStack.stackSize){ - ItemStack take = heliumStack.splitStack(decrement); - if(heliumStack.stackSize <= 0) - heliumStack = null; + } + if(decrement < this.heliumStack.stackSize){ + final ItemStack take = this.heliumStack.splitStack(decrement); + if(this.heliumStack.stackSize <= 0) { + this.heliumStack = null; + } return take; } - ItemStack take = heliumStack; - heliumStack = null; + final ItemStack take = this.heliumStack; + this.heliumStack = null; return take; } @@ -190,13 +191,13 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II public void closeInventory() {} @Override - public boolean isUseableByPlayer(EntityPlayer player) + public boolean isUseableByPlayer(final EntityPlayer player) { - return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) == this && player.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D; + return (this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) == this) && (player.getDistanceSq(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D) <= 64.0D); } @Override - public boolean isItemValidForSlot(int slot, ItemStack stack){ + public boolean isItemValidForSlot(final int slot, final ItemStack stack){ return false; } @@ -206,12 +207,12 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II } @Override - public void setInventorySlotContents(int slot, ItemStack stack){ - heliumStack = stack; + public void setInventorySlotContents(final int slot, final ItemStack stack){ + this.heliumStack = stack; } @Override - public ItemStack getStackInSlotOnClosing(int slot){ + public ItemStack getStackInSlotOnClosing(final int slot){ return null; } @@ -247,7 +248,7 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II private int EmitHeatbuffer = 0; public int EmitHeat = 0; private boolean redstone = false; - private boolean fluidcoolreactor = false; + private final boolean fluidcoolreactor = false; private boolean active = true; @@ -260,9 +261,9 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II } short cols = 3; //Utils.LOG_WARNING("getReactorSize == "+cols); - for (Direction direction : Direction.directions) + for (final Direction direction : Direction.directions) { - TileEntity target = direction.applyToTileEntity(this); + final TileEntity target = direction.applyToTileEntity(this); if ((target instanceof TileEntityHeliumGenerator)) { cols = (short)(cols + 1); Utils.LOG_WARNING("getReactorSize =1= "+cols); @@ -278,7 +279,7 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II Utils.LOG_WARNING("updateEntityServer"); super.updateEntity(); - if (this.updateTicker++ % getTickRate() != 0) { + if ((this.updateTicker++ % this.getTickRate()) != 0) { return; } if (!this.worldObj.doChunksNearChunkExist(this.xCoord, this.yCoord, this.zCoord, 2)) @@ -288,31 +289,31 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II else { - dropAllUnfittingStuff(); + this.dropAllUnfittingStuff(); this.output = 0.0F; this.maxHeat = 10000; this.hem = 1.0F; - processChambers(); + this.processChambers(); this.EmitHeatbuffer = 0; - if (calculateHeatEffects()) { + if (this.calculateHeatEffects()) { return; } - setActive((this.heat >= 1000) || (this.output > 0.0F)); + this.setActive((this.heat >= 1000) || (this.output > 0.0F)); - markDirty(); + this.markDirty(); } - ((NetworkManager)IC2.network.get()).updateTileEntityField(this, "output"); + IC2.network.get().updateTileEntityField(this, "output"); } @Override - public void setActive(boolean active1) + public void setActive(final boolean active1) { Utils.LOG_WARNING("setActive"); this.active = active1; if (this.prevActive != active1) { - ((NetworkManager)IC2.network.get()).updateTileEntityField(this, "active"); + IC2.network.get().updateTileEntityField(this, "active"); } this.prevActive = active1; } @@ -322,43 +323,43 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II Utils.LOG_WARNING("dropAllUnfittingStuff"); for (int i = 0; i < this.reactorSlot.size(); i++) { - ItemStack stack = this.reactorSlot.get(i); - if ((stack != null) && (!isUsefulItem(stack, false))) + final ItemStack stack = this.reactorSlot.get(i); + if ((stack != null) && (!this.isUsefulItem(stack, false))) { this.reactorSlot.put(i, null); - eject(stack); + this.eject(stack); } } for (int i = this.reactorSlot.size(); i < this.reactorSlot.rawSize(); i++) { - ItemStack stack = this.reactorSlot.get(i); + final ItemStack stack = this.reactorSlot.get(i); this.reactorSlot.put(i, null); - eject(stack); + this.eject(stack); } } - public void eject(ItemStack drop) + public void eject(final ItemStack drop) { Utils.LOG_WARNING("eject"); if ((!IC2.platform.isSimulating()) || (drop == null)) { return; } - float f = 0.7F; - double d = this.worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5D; - double d1 = this.worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5D; - double d2 = this.worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5D; - EntityItem entityitem = new EntityItem(this.worldObj, this.xCoord + d, this.yCoord + d1, this.zCoord + d2, drop); + final float f = 0.7F; + final double d = (this.worldObj.rand.nextFloat() * f) + ((1.0F - f) * 0.5D); + final double d1 = (this.worldObj.rand.nextFloat() * f) + ((1.0F - f) * 0.5D); + final double d2 = (this.worldObj.rand.nextFloat() * f) + ((1.0F - f) * 0.5D); + final EntityItem entityitem = new EntityItem(this.worldObj, this.xCoord + d, this.yCoord + d1, this.zCoord + d2, drop); entityitem.delayBeforeCanPickup = 10; this.worldObj.spawnEntityInWorld(entityitem); } - public boolean isUsefulItem(ItemStack stack, boolean forInsertion) + public boolean isUsefulItem(final ItemStack stack, final boolean forInsertion) { //Utils.LOG_WARNING("isUsefulItem"); - Item item = stack.getItem(); - if ((forInsertion) && (this.fluidcoolreactor) && - ((item instanceof ItemReactorHeatStorage)) && + final Item item = stack.getItem(); + if ((forInsertion) && (this.fluidcoolreactor) && + ((item instanceof ItemReactorHeatStorage)) && (((ItemReactorHeatStorage)item).getCustomDamage(stack) > 0)) { return false; } @@ -374,25 +375,25 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II if ((this.heat < 8000) || (!IC2.platform.isSimulating()) || (ConfigUtil.getFloat(MainConfig.get(), "protection/reactorExplosionPowerLimit") <= 0.0F)) { return false; } - float power = this.heat / this.maxHeat; + final float power = this.heat / this.maxHeat; if (power >= 1.0F) { - explode(); + this.explode(); return true; } - if ((power >= 0.85F) && (this.worldObj.rand.nextFloat() <= 0.2F * this.hem)) + if ((power >= 0.85F) && (this.worldObj.rand.nextFloat() <= (0.2F * this.hem))) { - int[] coord = getRandCoord(2); + final int[] coord = this.getRandCoord(2); if (coord != null) { - Block block = this.worldObj.getBlock(coord[0], coord[1], coord[2]); + final Block block = this.worldObj.getBlock(coord[0], coord[1], coord[2]); if (block.isAir(this.worldObj, coord[0], coord[1], coord[2])) { this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.fire, 0, 7); } else if ((block.getBlockHardness(this.worldObj, coord[0], coord[1], coord[2]) >= 0.0F) && (this.worldObj.getTileEntity(coord[0], coord[1], coord[2]) == null)) { - Material mat = block.getMaterial(); + final Material mat = block.getMaterial(); if ((mat == Material.rock) || (mat == Material.iron) || (mat == Material.lava) || (mat == Material.ground) || (mat == Material.clay)) { this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.flowing_lava, 15, 7); } else { @@ -403,19 +404,19 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II } if (power >= 0.7F) { - List list1 = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(this.xCoord - 3, this.yCoord - 3, this.zCoord - 3, this.xCoord + 4, this.yCoord + 4, this.zCoord + 4)); + final List list1 = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(this.xCoord - 3, this.yCoord - 3, this.zCoord - 3, this.xCoord + 4, this.yCoord + 4, this.zCoord + 4)); for (int l = 0; l < list1.size(); l++) { - Entity ent = (Entity)list1.get(l); + final Entity ent = (Entity)list1.get(l); ent.attackEntityFrom(IC2DamageSource.radiation, (int)(this.worldObj.rand.nextInt(4) * this.hem)); } } if ((power >= 0.5F) && (this.worldObj.rand.nextFloat() <= this.hem)) { - int[] coord = getRandCoord(2); + final int[] coord = this.getRandCoord(2); if (coord != null) { - Block block = this.worldObj.getBlock(coord[0], coord[1], coord[2]); + final Block block = this.worldObj.getBlock(coord[0], coord[1], coord[2]); if (block.getMaterial() == Material.water) { this.worldObj.setBlockToAir(coord[0], coord[1], coord[2]); } @@ -423,12 +424,12 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II } if ((power >= 0.4F) && (this.worldObj.rand.nextFloat() <= this.hem)) { - int[] coord = getRandCoord(2); - if ((coord != null) && + final int[] coord = this.getRandCoord(2); + if ((coord != null) && (this.worldObj.getTileEntity(coord[0], coord[1], coord[2]) == null)) { - Block block = this.worldObj.getBlock(coord[0], coord[1], coord[2]); - Material mat = block.getMaterial(); + final Block block = this.worldObj.getBlock(coord[0], coord[1], coord[2]); + final Material mat = block.getMaterial(); if ((mat == Material.wood) || (mat == Material.leaves) || (mat == Material.cloth)) { this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.fire, 0, 7); } @@ -437,15 +438,15 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II return false; } - public int[] getRandCoord(int radius) + public int[] getRandCoord(final int radius) { if (radius <= 0) { return null; } - int[] c = new int[3]; - c[0] = (this.xCoord + this.worldObj.rand.nextInt(2 * radius + 1) - radius); - c[1] = (this.yCoord + this.worldObj.rand.nextInt(2 * radius + 1) - radius); - c[2] = (this.zCoord + this.worldObj.rand.nextInt(2 * radius + 1) - radius); + final int[] c = new int[3]; + c[0] = ((this.xCoord + this.worldObj.rand.nextInt((2 * radius) + 1)) - radius); + c[1] = ((this.yCoord + this.worldObj.rand.nextInt((2 * radius) + 1)) - radius); + c[2] = ((this.zCoord + this.worldObj.rand.nextInt((2 * radius) + 1)) - radius); if ((c[0] == this.xCoord) && (c[1] == this.yCoord) && (c[2] == this.zCoord)) { return null; } @@ -455,15 +456,15 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II public void processChambers() { Utils.LOG_WARNING("processChambers"); - int size = getReactorSize(); + final int size = this.getReactorSize(); for (int pass = 0; pass < 6; pass++) { for (int y = 0; y < 3; y++) { for (int x = 0; x < size; x++) { - ItemStack stack = this.reactorSlot.get(x, y); + final ItemStack stack = this.reactorSlot.get(x, y); if ((stack != null) && ((stack.getItem() instanceof IReactorComponent))) { - IReactorComponent comp = (IReactorComponent)stack.getItem(); + final IReactorComponent comp = (IReactorComponent)stack.getItem(); comp.processChamber(this, stack, x, y, pass == 0); } } @@ -488,13 +489,13 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II } @Override - public void setHeat(int heat1) + public void setHeat(final int heat1) { this.heat = heat1; } @Override - public int addHeat(int amount) + public int addHeat(final int amount) { this.heat += amount; return this.heat; @@ -507,13 +508,13 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II } @Override - public void setMaxHeat(int newMaxHeat) + public void setMaxHeat(final int newMaxHeat) { this.maxHeat = newMaxHeat; } @Override - public void addEmitHeat(int heat) + public void addEmitHeat(final int heat) { this.EmitHeatbuffer += heat; } @@ -525,7 +526,7 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II } @Override - public void setHeatEffectModifier(float newHEM) + public void setHeatEffectModifier(final float newHEM) { this.hem = newHEM; } @@ -539,42 +540,42 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II @Override public double getReactorEUEnergyOutput() { - return getOfferedEnergy(); + return this.getOfferedEnergy(); } public double getOfferedEnergy() { - return getReactorEnergyOutput() * 5.0F * 1.0F; + return this.getReactorEnergyOutput() * 5.0F * 1.0F; } @Override - public float addOutput(float energy) + public float addOutput(final float energy) { return this.output += energy; } @Override - public ItemStack getItemAt(int x, int y) + public ItemStack getItemAt(final int x, final int y) { Utils.LOG_WARNING("getItemAt"); - if ((x < 0) || (x >= getReactorSize()) || (y < 0) || (y >= 6)) { + if ((x < 0) || (x >= this.getReactorSize()) || (y < 0) || (y >= 6)) { return null; } return this.reactorSlot.get(x, y); } @Override - public void setItemAt(int x, int y, ItemStack item) + public void setItemAt(final int x, final int y, final ItemStack item) { Utils.LOG_WARNING("setItemAt"); - if ((x < 0) || (x >= getReactorSize()) || (y < 0) || (y >= 6)) { + if ((x < 0) || (x >= this.getReactorSize()) || (y < 0) || (y >= 6)) { return; } this.reactorSlot.put(x, y, item); } public TileEntityHeliumGenerator() { - this.updateTicker = IC2.random.nextInt(getTickRate()); + this.updateTicker = IC2.random.nextInt(this.getTickRate()); this.reactorSlot = new InvSlotRadiation(this, "helium_collector", 0, 54); //TODO } @@ -594,7 +595,7 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II { Utils.LOG_WARNING("receiveRedstone"); if ((this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord)) || (this.redstone)) { - decrStackSize(-1, 1); + this.decrStackSize(-1, 1); return true; } return false; @@ -604,11 +605,11 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II public boolean produceEnergy() { Utils.LOG_WARNING("produceEnergy"); - return (receiveredstone()) && (ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/generator") > 0.0F); + return (this.receiveredstone()) && (ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/generator") > 0.0F); } @Override - public void setRedstoneSignal(boolean redstone) + public void setRedstoneSignal(final boolean redstone) { this.redstone = redstone; } @@ -620,13 +621,13 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II } @Override - public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) + public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final int side) { return true; } @Override - public boolean wrenchCanRemove(EntityPlayer entityPlayer) + public boolean wrenchCanRemove(final EntityPlayer entityPlayer) { return true; } @@ -638,7 +639,7 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II } @Override - public ItemStack getWrenchDrop(EntityPlayer entityPlayer) + public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) { return new ItemStack(ModBlocks.blockHeliumGenerator, 1); } -- cgit