leave free space for creative tank (#3125)

This commit is contained in:
AngelBottomless 2023-03-18 21:20:36 +09:00 committed by GitHub
parent 92fce93890
commit f3a6e7a21f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -91,10 +91,7 @@ public class TankUnitBaseBlockEntity extends MachineBaseBlockEntity implements I
return false; return false;
} }
ItemStack secondStack = inventory.getStack(1); ItemStack secondStack = inventory.getStack(1);
if (secondStack.getCount() >= secondStack.getMaxCount()){ return secondStack.getCount() < secondStack.getMaxCount();
return false;
}
return true;
} }
// MachineBaseBlockEntity // MachineBaseBlockEntity
@ -107,10 +104,7 @@ public class TankUnitBaseBlockEntity extends MachineBaseBlockEntity implements I
} }
if (canDrainTransfer() && FluidUtils.isContainer(inventory.getStack(0))) { if (canDrainTransfer() && FluidUtils.isContainer(inventory.getStack(0))) {
boolean didSomething = false; boolean didSomething = FluidUtils.drainContainers(tank, inventory, 0, 1);
if(FluidUtils.drainContainers(tank, inventory, 0, 1)){
didSomething = true;
}
if(!didSomething && FluidUtils.fillContainers(tank, inventory, 0, 1)){ if(!didSomething && FluidUtils.fillContainers(tank, inventory, 0, 1)){
didSomething = true; didSomething = true;
} }
@ -122,9 +116,10 @@ public class TankUnitBaseBlockEntity extends MachineBaseBlockEntity implements I
syncWithAll(); syncWithAll();
} }
} }
// allow infinite fluid input for creative tank
if (type == TRContent.TankUnit.CREATIVE) { if (type == TRContent.TankUnit.CREATIVE) {
if (!tank.isEmpty() && !tank.isFull()) { if (!tank.isEmpty() && !tank.getFluidAmount().equals(tank.getFluidValueCapacity().fraction(2))) {
tank.setFluidAmount(tank.getFluidValueCapacity()); tank.setFluidAmount(tank.getFluidValueCapacity().fraction(2));
} }
} }
// Void excessive fluid in creative tank (#2205) // Void excessive fluid in creative tank (#2205)