Also fix the bug in fluid interface, fixes #369

This commit is contained in:
Raoul Van den Berge
2016-09-20 18:09:58 +02:00
parent 26871e7880
commit 6e63cf368e
2 changed files with 13 additions and 7 deletions

View File

@@ -119,13 +119,19 @@ public class TileFluidInterface extends TileNode implements IComparable {
network.insertFluid(remainder, remainder.amount, false);
}
} else if (stack != null) {
FluidStack result = network.extractFluid(stack, Fluid.BUCKET_VOLUME, compare);
FluidStack stackInStorage = network.getFluidStorage().get(stack, compare);
if (result != null) {
int remainder = Fluid.BUCKET_VOLUME - tankOut.fillInternal(result, true);
if (stackInStorage != null) {
int toExtract = Math.min(Fluid.BUCKET_VOLUME, stackInStorage.amount);
if (remainder > 0) {
network.insertFluid(stack, remainder, false);
FluidStack took = network.extractFluid(stack, toExtract, compare);
if (took != null) {
int remainder = toExtract - tankOut.fillInternal(took, true);
if (remainder > 0) {
network.insertFluid(took, remainder, false);
}
}
}
}