From 30ceed031c54185df288361267a7e07eb59cbfaf Mon Sep 17 00:00:00 2001 From: Gig Date: Tue, 28 Apr 2015 16:18:32 +0100 Subject: [PATCH] Cleaning --- .../techreborn/blocks/BlockAlloySmelter.java | 73 +------------- .../techreborn/blocks/BlockBlastFurnace.java | 73 +------------- .../techreborn/blocks/BlockCentrifuge.java | 71 +------------- .../java/techreborn/blocks/BlockGrinder.java | 73 +------------- .../blocks/BlockImplosionCompressor.java | 73 +------------- .../techreborn/blocks/BlockMachineBase.java | 97 +++++++++++++++++++ .../blocks/BlockMatterFabricator.java | 73 +------------- .../techreborn/blocks/BlockQuantumChest.java | 2 +- .../techreborn/blocks/BlockQuantumTank.java | 2 +- .../blocks/BlockRollingMachine.java | 4 +- .../blocks/BlockThermalGenerator.java | 94 +----------------- 11 files changed, 107 insertions(+), 528 deletions(-) create mode 100644 src/main/java/techreborn/blocks/BlockMachineBase.java diff --git a/src/main/java/techreborn/blocks/BlockAlloySmelter.java b/src/main/java/techreborn/blocks/BlockAlloySmelter.java index 19771186d..6c877c058 100644 --- a/src/main/java/techreborn/blocks/BlockAlloySmelter.java +++ b/src/main/java/techreborn/blocks/BlockAlloySmelter.java @@ -21,7 +21,7 @@ import techreborn.tiles.TileMachineCasing; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockAlloySmelter extends BlockContainer { +public class BlockAlloySmelter extends BlockMachineBase { @SideOnly(Side.CLIENT) private IIcon iconFront; @@ -35,9 +35,7 @@ public class BlockAlloySmelter extends BlockContainer { public BlockAlloySmelter(Material material) { super(material); - setCreativeTab(TechRebornCreativeTab.instance); setBlockName("techreborn.alloysmelter"); - setHardness(2F); } @Override @@ -77,73 +75,4 @@ public class BlockAlloySmelter extends BlockContainer { } - public void onBlockAdded(World world, int x, int y, int z) - { - - super.onBlockAdded(world, x, y, z); - this.setDefaultDirection(world, x, y, z); - - } - - private void setDefaultDirection(World world, int x, int y, int z) - { - - if (!world.isRemote) - { - Block block1 = world.getBlock(x, y, z - 1); - Block block2 = world.getBlock(x, y, z + 1); - Block block3 = world.getBlock(x - 1, y, z); - Block block4 = world.getBlock(x + 1, y, z); - - byte b = 3; - - if (block1.func_149730_j() && !block2.func_149730_j()) - { - b = 3; - } - if (block2.func_149730_j() && !block1.func_149730_j()) - { - b = 2; - } - if (block3.func_149730_j() && !block4.func_149730_j()) - { - b = 5; - } - if (block4.func_149730_j() && !block3.func_149730_j()) - { - b = 4; - } - - world.setBlockMetadataWithNotify(x, y, z, b, 2); - - } - - } - - public void onBlockPlacedBy(World world, int x, int y, int z, - EntityLivingBase player, ItemStack itemstack) - { - - int l = MathHelper - .floor_double((double) (player.rotationYaw * 4.0F / 360F) + 0.5D) & 3; - - if (l == 0) - { - world.setBlockMetadataWithNotify(x, y, z, 2, 2); - } - if (l == 1) - { - world.setBlockMetadataWithNotify(x, y, z, 5, 2); - } - if (l == 2) - { - world.setBlockMetadataWithNotify(x, y, z, 3, 2); - } - if (l == 3) - { - world.setBlockMetadataWithNotify(x, y, z, 4, 2); - } - - } - } diff --git a/src/main/java/techreborn/blocks/BlockBlastFurnace.java b/src/main/java/techreborn/blocks/BlockBlastFurnace.java index faa6b401b..224c3ac71 100644 --- a/src/main/java/techreborn/blocks/BlockBlastFurnace.java +++ b/src/main/java/techreborn/blocks/BlockBlastFurnace.java @@ -20,7 +20,7 @@ import techreborn.tiles.TileMachineCasing; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockBlastFurnace extends BlockContainer { +public class BlockBlastFurnace extends BlockMachineBase { @SideOnly(Side.CLIENT) private IIcon iconFront; @@ -34,9 +34,7 @@ public class BlockBlastFurnace extends BlockContainer { public BlockBlastFurnace(Material material) { super(material); - setCreativeTab(TechRebornCreativeTab.instance); setBlockName("techreborn.blastfurnace"); - setHardness(2F); } @Override @@ -90,73 +88,4 @@ public class BlockBlastFurnace extends BlockContainer { } - public void onBlockAdded(World world, int x, int y, int z) - { - - super.onBlockAdded(world, x, y, z); - this.setDefaultDirection(world, x, y, z); - - } - - private void setDefaultDirection(World world, int x, int y, int z) - { - - if (!world.isRemote) - { - Block block1 = world.getBlock(x, y, z - 1); - Block block2 = world.getBlock(x, y, z + 1); - Block block3 = world.getBlock(x - 1, y, z); - Block block4 = world.getBlock(x + 1, y, z); - - byte b = 3; - - if (block1.func_149730_j() && !block2.func_149730_j()) - { - b = 3; - } - if (block2.func_149730_j() && !block1.func_149730_j()) - { - b = 2; - } - if (block3.func_149730_j() && !block4.func_149730_j()) - { - b = 5; - } - if (block4.func_149730_j() && !block3.func_149730_j()) - { - b = 4; - } - - world.setBlockMetadataWithNotify(x, y, z, b, 2); - - } - - } - - public void onBlockPlacedBy(World world, int x, int y, int z, - EntityLivingBase player, ItemStack itemstack) - { - - int l = MathHelper - .floor_double((double) (player.rotationYaw * 4.0F / 360F) + 0.5D) & 3; - - if (l == 0) - { - world.setBlockMetadataWithNotify(x, y, z, 2, 2); - } - if (l == 1) - { - world.setBlockMetadataWithNotify(x, y, z, 5, 2); - } - if (l == 2) - { - world.setBlockMetadataWithNotify(x, y, z, 3, 2); - } - if (l == 3) - { - world.setBlockMetadataWithNotify(x, y, z, 4, 2); - } - - } - } diff --git a/src/main/java/techreborn/blocks/BlockCentrifuge.java b/src/main/java/techreborn/blocks/BlockCentrifuge.java index 768b5876c..580952d9d 100644 --- a/src/main/java/techreborn/blocks/BlockCentrifuge.java +++ b/src/main/java/techreborn/blocks/BlockCentrifuge.java @@ -17,7 +17,7 @@ import techreborn.tiles.TileCentrifuge; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockCentrifuge extends BlockContainer { +public class BlockCentrifuge extends BlockMachineBase { @SideOnly(Side.CLIENT) private IIcon iconFront; @@ -72,73 +72,4 @@ public class BlockCentrifuge extends BlockContainer { } - public void onBlockAdded(World world, int x, int y, int z) - { - - super.onBlockAdded(world, x, y, z); - this.setDefaultDirection(world, x, y, z); - - } - - private void setDefaultDirection(World world, int x, int y, int z) - { - - if (!world.isRemote) - { - Block block1 = world.getBlock(x, y, z - 1); - Block block2 = world.getBlock(x, y, z + 1); - Block block3 = world.getBlock(x - 1, y, z); - Block block4 = world.getBlock(x + 1, y, z); - - byte b = 3; - - if (block1.func_149730_j() && !block2.func_149730_j()) - { - b = 3; - } - if (block2.func_149730_j() && !block1.func_149730_j()) - { - b = 2; - } - if (block3.func_149730_j() && !block4.func_149730_j()) - { - b = 5; - } - if (block4.func_149730_j() && !block3.func_149730_j()) - { - b = 4; - } - - world.setBlockMetadataWithNotify(x, y, z, b, 2); - - } - - } - - public void onBlockPlacedBy(World world, int x, int y, int z, - EntityLivingBase player, ItemStack itemstack) - { - - int l = MathHelper - .floor_double((double) (player.rotationYaw * 4.0F / 360F) + 0.5D) & 3; - - if (l == 0) - { - world.setBlockMetadataWithNotify(x, y, z, 2, 2); - } - if (l == 1) - { - world.setBlockMetadataWithNotify(x, y, z, 5, 2); - } - if (l == 2) - { - world.setBlockMetadataWithNotify(x, y, z, 3, 2); - } - if (l == 3) - { - world.setBlockMetadataWithNotify(x, y, z, 4, 2); - } - - } - } diff --git a/src/main/java/techreborn/blocks/BlockGrinder.java b/src/main/java/techreborn/blocks/BlockGrinder.java index 8c4f4b9f7..55a0789dc 100644 --- a/src/main/java/techreborn/blocks/BlockGrinder.java +++ b/src/main/java/techreborn/blocks/BlockGrinder.java @@ -15,7 +15,7 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -public class BlockGrinder extends BlockContainer{ +public class BlockGrinder extends BlockMachineBase{ @SideOnly(Side.CLIENT) private IIcon iconFront; @@ -29,9 +29,7 @@ public class BlockGrinder extends BlockContainer{ public BlockGrinder(Material material) { super(material); - setCreativeTab(TechRebornCreativeTab.instance); setBlockName("techreborn.grinder"); - setHardness(2F); } @Override @@ -60,73 +58,4 @@ public class BlockGrinder extends BlockContainer{ } - public void onBlockAdded(World world, int x, int y, int z) - { - - super.onBlockAdded(world, x, y, z); - this.setDefaultDirection(world, x, y, z); - - } - - private void setDefaultDirection(World world, int x, int y, int z) - { - - if (!world.isRemote) - { - Block block1 = world.getBlock(x, y, z - 1); - Block block2 = world.getBlock(x, y, z + 1); - Block block3 = world.getBlock(x - 1, y, z); - Block block4 = world.getBlock(x + 1, y, z); - - byte b = 3; - - if (block1.func_149730_j() && !block2.func_149730_j()) - { - b = 3; - } - if (block2.func_149730_j() && !block1.func_149730_j()) - { - b = 2; - } - if (block3.func_149730_j() && !block4.func_149730_j()) - { - b = 5; - } - if (block4.func_149730_j() && !block3.func_149730_j()) - { - b = 4; - } - - world.setBlockMetadataWithNotify(x, y, z, b, 2); - - } - - } - - public void onBlockPlacedBy(World world, int x, int y, int z, - EntityLivingBase player, ItemStack itemstack) - { - - int l = MathHelper - .floor_double((double) (player.rotationYaw * 4.0F / 360F) + 0.5D) & 3; - - if (l == 0) - { - world.setBlockMetadataWithNotify(x, y, z, 2, 2); - } - if (l == 1) - { - world.setBlockMetadataWithNotify(x, y, z, 5, 2); - } - if (l == 2) - { - world.setBlockMetadataWithNotify(x, y, z, 3, 2); - } - if (l == 3) - { - world.setBlockMetadataWithNotify(x, y, z, 4, 2); - } - - } - } diff --git a/src/main/java/techreborn/blocks/BlockImplosionCompressor.java b/src/main/java/techreborn/blocks/BlockImplosionCompressor.java index f490cee0c..20365fda0 100644 --- a/src/main/java/techreborn/blocks/BlockImplosionCompressor.java +++ b/src/main/java/techreborn/blocks/BlockImplosionCompressor.java @@ -15,7 +15,7 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -public class BlockImplosionCompressor extends BlockContainer{ +public class BlockImplosionCompressor extends BlockMachineBase{ @SideOnly(Side.CLIENT) private IIcon iconFront; @@ -29,9 +29,7 @@ public class BlockImplosionCompressor extends BlockContainer{ public BlockImplosionCompressor(Material material) { super(material); - setCreativeTab(TechRebornCreativeTab.instance); setBlockName("techreborn.implosioncompressor"); - setHardness(2F); } @Override @@ -60,73 +58,4 @@ public class BlockImplosionCompressor extends BlockContainer{ } - public void onBlockAdded(World world, int x, int y, int z) - { - - super.onBlockAdded(world, x, y, z); - this.setDefaultDirection(world, x, y, z); - - } - - private void setDefaultDirection(World world, int x, int y, int z) - { - - if (!world.isRemote) - { - Block block1 = world.getBlock(x, y, z - 1); - Block block2 = world.getBlock(x, y, z + 1); - Block block3 = world.getBlock(x - 1, y, z); - Block block4 = world.getBlock(x + 1, y, z); - - byte b = 3; - - if (block1.func_149730_j() && !block2.func_149730_j()) - { - b = 3; - } - if (block2.func_149730_j() && !block1.func_149730_j()) - { - b = 2; - } - if (block3.func_149730_j() && !block4.func_149730_j()) - { - b = 5; - } - if (block4.func_149730_j() && !block3.func_149730_j()) - { - b = 4; - } - - world.setBlockMetadataWithNotify(x, y, z, b, 2); - - } - - } - - public void onBlockPlacedBy(World world, int x, int y, int z, - EntityLivingBase player, ItemStack itemstack) - { - - int l = MathHelper - .floor_double((double) (player.rotationYaw * 4.0F / 360F) + 0.5D) & 3; - - if (l == 0) - { - world.setBlockMetadataWithNotify(x, y, z, 2, 2); - } - if (l == 1) - { - world.setBlockMetadataWithNotify(x, y, z, 5, 2); - } - if (l == 2) - { - world.setBlockMetadataWithNotify(x, y, z, 3, 2); - } - if (l == 3) - { - world.setBlockMetadataWithNotify(x, y, z, 4, 2); - } - - } - } diff --git a/src/main/java/techreborn/blocks/BlockMachineBase.java b/src/main/java/techreborn/blocks/BlockMachineBase.java new file mode 100644 index 000000000..30df9d4f2 --- /dev/null +++ b/src/main/java/techreborn/blocks/BlockMachineBase.java @@ -0,0 +1,97 @@ +package techreborn.blocks; + +import techreborn.client.TechRebornCreativeTab; +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class BlockMachineBase extends BlockContainer{ + + public BlockMachineBase(Material material) + { + super(Material.rock); + setCreativeTab(TechRebornCreativeTab.instance); + setHardness(2f); + } + + @Override + public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) + { + return null; + } + + public void onBlockAdded(World world, int x, int y, int z) + { + + super.onBlockAdded(world, x, y, z); + this.setDefaultDirection(world, x, y, z); + + } + + private void setDefaultDirection(World world, int x, int y, int z) + { + + if (!world.isRemote) + { + Block block1 = world.getBlock(x, y, z - 1); + Block block2 = world.getBlock(x, y, z + 1); + Block block3 = world.getBlock(x - 1, y, z); + Block block4 = world.getBlock(x + 1, y, z); + + byte b = 3; + + if (block1.func_149730_j() && !block2.func_149730_j()) + { + b = 3; + } + if (block2.func_149730_j() && !block1.func_149730_j()) + { + b = 2; + } + if (block3.func_149730_j() && !block4.func_149730_j()) + { + b = 5; + } + if (block4.func_149730_j() && !block3.func_149730_j()) + { + b = 4; + } + + world.setBlockMetadataWithNotify(x, y, z, b, 2); + + } + + } + + public void onBlockPlacedBy(World world, int x, int y, int z, + EntityLivingBase player, ItemStack itemstack) + { + + int l = MathHelper + .floor_double((double) (player.rotationYaw * 4.0F / 360F) + 0.5D) & 3; + + if (l == 0) + { + world.setBlockMetadataWithNotify(x, y, z, 2, 2); + } + if (l == 1) + { + world.setBlockMetadataWithNotify(x, y, z, 5, 2); + } + if (l == 2) + { + world.setBlockMetadataWithNotify(x, y, z, 3, 2); + } + if (l == 3) + { + world.setBlockMetadataWithNotify(x, y, z, 4, 2); + } + + } + +} diff --git a/src/main/java/techreborn/blocks/BlockMatterFabricator.java b/src/main/java/techreborn/blocks/BlockMatterFabricator.java index ff1e954b5..a07ae2882 100644 --- a/src/main/java/techreborn/blocks/BlockMatterFabricator.java +++ b/src/main/java/techreborn/blocks/BlockMatterFabricator.java @@ -15,7 +15,7 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -public class BlockMatterFabricator extends BlockContainer{ +public class BlockMatterFabricator extends BlockMachineBase{ @SideOnly(Side.CLIENT) private IIcon iconFront; @@ -29,9 +29,7 @@ public class BlockMatterFabricator extends BlockContainer{ public BlockMatterFabricator(Material material) { super(material); - setCreativeTab(TechRebornCreativeTab.instance); setBlockName("techreborn.matterfabricator"); - setHardness(2F); } @Override @@ -60,73 +58,4 @@ public class BlockMatterFabricator extends BlockContainer{ } - public void onBlockAdded(World world, int x, int y, int z) - { - - super.onBlockAdded(world, x, y, z); - this.setDefaultDirection(world, x, y, z); - - } - - private void setDefaultDirection(World world, int x, int y, int z) - { - - if (!world.isRemote) - { - Block block1 = world.getBlock(x, y, z - 1); - Block block2 = world.getBlock(x, y, z + 1); - Block block3 = world.getBlock(x - 1, y, z); - Block block4 = world.getBlock(x + 1, y, z); - - byte b = 3; - - if (block1.func_149730_j() && !block2.func_149730_j()) - { - b = 3; - } - if (block2.func_149730_j() && !block1.func_149730_j()) - { - b = 2; - } - if (block3.func_149730_j() && !block4.func_149730_j()) - { - b = 5; - } - if (block4.func_149730_j() && !block3.func_149730_j()) - { - b = 4; - } - - world.setBlockMetadataWithNotify(x, y, z, b, 2); - - } - - } - - public void onBlockPlacedBy(World world, int x, int y, int z, - EntityLivingBase player, ItemStack itemstack) - { - - int l = MathHelper - .floor_double((double) (player.rotationYaw * 4.0F / 360F) + 0.5D) & 3; - - if (l == 0) - { - world.setBlockMetadataWithNotify(x, y, z, 2, 2); - } - if (l == 1) - { - world.setBlockMetadataWithNotify(x, y, z, 5, 2); - } - if (l == 2) - { - world.setBlockMetadataWithNotify(x, y, z, 3, 2); - } - if (l == 3) - { - world.setBlockMetadataWithNotify(x, y, z, 4, 2); - } - - } - } diff --git a/src/main/java/techreborn/blocks/BlockQuantumChest.java b/src/main/java/techreborn/blocks/BlockQuantumChest.java index 32c57247b..c1ceca46a 100644 --- a/src/main/java/techreborn/blocks/BlockQuantumChest.java +++ b/src/main/java/techreborn/blocks/BlockQuantumChest.java @@ -13,7 +13,7 @@ import techreborn.tiles.TileQuantumChest; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockQuantumChest extends BlockContainer { +public class BlockQuantumChest extends BlockMachineBase { @SideOnly(Side.CLIENT) private IIcon top; diff --git a/src/main/java/techreborn/blocks/BlockQuantumTank.java b/src/main/java/techreborn/blocks/BlockQuantumTank.java index 2b48471e6..283ab3147 100644 --- a/src/main/java/techreborn/blocks/BlockQuantumTank.java +++ b/src/main/java/techreborn/blocks/BlockQuantumTank.java @@ -13,7 +13,7 @@ import techreborn.tiles.TileQuantumTank; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockQuantumTank extends BlockContainer { +public class BlockQuantumTank extends BlockMachineBase { @SideOnly(Side.CLIENT) private IIcon top; diff --git a/src/main/java/techreborn/blocks/BlockRollingMachine.java b/src/main/java/techreborn/blocks/BlockRollingMachine.java index b8033da67..c1114213b 100644 --- a/src/main/java/techreborn/blocks/BlockRollingMachine.java +++ b/src/main/java/techreborn/blocks/BlockRollingMachine.java @@ -18,7 +18,7 @@ import techreborn.tiles.TileRollingMachine; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockRollingMachine extends BlockContainer { +public class BlockRollingMachine extends BlockMachineBase { @SideOnly(Side.CLIENT) private IIcon iconFront; @@ -32,9 +32,7 @@ public class BlockRollingMachine extends BlockContainer { public BlockRollingMachine(Material material) { super(material.rock); - setCreativeTab(TechRebornCreativeTab.instance); setBlockName("techreborn.rollingmachine"); - setHardness(2f); } @Override diff --git a/src/main/java/techreborn/blocks/BlockThermalGenerator.java b/src/main/java/techreborn/blocks/BlockThermalGenerator.java index 5b64714ed..9d335cc5f 100644 --- a/src/main/java/techreborn/blocks/BlockThermalGenerator.java +++ b/src/main/java/techreborn/blocks/BlockThermalGenerator.java @@ -21,7 +21,7 @@ import techreborn.tiles.TileThermalGenerator; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockThermalGenerator extends BlockContainer { +public class BlockThermalGenerator extends BlockMachineBase { @SideOnly(Side.CLIENT) private IIcon iconFront; @@ -59,96 +59,4 @@ public class BlockThermalGenerator extends BlockContainer { } - public void onBlockAdded(World world, int x, int y, int z) - { - - super.onBlockAdded(world, x, y, z); - this.setDefaultDirection(world, x, y, z); - - } - - private void setDefaultDirection(World world, int x, int y, int z) - { - - if (!world.isRemote) - { - Block block1 = world.getBlock(x, y, z - 1); - Block block2 = world.getBlock(x, y, z + 1); - Block block3 = world.getBlock(x - 1, y, z); - Block block4 = world.getBlock(x + 1, y, z); - - byte b = 3; - - if (block1.func_149730_j() && !block2.func_149730_j()) - { - b = 3; - } - if (block2.func_149730_j() && !block1.func_149730_j()) - { - b = 2; - } - if (block3.func_149730_j() && !block4.func_149730_j()) - { - b = 5; - } - if (block4.func_149730_j() && !block3.func_149730_j()) - { - b = 4; - } - - world.setBlockMetadataWithNotify(x, y, z, b, 2); - - } - - } - - public void onBlockPlacedBy(World world, int x, int y, int z, - EntityLivingBase player, ItemStack itemstack) - { - - int l = MathHelper - .floor_double((double) (player.rotationYaw * 4.0F / 360F) + 0.5D) & 3; - - if (l == 0) - { - world.setBlockMetadataWithNotify(x, y, z, 2, 2); - } - if (l == 1) - { - world.setBlockMetadataWithNotify(x, y, z, 5, 2); - } - if (l == 2) - { - world.setBlockMetadataWithNotify(x, y, z, 3, 2); - } - if (l == 3) - { - world.setBlockMetadataWithNotify(x, y, z, 4, 2); - } - - } - - @Override - public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) - { - return new TileThermalGenerator(); - } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, - EntityPlayer player, int side, float hitX, float hitY, float hitZ) - { - if (!player.isSneaking()) - player.openGui(Core.INSTANCE, GuiHandler.thermalGeneratorID, world, - x, y, z); - return true; - } - - @Override - public Item getItemDropped(int p_149650_1_, Random p_149650_2_, - int p_149650_3_) - { - // TODO change when added crafting - return Item.getItemFromBlock(Blocks.furnace); - } }