Fixed pump not filling area at all
Still need to rework the method to fix a few other issues
This commit is contained in:
parent
24645491a8
commit
835ae8a047
2 changed files with 14 additions and 21 deletions
|
@ -42,9 +42,9 @@ public class TileEntityDrain extends TileEntityFluidDevice implements ITankConta
|
|||
|
||||
public LiquidPathFinder getLiquidFinder()
|
||||
{
|
||||
if(pathLiquid == null)
|
||||
if (pathLiquid == null)
|
||||
{
|
||||
pathLiquid = new LiquidPathFinder(this.worldObj, false, 1000, 100);
|
||||
pathLiquid = new LiquidPathFinder(this.worldObj, 1000, 100);
|
||||
}
|
||||
return pathLiquid;
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ public class TileEntityDrain extends TileEntityFluidDevice implements ITankConta
|
|||
{
|
||||
|
||||
getLiquidFinder().reset();
|
||||
getLiquidFinder().init(new Vector3(this.xCoord + this.getFacing().offsetX, this.yCoord + this.getFacing().offsetY, this.zCoord + this.getFacing().offsetZ));
|
||||
getLiquidFinder().init(new Vector3(this.xCoord + this.getFacing().offsetX, this.yCoord + this.getFacing().offsetY, this.zCoord + this.getFacing().offsetZ), false);
|
||||
// System.out.println("Nodes:" + pathFinder.nodes.size() + "Results:" +
|
||||
// pathFinder.results.size());
|
||||
for (Vector3 vec : getLiquidFinder().nodes)
|
||||
|
@ -350,7 +350,8 @@ public class TileEntityDrain extends TileEntityFluidDevice implements ITankConta
|
|||
|
||||
/* FIND ALL VALID BLOCKS ON LEVEL OR BELLOW */
|
||||
final Vector3 faceVec = new Vector3(this.xCoord + this.getFacing().offsetX, this.yCoord + this.getFacing().offsetY, this.zCoord + this.getFacing().offsetZ);
|
||||
getLiquidFinder().init(faceVec);
|
||||
getLiquidFinder().init(faceVec, true);
|
||||
//System.out.println("Drain:FillArea: Targets -> " + getLiquidFinder().results.size());
|
||||
|
||||
/* SORT RESULTS TO PUT THE LOWEST AND CLOSEST AT THE TOP */
|
||||
try
|
||||
|
@ -386,11 +387,9 @@ public class TileEntityDrain extends TileEntityFluidDevice implements ITankConta
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("FluidMech: Error sorting fill collection \n");
|
||||
System.out.println("FluidMech: Error sorting fill collection");
|
||||
e.printStackTrace();
|
||||
}
|
||||
/* START FILLING IN OR CHECKING IF CAN FILL AREA */
|
||||
int fillable = 0;
|
||||
for (Vector3 loc : getLiquidFinder().results)
|
||||
{
|
||||
if (blocks <= 0)
|
||||
|
@ -400,7 +399,6 @@ public class TileEntityDrain extends TileEntityFluidDevice implements ITankConta
|
|||
LiquidStack stack = FluidHelper.getLiquidFromBlockId(loc.getBlockID(worldObj));
|
||||
if (stack != null && stack.isLiquidEqual(resource) && loc.getBlockMetadata(worldObj) != 0)
|
||||
{
|
||||
fillable++;
|
||||
drained += LiquidContainerRegistry.BUCKET_VOLUME;
|
||||
blocks--;
|
||||
if (doFill)
|
||||
|
@ -424,7 +422,6 @@ public class TileEntityDrain extends TileEntityFluidDevice implements ITankConta
|
|||
}
|
||||
if (loc.getBlockID(worldObj) == 0)
|
||||
{
|
||||
fillable++;
|
||||
drained += LiquidContainerRegistry.BUCKET_VOLUME;
|
||||
blocks--;
|
||||
if (doFill)
|
||||
|
|
|
@ -24,7 +24,7 @@ public class LiquidPathFinder
|
|||
* OVER
|
||||
*/
|
||||
public List<Vector3> results = new ArrayList<Vector3>();/* LOCATIONS THAT ARE VALID RESULTS */
|
||||
private boolean fill; /* ARE WE FILLING THE PATH OR DRAINING THE PATH */
|
||||
private boolean fill = false; /* ARE WE FILLING THE PATH OR DRAINING THE PATH */
|
||||
private ForgeDirection priority; /* BASED ON fill -- WHICH DIRECTION WILL THE PATH GO FIRST */
|
||||
private int resultLimit = 2000;
|
||||
private Vector2 Start;
|
||||
|
@ -32,11 +32,10 @@ public class LiquidPathFinder
|
|||
private Random random = new Random();
|
||||
List<ForgeDirection> bn = new ArrayList<ForgeDirection>();
|
||||
|
||||
public LiquidPathFinder(final World world, final boolean fill, final int resultLimit, final double range)
|
||||
public LiquidPathFinder(final World world, final int resultLimit, final double range)
|
||||
{
|
||||
this.range = range;
|
||||
this.world = world;
|
||||
this.fill = fill;
|
||||
if (fill)
|
||||
{
|
||||
priority = ForgeDirection.DOWN;
|
||||
|
@ -153,14 +152,11 @@ public class LiquidPathFinder
|
|||
/**
|
||||
* Called to execute the pathfinding operation.
|
||||
*/
|
||||
public LiquidPathFinder init(final Vector3 startNode)
|
||||
public LiquidPathFinder init(final Vector3 startNode, final boolean fill)
|
||||
{
|
||||
this.Start = startNode.toVector2();
|
||||
this.fill = fill;
|
||||
this.findNodes(startNode);
|
||||
if (this.fill && this.isValidNode(startNode))
|
||||
{
|
||||
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue