From 8b4bdfb2766edeb16acd4e3f0b247e7b6f2c1063 Mon Sep 17 00:00:00 2001 From: Rseifert Date: Sat, 30 Mar 2013 03:08:18 -0400 Subject: [PATCH] fixed an issue with the pump filling network not sure the cause but its fixed now. Also fixed a NPE with some debug code but that is not important. --- .../common/machines/TileEntityMinorPump.java | 2 +- .../core/liquidNetwork/HydraulicNetwork.java | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/minecraft/fluidmech/common/machines/TileEntityMinorPump.java b/src/minecraft/fluidmech/common/machines/TileEntityMinorPump.java index c8615b795..3c4a593d0 100644 --- a/src/minecraft/fluidmech/common/machines/TileEntityMinorPump.java +++ b/src/minecraft/fluidmech/common/machines/TileEntityMinorPump.java @@ -174,7 +174,7 @@ public class TileEntityMinorPump extends TileEntityElectricityRunnable implement LiquidData resource = LiquidHandler.getFromBlockAndMetadata(blockID, meta); - if (color.isValidLiquid(resource.getStack()) && meta == 0 && getFillTarget().fill(pipeConnection, resource.getStack(), false) != 0) + if (color.isValidLiquid(resource.getStack()) && meta == 0) { LiquidStack stack = resource.getStack(); diff --git a/src/minecraft/hydraulic/core/liquidNetwork/HydraulicNetwork.java b/src/minecraft/hydraulic/core/liquidNetwork/HydraulicNetwork.java index bf3621e61..ee69a86d2 100644 --- a/src/minecraft/hydraulic/core/liquidNetwork/HydraulicNetwork.java +++ b/src/minecraft/hydraulic/core/liquidNetwork/HydraulicNetwork.java @@ -241,7 +241,7 @@ public class HydraulicNetwork public int addFluidToNetwork(TileEntity source, LiquidStack stack, double pressure, boolean doFill) { int used = 0; - + LiquidStack prevCombined = this.combinedStorage.getLiquid(); if (!this.processingRequest && stack != null && color.isValidLiquid(stack)) { if (this.combinedStorage.getLiquid() != null && !stack.isLiquidEqual(this.combinedStorage.getLiquid())) @@ -314,19 +314,18 @@ public class HydraulicNetwork boolean filledMain = false; if (primaryFill != null) { - System.out.println("Primary Target"); used = primaryFill.fill(fillDir, stack, doFill); + System.out.println("Primary Target " + used); } else if (secondayFill != null) { - System.out.println("Seconday Target"); used = secondayFill.fill(fillDir, stack, doFill); + System.out.println("Seconday Target " + used); } else if (this.combinedStorage.getLiquid() == null || this.combinedStorage.getLiquid().amount < this.combinedStorage.getCapacity()) { used = this.combinedStorage.fill(stack, doFill); System.out.println("Network Target filled for " + used); - this.moveAndSumVolume(false); filledMain = true; } /* IF THE COMBINED STORAGE OF THE PIPES HAS LIQUID MOVE IT FIRST */ @@ -345,8 +344,12 @@ public class HydraulicNetwork used = Math.min(used, Math.max(used - this.combinedStorage.getLiquid().amount, 0)); drainStack = this.combinedStorage.drain(pUsed - used, doFill); } + System.out.println("Pulling " + drainStack.amount + " from combined leaving " + this.combinedStorage.getLiquid().amount); + + } + if (prevCombined != null && this.combinedStorage.getLiquid() != null && prevCombined.amount != this.combinedStorage.getLiquid().amount) + { this.moveAndSumVolume(false); - System.out.println("Pulling " + stack.amount + " from combined"); } } this.processingRequest = false; @@ -615,7 +618,8 @@ public class HydraulicNetwork } this.combinedStorage.setLiquid(new LiquidStack(itemID, volume, itemMeta)); } - if (this.combinedStorage.getLiquid() != null) + + if (this.combinedStorage.getLiquid() != null && this.fluidParts.size() > 0) { volume = this.combinedStorage.getLiquid().amount / this.fluidParts.size(); itemID = this.combinedStorage.getLiquid().itemID;