mirror of
https://github.com/misode/misode.github.io.git
synced 2026-05-01 01:59:33 +00:00
Fix #546 catch invalid recipe resource locations in result
This commit is contained in:
@@ -172,14 +172,18 @@ function placeItems(recipe: any, animation: number, itemTags: Map<string, any>)
|
|||||||
items.set(resultSlot, base)
|
items.set(resultSlot, base)
|
||||||
}
|
}
|
||||||
} else if (typeof result === 'string') {
|
} 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) {
|
} else if (typeof result === 'object' && result !== null) {
|
||||||
const id = typeof result.id === 'string' ? result.id
|
const id = typeof result.id === 'string' ? result.id
|
||||||
: typeof result.item === 'string' ? result.item
|
: typeof result.item === 'string' ? result.item
|
||||||
: 'minecraft:air'
|
: 'minecraft:air'
|
||||||
const count = typeof result.count === 'number' ? result.count : 1
|
const count = typeof result.count === 'number' ? result.count : 1
|
||||||
// TODO: add components
|
// 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
|
return items
|
||||||
|
|||||||
Reference in New Issue
Block a user