mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-18 11:19:28 +00:00
Fix rare crash when getting rewards from escritoire
This commit is contained in:
1 parent
1f21952beb
commit
cc8bcf384a
1 file changed
+8
-2
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user