diff --git a/resources/assets/fm/languages/en_US.properties b/resources/assets/fm/languages/en_US.properties index af6746821..8fc499c83 100644 --- a/resources/assets/fm/languages/en_US.properties +++ b/resources/assets/fm/languages/en_US.properties @@ -66,24 +66,6 @@ tile.FluidPipe.2014.name =Mangenta Stone Trough tile.FluidPipe.2015.name =Orange Stone Trough tile.FluidPipe.2016.name =White Stone Trough -tile.FluidPipe.2000.name =Tin Pipe -tile.FluidPipe.2001.name =Black Tin Pipe -tile.FluidPipe.2002.name =Red Tin Pipe -tile.FluidPipe.2003.name =Green Tin Pipe -tile.FluidPipe.2004.name =Brown Tin Pipe -tile.FluidPipe.2005.name =Blue Tin Pipe -tile.FluidPipe.2006.name =Purple Tin Pipe -tile.FluidPipe.2007.name =Cyan Tin Pipe -tile.FluidPipe.2008.name =Silver Tin Pipe -tile.FluidPipe.2009.name =Grey Tin Pipe -tile.FluidPipe.2010.name =Pink Tin Pipe -tile.FluidPipe.2011.name =Lime Tin Pipe -tile.FluidPipe.2012.name =Yellow Tin Pipe -tile.FluidPipe.2013.name =Light Tin Pipe -tile.FluidPipe.2014.name =Mangenta Tin Pipe -tile.FluidPipe.2015.name =Orange Tin Pipe -tile.FluidPipe.2016.name =White Tin Pipe - tile.FluidPipe.3000.name =Tin Pipe tile.FluidPipe.3001.name =Black Tin Pipe tile.FluidPipe.3002.name =Red Tin Pipe diff --git a/resources/assets/fm/textures/models/pipes/OilPipe.png b/resources/assets/fm/textures/models/pipes/OilPipe.png deleted file mode 100644 index 0f34b76da..000000000 Binary files a/resources/assets/fm/textures/models/pipes/OilPipe.png and /dev/null differ diff --git a/resources/assets/fm/textures/models/pipes/SteamPipe.png b/resources/assets/fm/textures/models/pipes/SteamPipe.png deleted file mode 100644 index f8695b64c..000000000 Binary files a/resources/assets/fm/textures/models/pipes/SteamPipe.png and /dev/null differ diff --git a/resources/assets/fm/textures/models/pipes/WaterPipe.png b/resources/assets/fm/textures/models/pipes/WaterPipe.png deleted file mode 100644 index fafffce55..000000000 Binary files a/resources/assets/fm/textures/models/pipes/WaterPipe.png and /dev/null differ diff --git a/resources/assets/fm/textures/models/pipes/bronze/Pipe.png b/resources/assets/fm/textures/models/pipes/bronze/Pipe.png new file mode 100644 index 000000000..b10e7382d Binary files /dev/null and b/resources/assets/fm/textures/models/pipes/bronze/Pipe.png differ diff --git a/resources/assets/fm/textures/models/pipes/copper/Pipe.png b/resources/assets/fm/textures/models/pipes/copper/Pipe.png new file mode 100644 index 000000000..6bd0cac59 Binary files /dev/null and b/resources/assets/fm/textures/models/pipes/copper/Pipe.png differ diff --git a/resources/assets/fm/textures/models/pipes/glass/Pipe.png b/resources/assets/fm/textures/models/pipes/glass/Pipe.png new file mode 100644 index 000000000..f156e14ed Binary files /dev/null and b/resources/assets/fm/textures/models/pipes/glass/Pipe.png differ diff --git a/resources/assets/fm/textures/models/pipes/gold/Pipe.png b/resources/assets/fm/textures/models/pipes/gold/Pipe.png new file mode 100644 index 000000000..b6461dbf8 Binary files /dev/null and b/resources/assets/fm/textures/models/pipes/gold/Pipe.png differ diff --git a/resources/assets/fm/textures/models/pipes/hell/Pipe.png b/resources/assets/fm/textures/models/pipes/hell/Pipe.png new file mode 100644 index 000000000..9feeb8d92 Binary files /dev/null and b/resources/assets/fm/textures/models/pipes/hell/Pipe.png differ diff --git a/resources/assets/fm/textures/models/pipes/iron/Pipe.png b/resources/assets/fm/textures/models/pipes/iron/Pipe.png new file mode 100644 index 000000000..a408ad4c0 Binary files /dev/null and b/resources/assets/fm/textures/models/pipes/iron/Pipe.png differ diff --git a/resources/assets/fm/textures/models/pipes/milkPipe.png b/resources/assets/fm/textures/models/pipes/milkPipe.png deleted file mode 100644 index a30449fbf..000000000 Binary files a/resources/assets/fm/textures/models/pipes/milkPipe.png and /dev/null differ diff --git a/resources/assets/fm/textures/models/pipes/obby/Pipe.png b/resources/assets/fm/textures/models/pipes/obby/Pipe.png new file mode 100644 index 000000000..df31cb4f6 Binary files /dev/null and b/resources/assets/fm/textures/models/pipes/obby/Pipe.png differ diff --git a/resources/assets/fm/textures/models/pipes/steel/Pipe.png b/resources/assets/fm/textures/models/pipes/steel/Pipe.png new file mode 100644 index 000000000..c371da096 Binary files /dev/null and b/resources/assets/fm/textures/models/pipes/steel/Pipe.png differ diff --git a/resources/assets/fm/textures/models/pipes/stone/Pipe.png b/resources/assets/fm/textures/models/pipes/stone/Pipe.png new file mode 100644 index 000000000..cdc34db8a Binary files /dev/null and b/resources/assets/fm/textures/models/pipes/stone/Pipe.png differ diff --git a/resources/assets/fm/textures/models/pipes/tin/Pipe.png b/resources/assets/fm/textures/models/pipes/tin/Pipe.png new file mode 100644 index 000000000..ce6a9c096 Binary files /dev/null and b/resources/assets/fm/textures/models/pipes/tin/Pipe.png differ diff --git a/resources/assets/fm/textures/models/pipes/wood/Pipe.png b/resources/assets/fm/textures/models/pipes/wood/Pipe.png new file mode 100644 index 000000000..086a20d5a Binary files /dev/null and b/resources/assets/fm/textures/models/pipes/wood/Pipe.png differ diff --git a/src/dark/fluid/client/render/ItemRenderHelper.java b/src/dark/fluid/client/render/ItemRenderHelper.java index df9fbad30..fd6a245e2 100644 --- a/src/dark/fluid/client/render/ItemRenderHelper.java +++ b/src/dark/fluid/client/render/ItemRenderHelper.java @@ -14,6 +14,7 @@ import dark.core.prefab.ModPrefab; import dark.fluid.client.model.ModelReleaseValve; import dark.fluid.common.FMRecipeLoader; import dark.fluid.common.FluidMech; +import dark.fluid.common.pipes.PipeMaterial; @SideOnly(Side.CLIENT) public class ItemRenderHelper implements IItemRenderer @@ -52,7 +53,7 @@ public class ItemRenderHelper implements IItemRenderer GL11.glPushMatrix(); - FMLClientHandler.instance().getClient().renderEngine.bindTexture(pipe.getTexture(item.itemID, item.getItemDamage())); + FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderPipe.getTexture(PipeMaterial.get(item.getItemDamage()), item.getItemDamage() % PipeMaterial.spacing)); if (!equ) { GL11.glTranslatef(0.5F, -0.5F, 0.5F); diff --git a/src/dark/fluid/client/render/RenderPipe.java b/src/dark/fluid/client/render/RenderPipe.java index 8e6b6175c..886640f0f 100644 --- a/src/dark/fluid/client/render/RenderPipe.java +++ b/src/dark/fluid/client/render/RenderPipe.java @@ -2,26 +2,23 @@ package dark.fluid.client.render; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fluids.Fluid; import org.lwjgl.opengl.GL11; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import dark.api.ColorCode; import dark.core.client.renders.RenderTileMachine; import dark.core.prefab.ModPrefab; -import dark.core.prefab.helpers.FluidHelper; import dark.fluid.client.model.ModelLargePipe; -import dark.fluid.common.FMRecipeLoader; import dark.fluid.common.FluidMech; +import dark.fluid.common.pipes.EnumPipeType; +import dark.fluid.common.pipes.PipeMaterial; import dark.fluid.common.pipes.TileEntityPipe; @SideOnly(Side.CLIENT) public class RenderPipe extends RenderTileMachine { public ModelLargePipe SixPipe; - private boolean[] renderSide = new boolean[6]; public RenderPipe() { @@ -35,19 +32,21 @@ public class RenderPipe extends RenderTileMachine GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); GL11.glScalef(1.0F, -1F, -1F); - int meta = 0; - int blockID = FMRecipeLoader.blockPipe.blockID; + PipeMaterial mat = PipeMaterial.IRON; + if (te.getBlockMetadata() < PipeMaterial.values().length) + { + System.out.println("Pipe meta " + te.getBlockMetadata()); + mat = PipeMaterial.values()[te.getBlockMetadata()]; + } if (te instanceof TileEntityPipe) { - meta = te.getBlockMetadata(); - blockID = te.getBlockType().blockID; - - TileEntityPipe pipe = ((TileEntityPipe) te); - this.renderSide = pipe.renderConnection; - + this.render(mat, ((TileEntityPipe) te).getPipeID(), ((TileEntityPipe) te).renderConnection); + } + else + { + this.render(PipeMaterial.STONE, 0, new boolean[6]); } - this.render(blockID, meta, renderSide); GL11.glPopMatrix(); } @@ -55,22 +54,26 @@ public class RenderPipe extends RenderTileMachine @Override public ResourceLocation getTexture(int block, int meta) { - String name = ""; - if (meta < 16) - { - Fluid stack = FluidHelper.getStackForColor(ColorCode.get(meta)); - name = stack != null ? stack.getName() : ""; - } - else - { - name = ColorCode.get(meta).getName(); - } - return new ResourceLocation(FluidMech.instance.DOMAIN, ModPrefab.MODEL_DIRECTORY + "pipes/" + name + "Pipe.png"); + return new ResourceLocation(FluidMech.instance.DOMAIN, ModPrefab.MODEL_DIRECTORY + "pipes/Pipe.png"); } - public void render(int blockID, int meta, boolean[] side) + public static ResourceLocation getTexture(PipeMaterial mat, int pipeID) { - bindTexture(this.getTexture(blockID, meta)); + if (mat != null) + { + String s = ""; + if (EnumPipeType.get(pipeID) != null) + { + s = EnumPipeType.get(pipeID).getName(pipeID); + } + return new ResourceLocation(FluidMech.instance.DOMAIN, ModPrefab.MODEL_DIRECTORY + "pipes/" + mat.matName + "/" + s + "Pipe.png"); + } + return new ResourceLocation(FluidMech.instance.DOMAIN, ModPrefab.MODEL_DIRECTORY + "pipes/Pipe.png"); + } + + public void render(PipeMaterial mat, int pipeID, boolean[] side) + { + bindTexture(RenderPipe.getTexture(mat, pipeID)); if (side[0]) { SixPipe.renderBottom(); diff --git a/src/dark/fluid/common/pipes/EnumPipeType.java b/src/dark/fluid/common/pipes/EnumPipeType.java index cfa856517..fbd4f87dc 100644 --- a/src/dark/fluid/common/pipes/EnumPipeType.java +++ b/src/dark/fluid/common/pipes/EnumPipeType.java @@ -15,11 +15,15 @@ public enum EnumPipeType implements IColoredId } @Override - public String getName() + public String getName(int pipeID) { - return "Colored Pipe"; + if (pipeID < 16 && pipeID > 0) + { + return ColorCode.get(pipeID - 1).name; + } + return ""; } - }, 0, 15, true); + }, 1, 16, true); private IPipeType type; public int metaStart = 1; @@ -69,7 +73,7 @@ public enum EnumPipeType implements IColoredId public static int getUpdatedID(int pipeID, ColorCode newColor) { - if(pipeID == 0) + if (pipeID == 0) { return 1 + newColor.ordinal(); } @@ -96,12 +100,12 @@ public enum EnumPipeType implements IColoredId return ColorCode.UNKOWN; } - public String getName() + public String getName(int pipeID) { if (type != null) { - return type.getName(); + return type.getName(pipeID); } - return "PipeType" + this.ordinal(); + return ""; } } diff --git a/src/dark/fluid/common/pipes/IPipeType.java b/src/dark/fluid/common/pipes/IPipeType.java index 8d259936a..a674f95b6 100644 --- a/src/dark/fluid/common/pipes/IPipeType.java +++ b/src/dark/fluid/common/pipes/IPipeType.java @@ -4,5 +4,5 @@ import dark.api.ColorCode.IColoredId; public interface IPipeType extends IColoredId { - public String getName(); + public String getName(int pipeID); } diff --git a/src/dark/fluid/common/pipes/ItemBlockPipe.java b/src/dark/fluid/common/pipes/ItemBlockPipe.java index acdbbb801..52349413e 100644 --- a/src/dark/fluid/common/pipes/ItemBlockPipe.java +++ b/src/dark/fluid/common/pipes/ItemBlockPipe.java @@ -33,7 +33,7 @@ public class ItemBlockPipe extends ItemBlock @Override public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) { - if (super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata / PipeMaterial.spacing)) + if (super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, (stack.getItemDamage() / PipeMaterial.spacing))) { TileEntity tile = world.getBlockTileEntity(x, y, z); if (tile instanceof TileEntityPipe) diff --git a/src/dark/fluid/common/pipes/PipeMaterial.java b/src/dark/fluid/common/pipes/PipeMaterial.java index 4c2f2ffe0..623b317a2 100644 --- a/src/dark/fluid/common/pipes/PipeMaterial.java +++ b/src/dark/fluid/common/pipes/PipeMaterial.java @@ -20,33 +20,31 @@ import dark.fluid.common.FMRecipeLoader; public enum PipeMaterial { /** Simple water only pipe. Should render open toped when it can */ - WOOD("wood", false, true, false, 50, 200), + WOOD("wood", false, true, false, -1, 200), /** Gas only pipe */ - GLASS("wood", true, false, false, 100, 300), + GLASS("glass", true, false, false, 100, 300), /** Another version of the wooden pipe */ - STONE("wood", false, true, false, 200, 1000), + STONE("stone", false, true, false, -1, 1000), /** Cheap fluid pipe */ - TIN("wood", false, true, false, 300, 1000), + TIN("tin", false, true, false, 300, 1000), /** Cheap fluid pipe */ - COPPER("wood", false, true, false, 400, 1000), + COPPER("copper", false, true, false, 400, 1000), /** First duel gas and fluid pipe */ - IRON("wood", true, true, false, 500, 1000), + IRON("iron", true, true, false, 500, 1000), /** Fluid movement pipe that doesn't work well with pressure */ - GOLD("wood", true, true, false, 200, 2000), + GOLD("gold", true, true, false, 200, 2000), /** Cheap molten metal pipe */ - OBBY("wood", false, true, true, 1000, 1000), + OBBY("obby", false, true, true, 1000, 1000), /** Very strong fluid and gas support pipe. Should also support molten metal as long as they * don't stay in the pipe too long. */ - STEEL("wood", true, true, false, 10000, 3000), + STEEL("steel", true, true, false, 10000, 3000), /** Weaker equal to steel pipes. Should also support steam very well */ - BRONZE("wood", true, true, false, 6000, 2000), + BRONZE("bronze", true, true, false, 6000, 2000), /** Hell fluids only. Meaning lava, and molten metals. Water should turn to steam, fuel and oil * should cause an explosion around the pipe */ - HELL("wood", true, true, true, 10000, 5000, "water", "fuel", "oil"); + HELL("hell", true, true, true, 10000, 5000, "water", "fuel", "oil"); public String matName = "material"; List unsupportedFluids = new ArrayList(); - public boolean supportsAllFluids = false; - public boolean supportsAllGas = false; public boolean canSupportGas = false; public boolean canSupportFluids = false; public boolean canSupportMoltenFluids = false; @@ -59,8 +57,8 @@ public enum PipeMaterial private PipeMaterial() { - supportsAllFluids = true; - supportsAllGas = true; + this.canSupportGas = true; + this.canSupportFluids = true; canSupportMoltenFluids = true; } @@ -100,7 +98,7 @@ public enum PipeMaterial { return PipeMaterial.values()[meta]; } - return null; + return PipeMaterial.WOOD; } public ItemStack getStack() @@ -142,7 +140,7 @@ public enum PipeMaterial public static int updateColor(Object cc, int pipeID) { - if(EnumPipeType.canColor(pipeID)) + if (EnumPipeType.canColor(pipeID)) { return EnumPipeType.getUpdatedID(pipeID, ColorCode.get(cc)); } diff --git a/src/dark/fluid/common/pipes/TileEntityPipe.java b/src/dark/fluid/common/pipes/TileEntityPipe.java index 1563ed07b..2dd96eb9d 100644 --- a/src/dark/fluid/common/pipes/TileEntityPipe.java +++ b/src/dark/fluid/common/pipes/TileEntityPipe.java @@ -203,11 +203,39 @@ public class TileEntityPipe extends TileEntityAdvanced implements IFluidHandler, { if (tileEntity instanceof INetworkPipe) { - if (((INetworkPipe) tileEntity).canTileConnect(Connection.NETWORK, side.getOpposite())) + if (tileEntity instanceof TileEntityPipe) + { + int meta = new Vector3(this).getBlockMetadata(this.worldObj); + int metaOther = new Vector3(tileEntity).getBlockMetadata(this.worldObj); + if (meta < PipeMaterial.values().length && metaOther < PipeMaterial.values().length) + { + PipeMaterial pipeMat = PipeMaterial.values()[meta]; + PipeMaterial pipeMatOther = PipeMaterial.values()[metaOther]; + //Same pipe types can connect + if (pipeMat == pipeMatOther) + { + this.getTileNetwork().merge(((INetworkPipe) tileEntity).getTileNetwork(), this); + return connectedBlocks.add(tileEntity); + }//Wood and stone pipes can connect to each other but not other pipe types since they are more like a trough than a pipe + else if ((pipeMat == PipeMaterial.WOOD || pipeMat == PipeMaterial.STONE) && (pipeMatOther == PipeMaterial.WOOD || pipeMatOther == PipeMaterial.STONE)) + { + this.getTileNetwork().merge(((INetworkPipe) tileEntity).getTileNetwork(), this); + return connectedBlocks.add(tileEntity); + }//Any other pipe can connect to each other as long as the color matches except for glass which only works with itself at the moment + else if (pipeMat != PipeMaterial.WOOD && pipeMat != PipeMaterial.STONE && pipeMatOther != PipeMaterial.WOOD && pipeMatOther != PipeMaterial.STONE && pipeMat != PipeMaterial.GLASS && pipeMatOther != PipeMaterial.GLASS) + { + this.getTileNetwork().merge(((INetworkPipe) tileEntity).getTileNetwork(), this); + return connectedBlocks.add(tileEntity); + } + } + return false; + } + else { this.getTileNetwork().merge(((INetworkPipe) tileEntity).getTileNetwork(), this); return connectedBlocks.add(tileEntity); } + } else { @@ -243,34 +271,6 @@ public class TileEntityPipe extends TileEntityAdvanced implements IFluidHandler, else if (type == Connection.FLUIDS) { return true; - }//Network connections are only supported for if pipe materials match - else if (type == Connection.NETWORK && entity instanceof INetworkPipe) - { - if (entity instanceof TileEntityPipe) - { - int meta = new Vector3(this).getBlockMetadata(this.worldObj); - int metaOther = connection.getBlockMetadata(this.worldObj); - if (meta < PipeMaterial.values().length && metaOther < PipeMaterial.values().length) - { - PipeMaterial pipeMat = PipeMaterial.values()[meta]; - PipeMaterial pipeMatOther = PipeMaterial.values()[metaOther]; - //Same pipe types can connect - if (pipeMat == pipeMatOther) - { - return true; - }//Wood and stone pipes can connect to each other but not other pipe types since they are more like a trough than a pipe - else if ((pipeMat == PipeMaterial.WOOD || pipeMat == PipeMaterial.STONE) && (pipeMatOther == PipeMaterial.WOOD || pipeMatOther == PipeMaterial.STONE)) - { - return true; - }//Any other pipe can connect to each other as long as the color matches except for glass which only works with itself at the moment - else if (pipeMat != PipeMaterial.WOOD && pipeMat != PipeMaterial.STONE && pipeMatOther != PipeMaterial.WOOD && pipeMatOther != PipeMaterial.STONE && pipeMat != PipeMaterial.GLASS && pipeMatOther != PipeMaterial.GLASS) - { - return true; - } - } - return false; - } - return true; } return false; } @@ -317,6 +317,11 @@ public class TileEntityPipe extends TileEntityAdvanced implements IFluidHandler, @Override public double getMaxPressure(ForgeDirection side) { + int meta = this.worldObj.getBlockMetadata(xCoord, yCoord, zCoord); + if (meta < PipeMaterial.values().length) + { + return PipeMaterial.values()[meta].maxPressure; + } return 350; } @@ -357,6 +362,7 @@ public class TileEntityPipe extends TileEntityAdvanced implements IFluidHandler, * @return flow rate in mili-Buckets */ public int calculateFlowRate(FluidStack fluid, float pressure, float temp) { + //TODO recalculate this based on pipe material for friction if (fluid != null & fluid.getFluid() != null) { float f = .012772f * pressure;