actually useful
This commit is contained in:
@@ -22,9 +22,17 @@ export function resolveBlock(state, properties) {
|
||||
// Handle standard variants
|
||||
const propStr = Object.keys(properties).sort().map(k => `${k}=${properties[k]}`).join(',');
|
||||
let variantDef = state.variants[propStr] || state.variants[""] || state.variants["normal"];
|
||||
if (Array.isArray(variantDef)) variantDef = variantDef[0]; // Take first random model
|
||||
|
||||
if (variantDef) parts.push(variantDef);
|
||||
// --- NEW ERROR REPORTING ---
|
||||
if (!variantDef) {
|
||||
console.warn("Available states:", Object.keys(state.variants));
|
||||
throw new Error(
|
||||
`Failed to resolve block variant.\nRequested: "${propStr}"\nCheck the console for available states.`
|
||||
);
|
||||
}
|
||||
|
||||
if (Array.isArray(variantDef)) variantDef = variantDef[0]; // Take first random model
|
||||
parts.push(variantDef);
|
||||
} else if (state.multipart) {
|
||||
// Handle multipart
|
||||
for (const part of state.multipart) {
|
||||
@@ -34,9 +42,12 @@ export function resolveBlock(state, properties) {
|
||||
parts.push(applyDef);
|
||||
}
|
||||
}
|
||||
|
||||
if (parts.length === 0) {
|
||||
console.warn("Possibly malformed multipart block with no parts.")
|
||||
}
|
||||
}
|
||||
|
||||
// Returns an array of definitions: [{ model: "block/wall_post", y: 90, uvlock: true }, ...]
|
||||
return parts;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user