From f5b8ea433818fd52287e3130bc2624ac2b3b2cde Mon Sep 17 00:00:00 2001 From: Boblet Date: Wed, 14 Dec 2022 11:58:40 +0100 Subject: [PATCH] paintable cables, 256k tank on new multiblock system --- src/main/java/com/hbm/blocks/ModBlocks.java | 11 +- .../blocks/machine/DummyBlockFluidTank.java | 59 ---- .../hbm/blocks/machine/DummyBlockMachine.java | 57 ++- .../com/hbm/blocks/machine/DummyOldBase.java | 3 +- .../machine/MachineCombustionEngine.java | 1 - .../hbm/blocks/machine/MachineFluidTank.java | 331 ++---------------- .../blocks/network/BlockCablePaintable.java | 173 +++++++++ src/main/java/com/hbm/handler/GUIHandler.java | 14 - .../java/com/hbm/items/special/ItemDrop.java | 80 ++--- src/main/java/com/hbm/lib/Library.java | 6 - .../java/com/hbm/main/CraftingManager.java | 3 +- src/main/java/com/hbm/main/MainRegistry.java | 2 + src/main/java/com/hbm/main/NEIConfig.java | 2 - .../render/tileentity/RenderFluidTank.java | 2 +- .../java/com/hbm/tileentity/TileMappings.java | 4 +- .../storage/TileEntityMachineFluidTank.java | 110 ++++-- src/main/resources/assets/hbm/lang/de_DE.lang | 1 + src/main/resources/assets/hbm/lang/en_US.lang | 1 + .../hbm/textures/blocks/red_cable_base.png | Bin 0 -> 534 bytes .../hbm/textures/blocks/red_cable_overlay.png | Bin 0 -> 115 bytes 20 files changed, 355 insertions(+), 505 deletions(-) delete mode 100644 src/main/java/com/hbm/blocks/machine/DummyBlockFluidTank.java create mode 100644 src/main/java/com/hbm/blocks/network/BlockCablePaintable.java create mode 100644 src/main/resources/assets/hbm/textures/blocks/red_cable_base.png create mode 100644 src/main/resources/assets/hbm/textures/blocks/red_cable_overlay.png diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index bda9dda99..45268853c 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -775,6 +775,7 @@ public class ModBlocks { public static Block red_wire_coated; public static Block red_cable; public static Block red_cable_classic; + public static Block red_cable_paintable; public static Block red_connector; public static Block red_pylon; public static Block red_pylon_large; @@ -1029,8 +1030,6 @@ public class ModBlocks { public static Block machine_chemfac; public static Block machine_fluidtank; - public static final int guiID_machine_fluidtank = 50; - public static Block machine_bat9000; public static Block machine_orbus; @@ -1264,8 +1263,6 @@ public class ModBlocks { public static Block dummy_port_drill; public static Block dummy_block_assembler; public static Block dummy_port_assembler; - public static Block dummy_block_fluidtank; - public static Block dummy_port_fluidtank; public static Block dummy_block_refinery; public static Block dummy_port_refinery; public static Block dummy_block_turbofan; @@ -1969,6 +1966,7 @@ public class ModBlocks { red_wire_coated = new WireCoated(Material.iron).setBlockName("red_wire_coated").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":red_wire_coated"); red_cable = new BlockCable(Material.iron).setBlockName("red_cable").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":cable_neo"); red_cable_classic = new BlockCable(Material.iron).setBlockName("red_cable_classic").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":red_cable_classic"); + red_cable_paintable = new BlockCablePaintable().setBlockName("red_cable_paintable").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); red_connector = new ConnectorRedWire(Material.iron).setBlockName("red_connector").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":red_connector"); red_pylon = new PylonRedWire(Material.iron).setBlockName("red_pylon").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":red_pylon"); red_pylon_large = new PylonLarge(Material.iron).setBlockName("red_pylon_large").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":red_pylon_large"); @@ -2373,8 +2371,6 @@ public class ModBlocks { dummy_port_drill = new DummyBlockDrill(Material.iron, true).setBlockName("dummy_port_drill").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_lead"); dummy_block_assembler = new DummyBlockAssembler(Material.iron, false).setBlockName("dummy_block_assembler").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel"); dummy_port_assembler = new DummyBlockAssembler(Material.iron, true).setBlockName("dummy_port_assembler").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel"); - dummy_block_fluidtank = new DummyBlockFluidTank(Material.iron, false).setBlockName("dummy_block_fluidtank").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel"); - dummy_port_fluidtank = new DummyBlockFluidTank(Material.iron, true).setBlockName("dummy_port_fluidtank").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel"); dummy_block_refinery = new DummyBlockRefinery(Material.iron, false).setBlockName("dummy_block_refinery").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_titanium"); dummy_port_refinery = new DummyBlockRefinery(Material.iron, true).setBlockName("dummy_port_refinery").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_titanium"); dummy_block_turbofan = new DummyBlockTurbofan(Material.iron, false).setBlockName("dummy_block_turbofan").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel"); @@ -3156,6 +3152,7 @@ public class ModBlocks { GameRegistry.registerBlock(red_cable, red_cable.getUnlocalizedName()); GameRegistry.registerBlock(red_cable_classic, red_cable_classic.getUnlocalizedName()); + GameRegistry.registerBlock(red_cable_paintable, red_cable_paintable.getUnlocalizedName()); GameRegistry.registerBlock(red_wire_coated, red_wire_coated.getUnlocalizedName()); GameRegistry.registerBlock(red_connector, ItemBlockBase.class, red_connector.getUnlocalizedName()); GameRegistry.registerBlock(red_pylon, ItemBlockBase.class, red_pylon.getUnlocalizedName()); @@ -3432,8 +3429,6 @@ public class ModBlocks { GameRegistry.registerBlock(dummy_port_drill, dummy_port_drill.getUnlocalizedName()); GameRegistry.registerBlock(dummy_block_assembler, dummy_block_assembler.getUnlocalizedName()); GameRegistry.registerBlock(dummy_port_assembler, dummy_port_assembler.getUnlocalizedName()); - GameRegistry.registerBlock(dummy_block_fluidtank, dummy_block_fluidtank.getUnlocalizedName()); - GameRegistry.registerBlock(dummy_port_fluidtank, dummy_port_fluidtank.getUnlocalizedName()); GameRegistry.registerBlock(dummy_block_refinery, dummy_block_refinery.getUnlocalizedName()); GameRegistry.registerBlock(dummy_port_refinery, dummy_port_refinery.getUnlocalizedName()); GameRegistry.registerBlock(dummy_block_turbofan, dummy_block_turbofan.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/blocks/machine/DummyBlockFluidTank.java b/src/main/java/com/hbm/blocks/machine/DummyBlockFluidTank.java deleted file mode 100644 index cccb4b798..000000000 --- a/src/main/java/com/hbm/blocks/machine/DummyBlockFluidTank.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.hbm.blocks.machine; - -import java.util.Random; - -import com.hbm.blocks.ModBlocks; -import com.hbm.interfaces.IDummy; -import com.hbm.main.MainRegistry; -import com.hbm.tileentity.machine.TileEntityDummy; -import com.hbm.tileentity.machine.storage.TileEntityMachineFluidTank; - -import cpw.mods.fml.common.network.internal.FMLNetworkHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.block.Block; -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -public class DummyBlockFluidTank extends DummyOldBase { - - public DummyBlockFluidTank(Material p_i45386_1_, boolean port) { - super(p_i45386_1_, port); - } - - @Override - @SideOnly(Side.CLIENT) - public Item getItem(World world, int x, int y, int z) - { - return Item.getItemFromBlock(ModBlocks.machine_fluidtank); - } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - if(world.isRemote) - { - return true; - } else if(!player.isSneaking()) - { - TileEntity te = world.getTileEntity(x, y, z); - if(te != null && te instanceof TileEntityDummy) { - int a = ((TileEntityDummy)te).targetX; - int b = ((TileEntityDummy)te).targetY; - int c = ((TileEntityDummy)te).targetZ; - - TileEntityMachineFluidTank entity = (TileEntityMachineFluidTank) world.getTileEntity(a, b, c); - if(entity != null) - { - FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_machine_fluidtank, world, a, b, c); - } - } - return true; - } else { - return false; - } - } -} diff --git a/src/main/java/com/hbm/blocks/machine/DummyBlockMachine.java b/src/main/java/com/hbm/blocks/machine/DummyBlockMachine.java index 20397318b..5eb0fbfd0 100644 --- a/src/main/java/com/hbm/blocks/machine/DummyBlockMachine.java +++ b/src/main/java/com/hbm/blocks/machine/DummyBlockMachine.java @@ -1,8 +1,5 @@ package com.hbm.blocks.machine; -import java.util.Random; - -import com.hbm.interfaces.IDummy; import com.hbm.main.MainRegistry; import com.hbm.tileentity.machine.TileEntityDummy; @@ -10,7 +7,6 @@ import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; -import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -52,47 +48,42 @@ public class DummyBlockMachine extends DummyOldBase { return this; } - @Override + @Override @SideOnly(Side.CLIENT) - public Item getItem(World world, int x, int y, int z) - { - return Item.getItemFromBlock(drop); - } - + public Item getItem(World world, int x, int y, int z) { + return Item.getItemFromBlock(drop); + } + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - if(world.isRemote) - { + if(world.isRemote) { return true; - } else if(!player.isSneaking()) - { - TileEntity te = world.getTileEntity(x, y, z); - if(te != null && te instanceof TileEntityDummy) { - int a = ((TileEntityDummy)te).targetX; - int b = ((TileEntityDummy)te).targetY; - int c = ((TileEntityDummy)te).targetZ; - - if(te != null) - { - FMLNetworkHandler.openGui(player, MainRegistry.instance, id, world, a, b, c); - } - } + } else if(!player.isSneaking()) { + TileEntity te = world.getTileEntity(x, y, z); + if(te != null && te instanceof TileEntityDummy) { + int a = ((TileEntityDummy) te).targetX; + int b = ((TileEntityDummy) te).targetY; + int c = ((TileEntityDummy) te).targetZ; + + if(te != null) { + FMLNetworkHandler.openGui(player, MainRegistry.instance, id, world, a, b, c); + } + } return true; } else { return false; } } - + @Override - public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) - { - this.setBlockBounds(oX, oY, oZ, dX, dY, dZ); - } - + public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) { + this.setBlockBounds(oX, oY, oZ, dX, dY, dZ); + } + @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { - - this.setBlockBounds(oX, oY, oZ, dX, dY, dZ); + + this.setBlockBounds(oX, oY, oZ, dX, dY, dZ); return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ); } } diff --git a/src/main/java/com/hbm/blocks/machine/DummyOldBase.java b/src/main/java/com/hbm/blocks/machine/DummyOldBase.java index 46989269b..4d5c183fd 100644 --- a/src/main/java/com/hbm/blocks/machine/DummyOldBase.java +++ b/src/main/java/com/hbm/blocks/machine/DummyOldBase.java @@ -3,6 +3,7 @@ package com.hbm.blocks.machine; import java.util.Random; import com.hbm.interfaces.IDummy; +import com.hbm.interfaces.IMultiblock; import com.hbm.inventory.fluid.FluidType; import com.hbm.tileentity.machine.TileEntityDummy; @@ -41,7 +42,7 @@ public abstract class DummyOldBase extends BlockContainer implements IDummy, IEn int b = ((TileEntityDummy) te).targetY; int c = ((TileEntityDummy) te).targetZ; - if(!world.isRemote) + if(!world.isRemote && world.getBlock(a, b, c) instanceof IMultiblock) world.func_147480_a(a, b, c, true); } } diff --git a/src/main/java/com/hbm/blocks/machine/MachineCombustionEngine.java b/src/main/java/com/hbm/blocks/machine/MachineCombustionEngine.java index d1ce8604b..162841266 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineCombustionEngine.java +++ b/src/main/java/com/hbm/blocks/machine/MachineCombustionEngine.java @@ -3,7 +3,6 @@ package com.hbm.blocks.machine; import com.hbm.blocks.BlockDummyable; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.TileEntityMachineCombustionEngine; -import com.hbm.util.fauxpointtwelve.DirPos; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/main/java/com/hbm/blocks/machine/MachineFluidTank.java b/src/main/java/com/hbm/blocks/machine/MachineFluidTank.java index 994097ec3..718af0599 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineFluidTank.java +++ b/src/main/java/com/hbm/blocks/machine/MachineFluidTank.java @@ -2,343 +2,64 @@ package com.hbm.blocks.machine; import java.util.ArrayList; import java.util.List; -import java.util.Random; +import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.IPersistentInfoProvider; -import com.hbm.blocks.ModBlocks; -import com.hbm.handler.MultiblockHandler; -import com.hbm.interfaces.IMultiblock; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; -import com.hbm.main.MainRegistry; import com.hbm.tileentity.IPersistentNBT; -import com.hbm.tileentity.machine.TileEntityDummy; +import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.storage.TileEntityMachineFluidTank; import com.hbm.util.I18nUtil; -import cpw.mods.fml.common.network.internal.FMLNetworkHandler; -import net.minecraft.block.Block; -import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.ISidedInventory; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.stats.StatList; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.MathHelper; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; -public class MachineFluidTank extends BlockContainer implements IMultiblock, IPersistentInfoProvider { +public class MachineFluidTank extends BlockDummyable implements IPersistentInfoProvider { - public MachineFluidTank(Material p_i45386_1_) { - super(p_i45386_1_); + public MachineFluidTank(Material mat) { + super(mat); } @Override - public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { - return new TileEntityMachineFluidTank(); + public TileEntity createNewTileEntity(World world, int meta) { + if(meta >= 12) + return new TileEntityMachineFluidTank(); + return new TileEntityProxyCombo().fluid(); } @Override - public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { - return Item.getItemFromBlock(ModBlocks.machine_fluidtank); + public int[] getDimensions() { + return new int[] {2, 0, 1, 1, 2, 2}; } @Override - public int getRenderType() { - return -1; - } - - @Override - public boolean isOpaqueCube() { - return false; - } - - @Override - public boolean renderAsNormalBlock() { - return false; + public int getOffset() { + return 1; } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - if(world.isRemote) - { - return true; - } else if(!player.isSneaking()) - { - TileEntityMachineFluidTank entity = (TileEntityMachineFluidTank) world.getTileEntity(x, y, z); - if(entity != null) - { - FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_machine_fluidtank, world, x, y, z); - } - return true; - } else { - return false; - } + return this.standardOpenBehavior(world, x, y, z, player, 0); } @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { - int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) { + super.fillSpace(world, x, y, z, dir, o); - ItemStack drop = itemStack.copy(); - drop.stackSize = 1; + ForgeDirection rot = dir.getRotation(ForgeDirection.UP); - if (i == 0) { - world.setBlockMetadataWithNotify(x, y, z, 5, 2); - if(MultiblockHandler.checkSpace(world, x, y, z, MultiblockHandler.fluidTankDimensionEW)) { - MultiblockHandler.fillUp(world, x, y, z, MultiblockHandler.fluidTankDimensionEW, ModBlocks.dummy_block_fluidtank); - - // - DummyBlockFluidTank.safeBreak = true; - world.setBlock(x + 1, y, z + 1, ModBlocks.dummy_port_fluidtank); - TileEntity te = world.getTileEntity(x + 1, y, z + 1); - if(te instanceof TileEntityDummy) { - TileEntityDummy dummy = (TileEntityDummy)te; - dummy.targetX = x; - dummy.targetY = y; - dummy.targetZ = z; - } - world.setBlock(x + 1, y, z - 1, ModBlocks.dummy_port_fluidtank); - TileEntity te1 = world.getTileEntity(x + 1, y, z - 1); - if(te1 instanceof TileEntityDummy) { - TileEntityDummy dummy = (TileEntityDummy)te1; - dummy.targetX = x; - dummy.targetY = y; - dummy.targetZ = z; - } - world.setBlock(x - 1, y, z + 1, ModBlocks.dummy_port_fluidtank); - TileEntity te2 = world.getTileEntity(x - 1, y, z + 1); - if(te2 instanceof TileEntityDummy) { - TileEntityDummy dummy = (TileEntityDummy)te2; - dummy.targetX = x; - dummy.targetY = y; - dummy.targetZ = z; - } - world.setBlock(x - 1, y, z - 1, ModBlocks.dummy_port_fluidtank); - TileEntity te3 = world.getTileEntity(x - 1, y, z - 1); - if(te3 instanceof TileEntityDummy) { - TileEntityDummy dummy = (TileEntityDummy)te3; - dummy.targetX = x; - dummy.targetY = y; - dummy.targetZ = z; - } - DummyBlockFluidTank.safeBreak = false; - // - - } else { - this.dropBlockAsItem(world, x, y, z, drop); - world.func_147480_a(x, y, z, false); - } - } - if (i == 1) { - world.setBlockMetadataWithNotify(x, y, z, 3, 2); - if(MultiblockHandler.checkSpace(world, x, y, z, MultiblockHandler.fluidTankDimensionNS)) { - MultiblockHandler.fillUp(world, x, y, z, MultiblockHandler.fluidTankDimensionNS, ModBlocks.dummy_block_fluidtank); - - // - DummyBlockFluidTank.safeBreak = true; - world.setBlock(x + 1, y, z + 1, ModBlocks.dummy_port_fluidtank); - TileEntity te = world.getTileEntity(x + 1, y, z + 1); - if(te instanceof TileEntityDummy) { - TileEntityDummy dummy = (TileEntityDummy)te; - dummy.targetX = x; - dummy.targetY = y; - dummy.targetZ = z; - } - world.setBlock(x + 1, y, z - 1, ModBlocks.dummy_port_fluidtank); - TileEntity te1 = world.getTileEntity(x + 1, y, z - 1); - if(te1 instanceof TileEntityDummy) { - TileEntityDummy dummy = (TileEntityDummy)te1; - dummy.targetX = x; - dummy.targetY = y; - dummy.targetZ = z; - } - world.setBlock(x - 1, y, z + 1, ModBlocks.dummy_port_fluidtank); - TileEntity te2 = world.getTileEntity(x - 1, y, z + 1); - if(te2 instanceof TileEntityDummy) { - TileEntityDummy dummy = (TileEntityDummy)te2; - dummy.targetX = x; - dummy.targetY = y; - dummy.targetZ = z; - } - world.setBlock(x - 1, y, z - 1, ModBlocks.dummy_port_fluidtank); - TileEntity te3 = world.getTileEntity(x - 1, y, z - 1); - if(te3 instanceof TileEntityDummy) { - TileEntityDummy dummy = (TileEntityDummy)te3; - dummy.targetX = x; - dummy.targetY = y; - dummy.targetZ = z; - } - DummyBlockFluidTank.safeBreak = false; - // - - } else { - this.dropBlockAsItem(world, x, y, z, drop); - world.func_147480_a(x, y, z, false); - } - } - if (i == 2) { - world.setBlockMetadataWithNotify(x, y, z, 4, 2); - if(MultiblockHandler.checkSpace(world, x, y, z, MultiblockHandler.fluidTankDimensionEW)) { - MultiblockHandler.fillUp(world, x, y, z, MultiblockHandler.fluidTankDimensionEW, ModBlocks.dummy_block_fluidtank); - - // - DummyBlockFluidTank.safeBreak = true; - world.setBlock(x + 1, y, z + 1, ModBlocks.dummy_port_fluidtank); - TileEntity te = world.getTileEntity(x + 1, y, z + 1); - if(te instanceof TileEntityDummy) { - TileEntityDummy dummy = (TileEntityDummy)te; - dummy.targetX = x; - dummy.targetY = y; - dummy.targetZ = z; - } - world.setBlock(x + 1, y, z - 1, ModBlocks.dummy_port_fluidtank); - TileEntity te1 = world.getTileEntity(x + 1, y, z - 1); - if(te1 instanceof TileEntityDummy) { - TileEntityDummy dummy = (TileEntityDummy)te1; - dummy.targetX = x; - dummy.targetY = y; - dummy.targetZ = z; - } - world.setBlock(x - 1, y, z + 1, ModBlocks.dummy_port_fluidtank); - TileEntity te2 = world.getTileEntity(x - 1, y, z + 1); - if(te2 instanceof TileEntityDummy) { - TileEntityDummy dummy = (TileEntityDummy)te2; - dummy.targetX = x; - dummy.targetY = y; - dummy.targetZ = z; - } - world.setBlock(x - 1, y, z - 1, ModBlocks.dummy_port_fluidtank); - TileEntity te3 = world.getTileEntity(x - 1, y, z - 1); - if(te3 instanceof TileEntityDummy) { - TileEntityDummy dummy = (TileEntityDummy)te3; - dummy.targetX = x; - dummy.targetY = y; - dummy.targetZ = z; - } - DummyBlockFluidTank.safeBreak = false; - // - - } else { - this.dropBlockAsItem(world, x, y, z, drop); - world.func_147480_a(x, y, z, false); - } - } - if (i == 3) { - world.setBlockMetadataWithNotify(x, y, z, 2, 2); - if(MultiblockHandler.checkSpace(world, x, y, z, MultiblockHandler.fluidTankDimensionNS)) { - MultiblockHandler.fillUp(world, x, y, z, MultiblockHandler.fluidTankDimensionNS, ModBlocks.dummy_block_fluidtank); - - // - DummyBlockFluidTank.safeBreak = true; - world.setBlock(x + 1, y, z + 1, ModBlocks.dummy_port_fluidtank); - TileEntity te = world.getTileEntity(x + 1, y, z + 1); - if(te instanceof TileEntityDummy) { - TileEntityDummy dummy = (TileEntityDummy)te; - dummy.targetX = x; - dummy.targetY = y; - dummy.targetZ = z; - } - world.setBlock(x + 1, y, z - 1, ModBlocks.dummy_port_fluidtank); - TileEntity te1 = world.getTileEntity(x + 1, y, z - 1); - if(te1 instanceof TileEntityDummy) { - TileEntityDummy dummy = (TileEntityDummy)te1; - dummy.targetX = x; - dummy.targetY = y; - dummy.targetZ = z; - } - world.setBlock(x - 1, y, z + 1, ModBlocks.dummy_port_fluidtank); - TileEntity te2 = world.getTileEntity(x - 1, y, z + 1); - if(te2 instanceof TileEntityDummy) { - TileEntityDummy dummy = (TileEntityDummy)te2; - dummy.targetX = x; - dummy.targetY = y; - dummy.targetZ = z; - } - world.setBlock(x - 1, y, z - 1, ModBlocks.dummy_port_fluidtank); - TileEntity te3 = world.getTileEntity(x - 1, y, z - 1); - if(te3 instanceof TileEntityDummy) { - TileEntityDummy dummy = (TileEntityDummy)te3; - dummy.targetX = x; - dummy.targetY = y; - dummy.targetZ = z; - } - DummyBlockFluidTank.safeBreak = false; - // - - } else { - this.dropBlockAsItem(world, x, y, z, drop); - world.func_147480_a(x, y, z, false); - } - } - - IPersistentNBT.restoreData(world, x, y, z, itemStack); - } - - private final Random field_149933_a = new Random(); - private static boolean keepInventory; - - @Override - public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) - { - if (!keepInventory) - { - ISidedInventory tileentityfurnace = (ISidedInventory)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); - - if (tileentityfurnace != null) - { - for (int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) - { - ItemStack itemstack = tileentityfurnace.getStackInSlot(i1); - - if (itemstack != null) - { - float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F; - float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; - float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; - - while (itemstack.stackSize > 0) - { - int j1 = this.field_149933_a.nextInt(21) + 10; - - if (j1 > itemstack.stackSize) - { - j1 = itemstack.stackSize; - } - - itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); - - if (itemstack.hasTagCompound()) - { - entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); - } - - float f3 = 0.05F; - entityitem.motionX = (float)this.field_149933_a.nextGaussian() * f3; - entityitem.motionY = (float)this.field_149933_a.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)this.field_149933_a.nextGaussian() * f3; - p_149749_1_.spawnEntityInWorld(entityitem); - } - } - } - - p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_); - } - } - - super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); - } - - @Override - public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { - return IPersistentNBT.getDrops(world, x, y, z, this); + this.makeExtra(world, x + rot.offsetX, y, z + rot.offsetZ); + this.makeExtra(world, x - rot.offsetX, y, z - rot.offsetZ); + this.makeExtra(world, x - dir.offsetX + rot.offsetX, y, z - dir.offsetZ + rot.offsetZ); + this.makeExtra(world, x - dir.offsetX - rot.offsetX, y, z - dir.offsetZ - rot.offsetZ); } @Override @@ -351,9 +72,11 @@ public class MachineFluidTank extends BlockContainer implements IMultiblock, IPe } } - /* - * Called after the block and TE are already gone, so this method is of no use to us. - */ + @Override + public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { + return IPersistentNBT.getDrops(world, x, y, z, this); + } + @Override public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) { player.addStat(StatList.mineBlockStatArray[getIdFromBlock(this)], 1); diff --git a/src/main/java/com/hbm/blocks/network/BlockCablePaintable.java b/src/main/java/com/hbm/blocks/network/BlockCablePaintable.java new file mode 100644 index 000000000..334654a4d --- /dev/null +++ b/src/main/java/com/hbm/blocks/network/BlockCablePaintable.java @@ -0,0 +1,173 @@ +package com.hbm.blocks.network; + +import com.hbm.blocks.IBlockMultiPass; +import com.hbm.lib.RefStrings; +import com.hbm.render.block.RenderBlockMultipass; +import com.hbm.tileentity.network.TileEntityCableBaseNT; + +import api.hbm.block.IToolable; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockCablePaintable extends BlockContainer implements IToolable, IBlockMultiPass { + + @SideOnly(Side.CLIENT) protected IIcon overlay; + + public BlockCablePaintable() { + super(Material.iron); + } + + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileEntityCablePaintable(); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister reg) { + this.blockIcon = reg.registerIcon(RefStrings.MODID + ":red_cable_base"); + this.overlay = reg.registerIcon(RefStrings.MODID + ":red_cable_overlay"); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { + TileEntity tile = world.getTileEntity(x, y, z); + + if(tile instanceof TileEntityCablePaintable) { + TileEntityCablePaintable pipe = (TileEntityCablePaintable) tile; + + if(pipe.block != null) { + if(RenderBlockMultipass.currentPass == 1) { + return this.overlay; + } else { + return pipe.block.getIcon(side, pipe.meta); + } + } + } + + return RenderBlockMultipass.currentPass == 1 ? this.overlay : this.blockIcon; + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float fX, float fY, float fZ) { + + ItemStack stack = player.getHeldItem(); + + if(stack != null && stack.getItem() instanceof ItemBlock) { + ItemBlock ib = (ItemBlock) stack.getItem(); + Block block = ib.field_150939_a; + + if(block.renderAsNormalBlock() && block != this) { + + TileEntity tile = world.getTileEntity(x, y, z); + + if(tile instanceof TileEntityCablePaintable) { + TileEntityCablePaintable pipe = (TileEntityCablePaintable) tile; + + if(pipe.block == null) { + pipe.block = block; + pipe.meta = stack.getItemDamage() & 15; + world.markBlockForUpdate(x, y, z); + pipe.markDirty(); + return true; + } + } + } + } + + return super.onBlockActivated(world, x, y, z, player, side, fX, fY, fZ); + } + + @Override + public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) { + + if(tool != ToolType.SCREWDRIVER) return false; + + TileEntity tile = world.getTileEntity(x, y, z); + + if(tile instanceof TileEntityCablePaintable) { + TileEntityCablePaintable pipe = (TileEntityCablePaintable) tile; + + if(pipe.block != null) { + pipe.block = null; + world.markBlockForUpdate(x, y, z); + pipe.markDirty(); + return true; + } + } + + return false; + } + + @Override + public int getPasses() { + return 2; + } + + @Override + public int getRenderType(){ + return IBlockMultiPass.getRenderType(); + } + + public static class TileEntityCablePaintable extends TileEntityCableBaseNT { + + private Block block; + private int meta; + private Block lastBlock; + private int lastMeta; + + @Override + public void updateEntity() { + super.updateEntity(); + + if(worldObj.isRemote && (lastBlock != block || lastMeta != meta)) { + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + lastBlock = block; + lastMeta = meta; + } + } + + @Override + public Packet getDescriptionPacket() { + NBTTagCompound nbt = new NBTTagCompound(); + this.writeToNBT(nbt); + return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt); + } + + @Override + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { + this.readFromNBT(pkt.func_148857_g()); + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + int id = nbt.getInteger("block"); + this.block = id == 0 ? null : Block.getBlockById(id); + this.meta = nbt.getInteger("meta"); + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + if(block != null) nbt.setInteger("block", Block.getIdFromBlock(block)); + nbt.setInteger("meta", meta); + } + } +} diff --git a/src/main/java/com/hbm/handler/GUIHandler.java b/src/main/java/com/hbm/handler/GUIHandler.java index 6d2184ea1..c33b85512 100644 --- a/src/main/java/com/hbm/handler/GUIHandler.java +++ b/src/main/java/com/hbm/handler/GUIHandler.java @@ -344,13 +344,6 @@ public class GUIHandler implements IGuiHandler { return null; } - case ModBlocks.guiID_machine_fluidtank: { - if(entity instanceof TileEntityMachineFluidTank) { - return new ContainerMachineFluidTank(player.inventory, (TileEntityMachineFluidTank) entity); - } - return null; - } - case ModBlocks.guiID_machine_turbofan: { if(entity instanceof TileEntityMachineTurbofan) { return new ContainerMachineTurbofan(player.inventory, (TileEntityMachineTurbofan) entity); @@ -1141,13 +1134,6 @@ public class GUIHandler implements IGuiHandler { return null; } - case ModBlocks.guiID_machine_fluidtank: { - if(entity instanceof TileEntityMachineFluidTank) { - return new GUIMachineFluidTank(player.inventory, (TileEntityMachineFluidTank) entity); - } - return null; - } - case ModBlocks.guiID_machine_turbofan: { if(entity instanceof TileEntityMachineTurbofan) { return new GUIMachineTurbofan(player.inventory, (TileEntityMachineTurbofan) entity); diff --git a/src/main/java/com/hbm/items/special/ItemDrop.java b/src/main/java/com/hbm/items/special/ItemDrop.java index ff199b528..14e921edc 100644 --- a/src/main/java/com/hbm/items/special/ItemDrop.java +++ b/src/main/java/com/hbm/items/special/ItemDrop.java @@ -13,9 +13,6 @@ import com.hbm.entity.effect.EntityRagingVortex; import com.hbm.entity.effect.EntityVortex; import com.hbm.entity.logic.EntityNukeExplosionMK3; import com.hbm.explosion.ExplosionChaos; -import com.hbm.explosion.ExplosionLarge; -import com.hbm.explosion.ExplosionNT; -import com.hbm.explosion.ExplosionNT.ExAttrib; import com.hbm.explosion.vanillant.ExplosionVNT; import com.hbm.interfaces.IBomb; import com.hbm.items.ModItems; @@ -100,76 +97,61 @@ public class ItemDrop extends Item { if(!ex.isDead) { entityItem.worldObj.playSoundEffect(entityItem.posX, entityItem.posY, entityItem.posZ, "random.explode", 100.0F, entityItem.worldObj.rand.nextFloat() * 0.1F + 0.9F); entityItem.worldObj.spawnEntityInWorld(ex); - - EntityCloudFleija cloud = new EntityCloudFleija(entityItem.worldObj, BombConfig.aSchrabRadius); - cloud.posX = entityItem.posX; - cloud.posY = entityItem.posY; - cloud.posZ = entityItem.posZ; - entityItem.worldObj.spawnEntityInWorld(cloud); + + EntityCloudFleija cloud = new EntityCloudFleija(entityItem.worldObj, BombConfig.aSchrabRadius); + cloud.posX = entityItem.posX; + cloud.posY = entityItem.posY; + cloud.posZ = entityItem.posZ; + entityItem.worldObj.spawnEntityInWorld(cloud); } } } if (stack.getItem() != null && stack.getItem() == ModItems.singularity && WeaponConfig.dropSing) { if (!entityItem.worldObj.isRemote) { - EntityVortex bl = new EntityVortex(entityItem.worldObj, 1.5F); - bl.posX = entityItem.posX ; - bl.posY = entityItem.posY ; - bl.posZ = entityItem.posZ ; - entityItem.worldObj.spawnEntityInWorld(bl); + EntityVortex bl = new EntityVortex(entityItem.worldObj, 1.5F); + bl.posX = entityItem.posX; + bl.posY = entityItem.posY; + bl.posZ = entityItem.posZ; + entityItem.worldObj.spawnEntityInWorld(bl); } } if (stack.getItem() != null && stack.getItem() == ModItems.singularity_counter_resonant && WeaponConfig.dropSing) { if (!entityItem.worldObj.isRemote) { - EntityVortex bl = new EntityVortex(entityItem.worldObj, 2.5F); - bl.posX = entityItem.posX ; - bl.posY = entityItem.posY ; - bl.posZ = entityItem.posZ ; - entityItem.worldObj.spawnEntityInWorld(bl); + EntityVortex bl = new EntityVortex(entityItem.worldObj, 2.5F); + bl.posX = entityItem.posX; + bl.posY = entityItem.posY; + bl.posZ = entityItem.posZ; + entityItem.worldObj.spawnEntityInWorld(bl); } } if (stack.getItem() != null && stack.getItem() == ModItems.singularity_super_heated && WeaponConfig.dropSing) { if (!entityItem.worldObj.isRemote) { - EntityVortex bl = new EntityVortex(entityItem.worldObj, 2.5F); - bl.posX = entityItem.posX ; - bl.posY = entityItem.posY ; - bl.posZ = entityItem.posZ ; - entityItem.worldObj.spawnEntityInWorld(bl); + EntityVortex bl = new EntityVortex(entityItem.worldObj, 2.5F); + bl.posX = entityItem.posX; + bl.posY = entityItem.posY; + bl.posZ = entityItem.posZ; + entityItem.worldObj.spawnEntityInWorld(bl); } } if (stack.getItem() != null && stack.getItem() == ModItems.black_hole && WeaponConfig.dropSing) { if (!entityItem.worldObj.isRemote) { - /*entityItem.worldObj.playSoundEffect(entityItem.posX, entityItem.posY, entityItem.posZ, - "random.explode", 100.0f, entityItem.worldObj.rand.nextFloat() * 0.1F + 0.9F); - - EntityNukeExplosionAdvanced entity = new EntityNukeExplosionAdvanced(entityItem.worldObj); - entity.posX = entityItem.posX; - entity.posY = entityItem.posY; - entity.posZ = entityItem.posZ; - entity.destructionRange = MainRegistry.aSchrabRadius * 3; - entity.speed = 25; - entity.coefficient = 0.01F; - entity.coefficient2 = 0.01F; - entity.waste = false; - - entityItem.worldObj.spawnEntityInWorld(entity);*/ - - EntityBlackHole bl = new EntityBlackHole(entityItem.worldObj, 1.5F); - bl.posX = entityItem.posX ; - bl.posY = entityItem.posY ; - bl.posZ = entityItem.posZ ; - entityItem.worldObj.spawnEntityInWorld(bl); + EntityBlackHole bl = new EntityBlackHole(entityItem.worldObj, 1.5F); + bl.posX = entityItem.posX; + bl.posY = entityItem.posY; + bl.posZ = entityItem.posZ; + entityItem.worldObj.spawnEntityInWorld(bl); } } if (stack.getItem() != null && stack.getItem() == ModItems.singularity_spark && WeaponConfig.dropSing) { if (!entityItem.worldObj.isRemote) { - EntityRagingVortex bl = new EntityRagingVortex(entityItem.worldObj, 3.5F); - bl.posX = entityItem.posX ; - bl.posY = entityItem.posY ; - bl.posZ = entityItem.posZ ; - entityItem.worldObj.spawnEntityInWorld(bl); + EntityRagingVortex bl = new EntityRagingVortex(entityItem.worldObj, 3.5F); + bl.posX = entityItem.posX; + bl.posY = entityItem.posY; + bl.posZ = entityItem.posZ; + entityItem.worldObj.spawnEntityInWorld(bl); } } if (stack.getItem() != null && stack.getItem() == ModItems.crystal_xen && WeaponConfig.dropCrys) { diff --git a/src/main/java/com/hbm/lib/Library.java b/src/main/java/com/hbm/lib/Library.java index 68cbbbc0a..2c17eccbe 100644 --- a/src/main/java/com/hbm/lib/Library.java +++ b/src/main/java/com/hbm/lib/Library.java @@ -165,7 +165,6 @@ public class Library { return true; if((tileentity != null && (tileentity instanceof IFluidAcceptor || tileentity instanceof IFluidSource)) || - world.getBlock(x, y, z) == ModBlocks.dummy_port_fluidtank || world.getBlock(x, y, z) == ModBlocks.dummy_port_refinery || world.getBlock(x, y, z) == ModBlocks.dummy_port_turbofan || world.getBlock(x, y, z) == ModBlocks.reactor_hatch || @@ -394,11 +393,6 @@ public class Library { Block block = worldObj.getBlock(x, y, z); TileEntity tileentity = worldObj.getTileEntity(x, y, z); - //Fluid Tank - if(block == ModBlocks.dummy_port_fluidtank) - { - tileentity = worldObj.getTileEntity(((TileEntityDummy)worldObj.getTileEntity(x, y, z)).targetX, ((TileEntityDummy)worldObj.getTileEntity(x, y, z)).targetY, ((TileEntityDummy)worldObj.getTileEntity(x, y, z)).targetZ); - } //Refinery if(block == ModBlocks.dummy_port_refinery) { diff --git a/src/main/java/com/hbm/main/CraftingManager.java b/src/main/java/com/hbm/main/CraftingManager.java index 5796739df..23a6b1364 100644 --- a/src/main/java/com/hbm/main/CraftingManager.java +++ b/src/main/java/com/hbm/main/CraftingManager.java @@ -263,7 +263,8 @@ public class CraftingManager { addRecipeAuto(new ItemStack(Item.getItemFromBlock(ModBlocks.machine_nuke_furnace_off), 1), new Object[] { "SSS", "LFL", "CCC", 'S', STEEL.plate(), 'C', ModItems.board_copper, 'L', PB.plate(), 'F', Item.getItemFromBlock(Blocks.furnace) }); addRecipeAuto(new ItemStack(Item.getItemFromBlock(ModBlocks.machine_electric_furnace_off), 1), new Object[] { "BBB", "WFW", "RRR", 'B', BE.ingot(), 'R', ModItems.coil_tungsten, 'W', ModItems.board_copper, 'F', Item.getItemFromBlock(Blocks.furnace) }); addRecipeAuto(new ItemStack(ModBlocks.machine_arc_furnace_off, 1), new Object[] { "ITI", "PFP", "ITI", 'I', W.ingot(), 'T', ModBlocks.machine_transformer, 'P', ModItems.board_copper, 'F', Blocks.furnace }); - addRecipeAuto(new ItemStack(Item.getItemFromBlock(ModBlocks.red_wire_coated), 16), new Object[] { "WRW", "RIR", "WRW", 'W', ModItems.plate_polymer, 'I', MINGRADE.ingot(), 'R', ModItems.wire_red_copper }); + addRecipeAuto(new ItemStack(ModBlocks.red_wire_coated, 16), new Object[] { "WRW", "RIR", "WRW", 'W', ModItems.plate_polymer, 'I', MINGRADE.ingot(), 'R', ModItems.wire_red_copper }); + addRecipeAuto(new ItemStack(ModBlocks.red_cable_paintable, 16), new Object[] { "WRW", "RIR", "WRW", 'W', STEEL.plate(), 'I', MINGRADE.ingot(), 'R', ModItems.wire_red_copper }); addRecipeAuto(new ItemStack(ModBlocks.cable_switch, 1), new Object[] { "S", "W", 'S', Blocks.lever, 'W', ModBlocks.red_wire_coated }); addRecipeAuto(new ItemStack(ModBlocks.cable_detector, 1), new Object[] { "S", "W", 'S', REDSTONE.dust(), 'W', ModBlocks.red_wire_coated }); addRecipeAuto(new ItemStack(ModBlocks.cable_diode, 1), new Object[] { " Q ", "CAC", " Q ", 'Q', NETHERQUARTZ.gem(), 'C', ModBlocks.red_cable, 'A', AL.ingot() }); diff --git a/src/main/java/com/hbm/main/MainRegistry.java b/src/main/java/com/hbm/main/MainRegistry.java index 82541e64f..571de590c 100644 --- a/src/main/java/com/hbm/main/MainRegistry.java +++ b/src/main/java/com/hbm/main/MainRegistry.java @@ -989,6 +989,8 @@ public class MainRegistry { ignoreMappings.add("hbm:tile.dummy_block_radgen"); ignoreMappings.add("hbm:tile.dummy_port_radgen"); ignoreMappings.add("hbm:tile.test_conductor"); + ignoreMappings.add("hbm:tile.dummy_block_fluidtank"); + ignoreMappings.add("hbm:tile.dummy_port_fluidtank"); /// REMAP /// remapItems.put("hbm:item.gadget_explosive8", ModItems.early_explosive_lenses); diff --git a/src/main/java/com/hbm/main/NEIConfig.java b/src/main/java/com/hbm/main/NEIConfig.java index 3c5c2525f..330a0a82b 100644 --- a/src/main/java/com/hbm/main/NEIConfig.java +++ b/src/main/java/com/hbm/main/NEIConfig.java @@ -96,7 +96,6 @@ public class NEIConfig implements IConfigureNEI { } API.hideItem(new ItemStack(ModBlocks.dummy_block_assembler)); API.hideItem(new ItemStack(ModBlocks.dummy_block_drill)); - API.hideItem(new ItemStack(ModBlocks.dummy_block_fluidtank)); API.hideItem(new ItemStack(ModBlocks.dummy_block_refinery)); API.hideItem(new ItemStack(ModBlocks.dummy_block_turbofan)); API.hideItem(new ItemStack(ModBlocks.dummy_block_ams_base)); @@ -108,7 +107,6 @@ public class NEIConfig implements IConfigureNEI { API.hideItem(new ItemStack(ModBlocks.dummy_block_puf6)); API.hideItem(new ItemStack(ModBlocks.dummy_port_assembler)); API.hideItem(new ItemStack(ModBlocks.dummy_port_drill)); - API.hideItem(new ItemStack(ModBlocks.dummy_port_fluidtank)); API.hideItem(new ItemStack(ModBlocks.dummy_port_refinery)); API.hideItem(new ItemStack(ModBlocks.dummy_port_turbofan)); API.hideItem(new ItemStack(ModBlocks.dummy_port_ams_base)); diff --git a/src/main/java/com/hbm/render/tileentity/RenderFluidTank.java b/src/main/java/com/hbm/render/tileentity/RenderFluidTank.java index 63f5accea..ee6b6f779 100644 --- a/src/main/java/com/hbm/render/tileentity/RenderFluidTank.java +++ b/src/main/java/com/hbm/render/tileentity/RenderFluidTank.java @@ -31,7 +31,7 @@ public class RenderFluidTank extends TileEntitySpecialRenderer implements IItemR GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); - switch(tileEntity.getBlockMetadata()) { + switch(tileEntity.getBlockMetadata() - 10) { case 2: GL11.glRotatef(270, 0F, 1F, 0F); break; case 4: GL11.glRotatef(0, 0F, 1F, 0F); break; case 3: GL11.glRotatef(90, 0F, 1F, 0F); break; diff --git a/src/main/java/com/hbm/tileentity/TileMappings.java b/src/main/java/com/hbm/tileentity/TileMappings.java index 98e3b1246..4f2fed397 100644 --- a/src/main/java/com/hbm/tileentity/TileMappings.java +++ b/src/main/java/com/hbm/tileentity/TileMappings.java @@ -10,6 +10,7 @@ import com.hbm.blocks.generic.BlockEmitter.TileEntityEmitter; import com.hbm.blocks.generic.BlockLoot.TileEntityLoot; import com.hbm.blocks.generic.BlockMotherOfAllOres.TileEntityRandomOre; import com.hbm.blocks.generic.BlockSnowglobe.TileEntitySnowglobe; +import com.hbm.blocks.network.BlockCablePaintable.TileEntityCablePaintable; import com.hbm.blocks.network.CableDiode.TileEntityDiode; import com.hbm.blocks.network.FluidDuctGauge.TileEntityPipeGauge; import com.hbm.blocks.network.FluidDuctPaintable.TileEntityPipePaintable; @@ -173,7 +174,8 @@ public class TileMappings { put(TileEntityDemonLamp.class, "tileentity_demonlamp"); put(TileEntityStorageDrum.class, "tileentity_waste_storage_drum"); put(TileEntityDeaerator.class, "tileentity_deaerator"); - put(TileEntityCableBaseNT.class, "tileentity_ohgod"); + put(TileEntityCableBaseNT.class, "tileentity_ohgod"); // what? + put(TileEntityCablePaintable.class, "tileentity_cable_paintable"); put(TileEntityPipeBaseNT.class, "tileentity_pipe_base"); put(TileEntityPipePaintable.class, "tileentity_pipe_paintable"); put(TileEntityPipeGauge.class, "tileentity_pipe_gauge"); diff --git a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java index 6fbef0770..8217ee724 100644 --- a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java +++ b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java @@ -4,19 +4,27 @@ import java.util.ArrayList; import java.util.List; import java.util.Random; +import com.hbm.blocks.BlockDummyable; +import com.hbm.blocks.ModBlocks; +import com.hbm.explosion.vanillant.ExplosionVNT; +import com.hbm.handler.MultiblockHandlerXR; import com.hbm.interfaces.IFluidAcceptor; import com.hbm.interfaces.IFluidContainer; import com.hbm.interfaces.IFluidSource; +import com.hbm.inventory.container.ContainerMachineFluidTank; import com.hbm.inventory.fluid.FluidType; import com.hbm.inventory.fluid.trait.FT_Corrosive; import com.hbm.inventory.fluid.trait.FT_Flammable; +import com.hbm.inventory.fluid.trait.FluidTraitSimple.FT_Amat; import com.hbm.inventory.fluid.trait.FluidTraitSimple.FT_Gaseous; import com.hbm.inventory.fluid.trait.FluidTraitSimple.FT_Gaseous_ART; +import com.hbm.inventory.gui.GUIMachineFluidTank; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.lib.Library; import com.hbm.packet.AuxParticlePacketNT; import com.hbm.packet.PacketDispatcher; +import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.IOverpressurable; import com.hbm.tileentity.IPersistentNBT; import com.hbm.tileentity.TileEntityMachineBase; @@ -27,12 +35,15 @@ import api.hbm.fluid.IFluidStandardTransceiver; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityMachineFluidTank extends TileEntityMachineBase implements IFluidContainer, IFluidSource, IFluidAcceptor, IFluidStandardTransceiver, IPersistentNBT, IOverpressurable { +public class TileEntityMachineFluidTank extends TileEntityMachineBase implements IFluidContainer, IFluidSource, IFluidAcceptor, IFluidStandardTransceiver, IPersistentNBT, IOverpressurable, IGUIProvider { public FluidTank tank; public short mode = 0; @@ -44,7 +55,7 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements public TileEntityMachineFluidTank() { super(6); - tank = new FluidTank(Fluids.NONE, 256000, 0); + tank = new FluidTank(Fluids.NONE, 256000); } @Override @@ -57,33 +68,51 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements if(!worldObj.isRemote) { - age++; + //meta below 121 means that it's an old multiblock configuration + if(this.getBlockMetadata() < 12) { + //get old direction + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata()); + //remove tile from the world to prevent inventory dropping + worldObj.removeTileEntity(xCoord, yCoord, zCoord); + //use fillspace to create a new multiblock configuration + MultiblockHandlerXR.fillSpace(worldObj, xCoord, yCoord, zCoord, ((BlockDummyable) ModBlocks.machine_fluidtank).getDimensions(), ModBlocks.machine_fluidtank, dir); + //set the tile entity to the one we have now + worldObj.setTileEntity(xCoord, yCoord, zCoord, this); + //reset cached metadata + this.blockMetadata = -1; + //validate again + this.validate(); + //cancel update tick just to be sure + return; + } - if(age >= 20) - age = 0; - - tank.setFill(TileEntityBarrel.transmitFluidFairly(worldObj, tank.getTankType(), this, tank.getFill(), this.mode == 0 || this.mode == 1, this.mode == 1 || this.mode == 2, getConPos())); - - if((mode == 1 || mode == 2) && (age == 9 || age == 19)) - fillFluidInit(tank.getTankType()); - - tank.loadTank(2, 3, slots); - tank.setType(0, 1, slots); + if(!hasExploded) { + age++; + + if(age >= 20) + age = 0; + + tank.setFill(TileEntityBarrel.transmitFluidFairly(worldObj, tank.getTankType(), this, tank.getFill(), this.mode == 0 || this.mode == 1, this.mode == 1 || this.mode == 2, getConPos())); + + if((mode == 1 || mode == 2) && (age == 9 || age == 19)) + fillFluidInit(tank.getTankType()); + + tank.loadTank(2, 3, slots); + tank.setType(0, 1, slots); + } if(tank.getFill() > 0) { if(tank.getTankType().isAntimatter()) { - //worldObj.func_147480_a(xCoord, yCoord, zCoord, false); worldObj.newExplosion(null, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 5, true, false); this.hasExploded = true; this.tank.setFill(0); } if(tank.getTankType().hasTrait(FT_Corrosive.class) && tank.getTankType().getTrait(FT_Corrosive.class).isHighlyCorrosive()) { - //worldObj.func_147480_a(xCoord, yCoord, zCoord, false); this.hasExploded = true; this.tank.setFill(0); } - this.hasExploded = true; + if(this.hasExploded) { int leaking = 0; @@ -100,12 +129,12 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements } tank.unloadTank(4, 5, slots); - tank.updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId); NBTTagCompound data = new NBTTagCompound(); data.setShort("mode", mode); data.setBoolean("hasExploded", hasExploded); - this.networkPack(data, 50); + this.tank.writeToNBT(data, "t"); + this.networkPack(data, 150); } } @@ -116,9 +145,15 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements this.tank.getTankType().onFluidRelease(this, tank, amount); this.tank.setFill(Math.max(0, this.tank.getFill() - amount)); - if(tank.getTankType().hasTrait(FT_Flammable.class)) { + FluidType type = tank.getTankType(); + + if(type.hasTrait(FT_Amat.class)) { + new ExplosionVNT(worldObj, xCoord + 0.5, yCoord + 1, zCoord + 0.5, 5F).makeAmat().explode(); + + } else if(tank.getTankType().hasTrait(FT_Flammable.class)) { Random rand = worldObj.rand; ParticleUtil.spawnGasFlame(worldObj, xCoord + rand.nextDouble(), yCoord + 0.5 + rand.nextDouble(), zCoord + rand.nextDouble(), rand.nextGaussian() * 0.2, 0.1, rand.nextGaussian() * 0.2); + } else if(tank.getTankType().hasTrait(FT_Gaseous.class) || tank.getTankType().hasTrait(FT_Gaseous_ART.class)) { if(worldObj.getTotalWorldTime() % 5 == 0) { @@ -159,23 +194,36 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements public void networkUnpack(NBTTagCompound data) { this.mode = data.getShort("mode"); this.hasExploded = data.getBoolean("hasExploded"); + this.tank.readFromNBT(data, "t"); } public void handleButtonPacket(int value, int meta) { - mode = (short) ((mode + 1) % modes); - markDirty(); + this.markChanged(); } + AxisAlignedBB bb = null; + @Override public AxisAlignedBB getRenderBoundingBox() { - return TileEntity.INFINITE_EXTENT_AABB; + + if(bb == null) { + bb = AxisAlignedBB.getBoundingBox( + xCoord - 2, + yCoord, + zCoord - 2, + xCoord + 3, + yCoord + 2, + zCoord + 2 + ); + } + + return bb; } @Override @SideOnly(Side.CLIENT) - public double getMaxRenderDistanceSquared() - { + public double getMaxRenderDistanceSquared() { return 65536.0D; } @@ -302,11 +350,23 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements @Override public FluidTank[] getSendingTanks() { + if(this.hasExploded) return new FluidTank[0]; return (mode == 1 || mode == 2) ? new FluidTank[] {tank} : new FluidTank[0]; } @Override public FluidTank[] getReceivingTanks() { + if(this.hasExploded) return new FluidTank[0]; return (mode == 0 || mode == 1) ? new FluidTank[] {tank} : new FluidTank[0]; } + + @Override + public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { + return new ContainerMachineFluidTank(player.inventory, (TileEntityMachineFluidTank) world.getTileEntity(x, y, z)); + } + + @Override + public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { + return new GUIMachineFluidTank(player.inventory, (TileEntityMachineFluidTank) world.getTileEntity(x, y, z)); + } } diff --git a/src/main/resources/assets/hbm/lang/de_DE.lang b/src/main/resources/assets/hbm/lang/de_DE.lang index e4b98d28b..f1dd71a38 100644 --- a/src/main/resources/assets/hbm/lang/de_DE.lang +++ b/src/main/resources/assets/hbm/lang/de_DE.lang @@ -3928,6 +3928,7 @@ tile.reactor_inserter.name=Reaktor-Brennstoffeinlass tile.red_barrel.name=Explosives Fass tile.red_cable.name=Rotes Kupferkabel tile.red_cable_classic.name=Rotes Kupferkabel (Klassisch) +tile.red_cable_paintable.name=Geschirmtes rotes Kupferkabel (Färbbar) tile.red_connector.name=Stromverbindungsstück tile.red_pylon.name=Strommasten tile.red_pylon_large.name=Hochspannungsmasten diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index 486ebe296..69d6057eb 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -4501,6 +4501,7 @@ tile.reactor_inserter.name=Reactor Fuel Inserter tile.red_barrel.name=Explosive Barrel tile.red_cable.name=Red Copper Cable tile.red_cable_classic.name=Red Copper Cable (Classic) +tile.red_cable_paintable.name=Paintable Red Copper Cable tile.red_connector.name=Electricity Connector tile.red_pylon.name=Electricity Pole tile.red_pylon_large.name=Large Electricity Pylon diff --git a/src/main/resources/assets/hbm/textures/blocks/red_cable_base.png b/src/main/resources/assets/hbm/textures/blocks/red_cable_base.png new file mode 100644 index 0000000000000000000000000000000000000000..656672a8edecdf301ec679e636299074a5aa916c GIT binary patch literal 534 zcmV+x0_pvUP)F_GL{D^0Bi+fLIXOLJb)`Y>Jl0ySZ*JneI+aLM1w};Jh0Gx9;=lDI!5JFI3Yz$RMfKIPRuiwX5 z`*$EEz=h9MIOp)*BUKRKa)-_Hh2(k2Cr*{ImR9pB!DM5BIF8X;V~jy-O&ErA1*8yy z@z~7W{$gX7rz^X(n#~#e1z$Sn5OVgj)|we z;~M9k?uA*^t&)KxO;e^XI2{goxwSQSYgIrx=RgR&U+D6mkbw*^#$a=c|4$X?T$vN8 zwMGb0HVQ%&g>caqLXSZm9KRY}!%QOh93Ny_%8&zud1C9ztkT}