diff --git a/changelog b/changelog index 2bb086e00..6ada44f00 100644 --- a/changelog +++ b/changelog @@ -1,12 +1,15 @@ ## Added * Configs for all things pollution related - * Pollution in general can be turned off, smog can be disabeld and adjusted, different poison types can be disabled and the threshold for spawning tougher mobs can also be changed + * Pollution in general can be turned off, smog can be disabled and adjusted, different poison types can be disabled and the threshold for spawning tougher mobs can also be changed * Glyphid meat * Dropped by glyphids (duh) * Can be grilled +* Fluid valves + * come in manual and restone variants ## Changed * Glyphids now have a config for a global spawn limit, which is 50 by default, no more than this many glyphids can be created at once +* Removed the old oil and gas ducts for good ## Fixed * Fixed player extprops like the HUD or backpack toggles not saving diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index da5c00298..ef999ee12 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -780,16 +780,15 @@ public class ModBlocks { public static Block cable_detector; public static Block cable_diode; public static Block machine_detector; - public static Block oil_duct_solid; - public static Block oil_duct; - public static Block gas_duct_solid; - public static Block gas_duct; public static Block fluid_duct; public static Block fluid_duct_solid; public static Block fluid_duct_neo; public static Block fluid_duct_box; public static Block fluid_duct_paintable; public static Block fluid_duct_gauge; + public static Block fluid_duct_exhaust; + public static Block fluid_valve; + public static Block fluid_switch; public static Block radio_torch_sender; public static Block radio_torch_receiver; @@ -1930,16 +1929,15 @@ public class ModBlocks { cable_detector = new CableDetector(Material.iron).setBlockName("cable_detector").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); cable_diode = new CableDiode(Material.iron).setBlockName("cable_diode").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":cable_diode"); machine_detector = new PowerDetector(Material.iron).setBlockName("machine_detector").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_detector_off"); - oil_duct_solid = new OilDuctSolid(Material.iron).setBlockName("oil_duct_solid").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":oil_duct_solid_alt"); - oil_duct = new BlockOilDuct(Material.iron).setBlockName("oil_duct").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":oil_duct_icon_alt"); - gas_duct_solid = new GasDuctSolid(Material.iron).setBlockName("gas_duct_solid").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":gas_duct_solid"); - gas_duct = new BlockGasDuct(Material.iron).setBlockName("gas_duct").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":gas_duct_icon"); fluid_duct = new BlockFluidDuct(Material.iron).setBlockName("fluid_duct").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":fluid_duct_icon"); fluid_duct_solid = new BlockFluidDuctSolid(Material.iron).setBlockName("fluid_duct_solid").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":fluid_duct_solid"); fluid_duct_neo = new FluidDuctStandard(Material.iron).setBlockName("fluid_duct_neo").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pipe_neo"); fluid_duct_box = new FluidDuctBox(Material.iron).setBlockName("fluid_duct_box").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":fluid_duct_box"); + fluid_duct_exhaust = new FluidDuctBoxExhaust(Material.iron).setBlockName("fluid_duct_exhaust").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":fluid_duct_box"); fluid_duct_paintable = new FluidDuctPaintable().setBlockName("fluid_duct_paintable").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); fluid_duct_gauge = new FluidDuctGauge().setBlockName("fluid_duct_gauge").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); + fluid_valve = new FluidValve(Material.iron).setBlockName("fluid_valve").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); + fluid_switch = new FluidSwitch(Material.iron).setBlockName("fluid_switch").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); radio_torch_sender = new RadioTorchSender().setBlockName("radio_torch_sender").setHardness(0.1F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); radio_torch_receiver = new RadioTorchReceiver().setBlockName("radio_torch_receiver").setHardness(0.1F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); @@ -3157,16 +3155,15 @@ public class ModBlocks { GameRegistry.registerBlock(cable_detector, cable_detector.getUnlocalizedName()); GameRegistry.registerBlock(cable_diode, ItemBlockBase.class, cable_diode.getUnlocalizedName()); GameRegistry.registerBlock(machine_detector, machine_detector.getUnlocalizedName()); - GameRegistry.registerBlock(oil_duct, oil_duct.getUnlocalizedName()); - GameRegistry.registerBlock(oil_duct_solid, oil_duct_solid.getUnlocalizedName()); - GameRegistry.registerBlock(gas_duct, gas_duct.getUnlocalizedName()); - GameRegistry.registerBlock(gas_duct_solid, gas_duct_solid.getUnlocalizedName()); GameRegistry.registerBlock(fluid_duct, fluid_duct.getUnlocalizedName()); register(fluid_duct_neo); register(fluid_duct_box); + register(fluid_duct_exhaust); register(fluid_duct_paintable); register(fluid_duct_gauge); GameRegistry.registerBlock(fluid_duct_solid, fluid_duct_solid.getUnlocalizedName()); + register(fluid_valve); + register(fluid_switch); register(radio_torch_sender); register(radio_torch_receiver); diff --git a/src/main/java/com/hbm/blocks/machine/GasDuctSolid.java b/src/main/java/com/hbm/blocks/machine/GasDuctSolid.java deleted file mode 100644 index 8351015a7..000000000 --- a/src/main/java/com/hbm/blocks/machine/GasDuctSolid.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.hbm.blocks.machine; - -import com.hbm.tileentity.conductor.TileEntityGasDuctSolid; - -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -public class GasDuctSolid extends BlockContainer { - - public GasDuctSolid(Material p_i45386_1_) { - super(p_i45386_1_); - } - - @Override - public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { - return new TileEntityGasDuctSolid(); - } -} diff --git a/src/main/java/com/hbm/blocks/machine/OilDuctSolid.java b/src/main/java/com/hbm/blocks/machine/OilDuctSolid.java deleted file mode 100644 index cfec07f2d..000000000 --- a/src/main/java/com/hbm/blocks/machine/OilDuctSolid.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.hbm.blocks.machine; - -import com.hbm.tileentity.conductor.TileEntityOilDuctSolid; - -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -public class OilDuctSolid extends BlockContainer { - - public OilDuctSolid(Material p_i45386_1_) { - super(p_i45386_1_); - } - - @Override - public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { - return new TileEntityOilDuctSolid(); - } -} diff --git a/src/main/java/com/hbm/blocks/network/BlockGasDuct.java b/src/main/java/com/hbm/blocks/network/BlockGasDuct.java deleted file mode 100644 index f1b85be7d..000000000 --- a/src/main/java/com/hbm/blocks/network/BlockGasDuct.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.hbm.blocks.network; - -import com.hbm.tileentity.conductor.TileEntityGasDuct; - -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -public class BlockGasDuct extends BlockContainer { - - public BlockGasDuct(Material p_i45386_1_) { - super(p_i45386_1_); - float p = 1F/16F; - this.setBlockBounds(11 * p / 2, 11 * p / 2, 11 * p / 2, 1 - 11 * p / 2, 1 - 11 * p / 2, 1 - 11 * p / 2); - this.useNeighborBrightness = true; - } - - @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { - if(world.getTileEntity(x, y, z) instanceof TileEntityGasDuct) { - TileEntityGasDuct cable = (TileEntityGasDuct)world.getTileEntity(x, y, z); - - if(cable != null) - { - float p = 1F/16F; - float minX = 11 * p / 2 - (cable.connections[5] != null ? (11 * p / 2) : 0); - float minY = 11 * p / 2 - (cable.connections[1] != null ? (11 * p / 2) : 0); - float minZ = 11 * p / 2 - (cable.connections[2] != null ? (11 * p / 2) : 0); - float maxX = 1 - 11 * p / 2 + (cable.connections[3] != null ? (11 * p / 2) : 0); - float maxY = 1 - 11 * p / 2 + (cable.connections[0] != null ? (11 * p / 2) : 0); - float maxZ = 1 - 11 * p / 2 + (cable.connections[4] != null ? (11 * p / 2) : 0); - - this.setBlockBounds(minX, minY, minZ, maxX, maxY, maxZ); - } - } - return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ); - } - - @Override - public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { - if(world.getTileEntity(x, y, z) instanceof TileEntityGasDuct) { - TileEntityGasDuct cable = (TileEntityGasDuct)world.getTileEntity(x, y, z); - - if(cable != null) - { - float p = 1F/16F; - float minX = 11 * p / 2 - (cable.connections[5] != null ? (11 * p / 2) : 0); - float minY = 11 * p / 2 - (cable.connections[1] != null ? (11 * p / 2) : 0); - float minZ = 11 * p / 2 - (cable.connections[2] != null ? (11 * p / 2) : 0); - float maxX = 1 - 11 * p / 2 + (cable.connections[3] != null ? (11 * p / 2) : 0); - float maxY = 1 - 11 * p / 2 + (cable.connections[0] != null ? (11 * p / 2) : 0); - float maxZ = 1 - 11 * p / 2 + (cable.connections[4] != null ? (11 * p / 2) : 0); - - this.setBlockBounds(minX, minY, minZ, maxX, maxY, maxZ); - } - } - } - - @Override - public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { - return new TileEntityGasDuct(); - } - - @Override - public int getRenderType(){ - return -1; - } - - @Override - public boolean isOpaqueCube() { - return false; - } - - @Override - public boolean renderAsNormalBlock() { - return false; - } -} diff --git a/src/main/java/com/hbm/blocks/network/BlockOilDuct.java b/src/main/java/com/hbm/blocks/network/BlockOilDuct.java deleted file mode 100644 index a1b9ca9bd..000000000 --- a/src/main/java/com/hbm/blocks/network/BlockOilDuct.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.hbm.blocks.network; - -import com.hbm.tileentity.conductor.TileEntityOilDuct; - -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -public class BlockOilDuct extends BlockContainer { - - public BlockOilDuct(Material p_i45386_1_) { - super(p_i45386_1_); - float p = 1F/16F; - this.setBlockBounds(11 * p / 2, 11 * p / 2, 11 * p / 2, 1 - 11 * p / 2, 1 - 11 * p / 2, 1 - 11 * p / 2); - this.useNeighborBrightness = true; - } - - @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { - if(world.getTileEntity(x, y, z) instanceof TileEntityOilDuct) { - TileEntityOilDuct cable = (TileEntityOilDuct)world.getTileEntity(x, y, z); - - if(cable != null) - { - float p = 1F/16F; - float minX = 11 * p / 2 - (cable.connections[5] != null ? (11 * p / 2) : 0); - float minY = 11 * p / 2 - (cable.connections[1] != null ? (11 * p / 2) : 0); - float minZ = 11 * p / 2 - (cable.connections[2] != null ? (11 * p / 2) : 0); - float maxX = 1 - 11 * p / 2 + (cable.connections[3] != null ? (11 * p / 2) : 0); - float maxY = 1 - 11 * p / 2 + (cable.connections[0] != null ? (11 * p / 2) : 0); - float maxZ = 1 - 11 * p / 2 + (cable.connections[4] != null ? (11 * p / 2) : 0); - - this.setBlockBounds(minX, minY, minZ, maxX, maxY, maxZ); - } - } - return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ); - } - - @Override - public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { - if(world.getTileEntity(x, y, z) instanceof TileEntityOilDuct) { - TileEntityOilDuct cable = (TileEntityOilDuct)world.getTileEntity(x, y, z); - - if(cable != null) - { - float p = 1F/16F; - float minX = 11 * p / 2 - (cable.connections[5] != null ? (11 * p / 2) : 0); - float minY = 11 * p / 2 - (cable.connections[1] != null ? (11 * p / 2) : 0); - float minZ = 11 * p / 2 - (cable.connections[2] != null ? (11 * p / 2) : 0); - float maxX = 1 - 11 * p / 2 + (cable.connections[3] != null ? (11 * p / 2) : 0); - float maxY = 1 - 11 * p / 2 + (cable.connections[0] != null ? (11 * p / 2) : 0); - float maxZ = 1 - 11 * p / 2 + (cable.connections[4] != null ? (11 * p / 2) : 0); - - this.setBlockBounds(minX, minY, minZ, maxX, maxY, maxZ); - } - } - } - - @Override - public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { - return new TileEntityOilDuct(); - } - - @Override - public int getRenderType(){ - return -1; - } - - @Override - public boolean isOpaqueCube() { - return false; - } - - @Override - public boolean renderAsNormalBlock() { - return false; - } -} diff --git a/src/main/java/com/hbm/blocks/network/FluidDuctBox.java b/src/main/java/com/hbm/blocks/network/FluidDuctBox.java index e8675d146..f2d6f7674 100644 --- a/src/main/java/com/hbm/blocks/network/FluidDuctBox.java +++ b/src/main/java/com/hbm/blocks/network/FluidDuctBox.java @@ -81,13 +81,13 @@ public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOve TileEntityPipeBaseNT pipe = (TileEntityPipeBaseNT) te; type = pipe.getType(); } - - boolean pX = Library.canConnectFluid(world, x + 1, y, z, Library.NEG_X, type); - boolean nX = Library.canConnectFluid(world, x - 1, y, z, Library.POS_X, type); - boolean pY = Library.canConnectFluid(world, x, y + 1, z, Library.NEG_Y, type); - boolean nY = Library.canConnectFluid(world, x, y - 1, z, Library.POS_Y, type); - boolean pZ = Library.canConnectFluid(world, x, y, z + 1, Library.NEG_Z, type); - boolean nZ = Library.canConnectFluid(world, x, y, z - 1, Library.POS_Z, type); + + boolean nX = canConnectTo(world, x, y, z, Library.NEG_X, te); + boolean pX = canConnectTo(world, x, y, z, Library.POS_X, te); + boolean nY = canConnectTo(world, x, y, z, Library.NEG_Y, te); + boolean pY = canConnectTo(world, x, y, z, Library.POS_Y, te); + boolean nZ = canConnectTo(world, x, y, z, Library.NEG_Z, te); + boolean pZ = canConnectTo(world, x, y, z, Library.POS_Z, te); int mask = 0 + (pX ? 32 : 0) + (nX ? 16 : 0) + (pY ? 8 : 0) + (nY ? 4 : 0) + (pZ ? 2 : 0) + (nZ ? 1 : 0); int count = 0 + (pX ? 1 : 0) + (nX ? 1 : 0) + (pY ? 1 : 0) + (nY ? 1 : 0) + (pZ ? 1 : 0) + (nZ ? 1 : 0); @@ -172,59 +172,55 @@ public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOve List bbs = new ArrayList(); TileEntity te = world.getTileEntity(x, y, z); - if(te instanceof TileEntityPipeBaseNT) { - TileEntityPipeBaseNT pipe = (TileEntityPipeBaseNT) te; - FluidType type = pipe.getType(); - double lower = 0.125D; - double upper = 0.875D; - double jLower = 0.0625D; - double jUpper = 0.9375D; - int meta = world.getBlockMetadata(x, y, z); - - for(int i = 2; i < 13; i += 3) { - - if(meta > i) { - lower += 0.0625D; - upper -= 0.0625D; - jLower += 0.0625D; - jUpper -= 0.0625D; - } - } - - boolean nX = canConnectTo(world, x, y, z, Library.NEG_X, type); - boolean pX = canConnectTo(world, x, y, z, Library.POS_X, type); - boolean nY = canConnectTo(world, x, y, z, Library.NEG_Y, type); - boolean pY = canConnectTo(world, x, y, z, Library.POS_Y, type); - boolean nZ = canConnectTo(world, x, y, z, Library.NEG_Z, type); - boolean pZ = canConnectTo(world, x, y, z, Library.POS_Z, type); - int mask = 0 + (pX ? 32 : 0) + (nX ? 16 : 0) + (pY ? 8 : 0) + (nY ? 4 : 0) + (pZ ? 2 : 0) + (nZ ? 1 : 0); - int count = 0 + (pX ? 1 : 0) + (nX ? 1 : 0) + (pY ? 1 : 0) + (nY ? 1 : 0) + (pZ ? 1 : 0) + (nZ ? 1 : 0); - - if(mask == 0) { - bbs.add(AxisAlignedBB.getBoundingBox(x + jLower, y + jLower, z + jLower, x + jUpper, y + jUpper, z + jUpper)); - } else if(mask == 0b100000 || mask == 0b010000 || mask == 0b110000) { - bbs.add(AxisAlignedBB.getBoundingBox(x + 0.0D, y + lower, z + lower, x + 1.0D, y + upper, z + upper)); - } else if(mask == 0b001000 || mask == 0b000100 || mask == 0b001100) { - bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + 0.0D, z + lower, x + upper, y + 1.0D, z + upper)); - } else if(mask == 0b000010 || mask == 0b000001 || mask == 0b000011) { - bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + lower, z + 0.0D, x + upper, y + upper, z + 1.0D)); - } else { - - if(count != 2) { - bbs.add(AxisAlignedBB.getBoundingBox(x + jLower, y + jLower, z + jLower, x + jUpper, y + jUpper, z + jUpper)); - } else { - bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + lower, z + lower, x + upper, y + upper, z + upper)); - } + double lower = 0.125D; + double upper = 0.875D; + double jLower = 0.0625D; + double jUpper = 0.9375D; + int meta = world.getBlockMetadata(x, y, z); - if(pX) bbs.add(AxisAlignedBB.getBoundingBox(x + upper, y + lower, z + lower, x + 1.0D, y + upper, z + upper)); - if(nX) bbs.add(AxisAlignedBB.getBoundingBox(x + 0.0D, y + lower, z + lower, x + lower, y + upper, z + upper)); - if(pY) bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + upper, z + lower, x + upper, y + 1.0D, z + upper)); - if(nY) bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + 0.0D, z + lower, x + upper, y + lower, z + upper)); - if(pZ) bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + lower, z + upper, x + upper, y + upper, z + 1.0D)); - if(nZ) bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + lower, z + 0.0D, x + upper, y + upper, z + lower)); + for(int i = 2; i < 13; i += 3) { + + if(meta > i) { + lower += 0.0625D; + upper -= 0.0625D; + jLower += 0.0625D; + jUpper -= 0.0625D; } } + + boolean nX = canConnectTo(world, x, y, z, Library.NEG_X, te); + boolean pX = canConnectTo(world, x, y, z, Library.POS_X, te); + boolean nY = canConnectTo(world, x, y, z, Library.NEG_Y, te); + boolean pY = canConnectTo(world, x, y, z, Library.POS_Y, te); + boolean nZ = canConnectTo(world, x, y, z, Library.NEG_Z, te); + boolean pZ = canConnectTo(world, x, y, z, Library.POS_Z, te); + int mask = 0 + (pX ? 32 : 0) + (nX ? 16 : 0) + (pY ? 8 : 0) + (nY ? 4 : 0) + (pZ ? 2 : 0) + (nZ ? 1 : 0); + int count = 0 + (pX ? 1 : 0) + (nX ? 1 : 0) + (pY ? 1 : 0) + (nY ? 1 : 0) + (pZ ? 1 : 0) + (nZ ? 1 : 0); + + if(mask == 0) { + bbs.add(AxisAlignedBB.getBoundingBox(x + jLower, y + jLower, z + jLower, x + jUpper, y + jUpper, z + jUpper)); + } else if(mask == 0b100000 || mask == 0b010000 || mask == 0b110000) { + bbs.add(AxisAlignedBB.getBoundingBox(x + 0.0D, y + lower, z + lower, x + 1.0D, y + upper, z + upper)); + } else if(mask == 0b001000 || mask == 0b000100 || mask == 0b001100) { + bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + 0.0D, z + lower, x + upper, y + 1.0D, z + upper)); + } else if(mask == 0b000010 || mask == 0b000001 || mask == 0b000011) { + bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + lower, z + 0.0D, x + upper, y + upper, z + 1.0D)); + } else { + + if(count != 2) { + bbs.add(AxisAlignedBB.getBoundingBox(x + jLower, y + jLower, z + jLower, x + jUpper, y + jUpper, z + jUpper)); + } else { + bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + lower, z + lower, x + upper, y + upper, z + upper)); + } + + if(pX) bbs.add(AxisAlignedBB.getBoundingBox(x + upper, y + lower, z + lower, x + 1.0D, y + upper, z + upper)); + if(nX) bbs.add(AxisAlignedBB.getBoundingBox(x + 0.0D, y + lower, z + lower, x + lower, y + upper, z + upper)); + if(pY) bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + upper, z + lower, x + upper, y + 1.0D, z + upper)); + if(nY) bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + 0.0D, z + lower, x + upper, y + lower, z + upper)); + if(pZ) bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + lower, z + upper, x + upper, y + upper, z + 1.0D)); + if(nZ) bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + lower, z + 0.0D, x + upper, y + upper, z + lower)); + } for(AxisAlignedBB bb : bbs) { if(entityBounding.intersectsWith(bb)) { @@ -244,68 +240,67 @@ public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOve public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { TileEntity te = world.getTileEntity(x, y, z); - if(te instanceof TileEntityPipeBaseNT) { - TileEntityPipeBaseNT pipe = (TileEntityPipeBaseNT) te; - FluidType type = pipe.getType(); - float lower = 0.125F; - float upper = 0.875F; - float jLower = 0.0625F; - float jUpper = 0.9375F; - int meta = world.getBlockMetadata(x, y, z); + float lower = 0.125F; + float upper = 0.875F; + float jLower = 0.0625F; + float jUpper = 0.9375F; + int meta = world.getBlockMetadata(x, y, z); + + for(int i = 2; i < 13; i += 3) { - for(int i = 2; i < 13; i += 3) { - - if(meta > i) { - lower += 0.0625F; - upper -= 0.0625F; - jLower += 0.0625F; - jUpper -= 0.0625F; - } + if(meta > i) { + lower += 0.0625F; + upper -= 0.0625F; + jLower += 0.0625F; + jUpper -= 0.0625F; } - - boolean nX = canConnectTo(world, x, y, z, Library.NEG_X, type); - boolean pX = canConnectTo(world, x, y, z, Library.POS_X, type); - boolean nY = canConnectTo(world, x, y, z, Library.NEG_Y, type); - boolean pY = canConnectTo(world, x, y, z, Library.POS_Y, type); - boolean nZ = canConnectTo(world, x, y, z, Library.NEG_Z, type); - boolean pZ = canConnectTo(world, x, y, z, Library.POS_Z, type); - int mask = 0 + (pX ? 32 : 0) + (nX ? 16 : 0) + (pY ? 8 : 0) + (nY ? 4 : 0) + (pZ ? 2 : 0) + (nZ ? 1 : 0); - int count = 0 + (pX ? 1 : 0) + (nX ? 1 : 0) + (pY ? 1 : 0) + (nY ? 1 : 0) + (pZ ? 1 : 0) + (nZ ? 1 : 0); + } + + boolean nX = canConnectTo(world, x, y, z, Library.NEG_X, te); + boolean pX = canConnectTo(world, x, y, z, Library.POS_X, te); + boolean nY = canConnectTo(world, x, y, z, Library.NEG_Y, te); + boolean pY = canConnectTo(world, x, y, z, Library.POS_Y, te); + boolean nZ = canConnectTo(world, x, y, z, Library.NEG_Z, te); + boolean pZ = canConnectTo(world, x, y, z, Library.POS_Z, te); + int mask = 0 + (pX ? 32 : 0) + (nX ? 16 : 0) + (pY ? 8 : 0) + (nY ? 4 : 0) + (pZ ? 2 : 0) + (nZ ? 1 : 0); + int count = 0 + (pX ? 1 : 0) + (nX ? 1 : 0) + (pY ? 1 : 0) + (nY ? 1 : 0) + (pZ ? 1 : 0) + (nZ ? 1 : 0); + + if(mask == 0) { + this.setBlockBounds(jLower, jLower, jLower, jUpper, jUpper, jUpper); + } else if(mask == 0b100000 || mask == 0b010000 || mask == 0b110000) { + this.setBlockBounds(0F, lower, lower, 1F, upper, upper); + } else if(mask == 0b001000 || mask == 0b000100 || mask == 0b001100) { + this.setBlockBounds(lower, 0F, lower, upper, 1F, upper); + } else if(mask == 0b000010 || mask == 0b000001 || mask == 0b000011) { + this.setBlockBounds(lower, lower, 0F, upper, upper, 1F); + } else { - if(mask == 0) { - this.setBlockBounds(jLower, jLower, jLower, jUpper, jUpper, jUpper); - } else if(mask == 0b100000 || mask == 0b010000 || mask == 0b110000) { - this.setBlockBounds(0F, lower, lower, 1F, upper, upper); - } else if(mask == 0b001000 || mask == 0b000100 || mask == 0b001100) { - this.setBlockBounds(lower, 0F, lower, upper, 1F, upper); - } else if(mask == 0b000010 || mask == 0b000001 || mask == 0b000011) { - this.setBlockBounds(lower, lower, 0F, upper, upper, 1F); + if(count != 2) { + this.setBlockBounds( + nX ? 0F : jLower, + nY ? 0F : jLower, + nZ ? 0F : jLower, + pX ? 1F : jUpper, + pY ? 1F : jUpper, + pZ ? 1F : jUpper); } else { - - if(count != 2) { - this.setBlockBounds( - nX ? 0F : jLower, - nY ? 0F : jLower, - nZ ? 0F : jLower, - pX ? 1F : jUpper, - pY ? 1F : jUpper, - pZ ? 1F : jUpper); - } else { - this.setBlockBounds( - nX ? 0F : lower, - nY ? 0F : lower, - nZ ? 0F : lower, - pX ? 1F : upper, - pY ? 1F : upper, - pZ ? 1F : upper); - } + this.setBlockBounds( + nX ? 0F : lower, + nY ? 0F : lower, + nZ ? 0F : lower, + pX ? 1F : upper, + pY ? 1F : upper, + pZ ? 1F : upper); } } } - public boolean canConnectTo(IBlockAccess world, int x, int y, int z, ForgeDirection dir, FluidType type) { - return Library.canConnectFluid(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir, type); + public boolean canConnectTo(IBlockAccess world, int x, int y, int z, ForgeDirection dir, TileEntity tile) { + if(tile instanceof TileEntityPipeBaseNT) { + return Library.canConnectFluid(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir, ((TileEntityPipeBaseNT) tile).getType()); + } + return false; } @Override @@ -319,7 +314,7 @@ public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOve TileEntityPipeBaseNT duct = (TileEntityPipeBaseNT) te; List text = new ArrayList(); - text.add("&[" + duct.getType().getColor() + "&]" +I18nUtil.resolveKey(duct.getType().getUnlocalizedName())); + text.add("&[" + duct.getType().getColor() + "&]" + I18nUtil.resolveKey(duct.getType().getUnlocalizedName())); ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); } diff --git a/src/main/java/com/hbm/blocks/network/FluidDuctBoxExhaust.java b/src/main/java/com/hbm/blocks/network/FluidDuctBoxExhaust.java new file mode 100644 index 000000000..3426cf93e --- /dev/null +++ b/src/main/java/com/hbm/blocks/network/FluidDuctBoxExhaust.java @@ -0,0 +1,86 @@ +package com.hbm.blocks.network; + +import java.util.ArrayList; +import java.util.List; + +import com.hbm.blocks.ILookOverlay; +import com.hbm.inventory.fluid.Fluids; +import com.hbm.lib.Library; +import com.hbm.lib.RefStrings; +import com.hbm.tileentity.network.TileEntityPipeExhaust; +import com.hbm.util.I18nUtil; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; +import net.minecraftforge.common.util.ForgeDirection; + +public class FluidDuctBoxExhaust extends FluidDuctBox { + + public FluidDuctBoxExhaust(Material mat) { + super(mat); + } + + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileEntityPipeExhaust(); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister iconRegister) { + super.registerBlockIcons(iconRegister); + + iconStraight = new IIcon[1]; + iconEnd = new IIcon[1]; + iconCurveTL = new IIcon[1]; + iconCurveTR = new IIcon[1]; + iconCurveBL = new IIcon[1]; + iconCurveBR = new IIcon[1]; + iconJunction = new IIcon[1]; + + iconStraight[0] = iconRegister.registerIcon(RefStrings.MODID + ":boxduct_exhaust_straight"); + iconEnd[0] = iconRegister.registerIcon(RefStrings.MODID + ":boxduct_exhaust_end"); + iconCurveTL[0] = iconRegister.registerIcon(RefStrings.MODID + ":boxduct_exhaust_curve_tl"); + iconCurveTR[0] = iconRegister.registerIcon(RefStrings.MODID + ":boxduct_exhaust_curve_tr"); + iconCurveBL[0] = iconRegister.registerIcon(RefStrings.MODID + ":boxduct_exhaust_curve_bl"); + iconCurveBR[0] = iconRegister.registerIcon(RefStrings.MODID + ":boxduct_exhaust_curve_br"); + iconJunction[0] = iconRegister.registerIcon(RefStrings.MODID + ":boxduct_exhaust_junction"); + } + + public boolean canConnectTo(IBlockAccess world, int x, int y, int z, ForgeDirection dir, TileEntity tile) { + return Library.canConnectFluid(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir, Fluids.SMOKE) || + Library.canConnectFluid(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir, Fluids.SMOKE_LEADED) || + Library.canConnectFluid(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir, Fluids.SMOKE_POISON); + } + + @Override + public int getSubCount() { + return 1; + } + + @SideOnly(Side.CLIENT) + public void getSubBlocks(Item item, CreativeTabs tab, List list) { + for(int i = 0; i < 15; i += 3) { + list.add(new ItemStack(item, 1, i)); + } + } + + @Override + public void printHook(Pre event, World world, int x, int y, int z) { + List text = new ArrayList(); + text.add(I18nUtil.resolveKey(Fluids.SMOKE.getUnlocalizedName())); + text.add(I18nUtil.resolveKey(Fluids.SMOKE_LEADED.getUnlocalizedName())); + text.add(I18nUtil.resolveKey(Fluids.SMOKE_POISON.getUnlocalizedName())); + ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); + } +} diff --git a/src/main/java/com/hbm/blocks/network/FluidSwitch.java b/src/main/java/com/hbm/blocks/network/FluidSwitch.java new file mode 100644 index 000000000..bbe44edd2 --- /dev/null +++ b/src/main/java/com/hbm/blocks/network/FluidSwitch.java @@ -0,0 +1,88 @@ +package com.hbm.blocks.network; + +import java.util.ArrayList; +import java.util.List; + +import com.hbm.blocks.ILookOverlay; +import com.hbm.lib.RefStrings; +import com.hbm.tileentity.network.TileEntityFluidValve; +import com.hbm.util.I18nUtil; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +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.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; +import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; + +public class FluidSwitch extends BlockContainer implements ILookOverlay { + + @SideOnly(Side.CLIENT) + private IIcon iconOn; + + public FluidSwitch(Material mat) { + super(mat); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister iconRegister) { + this.iconOn = iconRegister.registerIcon(RefStrings.MODID + ":fluid_valve_on"); + this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":fluid_valve_off"); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int metadata) { + return metadata == 1 ? iconOn : blockIcon; + } + + @Override + public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { + return new TileEntityFluidValve(); + } + + @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()) + { + int meta = world.getBlockMetadata(x, y, z); + if(meta == 0) { + world.setBlockMetadataWithNotify(x, y, z, 1, 2); + world.playSoundEffect(x, y, z, "hbm:block.reactorStart", 1.0F, 1.0F); + } else { + world.setBlockMetadataWithNotify(x, y, z, 0, 2); + world.playSoundEffect(x, y, z, "hbm:block.reactorStart", 1.0F, 0.85F); + } + + TileEntityFluidValve te = (TileEntityFluidValve) world.getTileEntity(x, y, z); + te.updateState(); + + return true; + } else { + return false; + } + } + + @Override + public void printHook(Pre event, World world, int x, int y, int z) { + + TileEntity te = world.getTileEntity(x, y, z); + + if(!(te instanceof TileEntityFluidValve)) + return; + + TileEntityFluidValve duct = (TileEntityFluidValve) te; + + List text = new ArrayList(); + text.add("&[" + duct.getType().getColor() + "&]" +I18nUtil.resolveKey(duct.getType().getUnlocalizedName())); + ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); + } +} diff --git a/src/main/java/com/hbm/blocks/network/FluidValve.java b/src/main/java/com/hbm/blocks/network/FluidValve.java new file mode 100644 index 000000000..9211dc6c3 --- /dev/null +++ b/src/main/java/com/hbm/blocks/network/FluidValve.java @@ -0,0 +1,89 @@ +package com.hbm.blocks.network; + +import java.util.ArrayList; +import java.util.List; + +import com.hbm.blocks.ILookOverlay; +import com.hbm.lib.RefStrings; +import com.hbm.tileentity.network.TileEntityFluidValve; +import com.hbm.util.I18nUtil; + +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.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; +import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; + +public class FluidValve extends BlockContainer implements ILookOverlay { + + @SideOnly(Side.CLIENT) + private IIcon iconOn; + + public FluidValve(Material mat) { + super(mat); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister iconRegister) { + this.iconOn = iconRegister.registerIcon(RefStrings.MODID + ":fluid_switch_on"); + this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":fluid_switch_off"); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int metadata) { + return metadata == 1 ? iconOn : blockIcon; + } + + @Override + public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { + return new TileEntityFluidValve(); + } + + @Override + public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { + + boolean on = world.isBlockIndirectlyGettingPowered(x, y, z); + int meta = world.getBlockMetadata(x, y, z); + + boolean update = false; + + if(on && meta == 0) { + world.setBlockMetadataWithNotify(x, y, z, 1, 2); + world.playSoundEffect(x, y, z, "hbm:block.reactorStart", 1.0F, 1.0F); + update = true; + } + + if(!on && meta == 1) { + world.setBlockMetadataWithNotify(x, y, z, 0, 2); + world.playSoundEffect(x, y, z, "hbm:block.reactorStart", 1.0F, 0.85F); + update = true; + } + + if(update) { + TileEntityFluidValve te = (TileEntityFluidValve) world.getTileEntity(x, y, z); + te.updateState(); + } + } + + @Override + public void printHook(Pre event, World world, int x, int y, int z) { + + TileEntity te = world.getTileEntity(x, y, z); + + if(!(te instanceof TileEntityFluidValve)) + return; + + TileEntityFluidValve duct = (TileEntityFluidValve) te; + + List text = new ArrayList(); + text.add("&[" + duct.getType().getColor() + "&]" +I18nUtil.resolveKey(duct.getType().getUnlocalizedName())); + ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); + } +} diff --git a/src/main/java/com/hbm/inventory/fluid/Fluids.java b/src/main/java/com/hbm/inventory/fluid/Fluids.java index df3839c36..6fdebb888 100644 --- a/src/main/java/com/hbm/inventory/fluid/Fluids.java +++ b/src/main/java/com/hbm/inventory/fluid/Fluids.java @@ -152,6 +152,9 @@ public class Fluids { public static FluidType POTASSIUM_CHLORIDE; public static FluidType CALCIUM_CHLORIDE; public static FluidType CALCIUM_SOLUTION; + public static FluidType SMOKE; + public static FluidType SMOKE_LEADED; + public static FluidType SMOKE_POISON; private static final HashMap idMapping = new HashMap(); private static final HashMap nameMapping = new HashMap(); @@ -302,8 +305,11 @@ public class Fluids { CHLOROCALCITE_MIX = new FluidType("CHLOROCALCITE_MIX", 0x808080, 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID, NOCON, new FT_Corrosive(60)); CHLOROCALCITE_CLEANED = new FluidType("CHLOROCALCITE_CLEANED", 0x808080, 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID, NOCON, new FT_Corrosive(60)); POTASSIUM_CHLORIDE = new FluidType("POTASSIUM_CHLORIDE", 0x808080, 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID, NOCON, new FT_Corrosive(60)); - CALCIUM_CHLORIDE = new FluidType("CALCIUM_CHLORIDE", 0x808080, 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID, NOCON, new FT_Corrosive(60)); - CALCIUM_SOLUTION = new FluidType(119, "CALCIUM_SOLUTION", 0x808080, 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID, NOCON, new FT_Corrosive(60)); + CALCIUM_CHLORIDE = new FluidType("CALCIUM_CHLORIDE", 0x808080, 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID, NOCON, new FT_Corrosive(60)); + CALCIUM_SOLUTION = new FluidType("CALCIUM_SOLUTION", 0x808080, 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID, NOCON, new FT_Corrosive(60)); + SMOKE = new FluidType("SMOKE", 0x808080, 0, 0, 0, EnumSymbol.NONE).addTraits(GASEOUS, NOID, NOCON); + SMOKE_LEADED = new FluidType("SMOKE_LEADED", 0x808080, 0, 0, 0, EnumSymbol.NONE).addTraits(GASEOUS, NOID, NOCON); + SMOKE_POISON = new FluidType(122, "SMOKE_POISON", 0x808080, 0, 0, 0, EnumSymbol.NONE).addTraits(GASEOUS, NOID, NOCON); // ^ ^ ^ ^ ^ ^ ^ ^ //ADD NEW FLUIDS HERE @@ -443,6 +449,10 @@ public class Fluids { metaOrder.add(PLASMA_DH3); metaOrder.add(PLASMA_XM); metaOrder.add(PLASMA_BF); + //smoke + metaOrder.add(SMOKE); + metaOrder.add(SMOKE_LEADED); + metaOrder.add(SMOKE_POISON); CHLORINE.addTraits(new FT_Toxin().addEntry(new ToxinDirectDamage(ModDamageSource.cloud, 2F, 20, HazardClass.GAS_CHLORINE, false))); PHOSGENE.addTraits(new FT_Toxin().addEntry(new ToxinDirectDamage(ModDamageSource.cloud, 4F, 20, HazardClass.GAS_CHLORINE, false))); diff --git a/src/main/java/com/hbm/inventory/recipes/ShredderRecipes.java b/src/main/java/com/hbm/inventory/recipes/ShredderRecipes.java index 2c0150b5d..457bddf9b 100644 --- a/src/main/java/com/hbm/inventory/recipes/ShredderRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/ShredderRecipes.java @@ -286,10 +286,6 @@ public class ShredderRecipes extends SerializableRecipe { ShredderRecipes.setRecipe(ModBlocks.chain, new ItemStack(ModItems.powder_steel_tiny, 1)); ShredderRecipes.setRecipe(ModBlocks.steel_grate, new ItemStack(ModItems.powder_steel_tiny, 3)); ShredderRecipes.setRecipe(ModItems.pipes_steel, new ItemStack(ModItems.powder_steel, 27)); - ShredderRecipes.setRecipe(ModBlocks.oil_duct, new ItemStack(ModItems.powder_steel_tiny, 3)); - ShredderRecipes.setRecipe(ModBlocks.oil_duct_solid, new ItemStack(ModItems.powder_steel_tiny, 3)); - ShredderRecipes.setRecipe(ModBlocks.gas_duct, new ItemStack(ModItems.powder_steel, 1)); - ShredderRecipes.setRecipe(ModBlocks.gas_duct_solid, new ItemStack(ModItems.powder_steel, 1)); ShredderRecipes.setRecipe(ModBlocks.machine_fluidtank, new ItemStack(ModItems.powder_steel, 32)); /* Sellafite scrapping */ diff --git a/src/main/java/com/hbm/lib/Library.java b/src/main/java/com/hbm/lib/Library.java index bd96c150b..28416dc2e 100644 --- a/src/main/java/com/hbm/lib/Library.java +++ b/src/main/java/com/hbm/lib/Library.java @@ -19,10 +19,6 @@ import com.hbm.items.ModItems; import com.hbm.tileentity.TileEntityProxyBase; import com.hbm.tileentity.TileEntityProxyInventory; import com.hbm.tileentity.conductor.TileEntityFluidDuctSimple; -import com.hbm.tileentity.conductor.TileEntityGasDuct; -import com.hbm.tileentity.conductor.TileEntityGasDuctSolid; -import com.hbm.tileentity.conductor.TileEntityOilDuct; -import com.hbm.tileentity.conductor.TileEntityOilDuctSolid; import com.hbm.tileentity.machine.TileEntityDummy; import api.hbm.energy.IBatteryItem; @@ -484,102 +480,6 @@ public class Library { ((TileEntityFluidDuctSimple)tileentity).uoteab.add(new UnionOfTileEntitiesAndBooleansForFluids(that, newTact)); } } - if(tileentity instanceof TileEntityGasDuct && ((TileEntityGasDuct)tileentity).type.name().equals(type.name())) - { - if(Library.checkUnionListForFluids(((TileEntityGasDuct)tileentity).uoteab, that)) - { - for(int i = 0; i < ((TileEntityGasDuct)tileentity).uoteab.size(); i++) - { - if(((TileEntityGasDuct)tileentity).uoteab.get(i).source == that) - { - if(((TileEntityGasDuct)tileentity).uoteab.get(i).ticked != newTact) - { - ((TileEntityGasDuct)tileentity).uoteab.get(i).ticked = newTact; - transmitFluid(x, y + 1, z, that.getTact(), that, worldObj, type); - transmitFluid(x, y - 1, z, that.getTact(), that, worldObj, type); - transmitFluid(x - 1, y, z, that.getTact(), that, worldObj, type); - transmitFluid(x + 1, y, z, that.getTact(), that, worldObj, type); - transmitFluid(x, y, z - 1, that.getTact(), that, worldObj, type); - transmitFluid(x, y, z + 1, that.getTact(), that, worldObj, type); - } - } - } - } else { - ((TileEntityGasDuct)tileentity).uoteab.add(new UnionOfTileEntitiesAndBooleansForFluids(that, newTact)); - } - } - if(tileentity instanceof TileEntityOilDuct && ((TileEntityOilDuct)tileentity).type.name().equals(type.name())) - { - if(Library.checkUnionListForFluids(((TileEntityOilDuct)tileentity).uoteab, that)) - { - for(int i = 0; i < ((TileEntityOilDuct)tileentity).uoteab.size(); i++) - { - if(((TileEntityOilDuct)tileentity).uoteab.get(i).source == that) - { - if(((TileEntityOilDuct)tileentity).uoteab.get(i).ticked != newTact) - { - ((TileEntityOilDuct)tileentity).uoteab.get(i).ticked = newTact; - transmitFluid(x, y + 1, z, that.getTact(), that, worldObj, type); - transmitFluid(x, y - 1, z, that.getTact(), that, worldObj, type); - transmitFluid(x - 1, y, z, that.getTact(), that, worldObj, type); - transmitFluid(x + 1, y, z, that.getTact(), that, worldObj, type); - transmitFluid(x, y, z - 1, that.getTact(), that, worldObj, type); - transmitFluid(x, y, z + 1, that.getTact(), that, worldObj, type); - } - } - } - } else { - ((TileEntityOilDuct)tileentity).uoteab.add(new UnionOfTileEntitiesAndBooleansForFluids(that, newTact)); - } - } - if(tileentity instanceof TileEntityGasDuctSolid && ((TileEntityGasDuctSolid)tileentity).type.name().equals(type.name())) - { - if(Library.checkUnionListForFluids(((TileEntityGasDuctSolid)tileentity).uoteab, that)) - { - for(int i = 0; i < ((TileEntityGasDuctSolid)tileentity).uoteab.size(); i++) - { - if(((TileEntityGasDuctSolid)tileentity).uoteab.get(i).source == that) - { - if(((TileEntityGasDuctSolid)tileentity).uoteab.get(i).ticked != newTact) - { - ((TileEntityGasDuctSolid)tileentity).uoteab.get(i).ticked = newTact; - transmitFluid(x, y + 1, z, that.getTact(), that, worldObj, type); - transmitFluid(x, y - 1, z, that.getTact(), that, worldObj, type); - transmitFluid(x - 1, y, z, that.getTact(), that, worldObj, type); - transmitFluid(x + 1, y, z, that.getTact(), that, worldObj, type); - transmitFluid(x, y, z - 1, that.getTact(), that, worldObj, type); - transmitFluid(x, y, z + 1, that.getTact(), that, worldObj, type); - } - } - } - } else { - ((TileEntityGasDuctSolid)tileentity).uoteab.add(new UnionOfTileEntitiesAndBooleansForFluids(that, newTact)); - } - } - if(tileentity instanceof TileEntityOilDuctSolid && ((TileEntityOilDuctSolid)tileentity).type.name().equals(type.name())) - { - if(Library.checkUnionListForFluids(((TileEntityOilDuctSolid)tileentity).uoteab, that)) - { - for(int i = 0; i < ((TileEntityOilDuctSolid)tileentity).uoteab.size(); i++) - { - if(((TileEntityOilDuctSolid)tileentity).uoteab.get(i).source == that) - { - if(((TileEntityOilDuctSolid)tileentity).uoteab.get(i).ticked != newTact) - { - ((TileEntityOilDuctSolid)tileentity).uoteab.get(i).ticked = newTact; - transmitFluid(x, y + 1, z, that.getTact(), that, worldObj, type); - transmitFluid(x, y - 1, z, that.getTact(), that, worldObj, type); - transmitFluid(x - 1, y, z, that.getTact(), that, worldObj, type); - transmitFluid(x + 1, y, z, that.getTact(), that, worldObj, type); - transmitFluid(x, y, z - 1, that.getTact(), that, worldObj, type); - transmitFluid(x, y, z + 1, that.getTact(), that, worldObj, type); - } - } - } - } else { - ((TileEntityOilDuctSolid)tileentity).uoteab.add(new UnionOfTileEntitiesAndBooleansForFluids(that, newTact)); - } - } } if(tileentity instanceof IFluidAcceptor && newTact && ((IFluidAcceptor)tileentity).getMaxFluidFillForReceive(type) > 0 && diff --git a/src/main/java/com/hbm/main/ClientProxy.java b/src/main/java/com/hbm/main/ClientProxy.java index b1a7d09fe..5216968ab 100644 --- a/src/main/java/com/hbm/main/ClientProxy.java +++ b/src/main/java/com/hbm/main/ClientProxy.java @@ -306,8 +306,6 @@ public class ClientProxy extends ServerProxy { ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySoyuzLauncher.class, new RenderSoyuzLauncher()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySoyuzCapsule.class, new RenderCapsule()); //network - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityOilDuct.class, new RenderOilDuct()); - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityGasDuct.class, new RenderGasDuct()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFluidDuct.class, new RenderFluidDuct()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRFDuct.class, new RenderRFCable()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPylon.class, new RenderPylon()); diff --git a/src/main/java/com/hbm/main/CraftingManager.java b/src/main/java/com/hbm/main/CraftingManager.java index c18a730e0..09737a6e0 100644 --- a/src/main/java/com/hbm/main/CraftingManager.java +++ b/src/main/java/com/hbm/main/CraftingManager.java @@ -622,6 +622,8 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModBlocks.fluid_duct, 8), new Object[] { "SAS", " D ", "SAS", 'S', STEEL.plate(), 'A', AL.plate(), 'D', ModItems.ducttape }); addShapelessAuto(new ItemStack(ModBlocks.fluid_duct_neo, 1, 0), new Object[] { ModBlocks.fluid_duct }); addRecipeAuto(new ItemStack(ModBlocks.fluid_duct_solid, 8), new Object[] { "SAS", "ADA", "SAS", 'S', STEEL.ingot(), 'A', AL.plate(), 'D', ModItems.ducttape }); + addRecipeAuto(new ItemStack(ModBlocks.fluid_valve, 1), new Object[] { "S", "W", 'S', Blocks.lever, 'W', ModBlocks.fluid_duct_paintable }); + addRecipeAuto(new ItemStack(ModBlocks.fluid_switch, 1), new Object[] { "S", "W", 'S', REDSTONE.dust(), 'W', ModBlocks.fluid_duct_paintable }); addRecipeAuto(new ItemStack(ModItems.template_folder, 1), new Object[] { "LPL", "BPB", "LPL", 'P', Items.paper, 'L', "dye", 'B', "dye" }); addRecipeAuto(new ItemStack(ModItems.pellet_antimatter, 1), new Object[] { "###", "###", "###", '#', ModItems.cell_antimatter }); addRecipeAuto(new ItemStack(ModItems.fluid_tank_empty, 8), new Object[] { "121", "1G1", "121", '1', AL.plate(), '2', IRON.plate(), 'G', KEY_ANYPANE }); diff --git a/src/main/java/com/hbm/main/MainRegistry.java b/src/main/java/com/hbm/main/MainRegistry.java index 19c93acf9..6f60eb450 100644 --- a/src/main/java/com/hbm/main/MainRegistry.java +++ b/src/main/java/com/hbm/main/MainRegistry.java @@ -1123,6 +1123,10 @@ public class MainRegistry { ignoreMappings.add("hbm:item.digamma_know"); ignoreMappings.add("hbm:item.digamma_kauai_moho"); ignoreMappings.add("hbm:item.digamma_up_on_top"); + ignoreMappings.add("hbm:tile.oil_duct_solid"); + ignoreMappings.add("hbm:tile.oil_duct"); + ignoreMappings.add("hbm:tile.gas_duct_solid"); + ignoreMappings.add("hbm:tile.gas_duct"); /// REMAP /// remapItems.put("hbm:item.gadget_explosive8", ModItems.early_explosive_lenses); diff --git a/src/main/java/com/hbm/render/block/RenderBoxDuct.java b/src/main/java/com/hbm/render/block/RenderBoxDuct.java index eb0d53002..c8c8f8915 100644 --- a/src/main/java/com/hbm/render/block/RenderBoxDuct.java +++ b/src/main/java/com/hbm/render/block/RenderBoxDuct.java @@ -23,7 +23,7 @@ public class RenderBoxDuct implements ISimpleBlockRenderingHandler { Tessellator tessellator = Tessellator.instance; FluidDuctBox duct = (FluidDuctBox) block; - int type = metadata % 3; + int type = duct.rectify(metadata); float lower = 0.125F; float upper = 0.875F; @@ -65,7 +65,23 @@ public class RenderBoxDuct implements ISimpleBlockRenderingHandler { tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z)); int meta = world.getBlockMetadata(x, y, z); + boolean pX = false; + boolean nX = false; + boolean pY = false; + boolean nY = false; + boolean pZ = false; + boolean nZ = false; + FluidDuctBox.cachedColor = 0xffffff; + FluidDuctBox duct = (FluidDuctBox) block; + + pX = duct.canConnectTo(world, x, y, z, Library.POS_X, te); + nX = duct.canConnectTo(world, x, y, z, Library.NEG_X, te); + pY = duct.canConnectTo(world, x, y, z, Library.POS_Y, te); + nY = duct.canConnectTo(world, x, y, z, Library.NEG_Y, te); + pZ = duct.canConnectTo(world, x, y, z, Library.POS_Z, te); + nZ = duct.canConnectTo(world, x, y, z, Library.NEG_Z, te); + if(te instanceof TileEntityPipeBaseNT) { TileEntityPipeBaseNT pipe = (TileEntityPipeBaseNT) te; type = pipe.getType(); @@ -74,13 +90,6 @@ public class RenderBoxDuct implements ISimpleBlockRenderingHandler { } } - boolean pX = Library.canConnectFluid(world, x + 1, y, z, Library.POS_X, type); - boolean nX = Library.canConnectFluid(world, x - 1, y, z, Library.NEG_X, type); - boolean pY = Library.canConnectFluid(world, x, y + 1, z, Library.POS_Y, type); - boolean nY = Library.canConnectFluid(world, x, y - 1, z, Library.NEG_Y, type); - boolean pZ = Library.canConnectFluid(world, x, y, z + 1, Library.POS_Z, type); - boolean nZ = Library.canConnectFluid(world, x, y, z - 1, Library.NEG_Z, type); - int mask = 0 + (pX ? 32 : 0) + (nX ? 16 : 0) + (pY ? 8 : 0) + (nY ? 4 : 0) + (pZ ? 2 : 0) + (nZ ? 1 : 0); int count = 0 + (pX ? 1 : 0) + (nX ? 1 : 0) + (pY ? 1 : 0) + (nY ? 1 : 0) + (pZ ? 1 : 0) + (nZ ? 1 : 0); diff --git a/src/main/java/com/hbm/render/tileentity/RenderGasDuct.java b/src/main/java/com/hbm/render/tileentity/RenderGasDuct.java deleted file mode 100644 index 460d20b52..000000000 --- a/src/main/java/com/hbm/render/tileentity/RenderGasDuct.java +++ /dev/null @@ -1,153 +0,0 @@ -package com.hbm.render.tileentity; - -import org.lwjgl.opengl.GL11; - -import com.hbm.lib.RefStrings; -import com.hbm.tileentity.conductor.TileEntityGasDuct; - -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.common.util.ForgeDirection; - -public class RenderGasDuct extends TileEntitySpecialRenderer { - - public ResourceLocation texture = new ResourceLocation(RefStrings.MODID, "textures/blocks/gas_duct.png"); - float pixel = 1F/16F; - float textureP = 1F / 32F; - - @Override - public void renderTileEntityAt(TileEntity tileentity, double offsetX, double offsetY, double offsetZ, float f) { - GL11.glTranslated(offsetX, offsetY, offsetZ); - GL11.glDisable(GL11.GL_LIGHTING); - this.bindTexture(texture); - drawCore(tileentity); - TileEntityGasDuct cable = (TileEntityGasDuct) tileentity; - for(int i = 0; i < cable.connections.length; i++) - { - if(cable.connections[i] != null) - { - drawConnection(cable.connections[i]); - } - } - GL11.glTranslated(-offsetX, -offsetY, -offsetZ); - GL11.glEnable(GL11.GL_LIGHTING); - - } - - public void drawCore(TileEntity tileentity) { - Tessellator tesseract = Tessellator.instance; - tesseract.startDrawingQuads(); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * textureP, 5 * textureP); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * textureP, 0 * textureP); - tesseract.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 0 * textureP, 0 * textureP); - tesseract.addVertexWithUV(11 * pixel / 2, 11 * pixel / 2, 1 - 11 * pixel / 2, 0 * textureP, 5 * textureP); - - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 11 * pixel / 2, 11 * pixel / 2, 5 * textureP, 5 * textureP); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 5 * textureP, 0 * textureP); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 0 * textureP, 0 * textureP); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 11 * pixel / 2, 1 - 11 * pixel / 2, 0 * textureP, 5 * textureP); - - tesseract.addVertexWithUV(11 * pixel / 2, 11 * pixel / 2, 11 * pixel / 2, 5 * textureP, 5 * textureP); - tesseract.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 5 * textureP, 0 * textureP); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 0 * textureP, 0 * textureP); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 11 * pixel / 2, 11 * pixel / 2, 0 * textureP, 5 * textureP); - - tesseract.addVertexWithUV(11 * pixel / 2, 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * textureP, 5 * textureP); - tesseract.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * textureP, 0 * textureP); - tesseract.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 0 * textureP, 0 * textureP); - tesseract.addVertexWithUV(11 * pixel / 2, 11 * pixel / 2, 11 * pixel / 2, 0 * textureP, 5 * textureP); - - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * textureP, 5 * textureP); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 5 * textureP, 0 * textureP); - tesseract.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 0 * textureP, 0 * textureP); - tesseract.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 0 * textureP, 5 * textureP); - - tesseract.addVertexWithUV(11 * pixel / 2, 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * textureP, 5 * textureP); - tesseract.addVertexWithUV(11 * pixel / 2, 11 * pixel / 2, 11 * pixel / 2, 5 * textureP, 0 * textureP); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 11 * pixel / 2, 11 * pixel / 2, 0 * textureP, 0 * textureP); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 11 * pixel / 2, 1 - 11 * pixel / 2, 0 * textureP, 5 * textureP); - tesseract.draw(); - } - - public void drawConnection(ForgeDirection direction) - { - Tessellator tesseract = Tessellator.instance; - tesseract.startDrawingQuads(); - GL11.glTranslatef(0.5F, 0.5F, 0.5F); - if(direction.equals(ForgeDirection.UP)) - { - - } - if(direction.equals(ForgeDirection.DOWN)) - { - GL11.glRotatef(180, 1, 0, 0); - } - if(direction.equals(ForgeDirection.NORTH)) - { - GL11.glRotatef(270, 1, 0, 0); - } - if(direction.equals(ForgeDirection.SOUTH)) - { - GL11.glRotatef(90, 1, 0, 0); - } - if(direction.equals(ForgeDirection.EAST)) - { - GL11.glRotatef(270, 0, 0, 1); - } - if(direction.equals(ForgeDirection.WEST)) - { - GL11.glRotatef(90, 0, 0, 1); - } - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * textureP, 5 * textureP); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1, 1 - 11 * pixel / 2, 10 * textureP, 5 * textureP); - tesseract.addVertexWithUV(11 * pixel / 2, 1, 1 - 11 * pixel / 2, 10 * textureP, 0 * textureP); - tesseract.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * textureP, 0 * textureP); - - tesseract.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 5 * textureP, 5 * textureP); - tesseract.addVertexWithUV(11 * pixel / 2, 1, 11 * pixel / 2, 10 * textureP, 5 * textureP); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1, 11 * pixel / 2, 10 * textureP, 0 * textureP); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 5 * textureP, 0 * textureP); - - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 5 * textureP, 5 * textureP); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1, 11 * pixel / 2, 10 * textureP, 5 * textureP); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1, 1 - 11 * pixel / 2, 10 * textureP, 0 * textureP); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * textureP, 0 * textureP); - - tesseract.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * textureP, 5 * textureP); - tesseract.addVertexWithUV(11 * pixel / 2, 1, 1 - 11 * pixel / 2, 10 * textureP, 5 * textureP); - tesseract.addVertexWithUV(11 * pixel / 2, 1, 11 * pixel / 2, 10 * textureP, 0 * textureP); - tesseract.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 5 * textureP, 0 * textureP); - tesseract.draw(); - - GL11.glTranslatef(0.5F, 0.5F, 0.5F); - if(direction.equals(ForgeDirection.UP)) - { - - } - if(direction.equals(ForgeDirection.DOWN)) - { - GL11.glRotatef(-180, 1, 0, 0); - } - if(direction.equals(ForgeDirection.NORTH)) - { - GL11.glRotatef(-270, 1, 0, 0); - } - if(direction.equals(ForgeDirection.SOUTH)) - { - GL11.glRotatef(-90, 1, 0, 0); - } - if(direction.equals(ForgeDirection.EAST)) - { - GL11.glRotatef(-270, 0, 0, 1); - } - if(direction.equals(ForgeDirection.WEST)) - { - GL11.glRotatef(-90, 0, 0, 1); - } - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - } -} diff --git a/src/main/java/com/hbm/render/tileentity/RenderOilDuct.java b/src/main/java/com/hbm/render/tileentity/RenderOilDuct.java deleted file mode 100644 index ec867972c..000000000 --- a/src/main/java/com/hbm/render/tileentity/RenderOilDuct.java +++ /dev/null @@ -1,153 +0,0 @@ -package com.hbm.render.tileentity; - -import org.lwjgl.opengl.GL11; - -import com.hbm.lib.RefStrings; -import com.hbm.tileentity.conductor.TileEntityOilDuct; - -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.common.util.ForgeDirection; - -public class RenderOilDuct extends TileEntitySpecialRenderer { - - public ResourceLocation texture = new ResourceLocation(RefStrings.MODID, "textures/blocks/oil_duct_alt.png"); - float pixel = 1F/16F; - float textureP = 1F / 32F; - - @Override - public void renderTileEntityAt(TileEntity tileentity, double offsetX, double offsetY, double offsetZ, float f) { - GL11.glTranslated(offsetX, offsetY, offsetZ); - GL11.glDisable(GL11.GL_LIGHTING); - this.bindTexture(texture); - drawCore(tileentity); - TileEntityOilDuct cable = (TileEntityOilDuct) tileentity; - for(int i = 0; i < cable.connections.length; i++) - { - if(cable.connections[i] != null) - { - drawConnection(cable.connections[i]); - } - } - GL11.glTranslated(-offsetX, -offsetY, -offsetZ); - GL11.glEnable(GL11.GL_LIGHTING); - - } - - public void drawCore(TileEntity tileentity) { - Tessellator tesseract = Tessellator.instance; - tesseract.startDrawingQuads(); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * textureP, 5 * textureP); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * textureP, 0 * textureP); - tesseract.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 0 * textureP, 0 * textureP); - tesseract.addVertexWithUV(11 * pixel / 2, 11 * pixel / 2, 1 - 11 * pixel / 2, 0 * textureP, 5 * textureP); - - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 11 * pixel / 2, 11 * pixel / 2, 5 * textureP, 5 * textureP); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 5 * textureP, 0 * textureP); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 0 * textureP, 0 * textureP); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 11 * pixel / 2, 1 - 11 * pixel / 2, 0 * textureP, 5 * textureP); - - tesseract.addVertexWithUV(11 * pixel / 2, 11 * pixel / 2, 11 * pixel / 2, 5 * textureP, 5 * textureP); - tesseract.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 5 * textureP, 0 * textureP); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 0 * textureP, 0 * textureP); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 11 * pixel / 2, 11 * pixel / 2, 0 * textureP, 5 * textureP); - - tesseract.addVertexWithUV(11 * pixel / 2, 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * textureP, 5 * textureP); - tesseract.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * textureP, 0 * textureP); - tesseract.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 0 * textureP, 0 * textureP); - tesseract.addVertexWithUV(11 * pixel / 2, 11 * pixel / 2, 11 * pixel / 2, 0 * textureP, 5 * textureP); - - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * textureP, 5 * textureP); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 5 * textureP, 0 * textureP); - tesseract.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 0 * textureP, 0 * textureP); - tesseract.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 0 * textureP, 5 * textureP); - - tesseract.addVertexWithUV(11 * pixel / 2, 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * textureP, 5 * textureP); - tesseract.addVertexWithUV(11 * pixel / 2, 11 * pixel / 2, 11 * pixel / 2, 5 * textureP, 0 * textureP); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 11 * pixel / 2, 11 * pixel / 2, 0 * textureP, 0 * textureP); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 11 * pixel / 2, 1 - 11 * pixel / 2, 0 * textureP, 5 * textureP); - tesseract.draw(); - } - - public void drawConnection(ForgeDirection direction) - { - Tessellator tesseract = Tessellator.instance; - tesseract.startDrawingQuads(); - GL11.glTranslatef(0.5F, 0.5F, 0.5F); - if(direction.equals(ForgeDirection.UP)) - { - - } - if(direction.equals(ForgeDirection.DOWN)) - { - GL11.glRotatef(180, 1, 0, 0); - } - if(direction.equals(ForgeDirection.NORTH)) - { - GL11.glRotatef(270, 1, 0, 0); - } - if(direction.equals(ForgeDirection.SOUTH)) - { - GL11.glRotatef(90, 1, 0, 0); - } - if(direction.equals(ForgeDirection.EAST)) - { - GL11.glRotatef(270, 0, 0, 1); - } - if(direction.equals(ForgeDirection.WEST)) - { - GL11.glRotatef(90, 0, 0, 1); - } - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * textureP, 5 * textureP); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1, 1 - 11 * pixel / 2, 10 * textureP, 5 * textureP); - tesseract.addVertexWithUV(11 * pixel / 2, 1, 1 - 11 * pixel / 2, 10 * textureP, 0 * textureP); - tesseract.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * textureP, 0 * textureP); - - tesseract.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 5 * textureP, 5 * textureP); - tesseract.addVertexWithUV(11 * pixel / 2, 1, 11 * pixel / 2, 10 * textureP, 5 * textureP); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1, 11 * pixel / 2, 10 * textureP, 0 * textureP); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 5 * textureP, 0 * textureP); - - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 5 * textureP, 5 * textureP); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1, 11 * pixel / 2, 10 * textureP, 5 * textureP); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1, 1 - 11 * pixel / 2, 10 * textureP, 0 * textureP); - tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * textureP, 0 * textureP); - - tesseract.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * textureP, 5 * textureP); - tesseract.addVertexWithUV(11 * pixel / 2, 1, 1 - 11 * pixel / 2, 10 * textureP, 5 * textureP); - tesseract.addVertexWithUV(11 * pixel / 2, 1, 11 * pixel / 2, 10 * textureP, 0 * textureP); - tesseract.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 5 * textureP, 0 * textureP); - tesseract.draw(); - - GL11.glTranslatef(0.5F, 0.5F, 0.5F); - if(direction.equals(ForgeDirection.UP)) - { - - } - if(direction.equals(ForgeDirection.DOWN)) - { - GL11.glRotatef(-180, 1, 0, 0); - } - if(direction.equals(ForgeDirection.NORTH)) - { - GL11.glRotatef(-270, 1, 0, 0); - } - if(direction.equals(ForgeDirection.SOUTH)) - { - GL11.glRotatef(-90, 1, 0, 0); - } - if(direction.equals(ForgeDirection.EAST)) - { - GL11.glRotatef(-270, 0, 0, 1); - } - if(direction.equals(ForgeDirection.WEST)) - { - GL11.glRotatef(-90, 0, 0, 1); - } - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - } -} diff --git a/src/main/java/com/hbm/tileentity/TileMappings.java b/src/main/java/com/hbm/tileentity/TileMappings.java index e9ba74599..697a65aa4 100644 --- a/src/main/java/com/hbm/tileentity/TileMappings.java +++ b/src/main/java/com/hbm/tileentity/TileMappings.java @@ -87,10 +87,6 @@ public class TileMappings { put(TileEntityPartEmitter.class, "tileentity_partemitter"); put(TileEntityDummy.class, "tileentity_dummy"); put(TileEntityMachineCyclotron.class, "tileentity_cyclotron"); - put(TileEntityOilDuct.class, "tileentity_oil_duct"); - put(TileEntityOilDuctSolid.class, "tileentity_oil_duct_solid"); - put(TileEntityGasDuct.class, "tileentity_gas_duct"); - put(TileEntityGasDuctSolid.class, "tileentity_gas_duct_solid"); put(TileEntityMachineRTG.class, "tileentity_machine_rtg"); put(TileEntityStructureMarker.class, "tileentity_structure_marker"); put(TileEntityMachineMiningDrill.class, "tileentity_mining_drill"); @@ -192,6 +188,8 @@ public class TileMappings { put(TileEntityPipeBaseNT.class, "tileentity_pipe_base"); put(TileEntityPipePaintable.class, "tileentity_pipe_paintable"); put(TileEntityPipeGauge.class, "tileentity_pipe_gauge"); + put(TileEntityPipeExhaust.class, "tileentity_pipe_exhaust"); + put(TileEntityFluidValve.class, "tileentity_pipe_valve"); put(TileEntityMachineBAT9000.class, "tileentity_bat9000"); put(TileEntityMachineOrbus.class, "tileentity_orbus"); put(TileEntityGlpyhidSpawner.class, "tileentity_glyphid_spawner"); diff --git a/src/main/java/com/hbm/tileentity/conductor/TileEntityGasDuct.java b/src/main/java/com/hbm/tileentity/conductor/TileEntityGasDuct.java deleted file mode 100644 index bcc06b8a4..000000000 --- a/src/main/java/com/hbm/tileentity/conductor/TileEntityGasDuct.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.hbm.tileentity.conductor; - -import java.util.ArrayList; -import java.util.List; - -import com.hbm.blocks.ModBlocks; -import com.hbm.calc.UnionOfTileEntitiesAndBooleansForFluids; -import com.hbm.interfaces.IFluidDuct; -import com.hbm.inventory.fluid.FluidType; -import com.hbm.inventory.fluid.Fluids; -import com.hbm.lib.Library; -import com.hbm.tileentity.network.TileEntityPipeBaseNT; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; - -public class TileEntityGasDuct extends TileEntity implements IFluidDuct { - - public ForgeDirection[] connections = new ForgeDirection[6]; - public FluidType type = Fluids.GAS; - public List uoteab = new ArrayList(); - - @Override - public void updateEntity() { - - //this.updateConnections(); - - worldObj.setBlock(xCoord, yCoord, zCoord, ModBlocks.fluid_duct_neo, 1, 3); - - TileEntity tile = worldObj.getTileEntity(xCoord, yCoord, zCoord); - if(tile instanceof TileEntityPipeBaseNT) { - ((TileEntityPipeBaseNT) tile).setType(this.type); - } - } - - public void updateConnections() { - if(Library.checkFluidConnectables(this.worldObj, xCoord, yCoord + 1, zCoord, type)) - connections[0] = ForgeDirection.UP; - else - connections[0] = null; - - if(Library.checkFluidConnectables(this.worldObj, xCoord, yCoord - 1, zCoord, type)) - connections[1] = ForgeDirection.DOWN; - else - connections[1] = null; - - if(Library.checkFluidConnectables(this.worldObj, xCoord, yCoord, zCoord - 1, type)) - connections[2] = ForgeDirection.NORTH; - else - connections[2] = null; - - if(Library.checkFluidConnectables(this.worldObj, xCoord + 1, yCoord, zCoord, type)) - connections[3] = ForgeDirection.EAST; - else - connections[3] = null; - - if(Library.checkFluidConnectables(this.worldObj, xCoord, yCoord, zCoord + 1, type)) - connections[4] = ForgeDirection.SOUTH; - else - connections[4] = null; - - if(Library.checkFluidConnectables(this.worldObj, xCoord - 1, yCoord, zCoord, type)) - connections[5] = ForgeDirection.WEST; - else - connections[5] = null; - } - - @Override - public void readFromNBT(NBTTagCompound nbt) { - super.readFromNBT(nbt); - type = Fluids.GAS; - } - - @Override - public void writeToNBT(NBTTagCompound nbt) { - super.writeToNBT(nbt); - } - - @Override - @SideOnly(Side.CLIENT) - public double getMaxRenderDistanceSquared() { - return 65536.0D; - } - - @Override - public FluidType getType() { - return type; - } - - @Override - public boolean setType(FluidType type) { - return false; - } -} diff --git a/src/main/java/com/hbm/tileentity/conductor/TileEntityGasDuctSolid.java b/src/main/java/com/hbm/tileentity/conductor/TileEntityGasDuctSolid.java deleted file mode 100644 index a78c2a6e3..000000000 --- a/src/main/java/com/hbm/tileentity/conductor/TileEntityGasDuctSolid.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.hbm.tileentity.conductor; - -import java.util.ArrayList; -import java.util.List; - -import com.hbm.blocks.ModBlocks; -import com.hbm.calc.UnionOfTileEntitiesAndBooleansForFluids; -import com.hbm.interfaces.IFluidDuct; -import com.hbm.inventory.fluid.FluidType; -import com.hbm.inventory.fluid.Fluids; -import com.hbm.tileentity.network.TileEntityPipeBaseNT; - -import net.minecraft.tileentity.TileEntity; - -public class TileEntityGasDuctSolid extends TileEntity implements IFluidDuct { - - public FluidType type = Fluids.GAS; - public List uoteab = new ArrayList(); - - @Override - public void updateEntity() { - - //if(!worldObj.isRemote) - // PacketDispatcher.wrapper.sendToAll(new TEFluidPipePacket(xCoord, yCoord, zCoord, type)); - - //this.updateConnections(); - - worldObj.setBlock(xCoord, yCoord, zCoord, ModBlocks.fluid_duct_paintable); - - TileEntity tile = worldObj.getTileEntity(xCoord, yCoord, zCoord); - if(tile instanceof TileEntityPipeBaseNT) { - ((TileEntityPipeBaseNT) tile).setType(this.type); - } - } - - @Override - public FluidType getType() { - return type; - } - - @Override - public boolean setType(FluidType type) { - return false; - } -} diff --git a/src/main/java/com/hbm/tileentity/conductor/TileEntityOilDuct.java b/src/main/java/com/hbm/tileentity/conductor/TileEntityOilDuct.java deleted file mode 100644 index 9db606172..000000000 --- a/src/main/java/com/hbm/tileentity/conductor/TileEntityOilDuct.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.hbm.tileentity.conductor; - -import java.util.ArrayList; -import java.util.List; - -import com.hbm.blocks.ModBlocks; -import com.hbm.calc.UnionOfTileEntitiesAndBooleansForFluids; -import com.hbm.interfaces.IFluidDuct; -import com.hbm.inventory.fluid.FluidType; -import com.hbm.inventory.fluid.Fluids; -import com.hbm.lib.Library; -import com.hbm.tileentity.network.TileEntityPipeBaseNT; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; - -public class TileEntityOilDuct extends TileEntity implements IFluidDuct { - - public ForgeDirection[] connections = new ForgeDirection[6]; - public FluidType type = Fluids.OIL; - public List uoteab = new ArrayList(); - - public TileEntityOilDuct() { - - } - - @Override - public void updateEntity() { - - //if(!worldObj.isRemote) - // PacketDispatcher.wrapper.sendToAll(new TEFluidPipePacket(xCoord, yCoord, zCoord, type)); - - //this.updateConnections(); - - worldObj.setBlock(xCoord, yCoord, zCoord, ModBlocks.fluid_duct_neo, 2, 3); - - TileEntity tile = worldObj.getTileEntity(xCoord, yCoord, zCoord); - if(tile instanceof TileEntityPipeBaseNT) { - ((TileEntityPipeBaseNT) tile).setType(this.type); - } - } - - public void updateConnections() { - if(Library.checkFluidConnectables(this.worldObj, xCoord, yCoord + 1, zCoord, type)) connections[0] = ForgeDirection.UP; - else connections[0] = null; - - if(Library.checkFluidConnectables(this.worldObj, xCoord, yCoord - 1, zCoord, type)) connections[1] = ForgeDirection.DOWN; - else connections[1] = null; - - if(Library.checkFluidConnectables(this.worldObj, xCoord, yCoord, zCoord - 1, type)) connections[2] = ForgeDirection.NORTH; - else connections[2] = null; - - if(Library.checkFluidConnectables(this.worldObj, xCoord + 1, yCoord, zCoord, type)) connections[3] = ForgeDirection.EAST; - else connections[3] = null; - - if(Library.checkFluidConnectables(this.worldObj, xCoord, yCoord, zCoord + 1, type)) connections[4] = ForgeDirection.SOUTH; - else connections[4] = null; - - if(Library.checkFluidConnectables(this.worldObj, xCoord - 1, yCoord, zCoord, type)) connections[5] = ForgeDirection.WEST; - else connections[5] = null; - } - - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - type = Fluids.OIL; - } - - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - } - - @Override - @SideOnly(Side.CLIENT) - public double getMaxRenderDistanceSquared() - { - return 65536.0D; - } - - @Override - public FluidType getType() { - return type; - } - - @Override - public boolean setType(FluidType type) { - return false; - } -} diff --git a/src/main/java/com/hbm/tileentity/conductor/TileEntityOilDuctSolid.java b/src/main/java/com/hbm/tileentity/conductor/TileEntityOilDuctSolid.java deleted file mode 100644 index 940494cbc..000000000 --- a/src/main/java/com/hbm/tileentity/conductor/TileEntityOilDuctSolid.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.hbm.tileentity.conductor; - -import java.util.ArrayList; -import java.util.List; - -import com.hbm.blocks.ModBlocks; -import com.hbm.calc.UnionOfTileEntitiesAndBooleansForFluids; -import com.hbm.interfaces.IFluidDuct; -import com.hbm.inventory.fluid.FluidType; -import com.hbm.inventory.fluid.Fluids; -import com.hbm.tileentity.network.TileEntityPipeBaseNT; - -import net.minecraft.tileentity.TileEntity; - -public class TileEntityOilDuctSolid extends TileEntity implements IFluidDuct { - - public FluidType type = Fluids.OIL; - public List uoteab = new ArrayList(); - - @Override - public void updateEntity() { - - //if(!worldObj.isRemote) - // PacketDispatcher.wrapper.sendToAll(new TEFluidPipePacket(xCoord, yCoord, zCoord, type)); - - //this.updateConnections(); - - worldObj.setBlock(xCoord, yCoord, zCoord, ModBlocks.fluid_duct_paintable); - - TileEntity tile = worldObj.getTileEntity(xCoord, yCoord, zCoord); - if(tile instanceof TileEntityPipeBaseNT) { - ((TileEntityPipeBaseNT) tile).setType(this.type); - } - } - - @Override - public FluidType getType() { - return type; - } - - @Override - public boolean setType(FluidType type) { - return false; - } -} diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineBoiler.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineBoiler.java index 7882e3e8c..3323f4bce 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineBoiler.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineBoiler.java @@ -5,6 +5,8 @@ import java.util.List; import com.hbm.blocks.ModBlocks; import com.hbm.blocks.machine.MachineBoiler; +import com.hbm.handler.pollution.PollutionHandler; +import com.hbm.handler.pollution.PollutionHandler.PollutionType; import com.hbm.interfaces.IFluidAcceptor; import com.hbm.interfaces.IFluidContainer; import com.hbm.interfaces.IFluidSource; @@ -253,6 +255,7 @@ public class TileEntityMachineBoiler extends TileEntityLoadedBase implements ISi if(burnTime > 0) { burnTime--; + if(worldObj.getTotalWorldTime() % 20 == 0) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND); heat += 50; flag1 = true; } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTurbineGas.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTurbineGas.java index f00709901..336e27bc5 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTurbineGas.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTurbineGas.java @@ -3,6 +3,8 @@ package com.hbm.tileentity.machine; import java.util.HashMap; import com.hbm.blocks.BlockDummyable; +import com.hbm.handler.pollution.PollutionHandler; +import com.hbm.handler.pollution.PollutionHandler.PollutionType; import com.hbm.interfaces.IControlReceiver; import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.inventory.fluid.trait.FT_Combustible; @@ -298,6 +300,7 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement } double consumption = fuelMaxCons.containsKey(tanks[0].getTankType()) ? fuelMaxCons.get(tanks[0].getTankType()) : 5D; + if(worldObj.getTotalWorldTime() % 20 == 0) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND * (float) consumption * 0.25F); makePower(consumption, throttle); } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTurbofan.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTurbofan.java index 613032cb6..e3f2e7705 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTurbofan.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTurbofan.java @@ -5,6 +5,8 @@ import java.util.List; import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ModBlocks; import com.hbm.handler.MultiblockHandlerXR; +import com.hbm.handler.pollution.PollutionHandler; +import com.hbm.handler.pollution.PollutionHandler.PollutionType; import com.hbm.interfaces.IFluidAcceptor; import com.hbm.interfaces.IFluidContainer; import com.hbm.inventory.UpgradeManager; @@ -161,6 +163,8 @@ public class TileEntityMachineTurbofan extends TileEntityMachineBase implements this.wasOn = true; this.tank.setFill(this.tank.getFill() - amountToBurn); this.power += burnValue * amountToBurn; + + if(worldObj.getTotalWorldTime() % 20 == 0) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND * amountToBurn); } power = Library.chargeItemsFromTE(slots, 3, power, power); diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityFluidValve.java b/src/main/java/com/hbm/tileentity/network/TileEntityFluidValve.java new file mode 100644 index 000000000..6e1a226dd --- /dev/null +++ b/src/main/java/com/hbm/tileentity/network/TileEntityFluidValve.java @@ -0,0 +1,27 @@ +package com.hbm.tileentity.network; + +import api.hbm.fluid.PipeNet; + +public class TileEntityFluidValve extends TileEntityPipeBaseNT { + + @Override + public boolean canUpdate() { + return this.worldObj != null && this.getBlockMetadata() == 1 && super.canUpdate(); + } + + public void updateState() { + + if(this.getBlockMetadata() == 0 && this.network != null) { + this.network.destroy(); + this.network = null; + } + + if(this.getBlockMetadata() == 1) { + this.connect(); + + if(this.getPipeNet(type) == null) { + new PipeNet(type).joinLink(this); + } + } + } +} diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityPipeExhaust.java b/src/main/java/com/hbm/tileentity/network/TileEntityPipeExhaust.java new file mode 100644 index 000000000..c871d3941 --- /dev/null +++ b/src/main/java/com/hbm/tileentity/network/TileEntityPipeExhaust.java @@ -0,0 +1,82 @@ +package com.hbm.tileentity.network; + +import java.util.HashMap; +import java.util.Map.Entry; + +import com.hbm.inventory.fluid.FluidType; +import com.hbm.inventory.fluid.Fluids; +import com.hbm.util.Compat; + +import api.hbm.fluid.IFluidConductor; +import api.hbm.fluid.IPipeNet; +import api.hbm.fluid.PipeNet; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; + +public class TileEntityPipeExhaust extends TileEntity implements IFluidConductor { + + public HashMap nets = new HashMap(); + + @Override + public void updateEntity() { + + if(!worldObj.isRemote && canUpdate()) { + + //we got here either because the net doesn't exist or because it's not valid, so that's safe to assume + this.nets.clear(); + + for(Entry entry : nets.entrySet()) { + + this.connect(entry.getKey()); + + if(this.getPipeNet(entry.getKey()) == null) { + this.setPipeNet(entry.getKey(), new PipeNet(entry.getKey()).joinLink(this)); + } + } + } + } + + protected void connect(FluidType type) { + + for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { + + TileEntity te = Compat.getTileStandard(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ); + + if(te instanceof IFluidConductor) { + + IFluidConductor conductor = (IFluidConductor) te; + + if(!conductor.canConnect(type, dir.getOpposite())) + continue; + + if(this.getPipeNet(type) == null && conductor.getPipeNet(type) != null) { + conductor.getPipeNet(type).joinLink(this); + } + + if(this.getPipeNet(type) != null && conductor.getPipeNet(type) != null && this.getPipeNet(type) != conductor.getPipeNet(type)) { + conductor.getPipeNet(type).joinNetworks(this.getPipeNet(type)); + } + } + } + } + + @Override + public boolean canConnect(FluidType type, ForgeDirection dir) { + return type == Fluids.SMOKE || type == Fluids.SMOKE_LEADED || type == Fluids.SMOKE_POISON; + } + + @Override + public long getDemand(FluidType type, int pressure) { + return 0; + } + + @Override + public IPipeNet getPipeNet(FluidType type) { + return nets.get(type); + } + + @Override + public void setPipeNet(FluidType type, IPipeNet network) { + nets.put(type, network); + } +} diff --git a/src/main/resources/assets/hbm/lang/de_DE.lang b/src/main/resources/assets/hbm/lang/de_DE.lang index 99542b701..1a4bc80b9 100644 --- a/src/main/resources/assets/hbm/lang/de_DE.lang +++ b/src/main/resources/assets/hbm/lang/de_DE.lang @@ -1689,6 +1689,7 @@ item.dysfunctional_reactor.name=Funktionsunfähiger Atomreaktor item.egg_balefire.name=Balefire-Ei item.egg_balefire.desc=Was für ein Vogel legt denn ein radioaktives Ei? item.egg_balefire_shard.name=Balefire-Scherbe +item.egg_glyphid.name=Glyphid-Ei item.elec_axe.name=Elektrische Kettensäge item.elec_pickaxe.name=Schlagbohrmaschine item.elec_shovel.name=Spiralbohrer @@ -3792,11 +3793,14 @@ tile.flame_war.name=Flamewar aus der Box tile.float_bomb.name=Schwebebombe tile.fluid_duct.name=Universelles Flüssigkeitsrohr (Veraltet) tile.fluid_duct_box.name=Universelles Flüssigkeitsrohr (Boxrohr) +tile.fluid_duct_exhaust.name=Abgasrohr tile.fluid_duct_gauge.name=Flussmessrohr tile.fluid_duct_gauge.desc=Rohr welches anzeight, wie viel Flüssigkeit$sich pro Tick im Netzwerk bewegt.$Geteilte Netzwerke die über Fässer oder Tanks$verbunden sind, werden als ein einzelnes gezählt. tile.fluid_duct_neo.name=Universelles Flüssigkeitsrohr tile.fluid_duct_paintable.name=Geschirmtes universelles Flüssigkeitsrohr (Färbbar) tile.fluid_duct_solid.name=Geschirmtes universelles Flüssigkeitsrohr (Veraltet) +tile.fluid_switch.name=Redstone-Ventil +tile.fluid_valve.name=Ventil tile.foam_layer.name=Schaumdecke tile.foundry_basin.name=Gussbecken tile.foundry_channel.name=Gusskanal diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index 01de09f83..75ec980cc 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -2365,6 +2365,7 @@ item.early_explosive_lenses.desc=Assembly of 8 high-explosive lenses with an alu item.egg_balefire.name=Balefire Egg item.egg_balefire.desc=What kind of bird lays a radioactive egg? item.egg_balefire_shard.name=Balefire Shard +item.egg_glyphid.name=Glyphid Egg item.elec_axe.name=Electric Chainsaw item.elec_pickaxe.name=Impact Drill item.elec_shovel.name=Spiral Drill @@ -4660,11 +4661,14 @@ tile.flame_war.name=Flame War in a Box tile.float_bomb.name=Levitation Bomb tile.fluid_duct.name=Universal Fluid Duct (Deprecated) tile.fluid_duct_box.name=Universal Fluid Duct (Boxduct) +tile.fluid_duct_exhaust.name=Exhaust Pipe tile.fluid_duct_gauge.name=Flow Gauge Pipe tile.fluid_duct_gauge.desc=Pipe that displays how much fluid$moves within the network per tick.$Split networks connected by barrels$or tanks are considered as one shared network. tile.fluid_duct_neo.name=Universal Fluid Duct tile.fluid_duct_paintable.name=Paintable Coated Universal Fluid Duct tile.fluid_duct_solid.name=Coated Universal Fluid Duct (Deprecated) +tile.fluid_switch.name=Redstone Fluid Valve +tile.fluid_valve.name=Fluid Valve tile.foam_layer.name=Foam layer tile.foundry_basin.name=Foundry Basin tile.foundry_channel.name=Foundry Channel diff --git a/src/main/resources/assets/hbm/textures/blocks/boxduct_exhaust.png b/src/main/resources/assets/hbm/textures/blocks/boxduct_exhaust.png new file mode 100644 index 000000000..ab1816ba5 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/boxduct_exhaust.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/boxduct_exhaust_curve_bl.png b/src/main/resources/assets/hbm/textures/blocks/boxduct_exhaust_curve_bl.png new file mode 100644 index 000000000..48dc1e6b8 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/boxduct_exhaust_curve_bl.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/boxduct_exhaust_curve_br.png b/src/main/resources/assets/hbm/textures/blocks/boxduct_exhaust_curve_br.png new file mode 100644 index 000000000..51129d041 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/boxduct_exhaust_curve_br.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/boxduct_exhaust_curve_tl.png b/src/main/resources/assets/hbm/textures/blocks/boxduct_exhaust_curve_tl.png new file mode 100644 index 000000000..6a7379597 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/boxduct_exhaust_curve_tl.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/boxduct_exhaust_curve_tr.png b/src/main/resources/assets/hbm/textures/blocks/boxduct_exhaust_curve_tr.png new file mode 100644 index 000000000..846ec559e Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/boxduct_exhaust_curve_tr.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/boxduct_exhaust_end.png b/src/main/resources/assets/hbm/textures/blocks/boxduct_exhaust_end.png new file mode 100644 index 000000000..2065be57b Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/boxduct_exhaust_end.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/boxduct_exhaust_junction.png b/src/main/resources/assets/hbm/textures/blocks/boxduct_exhaust_junction.png new file mode 100644 index 000000000..8019ad543 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/boxduct_exhaust_junction.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/boxduct_exhaust_straight.png b/src/main/resources/assets/hbm/textures/blocks/boxduct_exhaust_straight.png new file mode 100644 index 000000000..f6a5ed43e Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/boxduct_exhaust_straight.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/fluid_switch_off.png b/src/main/resources/assets/hbm/textures/blocks/fluid_switch_off.png new file mode 100644 index 000000000..b12413cf5 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/fluid_switch_off.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/fluid_switch_on.png b/src/main/resources/assets/hbm/textures/blocks/fluid_switch_on.png new file mode 100644 index 000000000..46c641f19 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/fluid_switch_on.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/fluid_valve_off.png b/src/main/resources/assets/hbm/textures/blocks/fluid_valve_off.png index 62e2dc7cf..fcf1d2a54 100644 Binary files a/src/main/resources/assets/hbm/textures/blocks/fluid_valve_off.png and b/src/main/resources/assets/hbm/textures/blocks/fluid_valve_off.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/fluid_valve_on.png b/src/main/resources/assets/hbm/textures/blocks/fluid_valve_on.png index 4bb093842..19c8bec2a 100644 Binary files a/src/main/resources/assets/hbm/textures/blocks/fluid_valve_on.png and b/src/main/resources/assets/hbm/textures/blocks/fluid_valve_on.png differ