From cb27ae272ccb65684caa454f361a8f983ab57fee Mon Sep 17 00:00:00 2001 From: P3pp3rF1y Date: Sun, 28 Apr 2024 09:58:17 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Fix=20loot=20modifier=20t?= =?UTF-8?q?o=20not=20cause=20stack=20overflow=20exception?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle.properties | 2 +- .../sophisticatedbackpacks/data/SBLootModifierProvider.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 6f2ac5ad..75bb0322 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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. diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBLootModifierProvider.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBLootModifierProvider.java index 62d9432d..5b5e86f7 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBLootModifierProvider.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBLootModifierProvider.java @@ -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 doApply(ObjectArrayList generatedLoot, LootContext context) { LootTable table = context.getResolver().getLootTable(lootTable); - table.getRandomItems(context, generatedLoot::add); + table.getRandomItemsRaw(context, generatedLoot::add); return generatedLoot; }