mirror of
https://github.com/GTNewHorizons/ThaumicTinkerer.git
synced 2026-10-25 20:32:29 +00:00
Fixed #860
This commit is contained in:
1 parent
d6ea0a3972
commit
fe9a84e60e
1 file changed
+9
-7
@@ -38,13 +38,15 @@ public class AspectCropLootManager {
|
||||
for (Integer i : aspectHashmap.values()) {
|
||||
sum += i;
|
||||
}
|
||||
|
||||
Random rand = new Random();
|
||||
int randInt = rand.nextInt(sum);
|
||||
for (Map.Entry<ItemStack, Integer> pair : aspectHashmap.entrySet()) {
|
||||
randInt -= pair.getValue();
|
||||
if (randInt <= 0) {
|
||||
return pair.getKey().copy();
|
||||
if(sum>0)
|
||||
{
|
||||
Random rand = new Random();
|
||||
int randInt = rand.nextInt(sum);
|
||||
for (Map.Entry<ItemStack, Integer> pair : aspectHashmap.entrySet()) {
|
||||
randInt -= pair.getValue();
|
||||
if (randInt <= 0) {
|
||||
return pair.getKey().copy();
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in new issue
Block a user