add redstone tweaks resource pack and fix blockstate variant order
This commit is contained in:
@@ -38,6 +38,7 @@ function evaluateWhen(properties, condition) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
export class Blockstate {
|
||||
constructor(json) {
|
||||
this.variants = json.variants;
|
||||
@@ -107,7 +108,21 @@ export class Blockstate {
|
||||
const parts = [];
|
||||
|
||||
if (this.variants) {
|
||||
let variantDef = this.variants[cacheKey] || this.variants[""] || this.variants["normal"];
|
||||
let variantDef = this.variants[cacheKey];
|
||||
|
||||
// Order-invariant fallback
|
||||
if (!variantDef && cacheKey !== "" && cacheKey !== "normal") {
|
||||
const sortedCacheKey = cacheKey.split(',').sort().join(',');
|
||||
const matchingKey = Object.keys(this.variants).find(k =>
|
||||
k.split(',').sort().join(',') === sortedCacheKey
|
||||
);
|
||||
if (matchingKey) {
|
||||
variantDef = this.variants[matchingKey];
|
||||
}
|
||||
}
|
||||
|
||||
// Standard fallbacks
|
||||
variantDef = variantDef || this.variants[""] || this.variants["normal"];
|
||||
|
||||
if (!variantDef) {
|
||||
console.warn(
|
||||
|
||||
Reference in New Issue
Block a user