diff --git a/archaic/src/main/java/resonantinduction/archaic/fluid/gutter/TileGutter.java b/archaic/src/main/java/resonantinduction/archaic/fluid/gutter/TileGutter.java index c21e8769..0f43efbb 100644 --- a/archaic/src/main/java/resonantinduction/archaic/fluid/gutter/TileGutter.java +++ b/archaic/src/main/java/resonantinduction/archaic/fluid/gutter/TileGutter.java @@ -146,11 +146,10 @@ public class TileGutter extends TilePressureNode { if (getInternalTank().getFluidAmount() > 0) { - int pressure = node.pressure; - for (int i = 2; i < 6; i++) { ForgeDirection dir = ForgeDirection.getOrientation(i); + int pressure = node.getPressure(dir); Vector3 position = position().translate(dir); TileEntity checkTile = position.getTileEntity(world()); diff --git a/mechanical/src/main/java/resonantinduction/mechanical/Mechanical.java b/mechanical/src/main/java/resonantinduction/mechanical/Mechanical.java index 7d7e7038..9eb2c2d0 100644 --- a/mechanical/src/main/java/resonantinduction/mechanical/Mechanical.java +++ b/mechanical/src/main/java/resonantinduction/mechanical/Mechanical.java @@ -20,6 +20,7 @@ import resonantinduction.mechanical.energy.turbine.SchematicWaterTurbine; import resonantinduction.mechanical.energy.turbine.SchematicWindTurbine; import resonantinduction.mechanical.energy.turbine.TileWaterTurbine; import resonantinduction.mechanical.energy.turbine.TileWindTurbine; +import resonantinduction.mechanical.fluid.pipe.EnumPipeMaterial; import resonantinduction.mechanical.fluid.pipe.ItemPipe; import resonantinduction.mechanical.fluid.transport.BlockPump; import resonantinduction.mechanical.fluid.transport.TilePump; @@ -173,8 +174,12 @@ public class Mechanical GameRegistry.addRecipe(new ShapedOreRecipe(blockPump, "PPP", "GGG", "PPP", 'P', itemPipe, 'G', new ItemStack(itemGear, 1, 2))); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemPipe, 3), "BBB", " ", "BBB", 'B', Item.ingotIron)); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemPipe, 4), "BBB", " ", "BBB", 'B', UniversalRecipe.SECONDARY_METAL.get())); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemPipe, 1, EnumPipeMaterial.CERAMIC.ordinal()), "BBB", " ", "BBB", 'B', Item.brick)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemPipe, 1, EnumPipeMaterial.BRONZE.ordinal()), "BBB", " ", "BBB", 'B', "ingotBronze")); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemPipe, 1, EnumPipeMaterial.PLASTIC.ordinal()), "BBB", " ", "BBB", 'B', "rubber")); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemPipe, 1, EnumPipeMaterial.IRON.ordinal()), "BBB", " ", "BBB", 'B', Item.ingotIron)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemPipe, 1, EnumPipeMaterial.STEEL.ordinal()), "BBB", " ", "BBB", 'B', "ingotSteel")); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemPipe, 1, EnumPipeMaterial.FIBERGLASS.ordinal()), "BBB", " ", "BBB", 'B', Item.diamond)); GameRegistry.addRecipe(new ShapedOreRecipe(blockGrinderWheel, "III", "LGL", "III", 'I', UniversalRecipe.PRIMARY_METAL.get(), 'L', "logWood", 'G', itemGear)); GameRegistry.addRecipe(new ShapedOreRecipe(blockPurifier, "IGI", "IGI", "IGI", 'I', UniversalRecipe.PRIMARY_METAL.get(), 'G', itemGear)); diff --git a/mechanical/src/main/java/resonantinduction/mechanical/fluid/pipe/EnumPipeMaterial.java b/mechanical/src/main/java/resonantinduction/mechanical/fluid/pipe/EnumPipeMaterial.java index d7b20e42..61aa39c2 100644 --- a/mechanical/src/main/java/resonantinduction/mechanical/fluid/pipe/EnumPipeMaterial.java +++ b/mechanical/src/main/java/resonantinduction/mechanical/fluid/pipe/EnumPipeMaterial.java @@ -1,139 +1,30 @@ package resonantinduction.mechanical.fluid.pipe; -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.fluids.FluidStack; -import resonantinduction.core.fluid.TileFluidDistribution; +import java.awt.Color; /** - * Enum to hold info about each pipe material. Values are by default and some can change with pipe - * upgrades. + * Enumerator to hold info about each pipe material. * - * @Note unsupportedFluids should only be used by filters. All pipes should allow all fluid types. - * However, pipes that can't support the fluid should have an effect. Eg no gas support should cause - * the pipe to leak. No molten support should cause the pipe to take damage. - * - * @author DarkGuardsman + * @author Calclavia */ public enum EnumPipeMaterial { - /** Gas only pipe */ - GLASS("glass", true, false, false, 100, 300), - /** Cheap fluid pipe */ - TIN("tin", false, true, false, 300, 1000), - /** Cheap fluid pipe */ - COPPER("copper", false, true, false, 400, 1000), - /** First duel gas and fluid pipe */ - IRON("iron", true, true, false, 500, 1000), - /** Fluid movement pipe that doesn't work well with pressure */ - GOLD("gold", true, true, false, 200, 2000), - /** Cheap molten metal pipe */ - OBSIDIAN("obsidian", false, true, true, 1000, 1000), + CERAMIC(5, 5, new Color(0xB3866F)), BRONZE(25, 25, new Color(0xD49568)), + PLASTIC(50, 30, new Color(0xDAF4F7)), IRON(40, 50, new Color(0x5C6362)), + STEEL(400, 100, new Color(0x888888)), FIBERGLASS(1000, 200, new Color(0x9F9691)); + + public final int maxPressure; + /** - * Very strong fluid and gas support pipe. Should also support molten metal as long as they - * don't stay in the pipe too long. + * The max flow rate in liters of tick. */ - STEEL("steel", true, true, false, 10000, 3000), - /** Weaker equal to steel pipes. Should also support steam very well */ - 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("hell", true, true, true, 10000, 5000, "water", "fuel", "oil"); - public String matName = "material"; - List unsupportedFluids = new ArrayList(); - public boolean canSupportGas = false; - public boolean canSupportFluids = false; - public boolean canSupportMoltenFluids = false; - public int maxPressure = 1000; - public int maxVolume = 2000; - /** - * Materials are stored as meta were there sub types are stored by NBT. Item versions of the - * pipes are still meta so there is a set spacing to allow for a large but defined range of sub - * pipes - */ - public static int spacing = 1000; + public final int maxFlowRate; + public final Color color; - private EnumPipeMaterial() + private EnumPipeMaterial(int maxFlowRate, int maxPressure, Color color) { - this.canSupportGas = true; - this.canSupportFluids = true; - canSupportMoltenFluids = true; - } - - private EnumPipeMaterial(String name, boolean gas, boolean fluid, boolean molten, String... strings) - { - this.matName = name; - this.canSupportGas = gas; - this.canSupportFluids = fluid; - this.canSupportMoltenFluids = molten; - } - - private EnumPipeMaterial(String name, boolean gas, boolean fluid, boolean molten, int pressure, int volume, String... strings) - { - this(name, gas, fluid, molten, strings); - this.maxPressure = pressure; - this.maxVolume = volume; - } - - public static EnumPipeMaterial get(World world, int x, int y, int z) - { - return get(world.getBlockMetadata(x, y, z)); - } - - public static EnumPipeMaterial get(int i) - { - if (i < EnumPipeMaterial.values().length) - { - return EnumPipeMaterial.values()[i]; - } - return null; - } - - public int getMeta(int typeID) - { - return (this.ordinal() * spacing) + typeID; - } - - public int getMeta() - { - return this.getMeta(0); - } - - public static int getType(int meta) - { - return meta / spacing; - } - - public static int getDropItemMeta(World world, int x, int y, int z) - { - int meta = world.getBlockMetadata(x, y, z); - TileEntity ent = world.getBlockTileEntity(x, y, z); - meta *= spacing; - if (ent instanceof TileFluidDistribution) - { - meta += ((TileFluidDistribution) ent).getSubID(); - } - return meta; - } - - public boolean canSupport(FluidStack fluid) - { - if (fluid != null && fluid.getFluid() != null) - { - if (fluid.getFluid().isGaseous(fluid) && this.canSupportGas) - { - return true; - } - else if (!fluid.getFluid().isGaseous(fluid) && this.canSupportFluids) - { - return true; - } - } - return false; + this.maxFlowRate = maxFlowRate; + this.maxPressure = maxPressure; + this.color = color; } } diff --git a/mechanical/src/main/java/resonantinduction/mechanical/fluid/pipe/ItemBlockFluidContainer.java b/mechanical/src/main/java/resonantinduction/mechanical/fluid/pipe/ItemBlockFluidContainer.java index dab49371..c2caab2b 100644 --- a/mechanical/src/main/java/resonantinduction/mechanical/fluid/pipe/ItemBlockFluidContainer.java +++ b/mechanical/src/main/java/resonantinduction/mechanical/fluid/pipe/ItemBlockFluidContainer.java @@ -119,7 +119,7 @@ public class ItemBlockFluidContainer 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 / EnumPipeMaterial.spacing))) + if (super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata)) { TileEntity tile = world.getBlockTileEntity(x, y, z); if (tile instanceof TileFluidDistribution) diff --git a/mechanical/src/main/java/resonantinduction/mechanical/fluid/pipe/ItemPipe.java b/mechanical/src/main/java/resonantinduction/mechanical/fluid/pipe/ItemPipe.java index 5bcacf90..8fb703c3 100644 --- a/mechanical/src/main/java/resonantinduction/mechanical/fluid/pipe/ItemPipe.java +++ b/mechanical/src/main/java/resonantinduction/mechanical/fluid/pipe/ItemPipe.java @@ -1,5 +1,15 @@ package resonantinduction.mechanical.fluid.pipe; +import java.util.List; + +import org.lwjgl.input.Keyboard; + +import resonantinduction.electrical.wire.EnumWireMaterial; +import universalelectricity.api.energy.UnitDisplay; +import universalelectricity.api.energy.UnitDisplay.Unit; +import calclavia.lib.render.EnumColor; +import calclavia.lib.utility.LanguageUtility; +import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; @@ -31,14 +41,34 @@ public class ItemPipe extends JItemMultiPart { return damage; } - /* - * @Override - * public void getSubItems(int itemID, CreativeTabs tab, List listToAddTo) - * { - * for (EnumPipeMaterial material : EnumPipeMaterial.values()) - * { - * listToAddTo.add(new ItemStack(itemID, 1, material.ordinal())); - * } - * } - */ + + @Override + public String getUnlocalizedName(ItemStack itemStack) + { + return super.getUnlocalizedName(itemStack) + "." + LanguageUtility.underscoreToCamel(EnumPipeMaterial.values()[itemStack.getItemDamage()].name()); + } + + @Override + @SuppressWarnings("unchecked") + public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean par4) + { + if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + { + list.add(LanguageUtility.getLocal("tooltip.noShift").replace("%0", EnumColor.AQUA.toString()).replace("%1", EnumColor.GREY.toString())); + } + else + { + list.add(EnumColor.AQUA + LanguageUtility.getLocal("tooltip.pipe.rate").replace("%v", "" + EnumColor.ORANGE + UnitDisplay.getDisplay(EnumPipeMaterial.values()[itemstack.getItemDamage()].maxFlowRate * 20, Unit.LITER) + "/s")); + list.add(EnumColor.AQUA + LanguageUtility.getLocal("tooltip.pipe.pressure").replace("%v", "" + EnumColor.ORANGE + EnumPipeMaterial.values()[itemstack.getItemDamage()].maxPressure + " Pa")); + } + } + + @Override + public void getSubItems(int itemID, CreativeTabs tab, List listToAddTo) + { + for (EnumPipeMaterial material : EnumPipeMaterial.values()) + { + listToAddTo.add(new ItemStack(itemID, 1, material.ordinal())); + } + } } diff --git a/mechanical/src/main/java/resonantinduction/mechanical/fluid/pipe/ModelPipe.java b/mechanical/src/main/java/resonantinduction/mechanical/fluid/pipe/ModelPipe.java deleted file mode 100644 index 91d883d5..00000000 --- a/mechanical/src/main/java/resonantinduction/mechanical/fluid/pipe/ModelPipe.java +++ /dev/null @@ -1,227 +0,0 @@ -package resonantinduction.mechanical.fluid.pipe; - -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.model.ModelRenderer; -import net.minecraftforge.common.ForgeDirection; -import calclavia.lib.utility.WorldUtility; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) -public class ModelPipe extends ModelBase -{ - // fields - ModelRenderer Mid; - ModelRenderer RightPipe; - ModelRenderer RightInter; - ModelRenderer RightConnect; - ModelRenderer LeftInter; - ModelRenderer LeftPipe; - ModelRenderer LeftConnect; - ModelRenderer TopInter; - ModelRenderer TopPipe; - ModelRenderer TopConnect; - ModelRenderer BottomPipe; - ModelRenderer BottomInter; - ModelRenderer BottomConnect; - ModelRenderer BackPipe; - ModelRenderer BackInter; - ModelRenderer BackConnect; - ModelRenderer FrontInter; - ModelRenderer FrontPipe; - ModelRenderer FrontConnect; - - public ModelPipe() - { - textureWidth = 128; - textureHeight = 32; - - Mid = new ModelRenderer(this, 50, 13); - Mid.addBox(-3F, -3F, -3F, 6, 6, 6); - Mid.setRotationPoint(0F, 16F, 0F); - Mid.setTextureSize(128, 32); - Mid.mirror = true; - setRotation(Mid, 0F, 0F, 0F); - RightPipe = new ModelRenderer(this, 25, 0); - RightPipe.addBox(0F, -3F, -3F, 4, 6, 6); - RightPipe.setRotationPoint(3F, 16F, 0F); - RightPipe.setTextureSize(128, 32); - RightPipe.mirror = true; - setRotation(RightPipe, 0F, 0F, 0F); - RightInter = new ModelRenderer(this, 98, 0); - RightInter.addBox(0F, -4F, -4F, 1, 8, 8); - RightInter.setRotationPoint(2F, 16F, 0F); - RightInter.setTextureSize(128, 32); - RightInter.mirror = true; - setRotation(RightInter, 0F, 0F, 0F); - RightConnect = new ModelRenderer(this, 98, 0); - RightConnect.addBox(0F, -4F, -4F, 1, 8, 8); - RightConnect.setRotationPoint(7F, 16F, 0F); - RightConnect.setTextureSize(128, 32); - RightConnect.mirror = true; - setRotation(RightConnect, 0F, 0F, 0F); - LeftInter = new ModelRenderer(this, 98, 0); - LeftInter.addBox(-1F, -4F, -4F, 1, 8, 8); - LeftInter.setRotationPoint(-2F, 16F, 0F); - LeftInter.setTextureSize(128, 32); - LeftInter.mirror = true; - setRotation(LeftInter, 0F, 0F, 0F); - LeftPipe = new ModelRenderer(this, 25, 0); - LeftPipe.addBox(-4F, -3F, -3F, 4, 6, 6); - LeftPipe.setRotationPoint(-3F, 16F, 0F); - LeftPipe.setTextureSize(128, 32); - LeftPipe.mirror = true; - setRotation(LeftPipe, 0F, 0F, 0F); - LeftConnect = new ModelRenderer(this, 98, 0); - LeftConnect.addBox(-1F, -4F, -4F, 1, 8, 8); - LeftConnect.setRotationPoint(-7F, 16F, 0F); - LeftConnect.setTextureSize(128, 32); - LeftConnect.mirror = true; - setRotation(LeftConnect, 0F, 0F, 0F); - TopInter = new ModelRenderer(this, 77, 17); - TopInter.addBox(-4F, -1F, -4F, 8, 1, 8); - TopInter.setRotationPoint(0F, 14F, 0F); - TopInter.setTextureSize(128, 32); - TopInter.mirror = true; - setRotation(TopInter, 0F, 0F, 0F); - TopPipe = new ModelRenderer(this, 50, 0); - TopPipe.addBox(-3F, -4F, -3F, 6, 4, 6); - TopPipe.setRotationPoint(0F, 13F, 0F); - TopPipe.setTextureSize(128, 32); - TopPipe.mirror = true; - setRotation(TopPipe, 0F, 0F, 0F); - TopConnect = new ModelRenderer(this, 77, 17); - TopConnect.addBox(-4F, -1F, -4F, 8, 1, 8); - TopConnect.setRotationPoint(0F, 9F, 0F); - TopConnect.setTextureSize(128, 32); - TopConnect.mirror = true; - setRotation(TopConnect, 0F, 0F, 0F); - BottomPipe = new ModelRenderer(this, 50, 0); - BottomPipe.addBox(-3F, 0F, -3F, 6, 4, 6); - BottomPipe.setRotationPoint(0F, 19F, 0F); - BottomPipe.setTextureSize(128, 32); - BottomPipe.mirror = true; - setRotation(BottomPipe, 0F, 0F, 0F); - BottomInter = new ModelRenderer(this, 77, 17); - BottomInter.addBox(-4F, 0F, -4F, 8, 1, 8); - BottomInter.setRotationPoint(0F, 18F, 0F); - BottomInter.setTextureSize(128, 32); - BottomInter.mirror = true; - setRotation(BottomInter, 0F, 0F, 0F); - BottomConnect = new ModelRenderer(this, 77, 17); - BottomConnect.addBox(-4F, 0F, -4F, 8, 1, 8); - BottomConnect.setRotationPoint(0F, 23F, 0F); - BottomConnect.setTextureSize(128, 32); - BottomConnect.mirror = true; - setRotation(BottomConnect, 0F, 0F, 0F); - BackPipe = new ModelRenderer(this, 0, 0); - BackPipe.addBox(-3F, -3F, 0F, 6, 6, 4); - BackPipe.setRotationPoint(0F, 16F, 3F); - BackPipe.setTextureSize(128, 32); - BackPipe.mirror = true; - setRotation(BackPipe, 0F, 0F, 0F); - BackInter = new ModelRenderer(this, 0, 23); - BackInter.addBox(-4F, -4F, 0F, 8, 8, 1); - BackInter.setRotationPoint(0F, 16F, 2F); - BackInter.setTextureSize(128, 32); - BackInter.mirror = true; - setRotation(BackInter, 0F, 0F, 0F); - BackConnect = new ModelRenderer(this, 0, 23); - BackConnect.addBox(-4F, -4F, 0F, 8, 8, 1); - BackConnect.setRotationPoint(0F, 16F, 7F); - BackConnect.setTextureSize(128, 32); - BackConnect.mirror = true; - setRotation(BackConnect, 0F, 0F, 0F); - FrontInter = new ModelRenderer(this, 0, 23); - FrontInter.addBox(-4F, -4F, -1F, 8, 8, 1); - FrontInter.setRotationPoint(0F, 16F, -2F); - FrontInter.setTextureSize(128, 32); - FrontInter.mirror = true; - setRotation(FrontInter, 0F, 0F, 0F); - FrontPipe = new ModelRenderer(this, 0, 0); - FrontPipe.addBox(-3F, -3F, -4F, 6, 6, 4); - FrontPipe.setRotationPoint(0F, 16F, -3F); - FrontPipe.setTextureSize(128, 32); - FrontPipe.mirror = true; - setRotation(FrontPipe, 0F, 0F, 0F); - FrontConnect = new ModelRenderer(this, 0, 23); - FrontConnect.addBox(-4F, -4F, -1F, 8, 8, 1); - FrontConnect.setRotationPoint(0F, 16F, -7F); - FrontConnect.setTextureSize(128, 32); - FrontConnect.mirror = true; - setRotation(FrontConnect, 0F, 0F, 0F); - } - - public void render(byte side) - { - if (WorldUtility.isEnabledSide(side, ForgeDirection.DOWN)) - renderBottom(); - if (WorldUtility.isEnabledSide(side, ForgeDirection.UP)) - renderUp(); - if (WorldUtility.isEnabledSide(side, ForgeDirection.NORTH)) - renderSouth(); - if (WorldUtility.isEnabledSide(side, ForgeDirection.SOUTH)) - renderNorth(); - if (WorldUtility.isEnabledSide(side, ForgeDirection.WEST)) - renderEast(); - if (WorldUtility.isEnabledSide(side, ForgeDirection.EAST)) - renderWest(); - - renderMiddle(); - } - - public void renderMiddle() - { - Mid.render(0.0625F); - } - - public void renderBottom() - { - BottomPipe.render(0.0625F); - BottomConnect.render(0.0625F); - BottomInter.render(0.0625F); - } - - public void renderUp() - { - TopPipe.render(0.0625F); - TopConnect.render(0.0625F); - TopInter.render(0.0625F); - } - - public void renderEast() - { - LeftPipe.render(0.0625F); - LeftConnect.render(0.0625F); - LeftInter.render(0.0625F); - } - - public void renderWest() - { - RightPipe.render(0.0625F); - RightConnect.render(0.0625F); - RightInter.render(0.0625F); - } - - public void renderSouth() - { - BackPipe.render(0.0625F); - BackConnect.render(0.0625F); - BackInter.render(0.0625F); - } - - public void renderNorth() - { - FrontPipe.render(0.0625F); - FrontConnect.render(0.0625F); - FrontInter.render(0.0625F); - } - - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - -} diff --git a/mechanical/src/main/java/resonantinduction/mechanical/fluid/pipe/PartPipe.java b/mechanical/src/main/java/resonantinduction/mechanical/fluid/pipe/PartPipe.java index 31257d96..38e1cd83 100644 --- a/mechanical/src/main/java/resonantinduction/mechanical/fluid/pipe/PartPipe.java +++ b/mechanical/src/main/java/resonantinduction/mechanical/fluid/pipe/PartPipe.java @@ -1,6 +1,5 @@ package resonantinduction.mechanical.fluid.pipe; -import calclavia.lib.utility.WorldUtility; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -13,11 +12,11 @@ import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidHandler; import resonantinduction.core.ResonantInduction; -import resonantinduction.core.grid.Node; import resonantinduction.core.grid.fluid.IPressureNodeProvider; import resonantinduction.core.grid.fluid.PressureNode; import resonantinduction.core.prefab.part.PartFramedNode; import resonantinduction.mechanical.Mechanical; +import calclavia.lib.utility.WorldUtility; import codechicken.lib.data.MCDataInput; import codechicken.lib.render.CCRenderState; import codechicken.lib.render.IconTransformation; @@ -26,7 +25,6 @@ import codechicken.lib.vec.Translation; import codechicken.microblock.IHollowConnect; import codechicken.multipart.JNormalOcclusion; import codechicken.multipart.TSlottedPart; -import codechicken.multipart.TileMultipart; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -92,21 +90,24 @@ public class PartPipe extends PartFramedNode 0) - { - Color insulationColour = new Color(ItemDye.dyeColors[part.getColor()]); - GL11.glColor4f(insulationColour.getRed() / 255f, insulationColour.getGreen() / 255f, insulationColour.getBlue() / 255f, 1); - } - else - { - GL11.glColor4f(1, 1, 1, 1); - } - - render(0, part.getAllCurrentConnections()); + GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5); + render(part.getMaterialID(), part.getColor() > 0 ? ItemDye.dyeColors[part.getColor()] : -1, part.getAllCurrentConnections()); GL11.glPopMatrix(); GL11.glPushMatrix(); @@ -121,11 +109,60 @@ public class RenderPipe implements ISimpleItemRenderer } - public static void render(int meta, byte sides) + @SuppressWarnings("incomplete-switch") + public static void render(int meta, int colorCode, byte sides) { RenderUtility.enableBlending(); RenderUtility.bind(TEXTURE); - MODEL_PIPE.render(sides); + EnumPipeMaterial material = EnumPipeMaterial.values()[meta]; + + GL11.glColor4f(material.color.getRed() / 255f, material.color.getGreen() / 255f, material.color.getBlue() / 255f, 1); + MODEL.renderOnly("Mid"); + + /** + * Render each side + */ + for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) + { + if (WorldUtility.isEnabledSide(sides, dir)) + { + GL11.glColor4f(material.color.getRed() / 255f, material.color.getGreen() / 255f, material.color.getBlue() / 255f, 1); + String prefix = null; + + switch (dir) + { + case DOWN: + prefix = "Bottom"; + break; + case UP: + prefix = "Top"; + break; + case NORTH: + prefix = "Front"; + break; + case SOUTH: + prefix = "Back"; + break; + case WEST: + prefix = "Right"; + break; + case EAST: + prefix = "Left"; + break; + } + + MODEL.renderOnly(prefix + "Inter", prefix + "Connect"); + + if (colorCode > 0) + { + Color color = new Color(colorCode); + GL11.glColor4f(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, 1); + } + + MODEL.renderOnly(prefix + "Pipe"); + } + } + RenderUtility.disableBlending(); } @@ -133,9 +170,8 @@ public class RenderPipe implements ISimpleItemRenderer public void renderInventoryItem(ItemStack itemStack) { GL11.glPushMatrix(); - GL11.glTranslatef(0.5F, 1.5F, 0.5F); - GL11.glScalef(1.0F, -1F, -1F); - render(itemStack.getItemDamage(), Byte.parseByte("001100", 2)); + GL11.glTranslatef(0.5f, 0.5f, 0.5f); + render(itemStack.getItemDamage(), -1, Byte.parseByte("001100", 2)); GL11.glPopMatrix(); } } \ No newline at end of file diff --git a/src/main/java/resonantinduction/core/grid/Node.java b/src/main/java/resonantinduction/core/grid/Node.java index 0a648d3c..15816318 100644 --- a/src/main/java/resonantinduction/core/grid/Node.java +++ b/src/main/java/resonantinduction/core/grid/Node.java @@ -95,6 +95,13 @@ public abstract class Node

return connections; } + /** + * Can this node connect with the source? + * + * @param from - Direction coming from. + * @param source - Object trying to connect with this node. This should either extend Node or be + * an object that can interface with the node. + */ public boolean canConnect(ForgeDirection from, Object source) { return false; diff --git a/src/main/java/resonantinduction/core/grid/fluid/PressureNode.java b/src/main/java/resonantinduction/core/grid/fluid/PressureNode.java index dea72f7f..e5424c44 100644 --- a/src/main/java/resonantinduction/core/grid/fluid/PressureNode.java +++ b/src/main/java/resonantinduction/core/grid/fluid/PressureNode.java @@ -18,7 +18,9 @@ import codechicken.multipart.TMultiPart; public class PressureNode extends Node { protected byte connectionMap = Byte.parseByte("111111", 2); - public int pressure = 0; + private int pressure = 0; + public int maxFlowRate = 10; + public int maxPressure = 10; public PressureNode(IPressureNodeProvider parent) { @@ -65,7 +67,7 @@ public class PressureNode extends Node 0) maxPressure -= 1; - pressure = Math.max(minPressure, Math.min(maxPressure, totalPressure / findCount + Integer.signum(totalPressure))); + setPressure(Math.max(minPressure, Math.min(maxPressure, totalPressure / findCount + Integer.signum(totalPressure)))); } } @@ -172,7 +174,15 @@ public class PressureNode extends Node 0) + pressure = Math.min(maxPressure, newPressure); + else + pressure = Math.max(-maxPressure, newPressure); } public int getPressure(ForgeDirection dir) @@ -216,6 +226,7 @@ public class PressureNode extends Node