Forgot fluid voiding
This commit is contained in:
@@ -689,19 +689,27 @@ public class TileController extends TileBase implements INetworkMaster, IRedston
|
||||
@Nullable
|
||||
@Override
|
||||
public FluidStack insertFluid(@Nonnull FluidStack stack, int size, boolean simulate) {
|
||||
if (stack == null || fluidStorage.getStorages().isEmpty()) {
|
||||
if (fluidStorage.getStorages().isEmpty()) {
|
||||
return RSUtils.copyStackWithSize(stack, size);
|
||||
}
|
||||
|
||||
int orginalSize = size;
|
||||
int originalSize = size;
|
||||
AccessType accessType = AccessType.INSERT_EXTRACT;
|
||||
FluidStack remainder = stack;
|
||||
|
||||
int insertedToIgnore = 0;
|
||||
|
||||
for (IFluidStorage storage : this.fluidStorage.getStorages()) {
|
||||
accessType = storage.getAccessType();
|
||||
|
||||
if (accessType != AccessType.EXTRACT) {
|
||||
remainder = storage.insertFluid(remainder, size, simulate);
|
||||
|
||||
if (remainder != null && storage.isVoiding() && !simulate) {
|
||||
insertedToIgnore += remainder.amount;
|
||||
|
||||
remainder = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (storage instanceof FluidStorageExternal && !simulate) {
|
||||
@@ -715,21 +723,15 @@ public class TileController extends TileBase implements INetworkMaster, IRedston
|
||||
}
|
||||
}
|
||||
|
||||
// If the stack size of the remainder is negative, it means of the original size abs(remainder.amount) fluids have been voided
|
||||
int inserted;
|
||||
if (!simulate) {
|
||||
int inserted = remainder == null ? originalSize : (originalSize - remainder.amount);
|
||||
|
||||
if (remainder == null) {
|
||||
inserted = orginalSize;
|
||||
} else if (remainder.amount < 0) {
|
||||
inserted = orginalSize + remainder.amount;
|
||||
remainder = null;
|
||||
} else {
|
||||
inserted = orginalSize - remainder.amount;
|
||||
}
|
||||
inserted -= insertedToIgnore;
|
||||
|
||||
if (!simulate && inserted > 0 && accessType != AccessType.INSERT) {
|
||||
if (inserted > 0 && accessType != AccessType.INSERT) {
|
||||
fluidStorage.add(RSUtils.copyStackWithSize(stack, inserted), false);
|
||||
}
|
||||
}
|
||||
|
||||
return remainder;
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ public class TileStorage extends TileNode implements IItemStorageProvider, IStor
|
||||
|
||||
@Override
|
||||
public ItemStack insertItem(ItemStack stack, int size, boolean simulate) {
|
||||
// @todo: this doesn't work with the item voiding system!
|
||||
if (!IFilterable.canTake(filters, mode, compare, stack)) {
|
||||
return ItemHandlerHelper.copyStackWithSize(stack, size);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user