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.
@@ -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 {
@@ -893,8 +893,15 @@ var init_Materials = __esm({
893
893
  material.blending = import_three5.CustomBlending;
894
894
  material.blendSrc = import_three5.OneFactor;
895
895
  material.blendDst = import_three5.OneFactor;
896
- material.blendSrcAlpha = import_three5.ZeroFactor;
897
- material.blendDstAlpha = import_three5.OneFactor;
896
+ material.blendSrcAlpha = import_three5.OneFactor;
897
+ material.blendDstAlpha = import_three5.OneMinusSrcAlphaFactor;
898
+ material.onBeforeCompile = (shader) => {
899
+ shader.fragmentShader = shader.fragmentShader.replace(
900
+ "#include <dithering_fragment>",
901
+ "gl_FragColor.a = max(gl_FragColor.r, max(gl_FragColor.g, gl_FragColor.b));\n#include <dithering_fragment>"
902
+ );
903
+ };
904
+ material.customProgramCacheKey = () => "energy_swirl";
898
905
  material.color.set(8421504);
899
906
  break;
900
907
  case "water_mask":
@@ -11320,7 +11327,11 @@ var legacyBlocks_default = {
11320
11327
 
11321
11328
  // src/model/multiblock/SchematicParser.ts
11322
11329
  var SchematicParser = class {
11323
- static async parse(nbt) {
11330
+ /**
11331
+ * Parses a legacy schematic using custom mappings before the bundled defaults.
11332
+ * Keys are `id:metadata`; values are block states such as `minecraft:oak_log[axis=x]`.
11333
+ */
11334
+ static async parse(nbt, customMappings = {}) {
11324
11335
  const tags = nbt.value;
11325
11336
  if (tags.Materials?.type !== "string" || tags.Materials.value !== "Alpha") {
11326
11337
  throw new MineRenderError("Schematic Materials must be Alpha");
@@ -11362,15 +11373,16 @@ var SchematicParser = class {
11362
11373
  const high = packed >> (index & 1) * 4 & 15;
11363
11374
  const id = high << 8 | ids.value[index] & 255;
11364
11375
  const metadata = data.value[index] & 255;
11365
- const mapped = mapping[`${id}:${metadata}`];
11376
+ const key = `${id}:${metadata}`;
11377
+ const mapped = customMappings[key] ?? mapping[key];
11366
11378
  if (!mapped) throw new MineRenderError(`Unsupported legacy block ${id}:${metadata} at schematic index ${index}`);
11367
11379
  const [type, state] = mapped.split("[");
11368
11380
  if (type === "minecraft:air") continue;
11369
11381
  const properties = {};
11370
11382
  if (state) {
11371
11383
  for (const property of state.slice(0, -1).split(",")) {
11372
- const [key, value] = property.split("=");
11373
- properties[key] = value;
11384
+ const [key2, value] = property.split("=");
11385
+ properties[key2] = value;
11374
11386
  }
11375
11387
  }
11376
11388
  blocks.push({