From db58a7b10549ff1bd4fdda05d6f87f0fbe9cae48 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 28 Dec 2021 12:13:20 +0100 Subject: [PATCH] backport 6a170a1ace0b85039e18825cd780227b9d2de21d --- .../prettypipes/pipe/modules/craft/CraftingModuleItem.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/ellpeck/prettypipes/pipe/modules/craft/CraftingModuleItem.java b/src/main/java/de/ellpeck/prettypipes/pipe/modules/craft/CraftingModuleItem.java index 8eed4bd..75d829c 100644 --- a/src/main/java/de/ellpeck/prettypipes/pipe/modules/craft/CraftingModuleItem.java +++ b/src/main/java/de/ellpeck/prettypipes/pipe/modules/craft/CraftingModuleItem.java @@ -169,8 +169,10 @@ public class CraftingModuleItem extends ModuleItem { ItemEquality[] equalityTypes = ItemFilter.getEqualityTypes(tile); int resultAmount = this.getResultAmountPerCraft(module, stack, equalityTypes); + // calculate how many crafting *operations* to do (as opposed to how many *items* to craft) int requiredCrafts = MathHelper.ceil(stack.getCount() / (float) resultAmount); - int toCraft = Math.min(craftableAmount, requiredCrafts); + int craftableCrafts = MathHelper.ceil(craftableAmount / (float) resultAmount); + int toCraft = Math.min(craftableCrafts, requiredCrafts); ItemStackHandler input = this.getInput(module); for (int i = 0; i < input.getSlots(); i++) {