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.
@@ -803,7 +803,7 @@ var init_Textures = __esm({
803
803
  });
804
804
 
805
805
  // src/Materials.ts
806
- import { Color, CustomBlending, DoubleSide, OneFactor, RepeatWrapping, FrontSide, MeshBasicMaterial, MeshStandardMaterial, ShaderChunk, ShaderMaterial, ZeroFactor } from "three";
806
+ import { Color, CustomBlending, DoubleSide, OneFactor, OneMinusSrcAlphaFactor, RepeatWrapping, FrontSide, MeshBasicMaterial, MeshStandardMaterial, ShaderChunk, ShaderMaterial } from "three";
807
807
  var _Materials, Materials;
808
808
  var init_Materials = __esm({
809
809
  "src/Materials.ts"() {
@@ -892,8 +892,15 @@ var init_Materials = __esm({
892
892
  material.blending = CustomBlending;
893
893
  material.blendSrc = OneFactor;
894
894
  material.blendDst = OneFactor;
895
- material.blendSrcAlpha = ZeroFactor;
896
- material.blendDstAlpha = OneFactor;
895
+ material.blendSrcAlpha = OneFactor;
896
+ material.blendDstAlpha = OneMinusSrcAlphaFactor;
897
+ material.onBeforeCompile = (shader) => {
898
+ shader.fragmentShader = shader.fragmentShader.replace(
899
+ "#include <dithering_fragment>",
900
+ "gl_FragColor.a = max(gl_FragColor.r, max(gl_FragColor.g, gl_FragColor.b));\n#include <dithering_fragment>"
901
+ );
902
+ };
903
+ material.customProgramCacheKey = () => "energy_swirl";
897
904
  material.color.set(8421504);
898
905
  break;
899
906
  case "water_mask":
@@ -11194,7 +11201,11 @@ var legacyBlocks_default = {
11194
11201
 
11195
11202
  // src/model/multiblock/SchematicParser.ts
11196
11203
  var SchematicParser = class {
11197
- static async parse(nbt) {
11204
+ /**
11205
+ * Parses a legacy schematic using custom mappings before the bundled defaults.
11206
+ * Keys are `id:metadata`; values are block states such as `minecraft:oak_log[axis=x]`.
11207
+ */
11208
+ static async parse(nbt, customMappings = {}) {
11198
11209
  const tags = nbt.value;
11199
11210
  if (tags.Materials?.type !== "string" || tags.Materials.value !== "Alpha") {
11200
11211
  throw new MineRenderError("Schematic Materials must be Alpha");
@@ -11236,15 +11247,16 @@ var SchematicParser = class {
11236
11247
  const high = packed >> (index & 1) * 4 & 15;
11237
11248
  const id = high << 8 | ids.value[index] & 255;
11238
11249
  const metadata = data.value[index] & 255;
11239
- const mapped = mapping[`${id}:${metadata}`];
11250
+ const key = `${id}:${metadata}`;
11251
+ const mapped = customMappings[key] ?? mapping[key];
11240
11252
  if (!mapped) throw new MineRenderError(`Unsupported legacy block ${id}:${metadata} at schematic index ${index}`);
11241
11253
  const [type, state] = mapped.split("[");
11242
11254
  if (type === "minecraft:air") continue;
11243
11255
  const properties = {};
11244
11256
  if (state) {
11245
11257
  for (const property of state.slice(0, -1).split(",")) {
11246
- const [key, value] = property.split("=");
11247
- properties[key] = value;
11258
+ const [key2, value] = property.split("=");
11259
+ properties[key2] = value;
11248
11260
  }
11249
11261
  }
11250
11262
  blocks.push({