multipart resolver type coercion

This commit is contained in:
2026-07-09 21:13:18 -04:00
parent 046fb89214
commit 826e8967a2

View File

@@ -26,16 +26,18 @@ function evaluateWhen(properties, condition) {
for (const [key, val] of Object.entries(condition)) {
if (key === 'OR' || key === 'AND') continue;
const prop = properties[key];
if (typeof val === 'string' && val.includes('|')) {
if (!val.split('|').includes(prop)) return false;
} else if (prop !== val.toString()) {
const prop = properties[key] !== undefined ? String(properties[key]) : undefined;
const strVal = String(val);
if (strVal.includes('|')) {
if (!strVal.split('|').includes(prop)) return false;
} else if (prop !== strVal) {
return false;
}
}
return true;
}
export class Blockstate {
constructor(json) {
this.variants = json.variants;