diff --git a/resources/mods/fluidmech/languages/en_US.properties b/resources/mods/fluidmech/languages/en_US.properties index 0be8acd0..3b9ed7d4 100644 --- a/resources/mods/fluidmech/languages/en_US.properties +++ b/resources/mods/fluidmech/languages/en_US.properties @@ -11,10 +11,10 @@ tile.eValve.0.name=Release Valve tile.lmTank.name = Tank tile.lmSink.name = Sink -tile.lmPipe.0.name =Oil Pipe -tile.lmPipe.1.name =Lava Pipe +tile.lmPipe.0.name =Black Pipe +tile.lmPipe.1.name =Red Pipe tile.lmPipe.2.name =Green Pipe -tile.lmPipe.3.name =Waste Pipe +tile.lmPipe.3.name =Brown Pipe tile.lmPipe.4.name =Water Pipe tile.lmPipe.5.name =Purple Pipe tile.lmPipe.6.name =Cyan Pipe @@ -22,12 +22,29 @@ tile.lmPipe.7.name =Silver Pipe tile.lmPipe.8.name =Grey Pipe tile.lmPipe.9.name =Pink Pipe tile.lmPipe.10.name =Lime Pipe -tile.lmPipe.11.name =Fuel Pipe +tile.lmPipe.11.name =Yellow Pipe tile.lmPipe.12.name =LightBlue Pipe -tile.lmPipe.13.name =Milk Pipe +tile.lmPipe.13.name =White Pipe tile.lmPipe.14.name =Orange Pipe tile.lmPipe.15.name =Generic Pipe +tile.rpipe.0.name =Oil Pipe +tile.rpipe.1.name =Lava Pipe +tile.rpipe.2.name =G Pipe +tile.rpipe.3.name =Waste Pipe +tile.rpipe.4.name =Water Pipe +tile.rpipe.5.name =P Pipe +tile.rpipe.6.name =C Pipe +tile.rpipe.7.name =S Pipe +tile.rpipe.8.name =G Pipe +tile.rpipe.9.name =P Pipe +tile.rpipe.10.name =L Pipe +tile.rpipe.11.name =Fuel Pipe +tile.rpipe.12.name =LB Pipe +tile.rpipe.13.name =Milk Pipe +tile.rpipe.14.name =Steam Pipe +tile.rpipe.15.name =Generic Pipe + tile.lmTank.0.name =Oil Tank tile.lmTank.1.name =Lava Tank tile.lmTank.2.name =Green Tank diff --git a/src/minecraft/fluidmech/common/FluidMech.java b/src/minecraft/fluidmech/common/FluidMech.java index 72162c2f..cf0a581a 100644 --- a/src/minecraft/fluidmech/common/FluidMech.java +++ b/src/minecraft/fluidmech/common/FluidMech.java @@ -16,6 +16,7 @@ import fluidmech.common.machines.mech.BlockRod; import fluidmech.common.machines.mech.TileEntityGenerator; import fluidmech.common.machines.mech.TileEntityRod; import fluidmech.common.machines.pipes.BlockPipe; +import fluidmech.common.machines.pipes.TileEntityGenericPipe; import fluidmech.common.machines.pipes.TileEntityPipe; import fluidmech.common.machines.pipes.TileEntityPipeWindow; import fluidmech.common.pump.BlockConstructionPump; @@ -117,6 +118,7 @@ public class FluidMech extends DummyModContainer /* BLOCKS */ public static Block blockPipe; + public static Block blockGenPipe; public static Block blockTank; public static Block blockMachine; public static Block blockRod; @@ -172,6 +174,7 @@ public class FluidMech extends DummyModContainer blockSink = new BlockSink(this.CONFIGURATION.getBlock("Sink", BLOCK_ID_PREFIX + 8).getInt()); blockDrain = new BlockDrain(this.CONFIGURATION.getBlock("Drain", BLOCK_ID_PREFIX + 9).getInt()); blockConPump = new BlockConstructionPump(this.CONFIGURATION.getBlock("ConstructionPump", BLOCK_ID_PREFIX + 10).getInt()); + blockGenPipe = new BlockPipe(this.CONFIGURATION.getBlock("GeneralPipes", BLOCK_ID_PREFIX+11).getInt()); /* ITEM DECLARATION -- COFNGI LOADER */ itemParts = new ItemParts(this.CONFIGURATION.getItem("Parts", ITEM_ID_PREFIX).getInt()); @@ -183,6 +186,7 @@ public class FluidMech extends DummyModContainer /* BLOCK REGISTER CALLS */ GameRegistry.registerBlock(blockPipe, ItemBlockPipe.class, "lmPipe"); + GameRegistry.registerBlock(blockPipe, ItemBlockPipe.class, "lmGenPipe"); GameRegistry.registerBlock(blockReleaseValve, ItemBlockReleaseValve.class, "eValve"); GameRegistry.registerBlock(blockRod, "mechRod"); GameRegistry.registerBlock(blockGenerator, "lmGen"); @@ -216,6 +220,7 @@ public class FluidMech extends DummyModContainer /* TILE ENTITY REGISTER CALLS */ GameRegistry.registerTileEntity(TileEntityPipe.class, "lmPipeTile"); + GameRegistry.registerTileEntity(TileEntityGenericPipe.class, "lmGenPipeTile"); GameRegistry.registerTileEntity(TileEntityStarterPump.class, "lmPumpTile"); GameRegistry.registerTileEntity(TileEntityRod.class, "lmRodTile"); GameRegistry.registerTileEntity(TileEntityReleaseValve.class, "lmeValve"); diff --git a/src/minecraft/fluidmech/common/item/ItemBlockPipe.java b/src/minecraft/fluidmech/common/item/ItemBlockPipe.java index 125e0245..2e58a64c 100644 --- a/src/minecraft/fluidmech/common/item/ItemBlockPipe.java +++ b/src/minecraft/fluidmech/common/item/ItemBlockPipe.java @@ -1,5 +1,6 @@ package fluidmech.common.item; +import fluidmech.common.FluidMech; import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; @@ -22,7 +23,11 @@ public class ItemBlockPipe extends ItemBlock @Override public String getUnlocalizedName(ItemStack itemStack) - { + { + if(itemStack.itemID == FluidMech.blockPipe.blockID) + { + return "tile.rpipe." + itemStack.getItemDamage(); + } return Block.blocksList[this.getBlockID()].getUnlocalizedName() + "." + itemStack.getItemDamage(); } } diff --git a/src/minecraft/fluidmech/common/machines/pipes/BlockPipe.java b/src/minecraft/fluidmech/common/machines/pipes/BlockPipe.java index 110ac572..a576b2f2 100644 --- a/src/minecraft/fluidmech/common/machines/pipes/BlockPipe.java +++ b/src/minecraft/fluidmech/common/machines/pipes/BlockPipe.java @@ -1,5 +1,6 @@ package fluidmech.common.machines.pipes; +import hydraulic.api.FluidRestrictionHandler; import hydraulic.fluidnetwork.IFluidNetworkPart; import java.util.List; @@ -26,8 +27,8 @@ public class BlockPipe extends BlockAdvanced this.setCreativeTab(TabFluidMech.INSTANCE); this.setUnlocalizedName("lmPipe"); this.setResistance(3f); + } - @Override public boolean isOpaqueCube() { @@ -94,7 +95,10 @@ public class BlockPipe extends BlockAdvanced { for (int i = 0; i < 16; i++) { - par3List.add(new ItemStack(par1, 1, i)); + if (this.blockID == FluidMech.blockGenPipe.blockID || FluidRestrictionHandler.hasRestrictedStack(i)) + { + par3List.add(new ItemStack(par1, 1, i)); + } } } diff --git a/src/minecraft/fluidmech/common/machines/pipes/TileEntityGenericPipe.java b/src/minecraft/fluidmech/common/machines/pipes/TileEntityGenericPipe.java new file mode 100644 index 00000000..198f6897 --- /dev/null +++ b/src/minecraft/fluidmech/common/machines/pipes/TileEntityGenericPipe.java @@ -0,0 +1,48 @@ +package fluidmech.common.machines.pipes; + +import hydraulic.api.ColorCode; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.liquids.ILiquidTank; +import net.minecraftforge.liquids.LiquidStack; + +public class TileEntityGenericPipe extends TileEntityPipe +{ + @Override + public int fill(ForgeDirection from, LiquidStack resource, boolean doFill) + { + if (resource == null) + { + return 0; + } + return this.getNetwork().addFluidToNetwork(worldObj.getBlockTileEntity(xCoord + from.offsetX, yCoord + from.offsetY, zCoord + from.offsetZ), resource, doFill); + } + + @Override + public int fill(int tankIndex, LiquidStack resource, boolean doFill) + { + if (tankIndex != 0 || resource == null) + { + return 0; + } + return this.getNetwork().addFluidToNetwork(this, resource, doFill); + } + + @Override + public ILiquidTank getTank(ForgeDirection direction, LiquidStack type) + { + return this.fakeTank; + } + + @Override + public ColorCode getColor() + { + return ColorCode.NONE; + } + @Override + public boolean canPipeConnect(TileEntity entity, ForgeDirection dir) + { + return this.subEntities[dir.ordinal()] == null && entity.getClass().equals(this.getClass()); + } + +} diff --git a/src/minecraft/fluidmech/common/machines/pipes/TileEntityPipe.java b/src/minecraft/fluidmech/common/machines/pipes/TileEntityPipe.java index 0630e236..0ad6135a 100644 --- a/src/minecraft/fluidmech/common/machines/pipes/TileEntityPipe.java +++ b/src/minecraft/fluidmech/common/machines/pipes/TileEntityPipe.java @@ -42,7 +42,7 @@ public class TileEntityPipe extends TileEntityAdvanced implements ITankContainer { /* TANK TO FAKE OTHER TILES INTO BELIVING THIS HAS AN INTERNAL STORAGE */ - private LiquidTank fakeTank = new LiquidTank(LiquidContainerRegistry.BUCKET_VOLUME); + protected LiquidTank fakeTank = new LiquidTank(LiquidContainerRegistry.BUCKET_VOLUME); /* CURRENTLY CONNECTED TILE ENTITIES TO THIS */ private TileEntity[] connectedBlocks = new TileEntity[6]; public boolean[] renderConnection = new boolean[6]; @@ -290,7 +290,7 @@ public class TileEntityPipe extends TileEntityAdvanced implements ITankContainer tile.yCoord = this.yCoord; tile.zCoord = this.zCoord; - sendExtentionToClient(side); + this.sendExtentionToClient(side); } } @@ -324,6 +324,10 @@ public class TileEntityPipe extends TileEntityAdvanced implements ITankContainer @Override public ColorCode getColor() { + if(this.worldObj == null) + { + return ColorCode.NONE; + } return ColorCode.get(worldObj.getBlockMetadata(xCoord, yCoord, zCoord)); } @@ -336,7 +340,7 @@ public class TileEntityPipe extends TileEntityAdvanced implements ITankContainer ColorCode code = ColorCode.get(cc); if (!worldObj.isRemote && code != this.getColor()) { - this.worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, code.ordinal() & 15, 3); + this.worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, code.ordinal(), 3); } }