Worked on and fixed issue with network fluid code

This commit is contained in:
DarkGuardsman 2013-10-30 22:00:21 -04:00
parent 7f94bf5c08
commit 4d65261212
24 changed files with 179 additions and 622 deletions

View file

@ -44,11 +44,7 @@ public class NetworkFluidTiles extends NetworkTileEntities
if (this.sharedTank == null)
{
this.sharedTank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME);
this.readDataFromTiles();
}
if (!loadedLiquids)
{
this.readDataFromTiles();
this.getNetworkTankInfo();
}
return this.sharedTank;
}
@ -64,6 +60,12 @@ public class NetworkFluidTiles extends NetworkTileEntities
public int fillNetworkTank(FluidStack stack, boolean doFill)
{
if (!this.loadedLiquids)
{
this.readDataFromTiles();
this.loadedLiquids = true;
}
if (this.getNetworkTank() != null)
{
int p = this.getNetworkTank().getFluid() != null ? this.getNetworkTank().getFluid().amount : 0;
@ -83,6 +85,12 @@ public class NetworkFluidTiles extends NetworkTileEntities
public FluidStack drainNetworkTank(int volume, boolean doDrain)
{
if (!this.loadedLiquids)
{
this.readDataFromTiles();
this.loadedLiquids = true;
}
if (this.getNetworkTank() != null)
{
FluidStack p = this.getNetworkTank().getFluid();
@ -247,7 +255,7 @@ public class NetworkFluidTiles extends NetworkTileEntities
else
{
part.setTileNetwork(this);
if (part instanceof INetworkFluidPart)
if (part instanceof INetworkFluidPart && ((INetworkFluidPart) part).getTankInfo()[0] != null)
{
capacity += ((INetworkFluidPart) part).getTankInfo()[0].capacity;
}

View file

@ -1,433 +0,0 @@
// Date: 10/8/2012 7:31:40 PM
// Template version 1.1
// Java generated by Techne
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package dark.fluid.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.tileentity.TileEntity;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.fluid.common.machines.TileEntityTank;
@SideOnly(Side.CLIENT)
public class ModelLiquidTank extends ModelBase
{
// fields
ModelRenderer Mid;
ModelRenderer Corner;
ModelRenderer Corner2;
ModelRenderer Corner3;
ModelRenderer Corner4;
ModelRenderer C8;
ModelRenderer C7;
ModelRenderer C6;
ModelRenderer C5;
ModelRenderer C4;
ModelRenderer C;
ModelRenderer C3;
ModelRenderer C2;
ModelRenderer GuageT;
ModelRenderer GuageB;
ModelRenderer Guage;
ModelRenderer GuageR;
// ModelRenderer GuageGlass;
ModelRenderer GuageL;
ModelRenderer GuageT2;
ModelRenderer GuageB2;
ModelRenderer Guage2;
ModelRenderer GuageR2;
// ModelRenderer GuageGlass2;
ModelRenderer GuageL2;
ModelRenderer GuageT3;
ModelRenderer GuageB3;
ModelRenderer Guage3;
ModelRenderer GuageR3;
// ModelRenderer GuageGlass3;
ModelRenderer GuageL3;
ModelRenderer GuageT4;
ModelRenderer GuageB4;
ModelRenderer Guage4;
ModelRenderer GuageR4;
// ModelRenderer GuageGlass4;
ModelRenderer GuageL4;
ModelRenderer CCBottom;
ModelRenderer CCRight;
ModelRenderer CCLeft;
ModelRenderer CCFront;
ModelRenderer CCBack;
ModelRenderer CCTop;
public ModelLiquidTank()
{
textureWidth = 128;
textureHeight = 128;
Mid = new ModelRenderer(this, 0, 50);
Mid.addBox(-6F, 0F, -6F, 12, 14, 12);
Mid.setRotationPoint(0F, 9F, 0F);
Mid.setTextureSize(128, 128);
Mid.mirror = true;
setRotation(Mid, 0F, 0F, 0F);
Corner = new ModelRenderer(this, 0, 30);
Corner.addBox(-1F, 0F, -1F, 2, 16, 2);
Corner.setRotationPoint(-7F, 8F, 7F);
Corner.setTextureSize(128, 128);
Corner.mirror = true;
setRotation(Corner, 0F, 0F, 0F);
Corner2 = new ModelRenderer(this, 0, 30);
Corner2.addBox(-1F, 0F, -1F, 2, 16, 2);
Corner2.setRotationPoint(-7F, 8F, -7F);
Corner2.setTextureSize(128, 128);
Corner2.mirror = true;
setRotation(Corner2, 0F, 0F, 0F);
Corner3 = new ModelRenderer(this, 0, 30);
Corner3.addBox(-1F, 0F, -1F, 2, 16, 2);
Corner3.setRotationPoint(7F, 8F, -7F);
Corner3.setTextureSize(128, 128);
Corner3.mirror = true;
setRotation(Corner3, 0F, 0F, 0F);
Corner4 = new ModelRenderer(this, 0, 30);
Corner4.addBox(-1F, 0F, -1F, 2, 16, 2);
Corner4.setRotationPoint(7F, 8F, 7F);
Corner4.setTextureSize(128, 128);
Corner4.mirror = true;
setRotation(Corner4, 0F, 0F, 0F);
C8 = new ModelRenderer(this, 9, 35);
C8.addBox(-1F, 0F, -1F, 2, 2, 12);
C8.setRotationPoint(6F, 22F, -5F);
C8.setTextureSize(128, 128);
C8.mirror = true;
setRotation(C8, 0F, 0F, 0F);
C7 = new ModelRenderer(this, 9, 35);
C7.addBox(-1F, 0F, -1F, 2, 2, 12);
C7.setRotationPoint(-6F, 8F, -5F);
C7.setTextureSize(128, 128);
C7.mirror = true;
setRotation(C7, 0F, 0F, 0F);
C6 = new ModelRenderer(this, 9, 35);
C6.addBox(-1F, 0F, -1F, 2, 2, 12);
C6.setRotationPoint(6F, 8F, -5F);
C6.setTextureSize(128, 128);
C6.mirror = true;
setRotation(C6, 0F, 0F, 0F);
C5 = new ModelRenderer(this, 9, 30);
C5.addBox(-1F, 0F, -1F, 12, 2, 2);
C5.setRotationPoint(-5F, 8F, 6F);
C5.setTextureSize(128, 128);
C5.mirror = true;
setRotation(C5, 0F, 0F, 0F);
C4 = new ModelRenderer(this, 9, 35);
C4.addBox(-1F, 0F, -1F, 2, 2, 12);
C4.setRotationPoint(-6F, 22F, -5F);
C4.setTextureSize(128, 128);
C4.mirror = true;
setRotation(C4, 0F, 0F, 0F);
C = new ModelRenderer(this, 9, 30);
C.addBox(-1F, 0F, -1F, 12, 2, 2);
C.setRotationPoint(-5F, 22F, 6F);
C.setTextureSize(128, 128);
C.mirror = true;
setRotation(C, 0F, 0F, 0F);
C3 = new ModelRenderer(this, 9, 30);
C3.addBox(-1F, 0F, -1F, 12, 2, 2);
C3.setRotationPoint(-5F, 8F, -6F);
C3.setTextureSize(128, 128);
C3.mirror = true;
setRotation(C3, 0F, 0F, 0F);
C2 = new ModelRenderer(this, 9, 30);
C2.addBox(-1F, 0F, -1F, 12, 2, 2);
C2.setRotationPoint(-5F, 22F, -6F);
C2.setTextureSize(128, 128);
C2.mirror = true;
setRotation(C2, 0F, 0F, 0F);
// G1--------------------------------------
GuageT = new ModelRenderer(this, 54, 42);
GuageT.addBox(-1F, -1F, 0F, 2, 1, 2);
GuageT.setRotationPoint(0F, 12F, -8F);
GuageT.setTextureSize(128, 128);
GuageT.mirror = true;
setRotation(GuageT, 0F, 0F, 0F);
GuageB = new ModelRenderer(this, 54, 42);
GuageB.addBox(-1F, 8F, 0F, 2, 1, 2);
GuageB.setRotationPoint(0F, 12F, -8F);
GuageB.setTextureSize(128, 128);
GuageB.mirror = true;
setRotation(GuageB, 0F, 0F, 0F);
Guage = new ModelRenderer(this, 54, 32);
Guage.addBox(-1F, 0F, 0F, 2, 8, 1);
Guage.setRotationPoint(0F, 12F, -7F);
Guage.setTextureSize(128, 128);
Guage.mirror = true;
setRotation(Guage, 0F, 0F, 0F);
GuageR = new ModelRenderer(this, 44, 32);
GuageR.addBox(1F, -1F, -1F, 2, 10, 2);
GuageR.setRotationPoint(0F, 12F, -7F);
GuageR.setTextureSize(128, 128);
GuageR.mirror = true;
setRotation(GuageR, 0F, 0F, 0F);
// GuageGlass = new ModelRenderer(this, 60, 32);
// GuageGlass.addBox(-1F, 0F, 0F, 2, 8, 1);
// GuageGlass.setRotationPoint(0F, 12F, -8F);
// GuageGlass.setTextureSize(128, 128);
// GuageGlass.mirror = true;
// setRotation(GuageGlass, 0F, 0F, 0F);
GuageL = new ModelRenderer(this, 44, 32);
GuageL.addBox(-3F, -1F, -1F, 2, 10, 2);
GuageL.setRotationPoint(0F, 12F, -7F);
GuageL.setTextureSize(128, 128);
GuageL.mirror = true;
setRotation(GuageL, 0F, 0F, 0F);
// G2----------------------------------
GuageT2 = new ModelRenderer(this, 54, 42);
GuageT2.addBox(-1F, -1F, 0F, 2, 1, 2);
GuageT2.setRotationPoint(-8F, 12F, 0F);
GuageT2.setTextureSize(128, 128);
GuageT2.mirror = true;
setRotation(GuageT2, 0F, 1.570796F, 0F);
GuageB2 = new ModelRenderer(this, 54, 42);
GuageB2.addBox(-1F, 8F, 0F, 2, 1, 2);
GuageB2.setRotationPoint(-8F, 12F, 0F);
GuageB2.setTextureSize(128, 128);
GuageB2.mirror = true;
setRotation(GuageB2, 0F, 1.570796F, 0F);
Guage2 = new ModelRenderer(this, 54, 32);
Guage2.addBox(-1F, 0F, 0F, 2, 8, 1);
Guage2.setRotationPoint(-7F, 12F, 0F);
Guage2.setTextureSize(128, 128);
Guage2.mirror = true;
setRotation(Guage2, 0F, 1.570796F, 0F);
GuageR2 = new ModelRenderer(this, 44, 32);
GuageR2.addBox(1F, -1F, -1F, 2, 10, 2);
GuageR2.setRotationPoint(-7F, 12F, 0F);
GuageR2.setTextureSize(128, 128);
GuageR2.mirror = true;
setRotation(GuageR2, 0F, 1.570796F, 0F);
// GuageGlass2 = new ModelRenderer(this, 60, 32);
// GuageGlass2.addBox(-1F, 0F, 0F, 2, 8, 1);
// GuageGlass2.setRotationPoint(-8F, 12F, 0F);
// GuageGlass2.setTextureSize(128, 128);
// GuageGlass2.mirror = true;
// setRotation(GuageGlass2, 0F, 1.570796F, 0F);
GuageL2 = new ModelRenderer(this, 44, 32);
GuageL2.addBox(-3F, -1F, -1F, 2, 10, 2);
GuageL2.setRotationPoint(-7F, 12F, 0F);
GuageL2.setTextureSize(128, 128);
GuageL2.mirror = true;
setRotation(GuageL2, 0F, 1.570796F, 0F);
// G3--------------------------------------
GuageT3 = new ModelRenderer(this, 54, 42);
GuageT3.addBox(-1F, -1F, 0F, 2, 1, 2);
GuageT3.setRotationPoint(0F, 12F, 8F);
GuageT3.setTextureSize(128, 128);
GuageT3.mirror = true;
setRotation(GuageT3, 0F, 3.141593F, 0F);
GuageB3 = new ModelRenderer(this, 54, 42);
GuageB3.addBox(-1F, 8F, 0F, 2, 1, 2);
GuageB3.setRotationPoint(0F, 12F, 8F);
GuageB3.setTextureSize(128, 128);
GuageB3.mirror = true;
setRotation(GuageB3, 0F, 3.141593F, 0F);
Guage3 = new ModelRenderer(this, 54, 32);
Guage3.addBox(-1F, 0F, 0F, 2, 8, 1);
Guage3.setRotationPoint(0F, 12F, 7F);
Guage3.setTextureSize(128, 128);
Guage3.mirror = true;
setRotation(Guage3, 0F, 3.141593F, 0F);
GuageR3 = new ModelRenderer(this, 44, 32);
GuageR3.addBox(1F, -1F, -1F, 2, 10, 2);
GuageR3.setRotationPoint(0F, 12F, 7F);
GuageR3.setTextureSize(128, 128);
GuageR3.mirror = true;
setRotation(GuageR3, 0F, 3.141593F, 0F);
// GuageGlass3 = new ModelRenderer(this, 60, 32);
// GuageGlass3.addBox(-1F, 0F, 0F, 2, 8, 1);
// GuageGlass3.setRotationPoint(0F, 12F, 8F);
// GuageGlass3.setTextureSize(128, 128);
// GuageGlass3.mirror = true;
// setRotation(GuageGlass3, 0F, 3.141593F, 0F);
GuageL3 = new ModelRenderer(this, 44, 32);
GuageL3.addBox(-3F, -1F, -1F, 2, 10, 2);
GuageL3.setRotationPoint(0F, 12F, 7F);
GuageL3.setTextureSize(128, 128);
GuageL3.mirror = true;
setRotation(GuageL3, 0F, 3.141593F, 0F);
// G4-------------------------------
GuageT4 = new ModelRenderer(this, 54, 42);
GuageT4.addBox(-1F, -1F, 0F, 2, 1, 2);
GuageT4.setRotationPoint(8F, 12F, 0F);
GuageT4.setTextureSize(128, 128);
GuageT4.mirror = true;
setRotation(GuageT4, 0F, -1.570796F, 0F);
GuageB4 = new ModelRenderer(this, 54, 42);
GuageB4.addBox(-1F, 8F, 0F, 2, 1, 2);
GuageB4.setRotationPoint(8F, 12F, 0F);
GuageB4.setTextureSize(128, 128);
GuageB4.mirror = true;
setRotation(GuageB4, 0F, -1.570796F, 0F);
Guage4 = new ModelRenderer(this, 54, 32);
Guage4.addBox(-1F, 0F, 0F, 2, 8, 1);
Guage4.setRotationPoint(7F, 12F, 0F);
Guage4.setTextureSize(128, 128);
Guage4.mirror = true;
setRotation(Guage4, 0F, -1.570796F, 0F);
GuageR4 = new ModelRenderer(this, 44, 32);
GuageR4.addBox(1F, -1F, -1F, 2, 10, 2);
GuageR4.setRotationPoint(7F, 12F, 0F);
GuageR4.setTextureSize(128, 128);
GuageR4.mirror = true;
setRotation(GuageR4, 0F, -1.570796F, 0F);
// GuageGlass4 = new ModelRenderer(this, 60, 32);
// GuageGlass4.addBox(-1F, 0F, 0F, 2, 8, 1);
// GuageGlass4.setRotationPoint(8F, 12F, 0F);
// GuageGlass4.setTextureSize(128, 128);
// GuageGlass4.mirror = true;
// setRotation(GuageGlass4, 0F, -1.570796F, 0F);
GuageL4 = new ModelRenderer(this, 44, 32);
GuageL4.addBox(-3F, -1F, -1F, 2, 10, 2);
GuageL4.setRotationPoint(7F, 12F, 0F);
GuageL4.setTextureSize(128, 128);
GuageL4.mirror = true;
setRotation(GuageL4, 0F, -1.570796F, 0F);
// Pipe Connectors
CCBottom = new ModelRenderer(this, 0, 0);
CCBottom.addBox(-3F, -9F, -3F, 6, 1, 6);
CCBottom.setRotationPoint(0F, 15F, 0F);
CCBottom.setTextureSize(128, 128);
CCBottom.mirror = true;
setRotation(CCBottom, 3.141593F, 0F, 0F);
CCRight = new ModelRenderer(this, 0, 0);
CCRight.addBox(-3F, -8F, -3F, 6, 2, 6);
CCRight.setRotationPoint(0F, 15F, 0F);
CCRight.setTextureSize(128, 128);
CCRight.mirror = true;
setRotation(CCRight, 0F, 0F, -1.570796F);
CCLeft = new ModelRenderer(this, 0, 0);
CCLeft.addBox(-3F, -8F, -3F, 6, 2, 6);
CCLeft.setRotationPoint(0F, 15F, 0F);
CCLeft.setTextureSize(128, 128);
CCLeft.mirror = true;
setRotation(CCLeft, 0F, 0F, 1.570796F);
CCFront = new ModelRenderer(this, 0, 0);
CCFront.addBox(-3F, -8F, -3F, 6, 2, 6);
CCFront.setRotationPoint(0F, 15F, 0F);
CCFront.setTextureSize(128, 128);
CCFront.mirror = true;
setRotation(CCFront, 1.570796F, 0F, 0F);
CCBack = new ModelRenderer(this, 0, 0);
CCBack.addBox(-3F, -8F, -3F, 6, 2, 6);
CCBack.setRotationPoint(0F, 15F, 0F);
CCBack.setTextureSize(128, 128);
CCBack.mirror = true;
setRotation(CCBack, -1.570796F, 0F, 0F);
CCTop = new ModelRenderer(this, 0, 0);
CCTop.addBox(-3F, -7F, -3F, 6, 1, 6);
CCTop.setRotationPoint(0F, 15F, 0F);
CCTop.setTextureSize(128, 128);
CCTop.mirror = true;
setRotation(CCTop, 0F, 0F, 0F);
}
public void renderMain(float f5)
{
// render regardless of sides
Mid.render(f5);
Corner.render(f5);
Corner2.render(f5);
Corner3.render(f5);
Corner4.render(f5);
C8.render(f5);
C7.render(f5);
C6.render(f5);
C5.render(f5);
C4.render(f5);
C.render(f5);
C3.render(f5);
C2.render(f5);
CCTop.render(f5);
CCBottom.render(f5);
}
public void renderMeter(TileEntity tee, float f5)
{
byte[] conenctedTiles = new byte[6];
if (tee instanceof TileEntityTank)
{
conenctedTiles = ((TileEntityTank) tee).renderConnection;
}
// Front
if (conenctedTiles[3] == 1)
{
CCFront.render(f5);
}
else if (conenctedTiles[3] == 0)
{
GuageT.render(f5);
GuageB.render(f5);
Guage.render(f5);
GuageR.render(f5);
// GuageGlass.render(f5);
GuageL.render(f5);
}
// back
if (conenctedTiles[2] == 1)
{
CCBack.render(f5);
}
else if (conenctedTiles[2] == 0)
{
GuageT3.render(f5);
Guage3.render(f5);
Guage3.render(f5);
GuageR3.render(f5);
// GuageGlass3.render(f5);
GuageL3.render(f5);
}
// right
if (conenctedTiles[4] == 1)
{
CCRight.render(f5);
}
else if (conenctedTiles[4] == 0)
{
GuageT4.render(f5);
Guage4.render(f5);
Guage4.render(f5);
GuageR4.render(f5);
// GuageGlass4.render(f5);
GuageL4.render(f5);
}
// left
if (conenctedTiles[5] == 1)
{
CCLeft.render(f5);
}
else if (conenctedTiles[3] == 1)
{
GuageT2.render(f5);
Guage2.render(f5);
Guage2.render(f5);
GuageR2.render(f5);
// GuageGlass2.render(f5);
GuageL2.render(f5);
}
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}

View file

@ -14,7 +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.PipeMaterial;
import dark.fluid.common.FluidPartsMaterial;
@SideOnly(Side.CLIENT)
public class ItemRenderHelper implements IItemRenderer
@ -53,7 +53,7 @@ public class ItemRenderHelper implements IItemRenderer
GL11.glPushMatrix();
FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderPipe.getTexture(PipeMaterial.getFromItemMeta(item.getItemDamage()), item.getItemDamage() % PipeMaterial.spacing));
FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderPipe.getTexture(FluidPartsMaterial.getFromItemMeta(item.getItemDamage()), item.getItemDamage() % FluidPartsMaterial.spacing));
if (!equ)
{
GL11.glTranslatef(0.5F, -0.5F, 0.5F);

View file

@ -11,7 +11,7 @@ import dark.core.client.renders.RenderTileMachine;
import dark.core.prefab.ModPrefab;
import dark.fluid.client.model.ModelLargePipe;
import dark.fluid.common.FluidMech;
import dark.fluid.common.PipeMaterial;
import dark.fluid.common.FluidPartsMaterial;
import dark.fluid.common.pipes.EnumPipeType;
import dark.fluid.common.pipes.TileEntityPipe;
@ -32,20 +32,19 @@ 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);
PipeMaterial mat = PipeMaterial.IRON;
if (te.getBlockMetadata() < PipeMaterial.values().length)
FluidPartsMaterial mat = FluidPartsMaterial.IRON;
if (te.getBlockMetadata() < FluidPartsMaterial.values().length)
{
System.out.println("Pipe meta " + te.getBlockMetadata());
mat = PipeMaterial.values()[te.getBlockMetadata()];
mat = FluidPartsMaterial.values()[te.getBlockMetadata()];
}
if (te instanceof TileEntityPipe)
{
this.render(mat, ((TileEntityPipe) te).getPipeID(), ((TileEntityPipe) te).renderConnection);
this.render(mat, ((TileEntityPipe) te).getSubID(), ((TileEntityPipe) te).renderConnection);
}
else
{
this.render(PipeMaterial.STONE, 0, new byte[6]);
this.render(FluidPartsMaterial.STONE, 0, new boolean[6]);
}
GL11.glPopMatrix();
@ -57,7 +56,7 @@ public class RenderPipe extends RenderTileMachine
return new ResourceLocation(FluidMech.instance.DOMAIN, ModPrefab.MODEL_DIRECTORY + "pipes/Pipe.png");
}
public static ResourceLocation getTexture(PipeMaterial mat, int pipeID)
public static ResourceLocation getTexture(FluidPartsMaterial mat, int pipeID)
{
if (mat != null)
{
@ -71,30 +70,30 @@ public class RenderPipe extends RenderTileMachine
return new ResourceLocation(FluidMech.instance.DOMAIN, ModPrefab.MODEL_DIRECTORY + "pipes/Pipe.png");
}
public void render(PipeMaterial mat, int pipeID, byte[] side)
public void render(FluidPartsMaterial mat, int pipeID, boolean[] side)
{
bindTexture(RenderPipe.getTexture(mat, pipeID));
if (side[0] != 0 && side[0] != 3)
if (side[0])
{
SixPipe.renderBottom();
}
if (side[1] != 0 && side[1] != 3)
if (side[1])
{
SixPipe.renderTop();
}
if (side[3] != 0 && side[3] != 3)
if (side[3])
{
SixPipe.renderFront();
}
if (side[2] != 0 && side[2] != 3)
if (side[2])
{
SixPipe.renderBack();
}
if (side[5] != 0 && side[05] != 3)
if (side[5])
{
SixPipe.renderRight();
}
if (side[4] != 0 && side[4] != 3)
if (side[4])
{
SixPipe.renderLeft();
}

View file

@ -35,7 +35,7 @@ public class RenderTank extends RenderTileMachine
public void renderTank(TileEntity tileEntity, double x, double y, double z, int meta, FluidStack liquid)
{
byte[] render = new byte[6];
boolean[] render = new boolean[6];
if (tileEntity instanceof TileEntityTank)
{
render = ((TileEntityTank) tileEntity).renderConnection;
@ -63,16 +63,16 @@ public class RenderTank extends RenderTileMachine
GL11.glPopMatrix();
}
boolean bot = render[1] == 2;
boolean top = render[0] == 2;
boolean north = render[2] == 2;
boolean south = render[3] == 2;
boolean east = render[5] == 2;
boolean west = render[4] == 2;
boolean bot = render[1];
boolean top = render[0];
boolean north = render[2];
boolean south = render[3];
boolean east = render[5];
boolean west = render[4];
for (int i = 0; i < 4; i++)
{
ForgeDirection dir = ForgeDirection.getOrientation(i + 2);
if (render[dir.getOpposite().ordinal()] != 2)
if (!render[dir.getOpposite().ordinal()])
{
GL11.glPushMatrix();

View file

@ -1,20 +0,0 @@
package dark.fluid.common;
import net.minecraftforge.common.Configuration;
public class ExtraConfigHandler
{
public static int steamPerBucket, heatPerBucket, coalHeatOutput;
static boolean loaded = false;
public static void loadSettings(Configuration config)
{
if (!loaded)
{
loaded = true;
steamPerBucket = config.get("Boiler", "SteamPerBucket", 10).getInt();
heatPerBucket = config.get("Boiler", "HeatPerBucket", 4500).getInt();
coalHeatOutput = config.get("Heater", "CoalHeatMax", 250).getInt();
}
}
}

View file

@ -59,7 +59,7 @@ public class FMRecipeLoader extends RecipeLoader
@SuppressWarnings("deprecation")
public void registerPipes()
{
for (PipeMaterial mat : PipeMaterial.values())
for (FluidPartsMaterial mat : FluidPartsMaterial.values())
{
if (mat.canSupportFluids && !mat.canSupportGas && !mat.canSupportMoltenFluids)
{
@ -71,11 +71,11 @@ public class FMRecipeLoader extends RecipeLoader
}
else if (mat.canSupportMoltenFluids)
{
if (mat == PipeMaterial.OBBY)
if (mat == FluidPartsMaterial.OBBY)
{
GameRegistry.addRecipe(new ShapelessOreRecipe(mat.getStack(2), new Object[] { mat.matName + "tube", Block.netherBrick, Block.netherBrick }));
}
if (mat == PipeMaterial.HELL)
if (mat == FluidPartsMaterial.HELL)
{
GameRegistry.addRecipe(new ShapedOreRecipe(mat.getStack(4), new Object[] { "OOO", "BNB", "OOO", 'N', Block.netherBrick, 'B', Item.blazeRod, 'O', Block.obsidian }));
}

View file

@ -103,7 +103,7 @@ public class FluidMech extends ModPrefab
FMLog.info(" Loaded: " + TranslationHelper.loadLanguages(LANGUAGE_PATH, LANGUAGES_SUPPORTED) + " Languages.");
if (FMRecipeLoader.blockPipe instanceof BlockPipe)
{
DMCreativeTab.tabHydrualic.setIconItemStack(PipeMaterial.IRON.getStack());
DMCreativeTab.tabHydrualic.setIconItemStack(FluidPartsMaterial.IRON.getStack());
}
}

View file

@ -18,7 +18,7 @@ import dark.fluid.common.prefab.TileEntityFluidNetworkTile;
* the pipe to leak. No molten support should cause the pipe to take damage.
*
* @author DarkGuardsman */
public enum PipeMaterial
public enum FluidPartsMaterial
{
/** Simple water only pipe. Should render open toped when it can */
WOOD("wood", false, true, false, -1, 200),
@ -56,14 +56,14 @@ public enum PipeMaterial
* pipes */
public static int spacing = 1000;
private PipeMaterial()
private FluidPartsMaterial()
{
this.canSupportGas = true;
this.canSupportFluids = true;
canSupportMoltenFluids = true;
}
private PipeMaterial(String name, boolean gas, boolean fluid, boolean molten, String... strings)
private FluidPartsMaterial(String name, boolean gas, boolean fluid, boolean molten, String... strings)
{
this.matName = name;
this.canSupportGas = gas;
@ -71,28 +71,28 @@ public enum PipeMaterial
this.canSupportMoltenFluids = molten;
}
private PipeMaterial(String name, boolean gas, boolean fluid, boolean molten, int pressure, int volume, String... strings)
private FluidPartsMaterial(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 PipeMaterial get(World world, int x, int y, int z)
public static FluidPartsMaterial get(World world, int x, int y, int z)
{
return get(world.getBlockMetadata(x, y, z));
}
public static PipeMaterial get(int i)
public static FluidPartsMaterial get(int i)
{
if(i < PipeMaterial.values().length)
if(i < FluidPartsMaterial.values().length)
{
return PipeMaterial.values()[i];
return FluidPartsMaterial.values()[i];
}
return null;
}
public static PipeMaterial get(ItemStack stack)
public static FluidPartsMaterial get(ItemStack stack)
{
if (stack != null)
{
@ -101,14 +101,14 @@ public enum PipeMaterial
return null;
}
public static PipeMaterial getFromItemMeta(int meta)
public static FluidPartsMaterial getFromItemMeta(int meta)
{
meta = meta / spacing;
if (meta < PipeMaterial.values().length)
if (meta < FluidPartsMaterial.values().length)
{
return PipeMaterial.values()[meta];
return FluidPartsMaterial.values()[meta];
}
return PipeMaterial.WOOD;
return FluidPartsMaterial.WOOD;
}
public ItemStack getStack()

View file

@ -1,9 +1,10 @@
package dark.fluid.common;
package dark.fluid.common.machines;
import net.minecraft.block.material.Material;
import dark.core.common.DMCreativeTab;
import dark.core.prefab.machine.BlockMachine;
import dark.core.registration.ModObjectRegistry.BlockBuildData;
import dark.fluid.common.FluidMech;
public abstract class BlockFM extends BlockMachine
{

View file

@ -14,7 +14,6 @@ import com.builtbroken.common.Pair;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.fluid.common.BlockFM;
import dark.fluid.common.FMRecipeLoader;
public class BlockReleaseValve extends BlockFM

View file

@ -18,7 +18,6 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.core.prefab.helpers.FluidHelper;
import dark.fluid.client.render.BlockRenderHelper;
import dark.fluid.common.BlockFM;
public class BlockSink extends BlockFM
{

View file

@ -20,8 +20,7 @@ import cpw.mods.fml.relauncher.SideOnly;
import dark.api.ColorCode.IColorCoded;
import dark.core.prefab.helpers.FluidHelper;
import dark.fluid.client.render.BlockRenderHelper;
import dark.fluid.common.BlockFM;
import dark.fluid.common.PipeMaterial;
import dark.fluid.common.FluidPartsMaterial;
import dark.fluid.common.pipes.TileEntityPipe;
public class BlockTank extends BlockFM
@ -87,7 +86,7 @@ public class BlockTank extends BlockFM
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
{
return new ItemStack(this, 1, PipeMaterial.getDropItemMeta(world, x, y, z));
return new ItemStack(this, 1, FluidPartsMaterial.getDropItemMeta(world, x, y, z));
}
@Override
@ -97,7 +96,7 @@ public class BlockTank extends BlockFM
TileEntity entity = world.getBlockTileEntity(x, y, z);
if (entity instanceof TileEntityPipe)
{
ret.add(new ItemStack(this, 1, PipeMaterial.getDropItemMeta(world, x, y, z)));
ret.add(new ItemStack(this, 1, FluidPartsMaterial.getDropItemMeta(world, x, y, z)));
}
return ret;
}

View file

@ -1,7 +1,29 @@
package dark.fluid.common.machines;
import dark.core.prefab.tilenetwork.NetworkTileEntities;
import dark.core.prefab.tilenetwork.fluid.NetworkFluidContainers;
import dark.core.prefab.tilenetwork.fluid.NetworkPipes;
import dark.fluid.common.prefab.TileEntityFluidNetworkTile;
public class TileEntityTank extends TileEntityFluidNetworkTile
{
@Override
public NetworkFluidContainers getTileNetwork()
{
if (!(this.network instanceof NetworkFluidContainers))
{
this.setTileNetwork(new NetworkFluidContainers(this));
}
return (NetworkFluidContainers) this.network;
}
@Override
public void setTileNetwork(NetworkTileEntities network)
{
if (network instanceof NetworkFluidContainers)
{
this.network = (NetworkFluidContainers) network;
}
}
}

View file

@ -26,8 +26,8 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.api.ColorCode;
import dark.api.ColorCode.IColorCoded;
import dark.fluid.common.BlockFM;
import dark.fluid.common.PipeMaterial;
import dark.fluid.common.FluidPartsMaterial;
import dark.fluid.common.machines.BlockFM;
public class BlockPipe extends BlockFM
{
@ -47,7 +47,7 @@ public class BlockPipe extends BlockFM
public void fillWithRain(World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
if (meta == PipeMaterial.WOOD.ordinal() || meta == PipeMaterial.STONE.ordinal())
if (meta == FluidPartsMaterial.WOOD.ordinal() || meta == FluidPartsMaterial.STONE.ordinal())
{
//TODO fill pipe since it will have an open top and can gather rain
}
@ -60,7 +60,7 @@ public class BlockPipe extends BlockFM
TileEntity entity = world.getBlockTileEntity(x, y, z);
if (entity instanceof TileEntityPipe)
{
ret.add(new ItemStack(this, 1, PipeMaterial.getDropItemMeta(world, x, y, z)));
ret.add(new ItemStack(this, 1, FluidPartsMaterial.getDropItemMeta(world, x, y, z)));
}
return ret;
}
@ -93,7 +93,7 @@ public class BlockPipe extends BlockFM
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
{
return new ItemStack(this, 1, PipeMaterial.getDropItemMeta(world, x, y, z));
return new ItemStack(this, 1, FluidPartsMaterial.getDropItemMeta(world, x, y, z));
}
@Override
@ -105,7 +105,7 @@ public class BlockPipe extends BlockFM
@Override
public int getLightValue(IBlockAccess world, int x, int y, int z)
{
if (world.getBlockMetadata(x, y, z) == PipeMaterial.HELL.ordinal())
if (world.getBlockMetadata(x, y, z) == FluidPartsMaterial.HELL.ordinal())
{
return 5;
}
@ -121,7 +121,7 @@ public class BlockPipe extends BlockFM
@Override
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
for (PipeMaterial data : PipeMaterial.values())
for (FluidPartsMaterial data : FluidPartsMaterial.values())
{
par3List.add(data.getStack());
}

View file

@ -6,8 +6,8 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import dark.api.ColorCode.IColorCoded;
import dark.fluid.common.PipeMaterial;
import dark.fluid.common.FluidPartsMaterial;
import dark.fluid.common.prefab.TileEntityFluidNetworkTile;
public class ItemBlockPipe extends ItemBlock
{
@ -34,12 +34,12 @@ 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, (stack.getItemDamage() / PipeMaterial.spacing)))
if (super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, (stack.getItemDamage() / FluidPartsMaterial.spacing)))
{
TileEntity tile = world.getBlockTileEntity(x, y, z);
if (tile instanceof TileEntityPipe)
if (tile instanceof TileEntityFluidNetworkTile)
{
((TileEntityPipe) tile).setPipeID(stack.getItemDamage());
((TileEntityFluidNetworkTile) tile).setSubID(stack.getItemDamage());
}
return true;
}

View file

@ -41,7 +41,7 @@ import dark.core.network.PacketHandler;
import dark.core.prefab.helpers.FluidHelper;
import dark.core.prefab.tilenetwork.NetworkTileEntities;
import dark.core.prefab.tilenetwork.fluid.NetworkPipes;
import dark.fluid.common.PipeMaterial;
import dark.fluid.common.FluidPartsMaterial;
import dark.fluid.common.prefab.TileEntityFluidNetworkTile;
public class TileEntityPipe extends TileEntityFluidNetworkTile implements IColorCoded, INetworkPipe
@ -75,35 +75,35 @@ public class TileEntityPipe extends TileEntityFluidNetworkTile implements IColor
{
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)
if (meta < FluidPartsMaterial.values().length && metaOther < FluidPartsMaterial.values().length)
{
PipeMaterial pipeMat = PipeMaterial.values()[meta];
PipeMaterial pipeMatOther = PipeMaterial.values()[metaOther];
FluidPartsMaterial pipeMat = FluidPartsMaterial.values()[meta];
FluidPartsMaterial pipeMatOther = FluidPartsMaterial.values()[metaOther];
//Same pipe types can connect
if (pipeMat == pipeMatOther)
{
this.getTileNetwork().merge(((INetworkPipe) tileEntity).getTileNetwork(), this);
connectedBlocks.add(tileEntity);
this.renderConnection[side.ordinal()] = TileEntityFluidNetworkTile.NETWORK_CONNECTION;
return;
this.renderConnection[side.ordinal()] = 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))
else if ((pipeMat == FluidPartsMaterial.WOOD || pipeMat == FluidPartsMaterial.STONE) && (pipeMatOther == FluidPartsMaterial.WOOD || pipeMatOther == FluidPartsMaterial.STONE))
{
this.getTileNetwork().merge(((INetworkPipe) tileEntity).getTileNetwork(), this);
connectedBlocks.add(tileEntity);
this.renderConnection[side.ordinal()] = TileEntityFluidNetworkTile.NETWORK_CONNECTION;
return;
this.renderConnection[side.ordinal()] = 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)
else if (pipeMat != FluidPartsMaterial.WOOD && pipeMat != FluidPartsMaterial.STONE && pipeMatOther != FluidPartsMaterial.WOOD && pipeMatOther != FluidPartsMaterial.STONE && pipeMat != FluidPartsMaterial.GLASS && pipeMatOther != FluidPartsMaterial.GLASS)
{
this.getTileNetwork().merge(((INetworkPipe) tileEntity).getTileNetwork(), this);
connectedBlocks.add(tileEntity);
this.renderConnection[side.ordinal()] = TileEntityFluidNetworkTile.NETWORK_CONNECTION;
return;
this.renderConnection[side.ordinal()] = true;
}
}
this.connectedBlocks.remove(tileEntity);
this.renderConnection[side.ordinal()] = TileEntityFluidNetworkTile.NO_CONENCTION;
}
else if (tileEntity instanceof IFluidHandler)
{
connectedBlocks.add(tileEntity);
this.renderConnection[side.ordinal()] = true;
}
}
@ -119,9 +119,9 @@ public class TileEntityPipe extends TileEntityFluidNetworkTile implements IColor
public double getMaxPressure(ForgeDirection side)
{
int meta = this.worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
if (meta < PipeMaterial.values().length)
if (meta < FluidPartsMaterial.values().length)
{
return PipeMaterial.values()[meta].maxPressure;
return FluidPartsMaterial.values()[meta].maxPressure;
}
return 350;
}
@ -129,7 +129,7 @@ public class TileEntityPipe extends TileEntityFluidNetworkTile implements IColor
@Override
public NetworkPipes getTileNetwork()
{
if (this.network == null || !(this.network instanceof NetworkPipes))
if (!(this.network instanceof NetworkPipes))
{
this.setTileNetwork(new NetworkPipes(this));
}
@ -183,15 +183,4 @@ public class TileEntityPipe extends TileEntityFluidNetworkTile implements IColor
}
return false;
}
public void setPipeID(int itemDamage)
{
this.subID = itemDamage;
}
public int getPipeID()
{
return this.subID;
}
}

View file

@ -32,6 +32,8 @@ import cpw.mods.fml.relauncher.SideOnly;
import universalelectricity.core.vector.Vector3;
import dark.api.ColorCode;
import dark.api.ColorCode.IColorCoded;
import dark.api.IToolReadOut.EnumTools;
import dark.api.IToolReadOut;
import dark.api.fluid.FluidMasterList;
import dark.api.fluid.INetworkFluidPart;
import dark.api.parts.INetworkPart;
@ -42,18 +44,18 @@ import dark.core.network.PacketHandler;
import dark.core.prefab.tilenetwork.NetworkTileEntities;
import dark.core.prefab.tilenetwork.fluid.NetworkFluidTiles;
import dark.core.prefab.tilenetwork.fluid.NetworkPipes;
import dark.fluid.common.PipeMaterial;
import dark.fluid.common.FluidPartsMaterial;
import dark.fluid.common.machines.TileEntityTank;
public class TileEntityFluidNetworkTile extends TileEntityFluidDevice implements INetworkFluidPart, ISimplePacketReceiver
{
private int updateTick = 1;
protected static final byte NO_CONENCTION = 0, PIPE_CONENCTION = 1, NETWORK_CONNECTION = 2, TILE_ENTITY_CONENCTION = 3;
protected static final byte NO_CONENCTION = 0, PIPE_CONENCTION = 1, NETWORK_CONNECTION = 2;
protected FluidTank[] internalTanks = new FluidTank[] { new FluidTank(FluidContainerRegistry.BUCKET_VOLUME) };
protected FluidTankInfo[] internalTanksInfo = new FluidTankInfo[] { new FluidTankInfo(null, FluidContainerRegistry.BUCKET_VOLUME) };
protected List<TileEntity> connectedBlocks = new ArrayList<TileEntity>();
public byte[] renderConnection = new byte[6];
public boolean[] canConnectSide = new boolean[] { true, true, true, true, true, true };
public boolean[] renderConnection = new boolean[6];
public boolean[] canConnectSide = new boolean[] { true, true, true, true, true, true, true };
protected int heat = 0;
protected int maxHeat = 20000;
protected int damage = 0;
@ -80,7 +82,7 @@ public class TileEntityFluidNetworkTile extends TileEntityFluidDevice implements
public void invalidate()
{
super.invalidate();
if (!this.worldObj.isRemote)
if (!this.worldObj.isRemote && this.getTileNetwork() != null)
{
this.getTileNetwork().splitNetwork(this.worldObj, this);
}
@ -150,7 +152,7 @@ public class TileEntityFluidNetworkTile extends TileEntityFluidDevice implements
{
if (this.worldObj != null && !this.worldObj.isRemote)
{
byte[] previousConnections = this.renderConnection.clone();
boolean[] previousConnections = this.renderConnection.clone();
this.connectedBlocks.clear();
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
@ -175,37 +177,13 @@ public class TileEntityFluidNetworkTile extends TileEntityFluidDevice implements
{
if (!this.worldObj.isRemote)
{
this.renderConnection[side.ordinal()] = TileEntityFluidNetworkTile.NO_CONENCTION;
if (tileEntity != null)
if (tileEntity instanceof INetworkFluidPart)
{
this.renderConnection[side.ordinal()] = TileEntityFluidNetworkTile.TILE_ENTITY_CONENCTION;
if (tileEntity instanceof ITileConnector && !((ITileConnector) tileEntity).canTileConnect(Connection.FLUIDS, side.getOpposite()))
if (this.canTileConnect(Connection.NETWORK, side.getOpposite()))
{
this.renderConnection[side.ordinal()] = TileEntityFluidNetworkTile.NO_CONENCTION;
}
else if (tileEntity instanceof INetworkFluidPart)
{
if (this.canTileConnect(Connection.NETWORK, side.getOpposite()))
{
this.getTileNetwork().merge(((INetworkFluidPart) tileEntity).getTileNetwork(), (INetworkPart) tileEntity);
this.renderConnection[side.ordinal()] = TileEntityFluidNetworkTile.NETWORK_CONNECTION;
connectedBlocks.add(tileEntity);
}
}
else if (tileEntity instanceof IFluidHandler)
{
this.getTileNetwork().merge(((TileEntityTank) tileEntity).getTileNetwork(), this);
this.getTileNetwork().merge(((INetworkFluidPart) tileEntity).getTileNetwork(), (INetworkPart) tileEntity);
this.renderConnection[side.ordinal()] = true;
connectedBlocks.add(tileEntity);
if (this.getTileNetwork() instanceof NetworkPipes)
{
((NetworkPipes) this.getTileNetwork()).addTile(tileEntity, false);
}
}
else
{
this.renderConnection[side.ordinal()] = TileEntityFluidNetworkTile.TILE_ENTITY_CONENCTION;
}
}
}
@ -214,7 +192,7 @@ public class TileEntityFluidNetworkTile extends TileEntityFluidDevice implements
@Override
public NetworkFluidTiles getTileNetwork()
{
if (this.network == null)
if (!(this.network instanceof NetworkFluidTiles))
{
this.network = new NetworkFluidTiles(this);
}
@ -245,7 +223,10 @@ public class TileEntityFluidNetworkTile extends TileEntityFluidDevice implements
this.internalTanksInfo = new FluidTankInfo[this.internalTanks.length];
for (int i = 0; i < this.internalTanks.length; i++)
{
this.internalTanksInfo[i] = this.internalTanks[i].getInfo();
if (this.internalTanks[i] != null)
{
this.internalTanksInfo[i] = this.internalTanks[i].getInfo();
}
}
}
return this.internalTanksInfo;
@ -302,18 +283,7 @@ public class TileEntityFluidNetworkTile extends TileEntityFluidDevice implements
{
return false;
}
Vector3 connection = new Vector3(this).modifyPositionFromSide(dir.getOpposite());
TileEntity entity = connection.getTileEntity(this.worldObj);
//Unknown color codes can connect to any color, however two different colors can connect to support better pipe layouts
if (entity instanceof IColorCoded && this instanceof IColorCoded && ((IColorCoded) entity).getColor() != ((IColorCoded) this).getColor() && ((IColorCoded) this).getColor() != ColorCode.UNKOWN && ((IColorCoded) entity).getColor() != ColorCode.UNKOWN)
{
return false;
}//All Fluid connections are supported
else if (type == Connection.FLUIDS)
{
return true;
}
return false;
return type == Connection.FLUIDS || type == Connection.NETWORK;
}
@Override
@ -325,7 +295,7 @@ public class TileEntityFluidNetworkTile extends TileEntityFluidDevice implements
@Override
public boolean onPassThrew(FluidStack fluid, ForgeDirection from, ForgeDirection to)
{
PipeMaterial mat = PipeMaterial.get(this.getBlockMetadata());
FluidPartsMaterial mat = FluidPartsMaterial.get(this.getBlockMetadata());
if (fluid != null && fluid.getFluid() != null && mat != null)
{
if (fluid.getFluid().isGaseous(fluid) && !mat.canSupportGas)
@ -402,7 +372,10 @@ public class TileEntityFluidNetworkTile extends TileEntityFluidDevice implements
this.internalTanksInfo = new FluidTankInfo[tankCount];
for (int i = 0; i < this.internalTanksInfo.length; i++)
{
this.internalTanksInfo[i] = this.internalTanks[i].getInfo();
if (this.internalTanks[i] != null)
{
this.internalTanksInfo[i] = this.internalTanks[i].getInfo();
}
}
}
}
@ -435,15 +408,15 @@ public class TileEntityFluidNetworkTile extends TileEntityFluidDevice implements
{
if (this.worldObj.isRemote)
{
if (id == "DescriptionPacket")
if (id.equalsIgnoreCase("DescriptionPacket"))
{
this.subID = data.readInt();
this.renderConnection[0] = data.readByte();
this.renderConnection[1] = data.readByte();
this.renderConnection[2] = data.readByte();
this.renderConnection[3] = data.readByte();
this.renderConnection[4] = data.readByte();
this.renderConnection[5] = data.readByte();
this.renderConnection[0] = data.readBoolean();
this.renderConnection[1] = data.readBoolean();
this.renderConnection[2] = data.readBoolean();
this.renderConnection[3] = data.readBoolean();
this.renderConnection[4] = data.readBoolean();
this.renderConnection[5] = data.readBoolean();
int tanks = data.readInt();
this.internalTanks = new FluidTank[tanks];
for (int i = 0; i < tanks; i++)
@ -453,18 +426,18 @@ public class TileEntityFluidNetworkTile extends TileEntityFluidDevice implements
}
return true;
}
else if (id == "TankPacket")
else if (id.equalsIgnoreCase("RenderPacket"))
{
this.subID = data.readInt();
this.renderConnection[0] = data.readByte();
this.renderConnection[1] = data.readByte();
this.renderConnection[2] = data.readByte();
this.renderConnection[3] = data.readByte();
this.renderConnection[4] = data.readByte();
this.renderConnection[5] = data.readByte();
this.renderConnection[0] = data.readBoolean();
this.renderConnection[1] = data.readBoolean();
this.renderConnection[2] = data.readBoolean();
this.renderConnection[3] = data.readBoolean();
this.renderConnection[4] = data.readBoolean();
this.renderConnection[5] = data.readBoolean();
return true;
}
else if (id == "RenderPacket")
else if (id.equalsIgnoreCase("TankPacket"))
{
int tanks = data.readInt();
this.internalTanks = new FluidTank[tanks];
@ -475,7 +448,7 @@ public class TileEntityFluidNetworkTile extends TileEntityFluidDevice implements
}
return true;
}
else if (id == "SingleTank")
else if (id.equalsIgnoreCase("SingleTank"))
{
int index = data.readInt();
this.internalTanks[index] = new FluidTank(data.readInt());
@ -496,7 +469,7 @@ public class TileEntityFluidNetworkTile extends TileEntityFluidDevice implements
@Override
public Packet getDescriptionPacket()
{
Object[] data = new Object[(this.internalTanks != null ? (this.internalTanks.length * 2) : 2) + 7];
Object[] data = new Object[(this.internalTanks != null ? (this.internalTanks.length * 2) : 2) + 9];
data[0] = "DescriptionPacket";
data[1] = this.subID;
data[2] = this.renderConnection[0];
@ -522,7 +495,7 @@ public class TileEntityFluidNetworkTile extends TileEntityFluidDevice implements
public void sendRenderUpdate()
{
Object[] data = new Object[7];
Object[] data = new Object[8];
data[0] = "renderPacket";
data[1] = this.subID;
data[2] = this.renderConnection[0];
@ -568,6 +541,22 @@ public class TileEntityFluidNetworkTile extends TileEntityFluidDevice implements
}
}
@Override
public String getMeterReading(EntityPlayer user, ForgeDirection side, EnumTools tool)
{
if (tool == EnumTools.PIPE_GUAGE)
{
String out = "Debug: " + this.getTileNetwork().toString();
out += " ";
for (boolean b : this.renderConnection)
{
out += "|" + (b ? "T" : "F");
}
return out;
}
return null;
}
@Override
@SideOnly(Side.CLIENT)
public AxisAlignedBB getRenderBoundingBox()
@ -580,4 +569,9 @@ public class TileEntityFluidNetworkTile extends TileEntityFluidDevice implements
return this.subID;
}
public void setSubID(int id)
{
this.subID = id;
}
}

View file

@ -23,9 +23,9 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.core.prefab.tilenetwork.fluid.FluidNetworkHelper;
import dark.fluid.client.render.BlockRenderHelper;
import dark.fluid.common.BlockFM;
import dark.fluid.common.FMRecipeLoader;
import dark.fluid.common.FluidMech;
import dark.fluid.common.machines.BlockFM;
public class BlockConstructionPump extends BlockFM
{

View file

@ -17,8 +17,8 @@ import net.minecraftforge.common.ForgeDirection;
import com.builtbroken.common.Pair;
import dark.fluid.common.BlockFM;
import dark.fluid.common.FluidMech;
import dark.fluid.common.machines.BlockFM;
public class BlockDrain extends BlockFM
{

View file

@ -16,8 +16,8 @@ import com.builtbroken.common.Pair;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.fluid.client.render.BlockRenderHelper;
import dark.fluid.common.BlockFM;
import dark.fluid.common.FMRecipeLoader;
import dark.fluid.common.machines.BlockFM;
public class BlockPumpMachine extends BlockFM
{

View file

@ -17,8 +17,8 @@ import com.builtbroken.common.Pair;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.fluid.client.render.BlockRenderHelper;
import dark.fluid.common.BlockFM;
import dark.fluid.common.FMRecipeLoader;
import dark.fluid.common.machines.BlockFM;
public class BlockMechanicalGenerator extends BlockFM
{

View file

@ -17,8 +17,8 @@ import com.builtbroken.common.Pair;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.fluid.client.render.BlockRenderHelper;
import dark.fluid.common.BlockFM;
import dark.fluid.common.FMRecipeLoader;
import dark.fluid.common.machines.BlockFM;
public class BlockRod extends BlockFM
{

View file

@ -13,7 +13,7 @@ import com.builtbroken.common.Pair;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.fluid.common.BlockFM;
import dark.fluid.common.machines.BlockFM;
public class BlockSteamPiston extends BlockFM
{