From e03aec69503784ee2cb5baf032496d595b52ca9a Mon Sep 17 00:00:00 2001 From: Calclavia Date: Tue, 11 Mar 2014 20:36:45 +0800 Subject: [PATCH] Fixed grate not filling world with gravity --- .../archaic/fluid/grate/TileGrate.java | 34 +++++++------------ .../core/fluid/TilePressureNode.java | 1 + .../core/grid/fluid/FluidPressureNode.java | 12 ++++--- 3 files changed, 21 insertions(+), 26 deletions(-) diff --git a/archaic/src/main/java/resonantinduction/archaic/fluid/grate/TileGrate.java b/archaic/src/main/java/resonantinduction/archaic/fluid/grate/TileGrate.java index 5d803342e..269e40d5f 100644 --- a/archaic/src/main/java/resonantinduction/archaic/fluid/grate/TileGrate.java +++ b/archaic/src/main/java/resonantinduction/archaic/fluid/grate/TileGrate.java @@ -60,24 +60,6 @@ public class TileGrate extends TilePressureNode implements IRotatable iconSide = iconRegister.registerIcon(Reference.PREFIX + "grate"); } - @Override - public boolean canUpdate() - { - return false; - } - - @Override - public ForgeDirection getDirection() - { - return ForgeDirection.getOrientation(getBlockMetadata()); - } - - @Override - public void setDirection(ForgeDirection direction) - { - this.worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, direction.ordinal(), 3); - } - @Override public FluidTankInfo[] getTankInfo(ForgeDirection from) { @@ -96,11 +78,18 @@ public class TileGrate extends TilePressureNode implements IRotatable return getDirection() != from; } + @Override + public void updateEntity() + { + super.updateEntity(); + + System.out.println("" + getPressureTank().getFluidAmount()); + } + @Override public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { int filled = getPressureTank().fill(resource, doFill); - System.out.println("FILL"); if (getPressureTank().getFluidAmount() > 0) { @@ -110,10 +99,11 @@ public class TileGrate extends TilePressureNode implements IRotatable gratePath.startFill(new Vector3(this), getPressureTank().getFluid().getFluid().getID()); } - return getPressureTank().drain(gratePath.tryFill(getPressureTank().getFluidAmount(), 2000), true).amount; + int filledInWorld = gratePath.tryFill(getPressureTank().getFluidAmount(), 2000); + getPressureTank().drain(filledInWorld, true); } - return 0; + return filled; } @Override @@ -127,6 +117,8 @@ public class TileGrate extends TilePressureNode implements IRotatable @Override public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { + System.out.println("DRAIN"); + if (maxDrain > 0) { if (gratePath == null) diff --git a/src/main/java/resonantinduction/core/fluid/TilePressureNode.java b/src/main/java/resonantinduction/core/fluid/TilePressureNode.java index 704809226..ccb136b5b 100644 --- a/src/main/java/resonantinduction/core/fluid/TilePressureNode.java +++ b/src/main/java/resonantinduction/core/fluid/TilePressureNode.java @@ -84,6 +84,7 @@ public abstract class TilePressureNode extends TileFluidNode implements IPressur { this.tank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME); } + return this.tank; } diff --git a/src/main/java/resonantinduction/core/grid/fluid/FluidPressureNode.java b/src/main/java/resonantinduction/core/grid/fluid/FluidPressureNode.java index 7a236fc93..92a342647 100644 --- a/src/main/java/resonantinduction/core/grid/fluid/FluidPressureNode.java +++ b/src/main/java/resonantinduction/core/grid/fluid/FluidPressureNode.java @@ -100,14 +100,16 @@ public class FluidPressureNode extends Node= pressureB) { @@ -123,7 +125,7 @@ public class FluidPressureNode extends Node 0) { - FluidTank tankB = otherPipe.parent.getPressureTank(); + FluidTank tankB = otherNode.parent.getPressureTank(); if (tankB != null) { @@ -137,7 +139,7 @@ public class FluidPressureNode extends Node 0) - parent.drain(dir.getOpposite(), otherPipe.parent.fill(dir, drainStack, true), true); + parent.drain(dir.getOpposite(), otherNode.parent.fill(dir, drainStack, true), true); } } }