minerender 2.1.0-alpha.63 → 2.1.0-alpha.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1558,7 +1558,11 @@ interface MultiBlockBlock extends Block {
1558
1558
  }
1559
1559
 
1560
1560
  declare class SchematicParser {
1561
- static parse(nbt: NBT): Promise<MultiBlockStructure>;
1561
+ /**
1562
+ * Parses a legacy schematic using custom mappings before the bundled defaults.
1563
+ * Keys are `id:metadata`; values are block states such as `minecraft:oak_log[axis=x]`.
1564
+ */
1565
+ static parse(nbt: NBT, customMappings?: Readonly<Record<string, string>>): Promise<MultiBlockStructure>;
1562
1566
  }
1563
1567
 
1564
1568
  declare class StructureParser {
@@ -1558,7 +1558,11 @@ interface MultiBlockBlock extends Block {
1558
1558
  }
1559
1559
 
1560
1560
  declare class SchematicParser {
1561
- static parse(nbt: NBT): Promise<MultiBlockStructure>;
1561
+ /**
1562
+ * Parses a legacy schematic using custom mappings before the bundled defaults.
1563
+ * Keys are `id:metadata`; values are block states such as `minecraft:oak_log[axis=x]`.
1564
+ */
1565
+ static parse(nbt: NBT, customMappings?: Readonly<Record<string, string>>): Promise<MultiBlockStructure>;
1562
1566
  }
1563
1567
 
1564
1568
  declare class StructureParser {
@@ -11371,7 +11371,11 @@ var legacyBlocks_default = {
11371
11371
 
11372
11372
  // src/model/multiblock/SchematicParser.ts
11373
11373
  var SchematicParser = class {
11374
- static async parse(nbt) {
11374
+ /**
11375
+ * Parses a legacy schematic using custom mappings before the bundled defaults.
11376
+ * Keys are `id:metadata`; values are block states such as `minecraft:oak_log[axis=x]`.
11377
+ */
11378
+ static async parse(nbt, customMappings = {}) {
11375
11379
  const tags = nbt.value;
11376
11380
  if (tags.Materials?.type !== "string" || tags.Materials.value !== "Alpha") {
11377
11381
  throw new MineRenderError("Schematic Materials must be Alpha");
@@ -11413,15 +11417,16 @@ var SchematicParser = class {
11413
11417
  const high = packed >> (index & 1) * 4 & 15;
11414
11418
  const id = high << 8 | ids.value[index] & 255;
11415
11419
  const metadata = data.value[index] & 255;
11416
- const mapped = mapping[`${id}:${metadata}`];
11420
+ const key = `${id}:${metadata}`;
11421
+ const mapped = customMappings[key] ?? mapping[key];
11417
11422
  if (!mapped) throw new MineRenderError(`Unsupported legacy block ${id}:${metadata} at schematic index ${index}`);
11418
11423
  const [type, state] = mapped.split("[");
11419
11424
  if (type === "minecraft:air") continue;
11420
11425
  const properties = {};
11421
11426
  if (state) {
11422
11427
  for (const property of state.slice(0, -1).split(",")) {
11423
- const [key, value] = property.split("=");
11424
- properties[key] = value;
11428
+ const [key2, value] = property.split("=");
11429
+ properties[key2] = value;
11425
11430
  }
11426
11431
  }
11427
11432
  blocks.push({