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.
@@ -11194,7 +11194,11 @@ var legacyBlocks_default = {
11194
11194
 
11195
11195
  // src/model/multiblock/SchematicParser.ts
11196
11196
  var SchematicParser = class {
11197
- static async parse(nbt) {
11197
+ /**
11198
+ * Parses a legacy schematic using custom mappings before the bundled defaults.
11199
+ * Keys are `id:metadata`; values are block states such as `minecraft:oak_log[axis=x]`.
11200
+ */
11201
+ static async parse(nbt, customMappings = {}) {
11198
11202
  const tags = nbt.value;
11199
11203
  if (tags.Materials?.type !== "string" || tags.Materials.value !== "Alpha") {
11200
11204
  throw new MineRenderError("Schematic Materials must be Alpha");
@@ -11236,15 +11240,16 @@ var SchematicParser = class {
11236
11240
  const high = packed >> (index & 1) * 4 & 15;
11237
11241
  const id = high << 8 | ids.value[index] & 255;
11238
11242
  const metadata = data.value[index] & 255;
11239
- const mapped = mapping[`${id}:${metadata}`];
11243
+ const key = `${id}:${metadata}`;
11244
+ const mapped = customMappings[key] ?? mapping[key];
11240
11245
  if (!mapped) throw new MineRenderError(`Unsupported legacy block ${id}:${metadata} at schematic index ${index}`);
11241
11246
  const [type, state] = mapped.split("[");
11242
11247
  if (type === "minecraft:air") continue;
11243
11248
  const properties = {};
11244
11249
  if (state) {
11245
11250
  for (const property of state.slice(0, -1).split(",")) {
11246
- const [key, value] = property.split("=");
11247
- properties[key] = value;
11251
+ const [key2, value] = property.split("=");
11252
+ properties[key2] = value;
11248
11253
  }
11249
11254
  }
11250
11255
  blocks.push({