From 337b7d9b0a2c1b6cf33abec2a2dd2a720e47abc4 Mon Sep 17 00:00:00 2001 From: Misode Date: Thu, 5 Sep 2024 15:10:07 +0200 Subject: [PATCH] Fix #546 catch invalid recipe resource locations in result --- src/app/components/previews/RecipePreview.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app/components/previews/RecipePreview.tsx b/src/app/components/previews/RecipePreview.tsx index a9fb24a4..12f282c2 100644 --- a/src/app/components/previews/RecipePreview.tsx +++ b/src/app/components/previews/RecipePreview.tsx @@ -172,14 +172,18 @@ function placeItems(recipe: any, animation: number, itemTags: Map) items.set(resultSlot, base) } } else if (typeof result === 'string') { - items.set(resultSlot, new ItemStack(Identifier.parse(result), 1)) + try { + items.set(resultSlot, new ItemStack(Identifier.parse(result), 1)) + } catch (e) {} } else if (typeof result === 'object' && result !== null) { const id = typeof result.id === 'string' ? result.id : typeof result.item === 'string' ? result.item : 'minecraft:air' const count = typeof result.count === 'number' ? result.count : 1 // TODO: add components - items.set(resultSlot, new ItemStack(Identifier.parse(id), count)) + try { + items.set(resultSlot, new ItemStack(Identifier.parse(id), count)) + } catch (e) {} } return items