changes/fixed stuff

*Finished basic version of new release valve
*Fixed a tank render issue
*Changed PipeColor to ColorCode
This commit is contained in:
Rseifert 2013-01-07 11:37:13 -05:00
parent 1e5c47ad3f
commit 064ef38db9
12 changed files with 132 additions and 138 deletions

View file

@ -1,13 +1,13 @@
package liquidmechanics.api;
import liquidmechanics.api.helpers.PipeColor;
import liquidmechanics.api.helpers.ColorCode;
public interface IColor
public interface IColorCoded
{
/**
* gets the pipeColor being used by this object
*/
public PipeColor getColor();
public ColorCode getColor();
/**
* sets the pipeColor to be used by this object *
* @param obj-can be anything must be sorted

View file

@ -1,7 +1,7 @@
package liquidmechanics.api.helpers;
public enum PipeColor
public enum ColorCode
{
BLACK("Black"),
RED("Red"),
@ -22,7 +22,7 @@ public enum PipeColor
String name;
private PipeColor(String name)
private ColorCode(String name)
{
this.name = name;
}
@ -37,25 +37,25 @@ public enum PipeColor
* @param obj
* - Integer,String,LiquidData,PipeColor
* @return Color NONE if it can't find it */
public static PipeColor get(Object obj)
public static ColorCode get(Object obj)
{
if (obj instanceof Integer && ((Integer) obj) < PipeColor.values().length)
if (obj instanceof Integer && ((Integer) obj) < ColorCode.values().length)
{
return PipeColor.values()[((Integer) obj)];
return ColorCode.values()[((Integer) obj)];
} else if (obj instanceof LiquidData)
{
LiquidData data = (LiquidData) obj;
if (data == LiquidHandler.lava) { return RED; }
if (data == LiquidHandler.steam) { return ORANGE; }
if (data == LiquidHandler.water) { return BLUE; }
} else if (obj instanceof PipeColor)
} else if (obj instanceof ColorCode)
{
return (PipeColor) obj;
return (ColorCode) obj;
} else if (obj instanceof String)
{
for (int i = 0; i < PipeColor.values().length; i++)
for (int i = 0; i < ColorCode.values().length; i++)
{
if (((String) obj).equalsIgnoreCase(PipeColor.get(i).getName())) { return PipeColor.get(i); }
if (((String) obj).equalsIgnoreCase(ColorCode.get(i).getName())) { return ColorCode.get(i); }
}
}
return NONE;

View file

@ -8,9 +8,9 @@ public class LiquidData
private int defaultPressure;
private LiquidStack sampleStack;
private String name;
private PipeColor color;
private ColorCode color;
public LiquidData(String name, LiquidStack stack,PipeColor color, boolean gas, int dPressure)
public LiquidData(String name, LiquidStack stack,ColorCode color, boolean gas, int dPressure)
{
this.sampleStack = stack;
this.isAGas = gas;
@ -37,10 +37,10 @@ public class LiquidData
{
return isAGas;
}
public PipeColor getColor()
public ColorCode getColor()
{
if (color != null) { return color; }
return PipeColor.NONE;
return ColorCode.NONE;
}
}

View file

@ -30,11 +30,11 @@ public class LiquidHandler
*/
public static void addDefaultLiquids()
{
water = new LiquidData("water", LiquidDictionary.getOrCreateLiquid("Water", new LiquidStack(Block.waterStill, 1)), PipeColor.BLUE, false, 32);
water = new LiquidData("water", LiquidDictionary.getOrCreateLiquid("Water", new LiquidStack(Block.waterStill, 1)), ColorCode.BLUE, false, 32);
allowedLiquids.add(water);
lava = new LiquidData("Lava", LiquidDictionary.getOrCreateLiquid("Lava", new LiquidStack(Block.lavaStill, 1)), PipeColor.RED, false, 20);
lava = new LiquidData("Lava", LiquidDictionary.getOrCreateLiquid("Lava", new LiquidStack(Block.lavaStill, 1)), ColorCode.RED, false, 20);
allowedLiquids.add(lava);
unkown = new LiquidData("Unknown", LiquidDictionary.getOrCreateLiquid("Unknown", new LiquidStack(20, 1)), PipeColor.NONE, false, 0);
unkown = new LiquidData("Unknown", LiquidDictionary.getOrCreateLiquid("Unknown", new LiquidStack(20, 1)), ColorCode.NONE, false, 32);
allowedLiquids.add(unkown);
}
@ -45,22 +45,22 @@ public class LiquidHandler
// or something along the lines of IDing liquids for use
if (event.Name.equalsIgnoreCase("methane"))
{
this.allowedLiquids.add(new LiquidData("methane", event.Liquid, PipeColor.LIME, true, 100));
this.allowedLiquids.add(new LiquidData("methane", event.Liquid, ColorCode.LIME, true, 100));
}
else if (event.Name.equalsIgnoreCase("oil"))
{
this.allowedLiquids.add(new LiquidData("oil", event.Liquid, PipeColor.BLACK, true, 50));
this.allowedLiquids.add(new LiquidData("oil", event.Liquid, ColorCode.BLACK, true, 50));
}
else if (event.Name.equalsIgnoreCase("fuel"))
{
this.allowedLiquids.add(new LiquidData("fuel", event.Liquid, PipeColor.YELLOW, true, 50));
this.allowedLiquids.add(new LiquidData("fuel", event.Liquid, ColorCode.YELLOW, true, 50));
}
else if (event.Name.equalsIgnoreCase("steam"))
{
this.steam = new LiquidData("steam", event.Liquid, PipeColor.ORANGE, true, 100);
this.steam = new LiquidData("steam", event.Liquid, ColorCode.ORANGE, true, 100);
}else if(event.Name.equalsIgnoreCase("Waste"))
{
this.waste = new LiquidData("Waste", event.Liquid, PipeColor.BROWN, false, 40);
this.waste = new LiquidData("Waste", event.Liquid, ColorCode.BROWN, false, 40);
this.allowedLiquids.add(waste);
}
}

