multipart resolver type coercion
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user