limit crystallizer to receive gas mutiples of receipe input

This commit is contained in:
sapphi-red committed 2020-01-13 20:26:42 +09:00
1 parent 29a3477776
commit 29bfb8bc26
1 file changed
+12 -1
@@ -162,7 +162,18 @@ public class TileEntityChemicalCrystallizer extends TileEntityOperationalMachine
@Override
public int receiveGas(EnumFacing side, GasStack stack, boolean doTransfer) {
if (canReceiveGas(side, stack.getGas())) {
return inputTank.receive(stack, doTransfer);
if (stack == null) {
return 0;
}
int recipeAmount = Recipe.CHEMICAL_CRYSTALLIZER.get().get(new GasInput(stack)).recipeInput.ingredient.amount;
int receivable = inputTank.receive(stack, false);
int stored = inputTank.stored != null ? inputTank.stored.amount : 0;
int newStored = stored + receivable;
int amount = newStored - stored - newStored % recipeAmount;
return inputTank.receive(stack.copy().withAmount(amount), doTransfer);
}
return 0;
}