From 2273dc425e9de5019347c471609b704b80aa4c5b Mon Sep 17 00:00:00 2001 From: Rseifert Date: Tue, 15 Jan 2013 00:52:07 -0500 Subject: [PATCH] Face Palm moment Last few release due to my fail to bug check to most simple of things the pipe nothing would function. Turns out that i fliped the checks on the fill liquid method. Also fixed more issues with crafting recipes, i really need someone to sit and bug test my mods for me. It always seem i'm too focused on the current part to check the rest for failures. --- .../liquidmechanics/api/IColorCoded.java | 5 +- .../liquidmechanics/api/IHeatCreator.java | 4 +- .../api/helpers/ColorCode.java | 4 +- .../client/render/RenderPump.java | 110 +++++++------- .../client/render/RenderTank.java | 13 +- .../common/LiquidMechanics.java | 50 +++++-- .../common/block/BlockSink.java | 24 +++ .../common/block/BlockTank.java | 1 + .../tileentity/TileEntityGenerator.java | 5 +- .../common/tileentity/TileEntityPipe.java | 32 ++-- .../common/tileentity/TileEntityPump.java | 139 +++++++++--------- .../tileentity/TileEntityReleaseValve.java | 2 +- .../resource/lang/en_US.properties | 4 +- .../liquidmechanics/resource/tanks/Corner.png | Bin 426 -> 1058 bytes .../resource/tanks/CornerLava.png | Bin 0 -> 1067 bytes .../resource/tanks/CornerWater.png | Bin 431 -> 1063 bytes .../resource/tanks/MilkTank.png | Bin 0 -> 3152 bytes .../liquidmechanics/resource/tanks/Tank.png | Bin 1029 -> 960 bytes 18 files changed, 219 insertions(+), 174 deletions(-) create mode 100644 minecraft/liquidmechanics/common/block/BlockSink.java create mode 100644 minecraft/liquidmechanics/resource/tanks/CornerLava.png create mode 100644 minecraft/liquidmechanics/resource/tanks/MilkTank.png diff --git a/minecraft/liquidmechanics/api/IColorCoded.java b/minecraft/liquidmechanics/api/IColorCoded.java index 3e66f71b..dfae2a9f 100644 --- a/minecraft/liquidmechanics/api/IColorCoded.java +++ b/minecraft/liquidmechanics/api/IColorCoded.java @@ -5,12 +5,11 @@ import liquidmechanics.api.helpers.ColorCode; public interface IColorCoded { /** - * gets the pipeColor being used by this object + * Returns the ColorCode of the object */ public ColorCode getColor(); /** - * sets the pipeColor to be used by this object * - * @param obj-can be anything must be sorted + * Sets the ColorCode of the Object */ public void setColor(Object obj); } diff --git a/minecraft/liquidmechanics/api/IHeatCreator.java b/minecraft/liquidmechanics/api/IHeatCreator.java index a6d7dbd7..8fadaa13 100644 --- a/minecraft/liquidmechanics/api/IHeatCreator.java +++ b/minecraft/liquidmechanics/api/IHeatCreator.java @@ -8,11 +8,11 @@ public interface IHeatCreator * @param dir - direction * @return Can create heat in this direction */ - public boolean canCreatHeat(ForgeDirection dir); + public boolean canOutputHeat(ForgeDirection dir); /** * @param dir - direction * @return ammount of heat created in joules */ - public int createHeat(ForgeDirection dir); + public int outputHeat(ForgeDirection dir); } diff --git a/minecraft/liquidmechanics/api/helpers/ColorCode.java b/minecraft/liquidmechanics/api/helpers/ColorCode.java index ef37a7bf..11a8b4a7 100644 --- a/minecraft/liquidmechanics/api/helpers/ColorCode.java +++ b/minecraft/liquidmechanics/api/helpers/ColorCode.java @@ -32,10 +32,10 @@ public enum ColorCode return this.name; } - /** gets a pipeColor from any of the following + /** gets a ColorCode from any of the following * * @param obj - * - Integer,String,LiquidData,PipeColor + * - Integer,String,LiquidData,ColorCode * @return Color NONE if it can't find it */ public static ColorCode get(Object obj) { diff --git a/minecraft/liquidmechanics/client/render/RenderPump.java b/minecraft/liquidmechanics/client/render/RenderPump.java index be940401..84bd0504 100644 --- a/minecraft/liquidmechanics/client/render/RenderPump.java +++ b/minecraft/liquidmechanics/client/render/RenderPump.java @@ -10,67 +10,65 @@ import net.minecraft.tileentity.TileEntity; import org.lwjgl.opengl.GL11; - public class RenderPump extends TileEntitySpecialRenderer { - int type = 0; - private ModelPump model; + int type = 0; + private ModelPump model; - public RenderPump() - { - model = new ModelPump(); - } + public RenderPump() + { + model = new ModelPump(); + } - public void renderAModelAt(TileEntityPump tileEntity, double d, double d1, double d2, float f) - { - LiquidData type = tileEntity.type; - int meta = tileEntity.worldObj.getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord); - switch (LiquidHandler.getMeta(type)) - { - default: - bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pumps/Pump.png"); - break; - case 1: - bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pumps/WaterPump.png"); - break;// water - case 2: - bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pumps/LavaPump.png"); - break;// lava - case 3: - bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pumps/OilPump.png"); - break;// oil - // case 4://fuel - } - GL11.glPushMatrix(); - GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); - GL11.glScalef(1.0F, -1F, -1F); - switch (meta) - { - case 1: - GL11.glRotatef(0f, 0f, 1f, 0f); - break; - case 2: - GL11.glRotatef(90f, 0f, 1f, 0f); - break; - case 3: - GL11.glRotatef(180f, 0f, 1f, 0f); - break; - case 0: - GL11.glRotatef(270f, 0f, 1f, 0f); - break; - } - model.renderMain(0.0625F); - model.renderC1(0.0625F); - model.renderC2(0.0625F); - model.renderC3(0.0625F); - GL11.glPopMatrix(); + public void renderAModelAt(TileEntityPump te, double d, double d1, double d2, float f) + { + int meta = te.worldObj.getBlockMetadata(te.xCoord, te.yCoord, te.zCoord); + switch (te.color.ordinal()) + { + case 1: + bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pumps/WaterPump.png"); + break;// water + case 2: + bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pumps/LavaPump.png"); + break;// lava + case 3: + bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pumps/OilPump.png"); + break; + default: + bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pumps/Pump.png"); + break; - } + } + GL11.glPushMatrix(); + GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); + GL11.glScalef(1.0F, -1F, -1F); + switch (meta) + { + case 1: + GL11.glRotatef(0f, 0f, 1f, 0f); + break; + case 2: + GL11.glRotatef(90f, 0f, 1f, 0f); + break; + case 3: + GL11.glRotatef(180f, 0f, 1f, 0f); + break; + case 0: + GL11.glRotatef(270f, 0f, 1f, 0f); + break; + } + model.renderMain(0.0625F); + model.renderC1(0.0625F); + model.renderC2(0.0625F); + model.renderC3(0.0625F); + GL11.glPopMatrix(); - @Override - public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8) - { - this.renderAModelAt((TileEntityPump) tileEntity, var2, var4, var6, var8); - } + } + + @Override + public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8) + { + this.renderAModelAt((TileEntityPump) tileEntity, var2, var4, var6, var8); + } } \ No newline at end of file diff --git a/minecraft/liquidmechanics/client/render/RenderTank.java b/minecraft/liquidmechanics/client/render/RenderTank.java index f8489f12..cd03b659 100644 --- a/minecraft/liquidmechanics/client/render/RenderTank.java +++ b/minecraft/liquidmechanics/client/render/RenderTank.java @@ -20,7 +20,6 @@ public class RenderTank extends TileEntitySpecialRenderer private ModelLiquidTank model; private ModelLiquidTankCorner modelC; - public RenderTank() { model = new ModelLiquidTank(); @@ -33,15 +32,14 @@ public class RenderTank extends TileEntitySpecialRenderer int guageMeta = meta; LiquidStack stack = te.getStack(); int pos = 0; - if(stack != null) + if (stack != null) { pos = Math.min((stack.amount / LiquidContainerRegistry.BUCKET_VOLUME), 4); - if(meta == ColorCode.NONE.ordinal()) + if (meta == ColorCode.NONE.ordinal()) { guageMeta = ColorCode.get(stack).ordinal(); } } - GL11.glPushMatrix(); GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); @@ -90,6 +88,9 @@ public class RenderTank extends TileEntitySpecialRenderer case 4: type = "Water"; break; + case 13: + type = "Milk"; + break; case 14: type = "Steam"; break; @@ -127,7 +128,7 @@ public class RenderTank extends TileEntitySpecialRenderer switch (meta) { case 1: - type = "Red"; + type = "Lava"; break; case 4: type = "Water"; @@ -136,7 +137,7 @@ public class RenderTank extends TileEntitySpecialRenderer type = ""; break; } - return LiquidMechanics.RESOURCE_PATH + "tanks/Corner" + type + "png"; + return LiquidMechanics.RESOURCE_PATH + "tanks/Corner" + type + ".png"; } diff --git a/minecraft/liquidmechanics/common/LiquidMechanics.java b/minecraft/liquidmechanics/common/LiquidMechanics.java index 32900f7d..3121d33f 100644 --- a/minecraft/liquidmechanics/common/LiquidMechanics.java +++ b/minecraft/liquidmechanics/common/LiquidMechanics.java @@ -50,15 +50,17 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.registry.GameRegistry; -/** Used in the creation of a new mod class +/** + * Used in the creation of a new mod class * - * @author Rseifert */ + * @author Rseifert + */ @Mod(modid = LiquidMechanics.NAME, name = LiquidMechanics.NAME, version = LiquidMechanics.VERSION, dependencies = "after:BasicComponents") @NetworkMod(channels = { LiquidMechanics.CHANNEL }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketManager.class) public class LiquidMechanics extends DummyModContainer { // TODO Change in Version Release - public static final String VERSION = "0.2.4"; + public static final String VERSION = "0.2.6"; // Constants public static final String NAME = "Liquid Mechanics"; @@ -226,25 +228,47 @@ public class LiquidMechanics extends DummyModContainer new ItemStack(Item.dyePowder, 1, it) }); } } + // steam pipes GameRegistry.addShapelessRecipe(new ItemStack(blockPipe, 1, ColorCode.ORANGE.ordinal()), new Object[] { - new ItemStack(itemParts, 1, Parts.Bronze.ordinal()), - new ItemStack(itemParts, 1, Parts.Seal.ordinal()) }); + new ItemStack(itemParts, 1, Parts.Bronze.ordinal()), + new ItemStack(itemParts, 1, Parts.Seal.ordinal()) }); + // milk pipes GameRegistry.addShapelessRecipe(new ItemStack(blockPipe, 4, ColorCode.WHITE.ordinal()), new Object[] { - new ItemStack(blockPipe, 1, 15), - new ItemStack(blockPipe, 1, 15), - new ItemStack(blockPipe, 1, 15), - new ItemStack(blockPipe, 1, 15), - new ItemStack(Item.dyePowder, 1, 0) }); + new ItemStack(blockPipe, 1, 15), + new ItemStack(blockPipe, 1, 15), + new ItemStack(blockPipe, 1, 15), + new ItemStack(blockPipe, 1, 15), + new ItemStack(Item.dyePowder, 1, 0) }); // steam tank 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, ColorCode.ORANGE.ordinal()) }); + new ItemStack(itemParts, 1, Parts.Bronze.ordinal()), + new ItemStack(itemParts, 1, Parts.Bronze.ordinal()) }); // lava tank GameRegistry.addRecipe(new ItemStack(blockTank, 1, ColorCode.RED.ordinal()), new Object[] { - " @ ", "@T@", " @ ", + "N@N", "@ @", "N@N", 'T', new ItemStack(itemParts, 1, Parts.Tank.ordinal()), - '@', Block.obsidian, }); + '@', Block.obsidian, + 'N', Block.netherrack }); + // water tank + GameRegistry.addRecipe(new ItemStack(blockTank, 1, ColorCode.BLUE.ordinal()), new Object[] { + "@G@", "STS", "@G@", + 'T', new ItemStack(itemParts, 1, Parts.Tank.ordinal()), + '@', Block.planks, + 'G', Block.glass, + 'S', new ItemStack(itemParts, 1, Parts.Seal.ordinal()) }); + // milk tank + GameRegistry.addRecipe(new ItemStack(blockTank, 1, ColorCode.WHITE.ordinal()), new Object[] { + "W@W", "WTW", "W@W", + 'T', new ItemStack(itemParts, 1, Parts.Tank.ordinal()), + '@', Block.stone, + 'W', Block.planks }); + // generic Tank + GameRegistry.addRecipe(new ItemStack(blockTank, 1, ColorCode.NONE.ordinal()), new Object[] { + "@@@", "@T@", "@@@", + 'T', new ItemStack(itemParts, 1, Parts.Tank.ordinal()), + '@', Block.stone }); // pump GameRegistry.addRecipe(new ItemStack(blockMachine, 1, 0), new Object[] { diff --git a/minecraft/liquidmechanics/common/block/BlockSink.java b/minecraft/liquidmechanics/common/block/BlockSink.java new file mode 100644 index 00000000..916a30bd --- /dev/null +++ b/minecraft/liquidmechanics/common/block/BlockSink.java @@ -0,0 +1,24 @@ +package liquidmechanics.common.block; + +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public class BlockSink extends BlockContainer +{ + + protected BlockSink(int par1) + { + super(par1, Material.iron); + // TODO Auto-generated constructor stub + } + + @Override + public TileEntity createNewTileEntity(World var1) + { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/minecraft/liquidmechanics/common/block/BlockTank.java b/minecraft/liquidmechanics/common/block/BlockTank.java index 1aed10b2..c9f436ee 100644 --- a/minecraft/liquidmechanics/common/block/BlockTank.java +++ b/minecraft/liquidmechanics/common/block/BlockTank.java @@ -141,6 +141,7 @@ public class BlockTank extends BlockMachine { par3List.add(new ItemStack(par1, 1, 1)); par3List.add(new ItemStack(par1, 1, 4)); + par3List.add(new ItemStack(par1, 1, 13)); par3List.add(new ItemStack(par1, 1, 15)); } } diff --git a/minecraft/liquidmechanics/common/tileentity/TileEntityGenerator.java b/minecraft/liquidmechanics/common/tileentity/TileEntityGenerator.java index 932a27bb..00f3208c 100644 --- a/minecraft/liquidmechanics/common/tileentity/TileEntityGenerator.java +++ b/minecraft/liquidmechanics/common/tileentity/TileEntityGenerator.java @@ -277,9 +277,10 @@ public class TileEntityGenerator extends TileEntityElectricityProducer implement } @Override - public double getVoltage() + public double getVoltage(Object... data) { - return 120; + return 120; + } @Override diff --git a/minecraft/liquidmechanics/common/tileentity/TileEntityPipe.java b/minecraft/liquidmechanics/common/tileentity/TileEntityPipe.java index f6bc6a30..30ce9349 100644 --- a/minecraft/liquidmechanics/common/tileentity/TileEntityPipe.java +++ b/minecraft/liquidmechanics/common/tileentity/TileEntityPipe.java @@ -28,11 +28,13 @@ import universalelectricity.prefab.network.PacketManager; import com.google.common.io.ByteArrayDataInput; -public class TileEntityPipe extends TileEntity implements ITankContainer, IReadOut,IColorCoded +import cpw.mods.fml.common.FMLLog; + +public class TileEntityPipe extends TileEntity implements ITankContainer, IReadOut, IColorCoded { private ColorCode color = ColorCode.NONE; - private int count = 40; + private int count = 20; private int count2, presure = 0; public boolean converted = false; @@ -48,7 +50,7 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IReadO this.validataConnections(); this.color = ColorCode.get(worldObj.getBlockMetadata(xCoord, yCoord, zCoord)); - if (!worldObj.isRemote && ++count >= 40) + if (!worldObj.isRemote && ++count >= 20) { count = 0; this.updatePressure(); @@ -76,7 +78,7 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IReadO stored.drain(((ITankContainer) connectedBlocks[i]).fill(dir.getOpposite(), stack, true), true); } } - + if (stack == null || stack.amount <= 0) { break; @@ -124,7 +126,7 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IReadO { super.readFromNBT(nbt); UpdateConverter.convert(this, nbt); - + LiquidStack liquid = new LiquidStack(0, 0, 0); liquid.readFromNBT(nbt.getCompoundTag("stored")); stored.setLiquid(liquid); @@ -149,7 +151,7 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IReadO LiquidStack stack = this.stored.getLiquid(); if (stack != null) { return (stack.amount / LiquidContainerRegistry.BUCKET_VOLUME) + "/" + (this.stored.getCapacity() / LiquidContainerRegistry.BUCKET_VOLUME) + " " + LiquidHandler.get(stack).getName() + " @ " + this.presure + "p"; } - return "Empty"; + return "Empty" + " @ " + this.presure + "p"; } @Override @@ -159,36 +161,34 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IReadO LiquidStack stack = stored.getLiquid(); if (color != ColorCode.NONE) { - if (color != ColorCode.get(LiquidHandler.get(resource)) || !LiquidHandler.isEqual(stack, resource)) + + if (stack == null || LiquidHandler.isEqual(resource, this.color.getLiquidData())) { - this.causeMix(stack, resource); + return this.fill(0, resource, doFill); } else { - this.fill(0, resource, doFill); + return this.causeMix(stack, resource); } } else { - if (stack != null && !LiquidHandler.isEqual(stack, resource)) + if (stack == null || LiquidHandler.isEqual(stack, resource)) { - this.causeMix(stack, resource); + return this.fill(0, resource, doFill); } else { - this.fill(0, resource, doFill); + return this.causeMix(stack, resource); } } - - return 0; } @Override public int fill(int tankIndex, LiquidStack resource, boolean doFill) { - if (tankIndex != 0 || resource == null) - return 0; + if (tankIndex != 0 || resource == null) { return 0; } return stored.fill(resource, doFill); } diff --git a/minecraft/liquidmechanics/common/tileentity/TileEntityPump.java b/minecraft/liquidmechanics/common/tileentity/TileEntityPump.java index 572a6396..404a2218 100644 --- a/minecraft/liquidmechanics/common/tileentity/TileEntityPump.java +++ b/minecraft/liquidmechanics/common/tileentity/TileEntityPump.java @@ -4,10 +4,12 @@ import java.util.EnumSet; import liquidmechanics.api.IReadOut; import liquidmechanics.api.IPressure; +import liquidmechanics.api.helpers.ColorCode; import liquidmechanics.api.helpers.LiquidData; import liquidmechanics.api.helpers.LiquidHandler; import liquidmechanics.common.LiquidMechanics; import liquidmechanics.common.MetaGroup; +import liquidmechanics.common.handlers.UpdateConverter; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; @@ -19,6 +21,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.liquids.ILiquidTank; import net.minecraftforge.liquids.ITankContainer; +import net.minecraftforge.liquids.LiquidContainerData; import net.minecraftforge.liquids.LiquidContainerRegistry; import net.minecraftforge.liquids.LiquidStack; import net.minecraftforge.liquids.LiquidTank; @@ -31,7 +34,7 @@ import universalelectricity.prefab.tile.TileEntityElectricityReceiver; import com.google.common.io.ByteArrayDataInput; -public class TileEntityPump extends TileEntityElectricityReceiver implements IPacketReceiver, IReadOut, IPressure,ITankContainer +public class TileEntityPump extends TileEntityElectricityReceiver implements IPacketReceiver, IReadOut, IPressure, ITankContainer { public final double WATTS_PER_TICK = 400; double percentPumped = 0.0; @@ -42,18 +45,17 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa int count = 0; private boolean converted = false; - - public LiquidData type = LiquidHandler.unkown; + public ColorCode color = ColorCode.NONE; public LiquidTank tank = new LiquidTank(wMax); @Override public void initiate() { - this.registerConnections(); + this.registerWireConnections(); this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, LiquidMechanics.blockMachine.blockID); } - public void registerConnections() + public void registerWireConnections() { int notchMeta = MetaGroup.getFacingMeta(worldObj.getBlockMetadata(xCoord, yCoord, zCoord)); ForgeDirection facing = ForgeDirection.getOrientation(notchMeta).getOpposite(); @@ -92,29 +94,30 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa { if (count-- <= 0) { + count = 40; int bBlock = worldObj.getBlockId(xCoord, yCoord - 1, zCoord); LiquidData bellow = LiquidHandler.getFromBlockID(bBlock); if (bellow != null) { - if (this.type != bellow && bellow != LiquidHandler.unkown) + if (this.color.getLiquidData() != bellow && bellow != LiquidHandler.unkown) { - this.tank.setLiquid(LiquidHandler.getStack(bellow, 0)); - this.type = bellow; + this.tank.setLiquid(LiquidHandler.getStack(bellow, 1)); + this.color = bellow.getColor(); } } - count = 40; + } - + if (this.tank.getLiquid() == null) { - this.tank.setLiquid(LiquidHandler.getStack(this.type, 1)); + this.tank.setLiquid(LiquidHandler.getStack(this.color.getLiquidData(), 1)); } - - //consume/give away stored units + + // consume/give away stored units this.fillSurroundings(); this.chargeUp(); - + if (this.joulesReceived >= this.WATTS_PER_TICK - 50 && this.canPump(xCoord, yCoord - 1, zCoord)) { @@ -130,11 +133,31 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa { if (this.ticks % 10 == 0) { - Packet packet = PacketManager.getPacket(LiquidMechanics.CHANNEL, this, type.getName()); + Packet packet = PacketManager.getPacket(LiquidMechanics.CHANNEL, this, color.ordinal()); PacketManager.sendPacketToClients(packet, worldObj, new Vector3(this), 60); } } } + + /** + * gets the search range the pump used to find valid block to pump + */ + public int getPumpRange() + { + int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); + switch (MetaGroup.getGrouping(meta)) + { + case 0: + case 1: + return 1; + case 2: + return 20; + case 3: + return 50; + } + return 1; + } + /** * Cause this to empty its internal tank to surrounding tanks */ @@ -154,18 +177,22 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa int moved = ((ITankContainer) tile).fill(dir.getOpposite(), stack, true); tank.drain(moved, true); if (stack.amount <= 0) + { break; + } } } } } + /** * causes this to request/drain energy from connected networks */ public void chargeUp() { - this.joulesReceived += this.WATTS_PER_TICK; //TODO remove after testing + // this.joulesReceived += this.WATTS_PER_TICK; //TODO remove after + // testing int notchMeta = MetaGroup.getFacingMeta(worldObj.getBlockMetadata(xCoord, yCoord, zCoord)); ForgeDirection facing = ForgeDirection.getOrientation(notchMeta).getOpposite(); @@ -192,6 +219,7 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa } } } + public boolean canPump(int x, int y, int z) { // if (this.tank.getLiquid() == null) return false; @@ -212,24 +240,18 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa */ public boolean drainBlock(Vector3 loc) { - int bBlock = worldObj.getBlockId(loc.intX(), loc.intY(), loc.intZ()); + int blockID = worldObj.getBlockId(loc.intX(), loc.intY(), loc.intZ()); int meta = worldObj.getBlockMetadata(loc.intX(), loc.intY(), loc.intZ()); - LiquidData bellow = LiquidHandler.getFromBlockID(bBlock); - if (bBlock == Block.waterMoving.blockID || (bBlock == Block.waterStill.blockID && meta != 0)) - return false; - if (bBlock == Block.lavaMoving.blockID || (bBlock == Block.lavaStill.blockID && meta != 0)) - return false; - if (bBlock == type.getStack().itemID) + LiquidData resource = LiquidHandler.getFromBlockID(blockID); + if (resource == color.getLiquidData()) { - // FMLLog.info("pumping " + bellow.displayerName + " blockID:" + - // bBlock + " Meta:" + - // meta); - int f = this.tank.fill(LiquidHandler.getStack(this.type, LiquidContainerRegistry.BUCKET_VOLUME), true); - if (f > 0) - worldObj.setBlockWithNotify(loc.intX(), loc.intY(), loc.intZ(), 0); - percentPumped = 0; + worldObj.setBlockWithNotify(xCoord, yCoord - 1, zCoord, 0); + LiquidStack stack = resource.getStack(); + stack.amount = LiquidContainerRegistry.BUCKET_VOLUME; + this.tank.fill(stack, true); return true; } + return false; } @@ -238,7 +260,7 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa { try { - this.type = (LiquidHandler.get(data.readUTF())); + this.color = (ColorCode.get(data.readInt())); } catch (Exception e) { @@ -255,21 +277,9 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa { super.readFromNBT(nbt); - this.converted = nbt.getBoolean("converted"); - if (!converted) - { - int t = nbt.getInteger("type"); - this.type = LiquidHandler.getFromMeta(t); - this.converted = true; - } - else - { - this.type = LiquidHandler.get(nbt.getString("name")); - } - if (this.type == null) type = LiquidHandler.unkown; - - int stored = nbt.getInteger("liquid"); - this.tank.setLiquid(LiquidHandler.getStack(this.type, stored)); + LiquidStack liquid = new LiquidStack(0, 0, 0); + liquid.readFromNBT(nbt.getCompoundTag("stored")); + tank.setLiquid(liquid); } /** @@ -279,28 +289,19 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - nbt.setBoolean("converted", this.converted); - int s = 1; - if (this.tank.getLiquid() != null) s = this.tank.getLiquid().amount; - nbt.setInteger("liquid", s); - - nbt.setString("name", type.getName()); + if (tank.getLiquid() != null) + { + nbt.setTag("stored", tank.getLiquid().writeToNBT(new NBTTagCompound())); + } } @Override public String getMeterReading(EntityPlayer user, ForgeDirection side) { - if (type == null) return "Error: No Type"; - int liquid = 0; - if (this.tank.getLiquid() != null) - { - liquid = (this.tank.getLiquid().amount / LiquidContainerRegistry.BUCKET_VOLUME); - } - else - { - liquid = 0; - } - return liquid + "" + type.getName() + " " + this.joulesReceived + "W " + this.percentPumped + "/20"; + LiquidStack stack = this.tank.getLiquid(); + if (stack != null) { return (stack.amount / LiquidContainerRegistry.BUCKET_VOLUME) + "/" + (this.tank.getCapacity() / LiquidContainerRegistry.BUCKET_VOLUME) + " " + LiquidHandler.get(stack).getName() + " " + this.joulesReceived + "/" + this.WATTS_PER_TICK + " " + this.percentPumped; } + + return "Empty"; } @Override @@ -318,15 +319,12 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa @Override public LiquidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { - return drain(0, maxDrain, doDrain); + return null; } @Override public LiquidStack drain(int tankIndex, int maxDrain, boolean doDrain) { - if (tankIndex == 0) - return tank.drain(maxDrain, doDrain); - return null; } @@ -345,16 +343,15 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa @Override public int presureOutput(LiquidData type, ForgeDirection dir) { - if (type == this.type || type == LiquidHandler.unkown) - return this.type.getPressure(); + if (type == this.color.getLiquidData() || type == LiquidHandler.unkown) + return this.color.getLiquidData().getPressure(); return 0; } @Override public boolean canPressureToo(LiquidData type, ForgeDirection dir) { - if (type == this.type || type == LiquidHandler.unkown) - return true; + if (type == this.color.getLiquidData() || type == LiquidHandler.unkown) { return true; } return false; } diff --git a/minecraft/liquidmechanics/common/tileentity/TileEntityReleaseValve.java b/minecraft/liquidmechanics/common/tileentity/TileEntityReleaseValve.java index dd0ff5d1..3b70795f 100644 --- a/minecraft/liquidmechanics/common/tileentity/TileEntityReleaseValve.java +++ b/minecraft/liquidmechanics/common/tileentity/TileEntityReleaseValve.java @@ -80,7 +80,7 @@ public class TileEntityReleaseValve extends TileEntity implements IPressure, IRe if (pipe != null) { ILiquidTank tankP = pipe.getTanks(ForgeDirection.UNKNOWN)[0]; - //FMLLog.warning("Pipe: " + pipe.getColor() + " Vol: " + (tankP.getLiquid() != null ? tankP.getLiquid().amount : 0000)); + //FMLLog.warning("Pipe: " + pipe.getColor() + " Vol: " + (tankP.getLiquid() != null ? tankP.getLiquid().amount : 0000)); int drain = pipe.fill(ForgeDirection.UNKNOWN, tank.getLiquid(), true); tank.drain(drain, true); } diff --git a/minecraft/liquidmechanics/resource/lang/en_US.properties b/minecraft/liquidmechanics/resource/lang/en_US.properties index 175c4087..4a87cc2e 100644 --- a/minecraft/liquidmechanics/resource/lang/en_US.properties +++ b/minecraft/liquidmechanics/resource/lang/en_US.properties @@ -21,7 +21,7 @@ tile.lmPipe.9.name =Pink Pipe tile.lmPipe.10.name =Lime Pipe tile.lmPipe.11.name =Fuel Pipe tile.lmPipe.12.name =LightBlue Pipe -tile.lmPipe.13.name =Magenta Pipe +tile.lmPipe.13.name =Milk Pipe tile.lmPipe.14.name =Orange Pipe tile.lmPipe.15.name =Generic Pipe @@ -38,7 +38,7 @@ tile.lmTank.9.name =Pink Tank tile.lmTank.10.name =Lime Tank tile.lmTank.11.name =Fuel Tank tile.lmTank.12.name =LightBlue Tank -tile.lmTank.13.name =Magenta Tank +tile.lmTank.13.name =Milk Tank tile.lmTank.14.name =Steam Tank tile.lmTank.15.name =Generic Tank diff --git a/minecraft/liquidmechanics/resource/tanks/Corner.png b/minecraft/liquidmechanics/resource/tanks/Corner.png index fe0083351a3d896cbe48682e426230087f3fcfad..cde8509f2a95f1e0a16d547ef99c06e3b1907bd5 100644 GIT binary patch literal 1058 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1|$#LC7uRSjKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sDEfH31!Z9ZwBAX}2Ry9>jA5L~c#`DCC7dx@v7EBjqW7Je13 zQ{o}U3=GVZJY5_^D&pSG4a`$=6mU*F&$Ru)w*qdy&7DfQOB8ZnaONGKSNA6^=;=23 zt7kJ+kJ+?Dybv%MGS^)mvU`x2ZM!p8NmBkNutxu6=yP zlBLkjd11mOmtF>gi+9>CF;JB~|2*@DFK1k)H+vg1HXSbXu%73)Jb%A@LhJG*8Mo!% z5}1~#C0}A?P+J^)o53N=NG+Bj!N_VWF9T)5&i4h9E;-GPFKFQWz`aa;>z_Fc+i&YS zU4L5Cd0}H0huQ%x&;RLjkH7vZ^>enP4-@}PABO((8)F$1%%u7a7(V=vxy{OuwD=>Hm-T-`LA8Sxi+vgj*Oyg3 zy})wg>8Z#o?aV$6M}cXLA>vNs(dqkN@=W-Y*$}+1FKQdZ-04%N0yUnpo`3##)v*~2 zRsO5B_|7el%D6yVe`gfKgy>tL0t~x8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({ZU!H><=Yq=uB7ugMyhy6n z|6O%#21AwqYArtBhE<}9Ws{lh*&Md&7A&|uW%{3_Z45h?##V{fIR;U2O zu1}Lz%UZFl;;UKw%2J}ws`P)UPs4B9HR}va7*~aN{K%L6A;_>enrX4ke7kK8e|nZ_ zu{5mw_Dq}|%$BiY?s@lf`;;QJ9Zx6xfA7Pv|9PNnyPCt4q$3`(2}~Yu-)OTj)Xwx2 rWp21~ZeJ3^h3PXx3>k)m@Hc*S<<`j|>AQeI&cNX5>gTe~DWM4f>RGUR literal 431 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1|$#LC7uRSY)RhkE)4%caKYZ?lYt_f1s;*b z3=DjSL74G){)!Z!AbW|YuPggqMizb@E~az$tQi;>Z9H8ZLn>~)y}NN;lYvA-V3tf} z&%1s9lQ(=fyisU;sl`K>YwMiNGw-;*KYl;TLx%0aKBx2fc{1^*zrU`W*Hr)W)?s%A z29^c}0R|=q1`Y61(u;f8nW4s}nT`!ESJFruh~aTp%-=hz8Xi25tsWG;BdlJWGEIj0W;3#RD|eIX^M zzrK?1|8?~InMkG;hKy1BKluX9WoWo}p7G76TJ8gu4W0>14C;AI**e_EcBn#ZEM|~) w7G}u!EtBwmQo@vICZN9#Tz9AjX+#4JO8I6&4zo1^nHWJbp00i_>zopr01h~VhX4Qo diff --git a/minecraft/liquidmechanics/resource/tanks/MilkTank.png b/minecraft/liquidmechanics/resource/tanks/MilkTank.png new file mode 100644 index 0000000000000000000000000000000000000000..e617ef3ee05e2eab3f44e966d3b1547bd47ec180 GIT binary patch literal 3152 zcmeH}`%_bA8pq#raxe)|6AU6&g|vcL0g=VZMMHuG16pocCtMXhXU?4Sedf&b z{XXx!b3X5dh%m+q>kq5}04qX*1NQ>}p|23YEkhryQ`HIY)#?3=-Jnjoehd{zVnApB z01br%(_t%A-`N~b6vR(EiQ}S#|Q+L_g7{6tt)5+n;H@tgq1@G(QR8- zC-wpW1W8C>z~>oplk$dqr=x4J%C(qiyWXkYFFv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9bk< zF={Hw(J7i%*z*etLmg=c<<8RBrFOo4(YfxSFK)z{LsWJZ61c!+S-K$_o&yQGLF_Q5 z`cm!B_#uqXIbK>Jn`d5LT-~+DY62=ftR19g>leLPH&(4%U5`zE{csrL<5@o-TUC$U zmM`)ja-g3$5)>wJkgT1!%{7hBBsK*)@7RKxEI;>qzKU0?t_@WSr~)!^)IoAVSeAVq z713GxhjZZAM%Pnl0x5?rS1~JSkDRwOL_%DUXrJ}(Au_acAZ+=>>|JC6>Un*7n=p+q zgo&Crv8cj-P2l^jqy0K){aZ={_vIq69{gN*ljQ;voqA=q~~ZwcAjM_ExbdlfBDF{urraw`IlNP=5>xc;~+#!~1RMu$WUX z<%#2;M)9A&{6Z8C+;p2$3igqs+`#qhG-b2sT`Q3~pS7>uPg_L=ELo$K9YN4)Z_!Sj z5s7sJ?4;PJd1Pyp@(q;yu-!51=T((7O$hHkJ{RRm2Ka>>jPmBD_$AVb+Ux>v@lI&{KVn~M`YGVi(w!S^Yp{oY z`Zgx+jXu9P$$jU5Ed*ByVg*G%!!Qr^R=gO$NJlg8{fK~@T}=YK#M@rz2VnCBH%cFq z4ra^lNO4zTxYFrw0y-OI{h3C;jS=V&e>C`G4gNp(fdw0br`-5cZBPt)yaypcVS#nK HIXV9X(nkwB literal 0 HcmV?d00001 diff --git a/minecraft/liquidmechanics/resource/tanks/Tank.png b/minecraft/liquidmechanics/resource/tanks/Tank.png index 83fdc881c5fb86c1d3b8e53a4cb7465dca3ff368..7a3b611b2ecc00aa767636e0769999ecf6312b9d 100644 GIT binary patch literal 960 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1|$#LC7uRSjKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sDEfH31!Z9ZwBAX}2Ry9>jA5L~c#`DCC7dx@v7EBjqW7JeOr zBZt^K85o!iJY5_^D&pSG2@GO#6mUM;eZX;ttxU`86@Ma{x_PF)z1de8_A~jS@!Thp zqF3%7zkd7nq1z7&B7S{1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