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.
@@ -1557,7 +1557,11 @@ interface MultiBlockBlock extends Block {
1557
1557
  }
1558
1558
 
1559
1559
  declare class SchematicParser {
1560
- static parse(nbt: NBT): Promise<MultiBlockStructure>;
1560
+ /**
1561
+ * Parses a legacy schematic using custom mappings before the bundled defaults.
1562
+ * Keys are `id:metadata`; values are block states such as `minecraft:oak_log[axis=x]`.
1563
+ */
1564
+ static parse(nbt: NBT, customMappings?: Readonly<Record<string, string>>): Promise<MultiBlockStructure>;
1561
1565
  }
1562
1566
 
1563
1567
  declare class StructureParser {
@@ -1557,7 +1557,11 @@ interface MultiBlockBlock extends Block {
1557
1557
  }
1558
1558
 
1559
1559
  declare class SchematicParser {
1560
- static parse(nbt: NBT): Promise<MultiBlockStructure>;
1560
+ /**
1561
+ * Parses a legacy schematic using custom mappings before the bundled defaults.
1562
+ * Keys are `id:metadata`; values are block states such as `minecraft:oak_log[axis=x]`.
1563
+ */
1564
+ static parse(nbt: NBT, customMappings?: Readonly<Record<string, string>>): Promise<MultiBlockStructure>;
1561
1565
  }
1562
1566
 
1563
1567
  declare class StructureParser {
@@ -11320,7 +11320,11 @@ var legacyBlocks_default = {
11320
11320
 
11321
11321
  // src/model/multiblock/SchematicParser.ts
11322
11322
  var SchematicParser = class {
11323
- static async parse(nbt) {
11323
+ /**
11324
+ * Parses a legacy schematic using custom mappings before the bundled defaults.
11325
+ * Keys are `id:metadata`; values are block states such as `minecraft:oak_log[axis=x]`.
11326
+ */
11327
+ static async parse(nbt, customMappings = {}) {
11324
11328
  const tags = nbt.value;
11325
11329
  if (tags.Materials?.type !== "string" || tags.Materials.value !== "Alpha") {
11326
11330
  throw new MineRenderError("Schematic Materials must be Alpha");
@@ -11362,15 +11366,16 @@ var SchematicParser = class {
11362
11366
  const high = packed >> (index & 1) * 4 & 15;
11363
11367
  const id = high << 8 | ids.value[index] & 255;
11364
11368
  const metadata = data.value[index] & 255;
11365
- const mapped = mapping[`${id}:${metadata}`];
11369
+ const key = `${id}:${metadata}`;
11370
+ const mapped = customMappings[key] ?? mapping[key];
11366
11371
  if (!mapped) throw new MineRenderError(`Unsupported legacy block ${id}:${metadata} at schematic index ${index}`);
11367
11372
  const [type, state] = mapped.split("[");
11368
11373
  if (type === "minecraft:air") continue;
11369
11374
  const properties = {};
11370
11375
  if (state) {
11371
11376
  for (const property of state.slice(0, -1).split(",")) {
11372
- const [key, value] = property.split("=");
11373
- properties[key] = value;
11377
+ const [key2, value] = property.split("=");
11378
+ properties[key2] = value;
11374
11379
  }
11375
11380
  }
11376
11381
  blocks.push({