add PipeEventFluid support - FindDest
This commit is contained in:
parent
6ca2933490
commit
c47173f4e6
2 changed files with 17 additions and 21 deletions
|
@ -8,6 +8,7 @@
|
|||
*/
|
||||
package buildcraft.transport;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.BitSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -38,6 +39,7 @@ import buildcraft.transport.pipes.PipeFluidsSandstone;
|
|||
import buildcraft.transport.pipes.PipeFluidsStone;
|
||||
import buildcraft.transport.pipes.PipeFluidsVoid;
|
||||
import buildcraft.transport.pipes.PipeFluidsWood;
|
||||
import buildcraft.transport.pipes.events.PipeEventFluid;
|
||||
|
||||
public class PipeTransportFluids extends PipeTransport implements IFluidHandler {
|
||||
public static final Map<Class<? extends Pipe<?>>, Integer> fluidCapacities = new HashMap<Class<? extends Pipe<?>>, Integer>();
|
||||
|
@ -406,8 +408,14 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
|||
FluidStack testStack = pushStack.copy();
|
||||
testStack.amount = flowRate;
|
||||
// Move liquid from the center to the output sides
|
||||
ArrayList<ForgeDirection> realDirections = new ArrayList<ForgeDirection>();
|
||||
for (ForgeDirection direction : directions) {
|
||||
if (transferState[direction.ordinal()] == TransferState.Output) {
|
||||
realDirections.add(direction);
|
||||
}
|
||||
}
|
||||
container.pipe.eventBus.handleEvent(new PipeEventFluid.FindDest(pushStack, realDirections));
|
||||
for (ForgeDirection direction : realDirections) {
|
||||
int available = internalTanks[direction.ordinal()].fill(testStack, false);
|
||||
int ammountToPush = (int) (available / (double) flowRate / outputCount * Math.min(flowRate, totalAvailable));
|
||||
if (ammountToPush < 1) {
|
||||
|
@ -424,7 +432,6 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void moveToCenter() {
|
||||
int transferInCount = 0;
|
||||
|
|
|
@ -20,15 +20,4 @@ public abstract class PipeEventFluid extends PipeEvent {
|
|||
this.destinations = destinations;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Fill extends PipeEventFluid {
|
||||
public final ForgeDirection from;
|
||||
public final boolean doAdd;
|
||||
|
||||
public Fill(ForgeDirection from, FluidStack fluidStack, boolean doAdd) {
|
||||
super(fluidStack);
|
||||
this.from = from;
|
||||
this.doAdd = doAdd;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue