improvements to fluid io, fixes #635

This commit is contained in:
way2muchnoise
2016-11-21 22:37:48 +01:00
parent 426a50fdfe
commit b6f83c81ee
2 changed files with 11 additions and 6 deletions

View File

@@ -90,10 +90,11 @@ public class TileExporter extends TileMultipartNode implements IComparable, ITyp
FluidStack took = network.extractFluid(stack, toExtract, compare, true); FluidStack took = network.extractFluid(stack, toExtract, compare, true);
if (took != null && (toExtract - handler.fill(took, false)) == 0) { if (took != null) {
took = network.extractFluid(stack, toExtract, compare, false); int filled = handler.fill(took, false);
took = network.extractFluid(stack, filled, compare, false);
handler.fill(took, true); handler.fill(took, true);
break;
} }
} }
} }

View File

@@ -95,10 +95,14 @@ public class TileImporter extends TileMultipartNode implements IComparable, IFil
FluidStack stack = handler.drain(Fluid.BUCKET_VOLUME, false); FluidStack stack = handler.drain(Fluid.BUCKET_VOLUME, false);
if (stack != null && IFilterable.canTakeFluids(fluidFilters, mode, compare, stack) && network.insertFluid(stack, stack.amount, true) == null) { if (stack != null && IFilterable.canTakeFluids(fluidFilters, mode, compare, stack) && network.insertFluid(stack, stack.amount, true) == null) {
FluidStack drained = handler.drain(Fluid.BUCKET_VOLUME * upgrades.getInteractStackSize(), true); FluidStack toDrain = handler.drain(Fluid.BUCKET_VOLUME * upgrades.getInteractStackSize(), false);
if (drained != null) { if (toDrain != null) {
network.insertFluid(drained, drained.amount, false); FluidStack remainder = network.insertFluid(toDrain, toDrain.amount, false);
if (remainder != null) {
toDrain.amount -= remainder.amount;
}
handler.drain(toDrain, true);
} }
} }
} }