fixed crafting modules miscalculating the amount of items they can craft

Closes #111
This commit is contained in:
Ell 2021-12-28 12:13:20 +01:00
parent bee6f7ef0b
commit 6a170a1ace

View file

@ -167,8 +167,10 @@ public class CraftingModuleItem extends ModuleItem {
var equalityTypes = ItemFilter.getEqualityTypes(tile);
var resultAmount = this.getResultAmountPerCraft(module, stack, equalityTypes);
// calculate how many crafting *operations* to do (as opposed to how many *items* to craft)
var requiredCrafts = Mth.ceil(stack.getCount() / (float) resultAmount);
var toCraft = Math.min(craftableAmount, requiredCrafts);
var craftableCrafts = Mth.ceil(craftableAmount / (float) resultAmount);
var toCraft = Math.min(craftableCrafts, requiredCrafts);
var input = this.getInput(module);
for (var i = 0; i < input.getSlots(); i++) {