Skip to content

Commit

Permalink
Fix #604 validate set_contents
Browse files Browse the repository at this point in the history
  • Loading branch information
misode committed Sep 17, 2024
1 parent 98e6c91 commit 7ea4227
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/app/components/previews/LootTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,10 @@ const LootFunctions: Record<string, (params: any) => LootFunction> = {
}
},
set_contents: ({ component, entries }) => (item, ctx) => {
const result = generateLootTable({ pools: [{ rolls: 1, entries }] }, ctx)
if (typeof component !== 'string' || !Array.isArray(entries)) {
return
}
const result = generateLootTable({ pools: [{ rolls: 1, entries: entries }] }, ctx)
if (Identifier.parse(component).is('container')) {
item.set(component, new NbtList(result.map(s => new NbtCompound()
.set('slot', new NbtInt(s.slot))
Expand Down

0 comments on commit 7ea4227

Please sign in to comment.