diff --git a/src/main/java/io/redspace/ironsspellbooks/loot/RandomizeSpellFunction.java b/src/main/java/io/redspace/ironsspellbooks/loot/RandomizeSpellFunction.java index c05484e16..c4359f44b 100644 --- a/src/main/java/io/redspace/ironsspellbooks/loot/RandomizeSpellFunction.java +++ b/src/main/java/io/redspace/ironsspellbooks/loot/RandomizeSpellFunction.java @@ -36,8 +36,13 @@ protected RandomizeSpellFunction(LootItemCondition[] lootConditions, NumberProvi protected ItemStack run(ItemStack itemStack, LootContext lootContext) { //irons_spellbooks.LOGGER.debug("RandomizeScrollFunction.run {}", itemStack.hashCode()); if (itemStack.getItem() instanceof Scroll || Utils.canImbue(itemStack)) { - - var spellList = getWeightedSpellList(applicableSpells.getApplicableSpells()); + var applicableSpells = this.applicableSpells.getApplicableSpells(); + if (applicableSpells.isEmpty()) { + //Return empty item stack + itemStack.setCount(0); + return itemStack; + } + var spellList = getWeightedSpellList(applicableSpells); int total = spellList.floorKey(Integer.MAX_VALUE); SpellType spellType = SpellType.NONE_SPELL; if (!spellList.isEmpty()) {