mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 06:42:56 +00:00
limit crystallizer to receive gas mutiples of receipe input
This commit is contained in:
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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user