Fix infused crops dropping nothing or items with incorrect weights (#90)

This commit is contained in:
John authored and GitHub committed 2026-05-09 11:07:35 +00:00
1 parent 1972b9ab2b
commit 92b212d5e0
1 file changed
+2 -11
@@ -41,7 +41,7 @@ public class AspectCropLootManager {
Random rand = new Random();
int randInt = rand.nextInt(sum);
for (Map.Entry<ItemStack, Integer> pair : aspectHashmap.entrySet()) {
if (randInt <= 0) {
if (randInt < pair.getValue()) {
return pair.getKey().copy();
}
randInt -= pair.getValue();
@@ -55,15 +55,7 @@ public class AspectCropLootManager {
}
public static void addAspectLoot(Aspect aspect, String target) {
addAspectLoot(aspect, target, 1);
for (String ore : OreDictionary.getOreNames()) {
if (ore.contains(WordUtils.capitalizeFully(target)) || ore.contains(target)) {
for (ItemStack stack : OreDictionary.getOres(ore)) {
addAspectLoot(aspect, stack);
}
}
}
}
public static void addAspectLoot(Aspect aspect, String target, int count) {
@@ -217,8 +209,7 @@ public class AspectCropLootManager {
addAspectLoot(Aspect.MAGIC, new ItemStack(ConfigItems.itemShard, 1, 6));
addAspectLoot(Aspect.HEAL, new ItemStack(Items.golden_apple));
addAspectLoot(Aspect.HEAL, new ItemStack(Blocks.cake));
addAspectLoot(Aspect.HEAL, new ItemStack(Items.cake));
addAspectLoot(Aspect.SENSES, new ItemStack(Items.dye, 20, 4));