Skip to content

Commit

Permalink
Fix #640 handle malformed set_enchantments in loot table preview
Browse files Browse the repository at this point in the history
  • Loading branch information
misode committed Nov 27, 2024
1 parent fdcb3f2 commit 794657d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/app/components/previews/LootTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,9 @@ const LootFunctions: Record<string, (params: any) => LootFunction> = {
}
},
set_enchantments: ({ enchantments, add }) => (item, ctx) => {
if (typeof enchantments !== 'object' || enchantments === null) {
return
}
if (item.is('book')) {
item.id = Identifier.create('enchanted_book')
item.base = ctx.getBaseComponents(item.id.toString())
Expand Down

0 comments on commit 794657d

Please sign in to comment.