Skip to content

Commit

Permalink
fix: 🐛 Fix loot modifier to not cause stack overflow exception
Browse files Browse the repository at this point in the history
  • Loading branch information
P3pp3rF1y committed Apr 28, 2024
1 parent c08c848 commit cb27ae2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ loader_version_range=[2,)
mod_id=sophisticatedbackpacks
mod_name=Sophisticated Backpacks
mod_license=GNU General Public License v3.0
mod_version=3.20.5
mod_version=3.20.6
mod_group_id=sophisticatedbackpacks
mod_authors=P3pp3rF1y, Ridanisaurus
mod_description=Fancy and functional backpacks.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@ protected InjectLootModifier(ResourceLocation lootTable, ResourceLocation lootTa
LootTableIdCondition.builder(lootTableToInjectInto).build()}, lootTable, lootTableToInjectInto);
}

@SuppressWarnings({"deprecation", "java:S1874"}) // Need to call getRandomItemsRaw to skip neo calling modifyLoot event and causing infinite loop
@Override
protected ObjectArrayList<ItemStack> doApply(ObjectArrayList<ItemStack> generatedLoot, LootContext context) {
LootTable table = context.getResolver().getLootTable(lootTable);
table.getRandomItems(context, generatedLoot::add);
table.getRandomItemsRaw(context, generatedLoot::add);
return generatedLoot;
}

Expand Down

0 comments on commit cb27ae2

Please sign in to comment.