Fixed a few issues with pipes
|
@ -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
|
||||
|
|
Before Width: | Height: | Size: 782 B |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 791 B |
BIN
resources/assets/fm/textures/models/pipes/bronze/Pipe.png
Normal file
After Width: | Height: | Size: 820 B |
BIN
resources/assets/fm/textures/models/pipes/copper/Pipe.png
Normal file
After Width: | Height: | Size: 820 B |
BIN
resources/assets/fm/textures/models/pipes/glass/Pipe.png
Normal file
After Width: | Height: | Size: 843 B |
BIN
resources/assets/fm/textures/models/pipes/gold/Pipe.png
Normal file
After Width: | Height: | Size: 829 B |
BIN
resources/assets/fm/textures/models/pipes/hell/Pipe.png
Normal file
After Width: | Height: | Size: 828 B |
BIN
resources/assets/fm/textures/models/pipes/iron/Pipe.png
Normal file
After Width: | Height: | Size: 808 B |
Before Width: | Height: | Size: 816 B |
BIN
resources/assets/fm/textures/models/pipes/obby/Pipe.png
Normal file
After Width: | Height: | Size: 829 B |
BIN
resources/assets/fm/textures/models/pipes/steel/Pipe.png
Normal file
After Width: | Height: | Size: 810 B |
BIN
resources/assets/fm/textures/models/pipes/stone/Pipe.png
Normal file
After Width: | Height: | Size: 820 B |
BIN
resources/assets/fm/textures/models/pipes/tin/Pipe.png
Normal file
After Width: | Height: | Size: 829 B |
BIN
resources/assets/fm/textures/models/pipes/wood/Pipe.png
Normal file
After Width: | Height: | Size: 827 B |
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}, 0, 15, true);
|
||||
return "";
|
||||
}
|
||||
}, 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 "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,5 +4,5 @@ import dark.api.ColorCode.IColoredId;
|
|||
|
||||
public interface IPipeType extends IColoredId
|
||||
{
|
||||
public String getName();
|
||||
public String getName(int pipeID);
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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<String> unsupportedFluids = new ArrayList<String>();
|
||||
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));
|
||||
}
|
||||
|
|
|
@ -203,12 +203,40 @@ 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
|
||||
{
|
||||
return connectedBlocks.add(tileEntity);
|
||||
|
@ -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;
|
||||
|
|