View file

@ -1,6 +1,6 @@
package liquidmechanics.client.render;
import liquidmechanics.api.helpers.PipeColor;
import liquidmechanics.api.helpers.ColorCode;
import liquidmechanics.client.model.ModelLargePipe;
import liquidmechanics.common.LiquidMechanics;
import liquidmechanics.common.tileentity.TileEntityPipe;
@ -37,7 +37,7 @@ public class RenderPipe extends TileEntitySpecialRenderer
}
public static String getPipeTexture(int meta)
{
return LiquidMechanics.RESOURCE_PATH + "pipes/"+PipeColor.get(meta).getName()+"Pipe.png";
return LiquidMechanics.RESOURCE_PATH + "pipes/"+ColorCode.get(meta).getName()+"Pipe.png";
}
public void render(int meta, TileEntity[] ents)
{

View file

@ -2,7 +2,7 @@ package liquidmechanics.client.render;
import liquidmechanics.api.helpers.LiquidData;
import liquidmechanics.api.helpers.LiquidHandler;
import liquidmechanics.api.helpers.PipeColor;
import liquidmechanics.api.helpers.ColorCode;
import liquidmechanics.api.helpers.connectionHelper;
import liquidmechanics.client.model.ModelLiquidTank;
import liquidmechanics.client.model.ModelLiquidTankCorner;
@ -11,15 +11,15 @@ import liquidmechanics.common.tileentity.TileEntityTank;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.liquids.LiquidContainerRegistry;
import net.minecraftforge.liquids.LiquidStack;
import org.lwjgl.opengl.GL11;
public class RenderTank extends TileEntitySpecialRenderer
{
private LiquidData type = LiquidHandler.unkown;
private ModelLiquidTank model;
private ModelLiquidTankCorner modelC;
private int pos = 0;
public RenderTank()
{
@ -31,12 +31,14 @@ public class RenderTank extends TileEntitySpecialRenderer
{
int meta = te.getBlockMetadata();
int guageMeta = meta;
if(te.tank.getLiquid() != null)
LiquidStack stack = te.getStack();
int pos = 0;
if(stack != null)
{
pos = Math.min((te.tank.getLiquid().amount / LiquidContainerRegistry.BUCKET_VOLUME), 4);
if(meta == PipeColor.NONE.ordinal())
pos = Math.min((stack.amount / LiquidContainerRegistry.BUCKET_VOLUME), 4);
if(meta == ColorCode.NONE.ordinal())
{
guageMeta = PipeColor.get(te.tank.getLiquid()).ordinal();
guageMeta = ColorCode.get(stack).ordinal();
}
}

View file

@ -4,7 +4,7 @@ import java.io.File;
import liquidmechanics.api.helpers.LiquidData;
import liquidmechanics.api.helpers.LiquidHandler;
import liquidmechanics.api.helpers.PipeColor;
import liquidmechanics.api.helpers.ColorCode;
import liquidmechanics.common.block.BlockGenerator;
import liquidmechanics.common.block.BlockPumpMachine;
import liquidmechanics.common.block.BlockPipe;
@ -219,12 +219,12 @@ public class LiquidMechanics extends DummyModContainer
new ItemStack(itemParts, 1, Parts.Seal.ordinal()) });
// steam tank
GameRegistry.addShapelessRecipe(new ItemStack(blockTank, 1, PipeColor.ORANGE.ordinal()), new Object[] {
GameRegistry.addShapelessRecipe(new ItemStack(blockTank, 1, ColorCode.ORANGE.ordinal()), new Object[] {
new ItemStack(itemParts, 1, Parts.Tank.ordinal()),
new ItemStack(itemParts, 1, Parts.Seal.ordinal()),
new ItemStack(Item.dyePowder, 1, PipeColor.ORANGE.ordinal()) });
new ItemStack(Item.dyePowder, 1, ColorCode.ORANGE.ordinal()) });
// lava tank
GameRegistry.addRecipe(new ItemStack(blockTank, 1, PipeColor.RED.ordinal()), new Object[] {
GameRegistry.addRecipe(new ItemStack(blockTank, 1, ColorCode.RED.ordinal()), new Object[] {
" @ ", "@T@", " @ ",
'T', new ItemStack(itemParts, 1, Parts.Tank.ordinal()),
'@', Block.obsidian, });

View file

@ -85,7 +85,7 @@ public class BlockTank extends BlockMachine
else
{
LiquidStack stack = tank.tank.getLiquid();
LiquidStack stack = tank.getStack();
if (stack != null)
{
ItemStack liquidItem = LiquidContainerRegistry.fillLiquidContainer(stack, current);
@ -110,7 +110,7 @@ public class BlockTank extends BlockMachine
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, liquidItem);
}
}
tank.tank.drain(liquid.amount, true);
tank.drain(null, liquid.amount, true);
return true;
}
}

View file

@ -2,7 +2,7 @@ package liquidmechanics.common.handlers;
import net.minecraft.nbt.NBTTagCompound;
import liquidmechanics.api.helpers.LiquidHandler;
import liquidmechanics.api.helpers.PipeColor;
import liquidmechanics.api.helpers.ColorCode;
import liquidmechanics.common.tileentity.TileEntityPipe;
import liquidmechanics.common.tileentity.TileEntityTank;
@ -17,11 +17,11 @@ public class UpdateConverter
Boolean converted25 = nbt.getBoolean("converted025");
if (!converted24)
{
pipe.setColor(PipeColor.get(LiquidHandler.getFromMeta(nbt.getInteger("type"))));
pipe.setColor(ColorCode.get(LiquidHandler.getFromMeta(nbt.getInteger("type"))));
}
else if (converted24 && !converted25)
{
pipe.setColor(PipeColor.get(LiquidHandler.get(nbt.getString("name"))));
pipe.setColor(ColorCode.get(LiquidHandler.get(nbt.getString("name"))));
}
nbt.setBoolean("converted", true);
nbt.setBoolean("converted025", true);
@ -32,11 +32,11 @@ public class UpdateConverter
Boolean converted25 = nbt.getBoolean("converted025");
if (!converted24)
{
pipe.setColor(PipeColor.get(LiquidHandler.getFromMeta(nbt.getInteger("type"))));
pipe.setColor(ColorCode.get(LiquidHandler.getFromMeta(nbt.getInteger("type"))));
}
else if (converted24 && !converted25)
{
pipe.setColor(PipeColor.get(LiquidHandler.get(nbt.getString("name"))));
pipe.setColor(ColorCode.get(LiquidHandler.get(nbt.getString("name"))));
}
nbt.setBoolean("converted", true);
nbt.setBoolean("converted025", true);

View file

@ -1,11 +1,11 @@
package liquidmechanics.common.tileentity;
import liquidmechanics.api.IColor;
import liquidmechanics.api.IColorCoded;
import liquidmechanics.api.IReadOut;
import liquidmechanics.api.IPressure;
import liquidmechanics.api.helpers.LiquidData;
import liquidmechanics.api.helpers.LiquidHandler;
import liquidmechanics.api.helpers.PipeColor;
import liquidmechanics.api.helpers.ColorCode;
import liquidmechanics.api.helpers.connectionHelper;
import liquidmechanics.common.LiquidMechanics;
import liquidmechanics.common.handlers.UpdateConverter;
@ -28,9 +28,9 @@ import universalelectricity.prefab.network.PacketManager;
import com.google.common.io.ByteArrayDataInput;
public class TileEntityPipe extends TileEntity implements ITankContainer, IReadOut,IColor
public class TileEntityPipe extends TileEntity implements ITankContainer, IReadOut,IColorCoded
{
private PipeColor color = PipeColor.NONE;
private ColorCode color = ColorCode.NONE;
private int count = 40;
private int count2, presure = 0;
@ -47,7 +47,7 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IReadO
{
this.validataConnections();
this.color = PipeColor.get(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
this.color = ColorCode.get(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
if (!worldObj.isRemote && ++count >= 40)
{
count = 0;
@ -91,7 +91,7 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IReadO
* gets the current color mark of the pipe
*/
@Override
public PipeColor getColor()
public ColorCode getColor()
{
return this.color;
}
@ -102,7 +102,7 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IReadO
@Override
public void setColor(Object cc)
{
this.color = PipeColor.get(cc);
this.color = ColorCode.get(cc);
}
/**
@ -110,9 +110,9 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IReadO
*/
public void setColor(int i)
{
if (i < PipeColor.values().length)
if (i < ColorCode.values().length)
{
this.color = PipeColor.values()[i];
this.color = ColorCode.values()[i];
}
}
@ -157,9 +157,9 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IReadO
{
if (resource == null) { return 0; }
LiquidStack stack = stored.getLiquid();
if (color != PipeColor.NONE)
if (color != ColorCode.NONE)
{
if (color != PipeColor.get(LiquidHandler.get(resource)) || !LiquidHandler.isEqual(stack, resource))
if (color != ColorCode.get(LiquidHandler.get(resource)) || !LiquidHandler.isEqual(stack, resource))
{
this.causeMix(stack, resource);
}
@ -259,7 +259,7 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IReadO
connectedBlocks[i] = null;
}
if (this.color != PipeColor.NONE && ent instanceof TileEntityTank && color != ((TileEntityTank) ent).getColor())
if (this.color != ColorCode.NONE && ent instanceof TileEntityTank && color != ((TileEntityTank) ent).getColor())
{
connectedBlocks[i] = null;
}

View file

@ -5,11 +5,13 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import cpw.mods.fml.common.FMLLog;
import liquidmechanics.api.IPressure;
import liquidmechanics.api.IReadOut;
import liquidmechanics.api.helpers.LiquidData;
import liquidmechanics.api.helpers.LiquidHandler;
import liquidmechanics.api.helpers.PipeColor;
import liquidmechanics.api.helpers.ColorCode;
import liquidmechanics.api.helpers.connectionHelper;
import liquidmechanics.common.block.BlockReleaseValve;
import net.minecraft.entity.player.EntityPlayer;
@ -27,7 +29,7 @@ import universalelectricity.prefab.implement.IRedstoneReceptor;
public class TileEntityReleaseValve extends TileEntity implements IPressure, IReadOut, IRedstoneReceptor, IInventory
{
public boolean[] allowed = new boolean[PipeColor.values().length];
public boolean[] allowed = new boolean[ColorCode.values().length - 1];
public TileEntity[] connected = new TileEntity[6];
private List<TileEntityPipe> output = new ArrayList<TileEntityPipe>();
@ -45,70 +47,72 @@ public class TileEntityReleaseValve extends TileEntity implements IPressure, IRe
{
super.updateEntity();
if (!this.worldObj.isRemote && ticks++ == 10)
if (!this.worldObj.isRemote && ticks++ >= 40)
{
ticks = 0;
BlockReleaseValve.checkForPower(worldObj, xCoord, yCoord, zCoord);
validateNBuildList();
//start the draining process
// start the draining process
if (this.input.size() > 0 && this.output.size() > 0)
{
Iterator itr = input.iterator();
// testing out Iterators :p
while (itr.hasNext())
for (ILiquidTank tank : input)
{
Object element = itr.next();
if (element instanceof ILiquidTank)
if (tank.getLiquid() != null && tank.getLiquid().amount > 0)
{
ILiquidTank tank = (ILiquidTank) element;
if (tank.getLiquid() != null && tank.getLiquid().amount < tank.getCapacity())
FMLLog.warning("Tank: " + LiquidHandler.getName(tank.getLiquid()) + " Vol: " + tank.getLiquid().amount);
TileEntityPipe pipe = this.findValidPipe(tank.getLiquid());
if (pipe != null)
{
TileEntityPipe pipe = this.findValidPipe(tank.getLiquid());
if (pipe != null)
{
int drain = pipe.stored.fill(tank.getLiquid(), true);
tank.drain(drain, true);
break;
}
FMLLog.warning("Pipe: " + pipe.getColor() + " Vol: " + (pipe.stored.getLiquid() != null ? pipe.stored.getLiquid().amount : 0000));
int drain = pipe.stored.fill(tank.getLiquid(), true);
tank.drain(drain, true);
}
}
}
}
}
}
/**
* used to find a valid pipe for filling of the liquid type
*/
/** used to find a valid pipe for filling of the liquid type */
public TileEntityPipe findValidPipe(LiquidStack stack)
{
LiquidData data = LiquidHandler.get(stack);
if (data != LiquidHandler.unkown)
{
// find normal color selective pipe first
for (TileEntityPipe pipe : output)
{
if (pipe.getColor() == data.getColor() && (pipe.stored.getLiquid() == null || pipe.stored.getLiquid().amount < pipe.stored.getCapacity())) { return pipe; }
if (LiquidHandler.isEqual(pipe.getColor().getLiquidData().getStack(),stack) && (pipe.stored.getLiquid() == null || pipe.stored.getLiquid().amount < pipe.stored.getCapacity()))
{
//
return pipe;
}
}
}
// if no color selective pipe is found look for generic pipes
for (TileEntityPipe pipe : output)
{
if (pipe.getColor() == ColorCode.NONE) { return pipe; }
}
return null;
}
/**
* sees if it can connect to a pipe of some color
*/
public boolean canConnect(PipeColor cc)
/** sees if it can connect to a pipe of some color */
public boolean canConnect(ColorCode cc)
{
for (int i = 0; i < this.allowed.length; i++)
if (this.isRestricted())
{
if (allowed[i] && i == cc.ordinal()) { return true; }
for (int i = 0; i < this.allowed.length; i++)
{
if (i == cc.ordinal()) { return allowed[i]; }
}
}
return false;
return true;
}
/**
* if any of allowed list is true
/** if any of allowed list is true
*
* @return true
*/
* @return true */
public boolean isRestricted()
{
for (int i = 0; i < this.allowed.length; i++)
@ -118,15 +122,18 @@ public class TileEntityReleaseValve extends TileEntity implements IPressure, IRe
return false;
}
/** checks a liquidstack against its color code
*
* @param stack
* @return */
public boolean canAcceptLiquid(LiquidStack stack)
{
return canConnect(PipeColor.get(LiquidHandler.get(stack)));
if (!this.isRestricted()) { return true; }
return canConnect(ColorCode.get(LiquidHandler.get(stack)));
}
/**
* Collects info about the surrounding 6 tiles and orders them into
* drain-able(ITankContainer) and fill-able(TileEntityPipes) instances
*/
/** Collects info about the surrounding 6 tiles and orders them into
* drain-able(ITankContainer) and fill-able(TileEntityPipes) instances */
public void validateNBuildList()
{
// cleanup
@ -160,17 +167,9 @@ public class TileEntityReleaseValve extends TileEntity implements IPressure, IRe
for (int t = 0; t < tanks.length; t++)
{
LiquidStack ll = tanks[t].getLiquid();
if (ll != null && ll.amount > 0 && ll.amount < tanks[t].getCapacity())
if (ll != null && ll.amount > 0 && ll.amount > 0)
{
// if restricted check for type match
if (this.isRestricted())
{
if (this.canAcceptLiquid(ll))
{
this.input.add(tanks[t]);
}
}
else
if (this.canAcceptLiquid(ll))
{
this.input.add(tanks[t]);
}
@ -234,9 +233,7 @@ public class TileEntityReleaseValve extends TileEntity implements IPressure, IRe
}
}
/**
* Writes a tile entity to NBT.
*/
/** Writes a tile entity to NBT. */
@Override
public void writeToNBT(NBTTagCompound nbt)
{
@ -266,18 +263,14 @@ public class TileEntityReleaseValve extends TileEntity implements IPressure, IRe
return this.inventory.length;
}
/**
* Returns the stack in slot i
*/
/** Returns the stack in slot i */
public ItemStack getStackInSlot(int par1)
{
return this.inventory[par1];
}
/**
* Removes from an inventory slot (first arg) up to a specified number
* (second arg) of items and returns them in a new stack.
*/
/** Removes from an inventory slot (first arg) up to a specified number
* (second arg) of items and returns them in a new stack. */
public ItemStack decrStackSize(int par1, int par2)
{
if (this.inventory[par1] != null)
@ -308,11 +301,9 @@ public class TileEntityReleaseValve extends TileEntity implements IPressure, IRe
}
}
/**
* When some containers are closed they call this on each slot, then drop
/** When some containers are closed they call this on each slot, then drop
* whatever it returns as an EntityItem - like when you close a workbench
* GUI.
*/
* GUI. */
public ItemStack getStackInSlotOnClosing(int par1)
{
if (this.inventory[par1] != null)
@ -327,10 +318,8 @@ public class TileEntityReleaseValve extends TileEntity implements IPressure, IRe
}
}
/**
* Sets the given item stack to the specified slot in the inventory (can be
* crafting or armor sections).
*/
/** Sets the given item stack to the specified slot in the inventory (can be
* crafting or armor sections). */
public void setInventorySlotContents(int par1, ItemStack par2ItemStack)
{
this.inventory[par1] = par2ItemStack;

View file

@ -2,12 +2,12 @@ package liquidmechanics.common.tileentity;
import javax.swing.colorchooser.ColorSelectionModel;
import liquidmechanics.api.IColor;
import liquidmechanics.api.IColorCoded;
import liquidmechanics.api.IReadOut;
import liquidmechanics.api.IPressure;
import liquidmechanics.api.helpers.LiquidData;
import liquidmechanics.api.helpers.LiquidHandler;
import liquidmechanics.api.helpers.PipeColor;
import liquidmechanics.api.helpers.ColorCode;
import liquidmechanics.api.helpers.connectionHelper;
import liquidmechanics.common.LiquidMechanics;
import liquidmechanics.common.handlers.UpdateConverter;
@ -29,24 +29,24 @@ import universalelectricity.prefab.network.PacketManager;
import com.google.common.io.ByteArrayDataInput;
public class TileEntityTank extends TileEntity implements IPacketReceiver, IReadOut, IPressure, ITankContainer, IColor
public class TileEntityTank extends TileEntity implements IPacketReceiver, IReadOut, IPressure, ITankContainer, IColorCoded
{
public TileEntity[] cc = { null, null, null, null, null, null };
private PipeColor color = PipeColor.NONE;
private ColorCode color = ColorCode.NONE;
public static final int LMax = 4;
private int count, count2 = 0;
public int pVolume = 0;
public LiquidTank tank = new LiquidTank(LiquidContainerRegistry.BUCKET_VOLUME * LMax);
private LiquidTank tank = new LiquidTank(LiquidContainerRegistry.BUCKET_VOLUME * LMax);
public void updateEntity()
{
LiquidStack liquid = tank.getLiquid();
this.color = PipeColor.get(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
this.color = ColorCode.get(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
if (++count >= 40 && liquid != null)
{
count = 0;
@ -73,7 +73,10 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
}
}
}
public LiquidStack getStack()
{
return tank.getLiquid();
}
@Override
public String getMeterReading(EntityPlayer user, ForgeDirection side)
{
@ -121,7 +124,7 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
@Override
public int fill(ForgeDirection from, LiquidStack resource, boolean doFill)
{
if (resource == null || (!LiquidHandler.isEqual(resource, color.getLiquidData().getStack()) && this.color != PipeColor.NONE)) { return 0; }
if (resource == null || (!LiquidHandler.isEqual(resource, color.getLiquidData().getStack()) && this.color != ColorCode.NONE)) { return 0; }
return this.fill(0, resource, doFill);
}
@ -298,8 +301,8 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
TileEntity ent = worldObj.getBlockTileEntity(xCoord, yCoord + change, zCoord);
if (ent instanceof TileEntityPipe)
{
PipeColor c = ((TileEntityPipe) ent).getColor();
if (c == PipeColor.NONE || c == this.color)
ColorCode c = ((TileEntityPipe) ent).getColor();
if (c == ColorCode.NONE || c == this.color)
{
int vol = LiquidContainerRegistry.BUCKET_VOLUME;
if (this.tank.getLiquid().amount < vol)
@ -316,12 +319,12 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
@Override
public void setColor(Object obj)
{
this.color = PipeColor.get(cc);
this.color = ColorCode.get(cc);
}
@Override
public PipeColor getColor()
public ColorCode getColor()
{
return color;
}