Handle invalid set_lore functions

This commit is contained in:
Misode
2024-12-03 21:14:26 +01:00
parent 1d1bae9459
commit a8aaec69e2
2 changed files with 5 additions and 0 deletions
+1
View File
@@ -471,6 +471,7 @@ const LootFunctions: Record<string, (params: any) => LootFunction> = {
.set('seed', new NbtLong(typeof seed === 'number' ? BigInt(seed) : BigInt(0))))
},
set_lore: ({ lore }) => (item) => {
if (!Array.isArray(lore)) return
const lines: string[] = lore.flatMap((line: any) => line !== undefined ? [JSON.stringify(line)] : [])
// TODO: account for mode
item.set('lore', new NbtList(lines.map(l => new NbtString(l))))