minerender 2.1.0-alpha.63 → 2.1.0-alpha.65

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 {
@@ -944,8 +944,15 @@ var init_Materials = __esm({
944
944
  material.blending = import_three5.CustomBlending;
945
945
  material.blendSrc = import_three5.OneFactor;
946
946
  material.blendDst = import_three5.OneFactor;
947
- material.blendSrcAlpha = import_three5.ZeroFactor;
948
- material.blendDstAlpha = import_three5.OneFactor;
947
+ material.blendSrcAlpha = import_three5.OneFactor;
948
+ material.blendDstAlpha = import_three5.OneMinusSrcAlphaFactor;
949
+ material.onBeforeCompile = (shader) => {
950
+ shader.fragmentShader = shader.fragmentShader.replace(
951
+ "#include <dithering_fragment>",
952
+ "gl_FragColor.a = max(gl_FragColor.r, max(gl_FragColor.g, gl_FragColor.b));\n#include <dithering_fragment>"
953
+ );
954
+ };
955
+ material.customProgramCacheKey = () => "energy_swirl";
949
956
  material.color.set(8421504);
950
957
  break;
951
958
  case "water_mask":
@@ -11371,7 +11378,11 @@ var legacyBlocks_default = {
11371
11378
 
11372
11379
  // src/model/multiblock/SchematicParser.ts
11373
11380
  var SchematicParser = class {
11374
- static async parse(nbt) {
11381
+ /**
11382
+ * Parses a legacy schematic using custom mappings before the bundled defaults.
11383
+ * Keys are `id:metadata`; values are block states such as `minecraft:oak_log[axis=x]`.
11384
+ */
11385
+ static async parse(nbt, customMappings = {}) {
11375
11386
  const tags = nbt.value;
11376
11387
  if (tags.Materials?.type !== "string" || tags.Materials.value !== "Alpha") {
11377
11388
  throw new MineRenderError("Schematic Materials must be Alpha");
@@ -11413,15 +11424,16 @@ var SchematicParser = class {
11413
11424
  const high = packed >> (index & 1) * 4 & 15;
11414
11425
  const id = high << 8 | ids.value[index] & 255;
11415
11426
  const metadata = data.value[index] & 255;
11416
- const mapped = mapping[`${id}:${metadata}`];
11427
+ const key = `${id}:${metadata}`;
11428
+ const mapped = customMappings[key] ?? mapping[key];
11417
11429
  if (!mapped) throw new MineRenderError(`Unsupported legacy block ${id}:${metadata} at schematic index ${index}`);
11418
11430
  const [type, state] = mapped.split("[");
11419
11431
  if (type === "minecraft:air") continue;
11420
11432
  const properties = {};
11421
11433
  if (state) {
11422
11434
  for (const property of state.slice(0, -1).split(",")) {
11423
- const [key, value] = property.split("=");
11424
- properties[key] = value;
11435
+ const [key2, value] = property.split("=");
11436
+ properties[key2] = value;
11425
11437
  }
11426
11438
  }
11427
11439
  blocks.push({