fix: importer using simulated extractions to insert
The behavior is now consistent with items. This caused issues with Gregtech, they returned fluids that weren't extractable in simulation mode so RS ended up duping them. Now we only insert fluids that return from execution mode. Fixes #3570
This commit is contained in:
@@ -103,20 +103,15 @@ public class ImporterNetworkNode extends NetworkNode implements IComparable, IWh
|
|||||||
IFluidHandler handler = LevelUtils.getFluidHandler(getFacingBlockEntity(), getDirection().getOpposite());
|
IFluidHandler handler = LevelUtils.getFluidHandler(getFacingBlockEntity(), getDirection().getOpposite());
|
||||||
|
|
||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
FluidStack stack = handler.drain(FluidType.BUCKET_VOLUME, IFluidHandler.FluidAction.SIMULATE);
|
FluidStack extractedSimulated = handler.drain(FluidType.BUCKET_VOLUME * upgrades.getStackInteractCount(), IFluidHandler.FluidAction.SIMULATE);
|
||||||
|
|
||||||
if (!stack.isEmpty() &&
|
if (!extractedSimulated.isEmpty()
|
||||||
IWhitelistBlacklist.acceptsFluid(fluidFilters, mode, compare, stack) &&
|
&& IWhitelistBlacklist.acceptsFluid(fluidFilters, mode, compare, extractedSimulated)
|
||||||
network.insertFluid(stack, stack.getAmount(), Action.SIMULATE).isEmpty()) {
|
&& network.insertFluid(extractedSimulated, extractedSimulated.getAmount(), Action.SIMULATE).isEmpty()) {
|
||||||
FluidStack toDrain = handler.drain(FluidType.BUCKET_VOLUME * upgrades.getStackInteractCount(), IFluidHandler.FluidAction.SIMULATE);
|
FluidStack extracted = handler.drain(extractedSimulated, IFluidHandler.FluidAction.EXECUTE);
|
||||||
|
|
||||||
if (!toDrain.isEmpty()) {
|
if (!extracted.isEmpty()) {
|
||||||
FluidStack remainder = network.insertFluidTracked(toDrain, toDrain.getAmount());
|
network.insertFluidTracked(extracted, extracted.getAmount());
|
||||||
if (!remainder.isEmpty()) {
|
|
||||||
toDrain.shrink(remainder.getAmount());
|
|
||||||
}
|
|
||||||
|
|
||||||
handler.drain(toDrain, IFluidHandler.FluidAction.EXECUTE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user