diff options
| author | draknyte1 <draknyte1@hotmail.com> | 2016-11-04 15:23:26 +1000 |
|---|---|---|
| committer | draknyte1 <draknyte1@hotmail.com> | 2016-11-04 15:23:26 +1000 |
| commit | 0669f5eb9d5029a8b94ec552171b0837605f7747 (patch) | |
| tree | 6b40e64c04d51b7a33cf2f0b35f7232cf37c4247 /src/Java/gtPlusPlus/core/block/machine | |
| parent | 3654052fb63a571c5eaca7f20714b87c17f7e966 (diff) | |
| download | GT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.tar.gz GT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.tar.bz2 GT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.zip | |
$ Cleaned up the entire project.
> Much neat, very nices.
Diffstat (limited to 'src/Java/gtPlusPlus/core/block/machine')
11 files changed, 898 insertions, 964 deletions
diff --git a/src/Java/gtPlusPlus/core/block/machine/BlockGtFrameBox.java b/src/Java/gtPlusPlus/core/block/machine/BlockGtFrameBox.java index 6de87e522b..dbbc91c902 100644 --- a/src/Java/gtPlusPlus/core/block/machine/BlockGtFrameBox.java +++ b/src/Java/gtPlusPlus/core/block/machine/BlockGtFrameBox.java @@ -8,27 +8,26 @@ import net.minecraft.world.IBlockAccess; public class BlockGtFrameBox extends MetaBlock { - private int[] colours; - private int totalColours; - - public BlockGtFrameBox( - String unlocalizedName, Material material, - BlockTypes blockTypeENUM, boolean recolour, int... colour) { + private int[] colours; + private int totalColours; + + public BlockGtFrameBox(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/Machine_Charger.java b/src/Java/gtPlusPlus/core/block/machine/Machine_Charger.java index 43a38d0b52..e88c5c5b6b 100644 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_Charger.java +++ b/src/Java/gtPlusPlus/core/block/machine/Machine_Charger.java @@ -16,67 +16,67 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import scala.util.Random; -public class Machine_Charger extends BlockContainer -{ - private static final String name = "Charging Machine"; - - private final Random rand = new Random(); - - public Machine_Charger(String unlocalizedName) - { - super(Material.iron); - //GameRegistry.registerBlock(this, unlocalizedName); - this.setBlockName(unlocalizedName); - this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName); - this.setCreativeTab(AddToCreativeTab.tabMachines); - } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz) - { - if (world.isRemote) return true; - - TileEntity te = world.getTileEntity(x, y, z); - if (te != null && te instanceof TileEntityCharger) - { - player.openGui(GTplusplus.instance, 1, world, x, y, z); - return true; - } - return false; - } - - @Override - public void breakBlock(World world, int x, int y, int z, Block block, int par6) - { - if (world.isRemote) return; - - ArrayList drops = new ArrayList(); - - TileEntity teRaw = world.getTileEntity(x, y, z); - - if (teRaw != null && teRaw instanceof TileEntityCharger) - { - TileEntityCharger te = (TileEntityCharger) teRaw; - - for (int i = 0; i < te.getSizeInventory(); i++) - { - ItemStack stack = te.getStackInSlot(i); - - if (stack != null) drops.add(stack.copy()); - } - } - - for (int i = 0;i < drops.size();i++) - { - EntityItem item = new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, (ItemStack) drops.get(i)); - item.setVelocity((rand.nextDouble() - 0.5) * 0.25, rand.nextDouble() * 0.5 * 0.25, (rand.nextDouble() - 0.5) * 0.25); - world.spawnEntityInWorld(item); - } - } - - @Override - public TileEntity createNewTileEntity(World world, int par2) - { - return new TileEntityCharger(); - } +public class Machine_Charger extends BlockContainer { + private static final String name = "Charging Machine"; + + private final Random rand = new Random(); + + public Machine_Charger(final String unlocalizedName) { + super(Material.iron); + // GameRegistry.registerBlock(this, unlocalizedName); + this.setBlockName(unlocalizedName); + this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName); + this.setCreativeTab(AddToCreativeTab.tabMachines); + } + + @Override + public void breakBlock(final World world, final int x, final int y, final int z, final Block block, + final int par6) { + if (world.isRemote) { + return; + } + + final ArrayList drops = new ArrayList(); + + final TileEntity teRaw = world.getTileEntity(x, y, z); + + if (teRaw != null && teRaw instanceof TileEntityCharger) { + final TileEntityCharger te = (TileEntityCharger) teRaw; + + for (int i = 0; i < te.getSizeInventory(); i++) { + final ItemStack stack = te.getStackInSlot(i); + + if (stack != null) { + drops.add(stack.copy()); + } + } + } + + for (int i = 0; i < drops.size(); i++) { + final EntityItem item = new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, (ItemStack) drops.get(i)); + item.setVelocity((this.rand.nextDouble() - 0.5) * 0.25, this.rand.nextDouble() * 0.5 * 0.25, + (this.rand.nextDouble() - 0.5) * 0.25); + world.spawnEntityInWorld(item); + } + } + + @Override + public TileEntity createNewTileEntity(final World world, final int par2) { + return new TileEntityCharger(); + } + + @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; + } + + final TileEntity te = world.getTileEntity(x, y, z); + if (te != null && te instanceof TileEntityCharger) { + player.openGui(GTplusplus.instance, 1, world, x, y, z); + return true; + } + return false; + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_NHG.java b/src/Java/gtPlusPlus/core/block/machine/Machine_NHG.java index 72cfc91826..cfad3006b9 100644 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_NHG.java +++ b/src/Java/gtPlusPlus/core/block/machine/Machine_NHG.java @@ -16,67 +16,67 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import scala.util.Random; -public class Machine_NHG extends BlockContainer -{ - private static final String name = "Nuclear Fueled Helium Generator"; - - private final Random rand = new Random(); - - public Machine_NHG(String unlocalizedName) - { - super(Material.iron); - //GameRegistry.registerBlock(this, unlocalizedName); - this.setBlockName(unlocalizedName); - this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName); - this.setCreativeTab(AddToCreativeTab.tabMachines); - } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz) - { - if (world.isRemote) return true; - - TileEntity te = world.getTileEntity(x, y, z); - if (te != null && te instanceof TileEntityNHG) - { - player.openGui(GTplusplus.instance, 0, world, x, y, z); - return true; - } - return false; - } - - @Override - public void breakBlock(World world, int x, int y, int z, Block block, int par6) - { - if (world.isRemote) return; - - ArrayList drops = new ArrayList(); - - TileEntity teRaw = world.getTileEntity(x, y, z); - - if (teRaw != null && teRaw instanceof TileEntityNHG) - { - TileEntityNHG te = (TileEntityNHG) teRaw; - - for (int i = 0; i < te.getSizeInventory(); i++) - { - ItemStack stack = te.getStackInSlot(i); - - if (stack != null) drops.add(stack.copy()); - } - } - - for (int i = 0;i < drops.size();i++) - { - EntityItem item = new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, (ItemStack) drops.get(i)); - item.setVelocity((rand.nextDouble() - 0.5) * 0.25, rand.nextDouble() * 0.5 * 0.25, (rand.nextDouble() - 0.5) * 0.25); - world.spawnEntityInWorld(item); - } - } - - @Override - public TileEntity createNewTileEntity(World world, int par2) - { - return new TileEntityNHG(); - } +public class Machine_NHG extends BlockContainer { + private static final String name = "Nuclear Fueled Helium Generator"; + + private final Random rand = new Random(); + + public Machine_NHG(final String unlocalizedName) { + super(Material.iron); + // GameRegistry.registerBlock(this, unlocalizedName); + this.setBlockName(unlocalizedName); + this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName); + this.setCreativeTab(AddToCreativeTab.tabMachines); + } + + @Override + public void breakBlock(final World world, final int x, final int y, final int z, final Block block, + final int par6) { + if (world.isRemote) { + return; + } + + final ArrayList drops = new ArrayList(); + + final TileEntity teRaw = world.getTileEntity(x, y, z); + + if (teRaw != null && teRaw instanceof TileEntityNHG) { + final TileEntityNHG te = (TileEntityNHG) teRaw; + + for (int i = 0; i < te.getSizeInventory(); i++) { + final ItemStack stack = te.getStackInSlot(i); + + if (stack != null) { + drops.add(stack.copy()); + } + } + } + + for (int i = 0; i < drops.size(); i++) { + final EntityItem item = new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, (ItemStack) drops.get(i)); + item.setVelocity((this.rand.nextDouble() - 0.5) * 0.25, this.rand.nextDouble() * 0.5 * 0.25, + (this.rand.nextDouble() - 0.5) * 0.25); + world.spawnEntityInWorld(item); + } + } + + @Override + public TileEntity createNewTileEntity(final World world, final int par2) { + return new TileEntityNHG(); + } + + @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; + } + + final TileEntity te = world.getTileEntity(x, y, z); + if (te != null && te instanceof TileEntityNHG) { + player.openGui(GTplusplus.instance, 0, world, x, y, z); + return true; + } + return false; + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_WireiusDeletus.java b/src/Java/gtPlusPlus/core/block/machine/Machine_WireiusDeletus.java index e964a9da01..e881d40d35 100644 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_WireiusDeletus.java +++ b/src/Java/gtPlusPlus/core/block/machine/Machine_WireiusDeletus.java @@ -1,5 +1,6 @@ package gtPlusPlus.core.block.machine; -public class Machine_WireiusDeletus { //A Block that removes GT Cable and Wire from it's inventory. +public class Machine_WireiusDeletus { // A Block that removes GT Cable and Wire + // from it's inventory. } diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java b/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java index 6827ec6741..1921aa8000 100644 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java +++ b/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java @@ -22,89 +22,84 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class Machine_Workbench extends BlockContainer -{ - @SideOnly(Side.CLIENT) - private IIcon textureTop; - @SideOnly(Side.CLIENT) - private IIcon textureBottom; - @SideOnly(Side.CLIENT) - private IIcon textureFront; +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") - public Machine_Workbench() - { - super(Material.iron); - this.setBlockName("blockWorkbenchGT"); - this.setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerBlock(this, "blockWorkbenchGT"); + @SuppressWarnings("deprecation") + public Machine_Workbench() { + 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 - @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)); - } + } + + @Override + public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { + return new TileEntityWorkbench(); + } - @Override + /** + * Gets the block's texture. Args: side, meta + */ + @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"); - } + 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; + } - /** - * 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) { ItemStack heldItem = null; - if (world.isRemote){ - heldItem = PlayerUtils.getItemStackInPlayersHand(); - } + if (world.isRemote) { + heldItem = PlayerUtils.getItemStackInPlayersHand(); + } boolean holdingWrench = false; - if (heldItem != null){ - if (heldItem.getItem() instanceof ItemToolWrench){ + if (heldItem != null) { + if (heldItem.getItem() instanceof ItemToolWrench) { holdingWrench = true; } - else if (heldItem.getItem() instanceof IToolWrench){ + else if (heldItem.getItem() instanceof IToolWrench) { holdingWrench = true; } - else if (heldItem.getItem() instanceof ITool){ + else if (heldItem.getItem() instanceof ITool) { holdingWrench = true; } - /*else if (heldItem.getItem() instanceof GT_MetaGenerated_Tool){ - GT_MetaGenerated_Tool testTool = (GT_MetaGenerated_Tool) heldItem.getItem(); - if (testTool.canWrench(player, x, y, z)){ - holdingWrench = true; - } - }*/ + /* + * else if (heldItem.getItem() instanceof GT_MetaGenerated_Tool){ + * GT_MetaGenerated_Tool testTool = (GT_MetaGenerated_Tool) + * heldItem.getItem(); if (testTool.canWrench(player, x, y, z)){ + * holdingWrench = true; } } + */ else { holdingWrench = false; } } - if (world.isRemote) return true; + if (world.isRemote) { + return true; + } - TileEntity te = world.getTileEntity(x, y, z); - if (te != null && te instanceof TileEntityWorkbench) - { - if (!holdingWrench){ + 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."); } @@ -112,7 +107,11 @@ public class Machine_Workbench extends BlockContainer } @Override - public TileEntity createNewTileEntity(World world, int p_149915_2_) { - return new TileEntityWorkbench(); + @SideOnly(Side.CLIENT) + 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"); } }
\ 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 37b801836f..20d6c8601c 100644 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java +++ b/src/Java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java @@ -22,18 +22,16 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class Machine_WorkbenchAdvanced extends BlockContainer -{ +public class Machine_WorkbenchAdvanced extends BlockContainer { @SideOnly(Side.CLIENT) - private IIcon textureTop; + private IIcon textureTop; @SideOnly(Side.CLIENT) - private IIcon textureBottom; + private IIcon textureBottom; @SideOnly(Side.CLIENT) - private IIcon textureFront; + private IIcon textureFront; @SuppressWarnings("deprecation") - public Machine_WorkbenchAdvanced() - { + public Machine_WorkbenchAdvanced() { super(Material.iron); this.setBlockName("blockWorkbenchGTAdvanced"); this.setCreativeTab(AddToCreativeTab.tabMachines); @@ -42,65 +40,61 @@ public class Machine_WorkbenchAdvanced extends BlockContainer } - /** - * 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 TileEntity createNewTileEntity(final World world, final int p_149915_2_) { + return new TileEntityWorkbenchAdvanced(128000, 2); } + /** + * Gets the block's texture. Args: side, meta + */ @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(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"); - this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "machine_top"); - this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "machine_top"); + 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; } /** * 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){ - if (heldItem.getItem() instanceof ItemToolWrench){ + if (heldItem != null) { + if (heldItem.getItem() instanceof ItemToolWrench) { holdingWrench = true; } - else if (heldItem.getItem() instanceof IToolWrench){ + else if (heldItem.getItem() instanceof IToolWrench) { holdingWrench = true; } - else if (heldItem.getItem() instanceof ITool){ + else if (heldItem.getItem() instanceof ITool) { holdingWrench = true; } - /*else if (heldItem.getItem() instanceof GT_MetaGenerated_Tool){ - GT_MetaGenerated_Tool testTool = (GT_MetaGenerated_Tool) heldItem.getItem(); - if (testTool.canWrench(player, x, y, z)){ - holdingWrench = true; - } - }*/ + /* + * else if (heldItem.getItem() instanceof GT_MetaGenerated_Tool){ + * GT_MetaGenerated_Tool testTool = (GT_MetaGenerated_Tool) + * heldItem.getItem(); if (testTool.canWrench(player, x, y, z)){ + * holdingWrench = true; } } + */ else { holdingWrench = false; } } - - TileEntity te = world.getTileEntity(x, y, z); - if (te != null && te instanceof TileEntityWorkbenchAdvanced) - { - if (!holdingWrench){ + 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."); } @@ -108,7 +102,11 @@ public class Machine_WorkbenchAdvanced extends BlockContainer } @Override - public TileEntity createNewTileEntity(World world, int p_149915_2_) { - return new TileEntityWorkbenchAdvanced(128000, 2); + @SideOnly(Side.CLIENT) + 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"); + this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "machine_top"); + this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "machine_top"); } }
\ 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 e83e189ddf..19e9b09e8f 100644 --- a/src/Java/gtPlusPlus/core/block/machine/heliumgen/block/HeliumGenerator.java +++ b/src/Java/gtPlusPlus/core/block/machine/heliumgen/block/HeliumGenerator.java @@ -25,140 +25,142 @@ import net.minecraft.world.World; 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); + } + + @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); + } + + @Override + public TileEntity createNewTileEntity(final World world, final int meta) { + return new TileEntityHeliumGenerator(); + } + + @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); - } - } - |
