Fixes #2887: PoweredCraftingHandler#onCraft doesn't check for overflow (#3065)

This commit is contained in:
Ayutac 2022-11-17 23:58:14 +01:00 committed by GitHub
parent 268de10661
commit d84eec20cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -62,7 +62,7 @@ public final class PoweredCraftingHandler implements ItemCraftCallback {
})
.sum();
energyItem.setStoredEnergy(stack, totalEnergy);
energyItem.setStoredEnergy(stack, Math.min(totalEnergy, energyItem.getEnergyCapacity()));
}
if (!Registry.ITEM.getId(stack.getItem()).getNamespace().equalsIgnoreCase(TechReborn.MOD_ID)) {