diff --git a/src/main/java/forestry/core/utils/ItemStackUtil.java b/src/main/java/forestry/core/utils/ItemStackUtil.java index 9a70f4bd4..f57866d04 100644 --- a/src/main/java/forestry/core/utils/ItemStackUtil.java +++ b/src/main/java/forestry/core/utils/ItemStackUtil.java @@ -423,9 +423,15 @@ public abstract class ItemStackUtil { } public static ItemStack copyWithRandomSize(ItemStack template, int max, Random rand) { - int size = rand.nextInt(max); + int size = max <= 0 ? 0 : rand.nextInt(max); ItemStack created = template.copy(); - created.stackSize = size <= 0 ? 1 : size > created.getMaxStackSize() ? created.getMaxStackSize() : size; + if (size <= 0) { + created.stackSize = 1; + } else if (size > created.getMaxStackSize()) { + created.stackSize = created.getMaxStackSize(); + } else { + created.stackSize = size; + } return created; }