Stack upgrade in importer/exporter/fluid interface in fluid mode does 64 buckets, fixes #424
This commit is contained in:
		@@ -54,11 +54,11 @@ public class TileExporter extends TileMultipartNode implements IComparable, ITyp
 | 
			
		||||
    @Override
 | 
			
		||||
    public void updateNode() {
 | 
			
		||||
        if (ticks % upgrades.getSpeed() == 0) {
 | 
			
		||||
            int size = upgrades.hasUpgrade(ItemUpgrade.TYPE_STACK) ? 64 : 1;
 | 
			
		||||
 | 
			
		||||
            if (type == IType.ITEMS) {
 | 
			
		||||
                IItemHandler handler = getItemHandler(getFacingTile(), getDirection().getOpposite());
 | 
			
		||||
 | 
			
		||||
                int size = upgrades.hasUpgrade(ItemUpgrade.TYPE_STACK) ? 64 : 1;
 | 
			
		||||
 | 
			
		||||
                if (handler != null) {
 | 
			
		||||
                    for (int i = 0; i < itemFilters.getSlots(); ++i) {
 | 
			
		||||
                        ItemStack slot = itemFilters.getStackInSlot(i);
 | 
			
		||||
@@ -87,7 +87,7 @@ public class TileExporter extends TileMultipartNode implements IComparable, ITyp
 | 
			
		||||
                            FluidStack stackInStorage = network.getFluidStorage().get(stack, compare);
 | 
			
		||||
 | 
			
		||||
                            if (stackInStorage != null) {
 | 
			
		||||
                                int toExtract = Math.min(Fluid.BUCKET_VOLUME, stackInStorage.amount);
 | 
			
		||||
                                int toExtract = Math.min(Fluid.BUCKET_VOLUME * size, stackInStorage.amount);
 | 
			
		||||
 | 
			
		||||
                                FluidStack took = network.extractFluid(stack, toExtract, compare);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -74,7 +74,7 @@ public class TileFluidInterface extends TileNode implements IComparable {
 | 
			
		||||
    private ItemHandlerBasic in = new ItemHandlerBasic(1, this);
 | 
			
		||||
    private ItemHandlerFluid out = new ItemHandlerFluid(1, this);
 | 
			
		||||
 | 
			
		||||
    private ItemHandlerUpgrade upgrades = new ItemHandlerUpgrade(4, this, ItemUpgrade.TYPE_SPEED);
 | 
			
		||||
    private ItemHandlerUpgrade upgrades = new ItemHandlerUpgrade(4, this, ItemUpgrade.TYPE_SPEED, ItemUpgrade.TYPE_STACK);
 | 
			
		||||
 | 
			
		||||
    public TileFluidInterface() {
 | 
			
		||||
        dataManager.addWatchedParameter(COMPARE);
 | 
			
		||||
@@ -101,8 +101,11 @@ public class TileFluidInterface extends TileNode implements IComparable {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (ticks % upgrades.getSpeed() == 0) {
 | 
			
		||||
            FluidStack drained = tankIn.drainInternal(Fluid.BUCKET_VOLUME, true);
 | 
			
		||||
            int size = upgrades.hasUpgrade(ItemUpgrade.TYPE_STACK) ? 64 : 1;
 | 
			
		||||
 | 
			
		||||
            FluidStack drained = tankIn.drainInternal(Fluid.BUCKET_VOLUME * size, true);
 | 
			
		||||
 | 
			
		||||
            // Drain in tank
 | 
			
		||||
            if (drained != null) {
 | 
			
		||||
                FluidStack remainder = network.insertFluid(drained, drained.amount, false);
 | 
			
		||||
 | 
			
		||||
@@ -113,17 +116,21 @@ public class TileFluidInterface extends TileNode implements IComparable {
 | 
			
		||||
 | 
			
		||||
            FluidStack stack = out.getFluidStackInSlot(0);
 | 
			
		||||
 | 
			
		||||
            // Fill out tank
 | 
			
		||||
 | 
			
		||||
            // If our out fluid doesn't match the new fluid, empty it first
 | 
			
		||||
            if (tankOut.getFluid() != null && (stack == null || (tankOut.getFluid().getFluid() != stack.getFluid()))) {
 | 
			
		||||
                FluidStack remainder = tankOut.drainInternal(Fluid.BUCKET_VOLUME, true);
 | 
			
		||||
                FluidStack remainder = tankOut.drainInternal(Fluid.BUCKET_VOLUME * size, true);
 | 
			
		||||
 | 
			
		||||
                if (remainder != null) {
 | 
			
		||||
                    network.insertFluid(remainder, remainder.amount, false);
 | 
			
		||||
                }
 | 
			
		||||
            } else if (stack != null) {
 | 
			
		||||
                // Fill the out fluid
 | 
			
		||||
                FluidStack stackInStorage = network.getFluidStorage().get(stack, compare);
 | 
			
		||||
 | 
			
		||||
                if (stackInStorage != null) {
 | 
			
		||||
                    int toExtract = Math.min(Fluid.BUCKET_VOLUME, stackInStorage.amount);
 | 
			
		||||
                    int toExtract = Math.min(Fluid.BUCKET_VOLUME * size, stackInStorage.amount);
 | 
			
		||||
 | 
			
		||||
                    FluidStack took = network.extractFluid(stack, toExtract, compare);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -59,6 +59,8 @@ public class TileImporter extends TileMultipartNode implements IComparable, IFil
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void updateNode() {
 | 
			
		||||
        int size = upgrades.hasUpgrade(ItemUpgrade.TYPE_STACK) ? 64 : 1;
 | 
			
		||||
 | 
			
		||||
        if (type == IType.ITEMS) {
 | 
			
		||||
            IItemHandler handler = getItemHandler(getFacingTile(), getDirection().getOpposite());
 | 
			
		||||
 | 
			
		||||
@@ -76,14 +78,12 @@ public class TileImporter extends TileMultipartNode implements IComparable, IFil
 | 
			
		||||
                if (stack == null || !IFilterable.canTake(itemFilters, mode, compare, stack)) {
 | 
			
		||||
                    currentSlot++;
 | 
			
		||||
                } else if (ticks % upgrades.getSpeed() == 0) {
 | 
			
		||||
                    int quantity = upgrades.hasUpgrade(ItemUpgrade.TYPE_STACK) ? 64 : 1;
 | 
			
		||||
 | 
			
		||||
                    ItemStack result = handler.extractItem(currentSlot, quantity, true);
 | 
			
		||||
                    ItemStack result = handler.extractItem(currentSlot, size, true);
 | 
			
		||||
 | 
			
		||||
                    if (result != null && network.insertItem(result, result.stackSize, true) == null) {
 | 
			
		||||
                        network.insertItem(result, result.stackSize, false);
 | 
			
		||||
 | 
			
		||||
                        handler.extractItem(currentSlot, quantity, false);
 | 
			
		||||
                        handler.extractItem(currentSlot, size, false);
 | 
			
		||||
                    } else {
 | 
			
		||||
                        currentSlot++;
 | 
			
		||||
                    }
 | 
			
		||||
@@ -96,9 +96,11 @@ public class TileImporter extends TileMultipartNode implements IComparable, IFil
 | 
			
		||||
                FluidStack stack = handler.drain(Fluid.BUCKET_VOLUME, false);
 | 
			
		||||
 | 
			
		||||
                if (stack != null && IFilterable.canTakeFluids(fluidFilters, mode, compare, stack) && network.insertFluid(stack, stack.amount, true) == null) {
 | 
			
		||||
                    FluidStack drain = handler.drain(Fluid.BUCKET_VOLUME, true);
 | 
			
		||||
                    FluidStack drained = handler.drain(Fluid.BUCKET_VOLUME * size, true);
 | 
			
		||||
 | 
			
		||||
                    network.insertFluid(drain, drain.amount, false);
 | 
			
		||||
                    if (drained != null) {
 | 
			
		||||
                        network.insertFluid(drained, drained.amount, false);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user