From a5cd066bd49f4c1964532830c9d16b8cb61e651a Mon Sep 17 00:00:00 2001 From: Raycoms Date: Mon, 19 Aug 2024 10:30:18 +0200 Subject: [PATCH] add second layer of try catch here too --- .../colony/crafting/LootTableAnalyzer.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/minecolonies/core/colony/crafting/LootTableAnalyzer.java b/src/main/java/com/minecolonies/core/colony/crafting/LootTableAnalyzer.java index 898eebfeeee..be501be829a 100644 --- a/src/main/java/com/minecolonies/core/colony/crafting/LootTableAnalyzer.java +++ b/src/main/java/com/minecolonies/core/colony/crafting/LootTableAnalyzer.java @@ -62,19 +62,27 @@ private LootTableAnalyzer() { } /** * Evaluate a loot table and report possible drops. * - * @param provider the registry provider + * @param provider the registry provider * @param lootTableId the loot table id * @return the list of possible drops */ public static List toDrops(final HolderLookup.Provider provider, @NotNull final ResourceKey lootTableId) { - return toDrops(provider, provider.holderOrThrow(lootTableId)); + try + { + return toDrops(provider, provider.holderOrThrow(lootTableId)); + } + catch (final JsonParseException ex) + { + Log.getLogger().error(String.format("Failed to parse loot table from %s", lootTableId), ex); + return Collections.emptyList(); + } } /** * Evaluate a loot table and report possible drops. * - * @param provider the registry provider + * @param provider the registry provider * @param lootTable the loot table * @return the list of possible drops */ @@ -87,13 +95,11 @@ public static List toDrops(@NotNull final HolderLookup.Provider provid } catch (final JsonParseException ex) { - Log.getLogger().error(String.format("Failed to parse loot table from %s", - lootTable.getKey()), ex); + Log.getLogger().error(String.format("Failed to parse loot table from %s", lootTable.getKey()), ex); return Collections.emptyList(); } } - /** * Evaluate a loot table and report possible drops. *