minerender 2.1.0-alpha.140 → 2.1.0-alpha.142

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.
package/dist/bundle.js CHANGED
@@ -4852,7 +4852,7 @@ var MineRender = (() => {
4852
4852
  }
4853
4853
  throw new Error(`THREE.TextureUtils: Unknown texture type ${type}.`);
4854
4854
  }
4855
- var REVISION, MOUSE, TOUCH, CullFaceNone, CullFaceBack, CullFaceFront, PCFShadowMap, PCFSoftShadowMap, VSMShadowMap, FrontSide, BackSide, DoubleSide, NoBlending, NormalBlending, AdditiveBlending, SubtractiveBlending, MultiplyBlending, CustomBlending, AddEquation, SubtractEquation, ReverseSubtractEquation, MinEquation, MaxEquation, ZeroFactor, OneFactor, SrcColorFactor, OneMinusSrcColorFactor, SrcAlphaFactor, OneMinusSrcAlphaFactor, DstAlphaFactor, OneMinusDstAlphaFactor, DstColorFactor, OneMinusDstColorFactor, SrcAlphaSaturateFactor, ConstantColorFactor, OneMinusConstantColorFactor, ConstantAlphaFactor, OneMinusConstantAlphaFactor, NeverDepth, AlwaysDepth, LessDepth, LessEqualDepth, EqualDepth, GreaterEqualDepth, GreaterDepth, NotEqualDepth, MultiplyOperation, MixOperation, AddOperation, NoToneMapping, LinearToneMapping, ReinhardToneMapping, CineonToneMapping, ACESFilmicToneMapping, CustomToneMapping, AgXToneMapping, NeutralToneMapping, UVMapping, CubeReflectionMapping, CubeRefractionMapping, EquirectangularReflectionMapping, EquirectangularRefractionMapping, CubeUVReflectionMapping, RepeatWrapping, ClampToEdgeWrapping, MirroredRepeatWrapping, NearestFilter, NearestMipmapNearestFilter, NearestMipmapLinearFilter, LinearFilter, LinearMipmapNearestFilter, LinearMipmapLinearFilter, UnsignedByteType, ByteType, ShortType, UnsignedShortType, IntType, UnsignedIntType, FloatType, HalfFloatType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedInt101111Type, AlphaFormat, RGBFormat, RGBAFormat, DepthFormat, DepthStencilFormat, RedFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, R11_EAC_Format, SIGNED_R11_EAC_Format, RG11_EAC_Format, SIGNED_RG11_EAC_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolateBezier, ZeroCurvatureEnding, ZeroSlopeEnding, WrapAroundEnding, TrianglesDrawMode, TriangleStripDrawMode, TriangleFanDrawMode, BasicDepthPacking, TangentSpaceNormalMap, ObjectSpaceNormalMap, NoColorSpace, SRGBColorSpace, LinearSRGBColorSpace, LinearTransfer, SRGBTransfer, KeepStencilOp, AlwaysStencilFunc, NeverCompare, LessCompare, EqualCompare, LessEqualCompare, GreaterCompare, NotEqualCompare, GreaterEqualCompare, AlwaysCompare, StaticDrawUsage, GLSL3, WebGLCoordinateSystem, WebGPUCoordinateSystem, _cache, _setConsoleFunction, ReversedDepthFuncs, EventDispatcher, _lut, _seed, DEG2RAD, RAD2DEG, MathUtils, _Vector2, Vector2, Quaternion, _Vector3, Vector3, _vector$c, _quaternion$5, _Matrix3, Matrix3, _m3, LINEAR_REC709_TO_XYZ, XYZ_TO_LINEAR_REC709, ColorManagement, _canvas, ImageUtils, _sourceId, TextureSource, _textureId, _tempVec3, Texture, _Vector4, Vector4, RenderTarget, WebGLRenderTarget, DataArrayTexture, Data3DTexture, _Matrix4, Matrix4, _v1$7, _m1$2, _zero, _one, _x, _y, _z, _matrix$2, _quaternion$4, Euler, Layers, _object3DId, _v1$6, _q1, _m1$1, _target, _position$4, _scale$3, _quaternion$3, _xAxis, _yAxis, _zAxis, _addedEvent, _removedEvent, _childaddedEvent, _childremovedEvent, Object3D, Group, _moveEvent, WebXRController, _colorKeywords, _hslA, _hslB, Color, _color, Scene, _v0$2, _v1$5, _v2$4, _v3$2, _vab, _vac, _vbc, _vap, _vbp, _vcp, _v40, _v41, _v42, Triangle, Box3, _points, _vector$b, _box$4, _v0$1, _v1$4, _v2$3, _f0, _f1, _f2, _center, _extents, _triangleNormal, _testAxis, _vector$a, _vector2$1, _id$2, BufferAttribute, Uint16BufferAttribute, Uint32BufferAttribute, Float32BufferAttribute, _box$3, _v1$3, _v2$2, Sphere, _id$1, _m1, _obj, _offset, _box$2, _boxMorphTargets, _vector$9, BufferGeometry, InterleavedBuffer, _vector$8, InterleavedBufferAttribute, _vector1, _vector2, _normalMatrix, Plane, _materialId, Material, _vector$7, _segCenter, _segDir, _diff, Ray, MeshBasicMaterial, _inverseMatrix$3, _ray$3, _sphere$6, _sphereHitAt, _vA, _vB, _vC, _tempA, _morphA, _intersectionPoint, _intersectionPointWorld, Mesh, DataTexture, InstancedBufferAttribute, _instanceLocalMatrix, _instanceWorldMatrix, _instanceIntersects, _box3, _identity, _mesh$1, _sphere$4, InstancedMesh, _sphere$3, _defaultSpriteCenter, _vector$6, Frustum, LineBasicMaterial, _vStart, _vEnd, _inverseMatrix$1, _ray$1, _sphere$1, _intersectPointOnRay, _intersectPointOnSegment, Line, _start, _end, LineSegments, CompressedTexture, CubeTexture, CanvasTexture, DepthTexture, CubeDepthTexture, ExternalTexture, BoxGeometry, _v0, _v1$1, _normal, _triangle, EdgesGeometry, PlaneGeometry, UniformsUtils, default_vertex, default_fragment, ShaderMaterial, RawShaderMaterial, MeshStandardMaterial, MeshDepthMaterial, MeshDistanceMaterial, Interpolant, CubicInterpolant, LinearInterpolant, DiscreteInterpolant, BezierInterpolant, KeyframeTrack, BooleanKeyframeTrack, ColorKeyframeTrack, NumberKeyframeTrack, QuaternionLinearInterpolant, QuaternionKeyframeTrack, StringKeyframeTrack, VectorKeyframeTrack, LoadingManager, DefaultLoadingManager, Loader, _position$2, _quaternion$2, _scale$2, Camera, _v3$1, _minTarget, _maxTarget, PerspectiveCamera, OrthographicCamera, fov, aspect, CubeCamera, ArrayCamera, _RESERVED_CHARS_RE, _reservedRe, _wordChar, _wordCharOrDot, _directoryRe, _nodeRe, _objectRe, _propertyRe, _trackRe, _supportedObjectNames, Composite, PropertyBinding, _controlInterpolantsResultBuffer, Uniform, _matrix, Raycaster, Spherical, _Matrix2, Matrix2, _vector$4, Box2, GridHelper, AxesHelper, Controls;
4855
+ var REVISION, MOUSE, TOUCH, CullFaceNone, CullFaceBack, CullFaceFront, PCFShadowMap, PCFSoftShadowMap, VSMShadowMap, FrontSide, BackSide, DoubleSide, NoBlending, NormalBlending, AdditiveBlending, SubtractiveBlending, MultiplyBlending, CustomBlending, AddEquation, SubtractEquation, ReverseSubtractEquation, MinEquation, MaxEquation, ZeroFactor, OneFactor, SrcColorFactor, OneMinusSrcColorFactor, SrcAlphaFactor, OneMinusSrcAlphaFactor, DstAlphaFactor, OneMinusDstAlphaFactor, DstColorFactor, OneMinusDstColorFactor, SrcAlphaSaturateFactor, ConstantColorFactor, OneMinusConstantColorFactor, ConstantAlphaFactor, OneMinusConstantAlphaFactor, NeverDepth, AlwaysDepth, LessDepth, LessEqualDepth, EqualDepth, GreaterEqualDepth, GreaterDepth, NotEqualDepth, MultiplyOperation, MixOperation, AddOperation, NoToneMapping, LinearToneMapping, ReinhardToneMapping, CineonToneMapping, ACESFilmicToneMapping, CustomToneMapping, AgXToneMapping, NeutralToneMapping, UVMapping, CubeReflectionMapping, CubeRefractionMapping, EquirectangularReflectionMapping, EquirectangularRefractionMapping, CubeUVReflectionMapping, RepeatWrapping, ClampToEdgeWrapping, MirroredRepeatWrapping, NearestFilter, NearestMipmapNearestFilter, NearestMipmapLinearFilter, LinearFilter, LinearMipmapNearestFilter, LinearMipmapLinearFilter, UnsignedByteType, ByteType, ShortType, UnsignedShortType, IntType, UnsignedIntType, FloatType, HalfFloatType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedInt101111Type, AlphaFormat, RGBFormat, RGBAFormat, DepthFormat, DepthStencilFormat, RedFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, R11_EAC_Format, SIGNED_R11_EAC_Format, RG11_EAC_Format, SIGNED_RG11_EAC_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolateBezier, ZeroCurvatureEnding, ZeroSlopeEnding, WrapAroundEnding, TrianglesDrawMode, TriangleStripDrawMode, TriangleFanDrawMode, BasicDepthPacking, TangentSpaceNormalMap, ObjectSpaceNormalMap, NoColorSpace, SRGBColorSpace, LinearSRGBColorSpace, LinearTransfer, SRGBTransfer, KeepStencilOp, AlwaysStencilFunc, NeverCompare, LessCompare, EqualCompare, LessEqualCompare, GreaterCompare, NotEqualCompare, GreaterEqualCompare, AlwaysCompare, StaticDrawUsage, DynamicDrawUsage, GLSL3, WebGLCoordinateSystem, WebGPUCoordinateSystem, _cache, _setConsoleFunction, ReversedDepthFuncs, EventDispatcher, _lut, _seed, DEG2RAD, RAD2DEG, MathUtils, _Vector2, Vector2, Quaternion, _Vector3, Vector3, _vector$c, _quaternion$5, _Matrix3, Matrix3, _m3, LINEAR_REC709_TO_XYZ, XYZ_TO_LINEAR_REC709, ColorManagement, _canvas, ImageUtils, _sourceId, TextureSource, _textureId, _tempVec3, Texture, _Vector4, Vector4, RenderTarget, WebGLRenderTarget, DataArrayTexture, Data3DTexture, _Matrix4, Matrix4, _v1$7, _m1$2, _zero, _one, _x, _y, _z, _matrix$2, _quaternion$4, Euler, Layers, _object3DId, _v1$6, _q1, _m1$1, _target, _position$4, _scale$3, _quaternion$3, _xAxis, _yAxis, _zAxis, _addedEvent, _removedEvent, _childaddedEvent, _childremovedEvent, Object3D, Group, _moveEvent, WebXRController, _colorKeywords, _hslA, _hslB, Color, _color, Scene, _v0$2, _v1$5, _v2$4, _v3$2, _vab, _vac, _vbc, _vap, _vbp, _vcp, _v40, _v41, _v42, Triangle, Box3, _points, _vector$b, _box$4, _v0$1, _v1$4, _v2$3, _f0, _f1, _f2, _center, _extents, _triangleNormal, _testAxis, _vector$a, _vector2$1, _id$2, BufferAttribute, Uint16BufferAttribute, Uint32BufferAttribute, Float32BufferAttribute, _box$3, _v1$3, _v2$2, Sphere, _id$1, _m1, _obj, _offset, _box$2, _boxMorphTargets, _vector$9, BufferGeometry, InterleavedBuffer, _vector$8, InterleavedBufferAttribute, _vector1, _vector2, _normalMatrix, Plane, _materialId, Material, _vector$7, _segCenter, _segDir, _diff, Ray, MeshBasicMaterial, _inverseMatrix$3, _ray$3, _sphere$6, _sphereHitAt, _vA, _vB, _vC, _tempA, _morphA, _intersectionPoint, _intersectionPointWorld, Mesh, DataTexture, InstancedBufferAttribute, _instanceLocalMatrix, _instanceWorldMatrix, _instanceIntersects, _box3, _identity, _mesh$1, _sphere$4, InstancedMesh, _sphere$3, _defaultSpriteCenter, _vector$6, Frustum, LineBasicMaterial, _vStart, _vEnd, _inverseMatrix$1, _ray$1, _sphere$1, _intersectPointOnRay, _intersectPointOnSegment, Line, _start, _end, LineSegments, CompressedTexture, CubeTexture, CanvasTexture, DepthTexture, CubeDepthTexture, ExternalTexture, BoxGeometry, _v0, _v1$1, _normal, _triangle, EdgesGeometry, PlaneGeometry, UniformsUtils, default_vertex, default_fragment, ShaderMaterial, RawShaderMaterial, MeshStandardMaterial, MeshDepthMaterial, MeshDistanceMaterial, Interpolant, CubicInterpolant, LinearInterpolant, DiscreteInterpolant, BezierInterpolant, KeyframeTrack, BooleanKeyframeTrack, ColorKeyframeTrack, NumberKeyframeTrack, QuaternionLinearInterpolant, QuaternionKeyframeTrack, StringKeyframeTrack, VectorKeyframeTrack, LoadingManager, DefaultLoadingManager, Loader, _position$2, _quaternion$2, _scale$2, Camera, _v3$1, _minTarget, _maxTarget, PerspectiveCamera, OrthographicCamera, fov, aspect, CubeCamera, ArrayCamera, _RESERVED_CHARS_RE, _reservedRe, _wordChar, _wordCharOrDot, _directoryRe, _nodeRe, _objectRe, _propertyRe, _trackRe, _supportedObjectNames, Composite, PropertyBinding, _controlInterpolantsResultBuffer, Uniform, _matrix, Raycaster, Spherical, _Matrix2, Matrix2, _vector$4, Box2, GridHelper, AxesHelper, Controls;
4856
4856
  var init_three_core = __esm({
4857
4857
  "../../node_modules/three/build/three.core.js"() {
4858
4858
  init_dirname();
@@ -5018,6 +5018,7 @@ var MineRender = (() => {
5018
5018
  GreaterEqualCompare = 518;
5019
5019
  AlwaysCompare = 519;
5020
5020
  StaticDrawUsage = 35044;
5021
+ DynamicDrawUsage = 35048;
5021
5022
  GLSL3 = "300 es";
5022
5023
  WebGLCoordinateSystem = 2e3;
5023
5024
  WebGPUCoordinateSystem = 2001;
@@ -35699,6 +35700,7 @@ void main() {
35699
35700
  this.entityTextureCache,
35700
35701
  this.entityAnimationCache,
35701
35702
  this.blockEntityIndexCache,
35703
+ this.entityDatasetVersionCache,
35702
35704
  this.fontCache,
35703
35705
  this.unihexCache,
35704
35706
  this.bannerPatternCache,
@@ -35754,6 +35756,7 @@ void main() {
35754
35756
  _Caching.entityTextureCache = _Caching.createAssetCache();
35755
35757
  _Caching.entityAnimationCache = _Caching.createAssetCache();
35756
35758
  _Caching.blockEntityIndexCache = _Caching.createAssetCache();
35759
+ _Caching.entityDatasetVersionCache = _Caching.createAssetCache();
35757
35760
  _Caching.unihexCache = _Caching.createAssetCache();
35758
35761
  _Caching.fontCache = _Caching.createAssetCache();
35759
35762
  _Caching.bannerPatternCache = _Caching.createAssetCache();
@@ -82360,26 +82363,45 @@ ${key}` : key;
82360
82363
  }
82361
82364
  });
82362
82365
 
82366
+ // src/assets/_versions/DatasetVersions.ts
82367
+ var parseRelease, compare2, nearestRelease;
82368
+ var init_DatasetVersions = __esm({
82369
+ "src/assets/_versions/DatasetVersions.ts"() {
82370
+ init_dirname();
82371
+ init_buffer2();
82372
+ init_process2();
82373
+ parseRelease = (value) => /^\d+\.\d+(?:\.\d+)?$/.test(value) ? value.split(".").map(Number) : void 0;
82374
+ compare2 = (left, right) => {
82375
+ for (let i4 = 0; i4 < 3; i4++) {
82376
+ const difference = (left[i4] ?? 0) - (right[i4] ?? 0);
82377
+ if (difference) return difference;
82378
+ }
82379
+ return 0;
82380
+ };
82381
+ nearestRelease = (requestedVersion, published) => {
82382
+ const requested = parseRelease(requestedVersion);
82383
+ if (!requested) return void 0;
82384
+ const versions2 = published.map((name2) => ({ name: name2, number: parseRelease(name2) })).filter((entry) => !!entry.number).sort((left, right) => compare2(left.number, right.number));
82385
+ const sameLine = versions2.filter((entry) => entry.number[0] === requested[0] && entry.number[1] === requested[1]);
82386
+ const selected = sameLine.sort((left, right) => Math.abs((left.number[2] ?? 0) - (requested[2] ?? 0)) - Math.abs((right.number[2] ?? 0) - (requested[2] ?? 0)) || compare2(left.number, right.number))[0] ?? versions2.filter((entry) => compare2(entry.number, requested) <= 0).pop() ?? versions2[0];
82387
+ return selected?.name;
82388
+ };
82389
+ }
82390
+ });
82391
+
82363
82392
  // src/assets/MineRenderData.ts
82364
- var object2, release2, compare2, MineRenderData;
82393
+ var object2, MineRenderData;
82365
82394
  var init_MineRenderData = __esm({
82366
82395
  "src/assets/MineRenderData.ts"() {
82367
82396
  init_dirname();
82368
82397
  init_buffer2();
82369
82398
  init_process2();
82399
+ init_DatasetVersions();
82370
82400
  init_AssetKey();
82371
82401
  init_AssetLoader();
82372
82402
  init_AssetParsers();
82373
82403
  init_Caching();
82374
82404
  object2 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
82375
- release2 = (value) => /^\d+\.\d+(?:\.\d+)?$/.test(value) ? value.split(".").map(Number) : void 0;
82376
- compare2 = (left, right) => {
82377
- for (let i4 = 0; i4 < 3; i4++) {
82378
- const difference = (left[i4] ?? 0) - (right[i4] ?? 0);
82379
- if (difference) return difference;
82380
- }
82381
- return 0;
82382
- };
82383
82405
  MineRenderData = class {
82384
82406
  /** Loads one registry. Missing files and invalid data reject the request. */
82385
82407
  static async get(dataset, root) {
@@ -82409,9 +82431,9 @@ ${key}` : key;
82409
82431
  const scope = AssetLoader.persistentScope;
82410
82432
  return this.cached(`resolve:${requestRoot === void 0 ? "sources" : "explicit"}:${root}`, scope, defaultRoot, async () => {
82411
82433
  const requestedVersion = root.slice(root.lastIndexOf("/") + 1);
82412
- let manifest = await this.manifest(root, requestRoot !== void 0 && release2(requestedVersion) ? requestedVersion : void 0, requestRoot);
82434
+ let manifest = await this.manifest(root, requestRoot !== void 0 && parseRelease(requestedVersion) ? requestedVersion : void 0, requestRoot);
82413
82435
  if (manifest) return { requestedVersion, version: manifest.minecraftVersion, root, manifest };
82414
- const requested = release2(requestedVersion);
82436
+ const requested = parseRelease(requestedVersion);
82415
82437
  if (!requested) {
82416
82438
  throw new Error(`No MineRender data is published for ${requestedVersion}; automatic fallback requires a release`);
82417
82439
  }
@@ -82423,14 +82445,12 @@ ${key}` : key;
82423
82445
  }
82424
82446
  return value.versions;
82425
82447
  });
82426
- const versions2 = index.map((entry) => ({ name: entry.name, number: release2(entry.name) })).filter((entry) => !!entry.number).sort((left, right) => compare2(left.number, right.number));
82427
- const sameLine = versions2.filter((entry) => entry.number[0] === requested[0] && entry.number[1] === requested[1]);
82428
- const selected = sameLine.sort((left, right) => Math.abs((left.number[2] ?? 0) - (requested[2] ?? 0)) - Math.abs((right.number[2] ?? 0) - (requested[2] ?? 0)) || compare2(left.number, right.number))[0] ?? versions2.filter((entry) => compare2(entry.number, requested) <= 0).pop() ?? versions2[0];
82448
+ const selected = nearestRelease(requestedVersion, index.map((entry) => entry.name));
82429
82449
  if (!selected) throw new Error(`No compatible MineRender data is published for ${requestedVersion}`);
82430
- const resolvedRoot = `${base}/${selected.name}`;
82431
- manifest = await this.manifest(resolvedRoot, selected.name, resolvedRoot);
82432
- if (!manifest) throw new Error(`Missing MineRender manifest for published version ${selected.name}`);
82433
- return { requestedVersion, version: selected.name, root: resolvedRoot, manifest };
82450
+ const resolvedRoot = `${base}/${selected}`;
82451
+ manifest = await this.manifest(resolvedRoot, selected, resolvedRoot);
82452
+ if (!manifest) throw new Error(`Missing MineRender manifest for published version ${selected}`);
82453
+ return { requestedVersion, version: selected, root: resolvedRoot, manifest };
82434
82454
  });
82435
82455
  }
82436
82456
  static async manifest(root, expectedVersion, requestRoot) {
@@ -83592,119 +83612,6 @@ ${key}` : key, async () => {
83592
83612
  }
83593
83613
  });
83594
83614
 
83595
- // src/assets/BlockEntities.ts
83596
- var log12, BlockEntities;
83597
- var init_BlockEntities = __esm({
83598
- "src/assets/BlockEntities.ts"() {
83599
- init_dirname();
83600
- init_buffer2();
83601
- init_process2();
83602
- init_three_module();
83603
- init_AssetKey();
83604
- init_AssetLoader();
83605
- init_source();
83606
- init_Caching();
83607
- init_log();
83608
- log12 = logger("BlockEntities");
83609
- BlockEntities = class {
83610
- /**
83611
- * Loads the block index of a version. Versions and sources without one yield an empty index, and so does
83612
- * a failed load: the index is optional, and blocks must not retry or fail with it one by one. The empty
83613
- * result is cached like any other; `Caching.clear()` or `AssetLoader.setVersion()` forces a new attempt.
83614
- */
83615
- static async getIndex(root) {
83616
- const key = new AssetKey("entity-models", "blocks", void 0, void 0, void 0, ".json", root);
83617
- key.rootType = void 0;
83618
- const index = await Caching.blockEntityIndexCache.get(key.serialize(), async () => {
83619
- try {
83620
- return await AssetLoader.get(key, "json" /* JSON */) ?? {};
83621
- } catch (error2) {
83622
- log12.warn("Could not load the block entity index; block entities are drawn as plain block models", error2);
83623
- return {};
83624
- }
83625
- });
83626
- return index ?? {};
83627
- }
83628
- /** The index entry of a block ID such as `minecraft:chest`. */
83629
- static entry(index, block) {
83630
- const entry = Object.prototype.hasOwnProperty.call(index, block) ? index[block] : void 0;
83631
- return Array.isArray(entry?.parts) ? entry : void 0;
83632
- }
83633
- /** Selects the parts and placement for a block ID such as `minecraft:chest`; undefined when nothing is drawn. */
83634
- static resolve(index, block, state = {}) {
83635
- const entry = this.entry(index, block);
83636
- if (!entry) return void 0;
83637
- const value = (property) => String(state[property]).toLowerCase();
83638
- const parts = entry.parts.filter((part) => Object.entries(part.when ?? {}).every(([property, values]) => String(values).split("|").includes(value(property))));
83639
- if (!parts.length) return void 0;
83640
- let rotation = 0;
83641
- if (entry.rotation) {
83642
- const selected = value(entry.rotation.property);
83643
- rotation = "degrees" in entry.rotation ? entry.rotation.degrees[selected] : Number(selected) * entry.rotation.step;
83644
- if (!Number.isFinite(rotation)) rotation = 0;
83645
- }
83646
- return { parts, rotation, translation: entry.translation ?? [0, 0, 0] };
83647
- }
83648
- /** Placement in block space (0..16 per axis), applied on top of the model's own transform. */
83649
- static matrix(resolved, matrix = new Matrix4()) {
83650
- return matrix.makeTranslation(8, 0, 8).multiply(new Matrix4().makeRotationY(resolved.rotation * Math.PI / 180)).multiply(new Matrix4().makeTranslation(resolved.translation[0] - 8, resolved.translation[1], resolved.translation[2] - 8));
83651
- }
83652
- };
83653
- }
83654
- });
83655
-
83656
- // src/assets/DecoratedPots.ts
83657
- var POTTERY_SHERDS, DecoratedPots;
83658
- var init_DecoratedPots = __esm({
83659
- "src/assets/DecoratedPots.ts"() {
83660
- init_dirname();
83661
- init_buffer2();
83662
- init_process2();
83663
- init_AssetKey();
83664
- POTTERY_SHERDS = Object.freeze([
83665
- "angler",
83666
- "archer",
83667
- "arms_up",
83668
- "blade",
83669
- "brewer",
83670
- "burn",
83671
- "danger",
83672
- "explorer",
83673
- "flow",
83674
- "friend",
83675
- "guster",
83676
- "heart",
83677
- "heartbreak",
83678
- "howl",
83679
- "miner",
83680
- "mourner",
83681
- "plenty",
83682
- "prize",
83683
- "scrape",
83684
- "sheaf",
83685
- "shelter",
83686
- "skull",
83687
- "snort"
83688
- ].map((pattern2) => `minecraft:${pattern2}_pottery_sherd`));
83689
- DecoratedPots = class {
83690
- /** Reads up to four item IDs in back, left, right, front order; missing and unmapped items use plain sides. */
83691
- static getSideTextures(value, root) {
83692
- const items = value === void 0 ? [] : value;
83693
- if (!Array.isArray(items) || items.length > 4) throw new Error("pot_decorations must be an array of at most four item IDs");
83694
- const textures = items.map((item) => {
83695
- if (!isResourceLocation(item)) throw new Error("Pot decorations must be item identifiers");
83696
- const id = item.includes(":") ? item : `minecraft:${item}`;
83697
- return POTTERY_SHERDS.includes(id) ? id.slice("minecraft:".length).replace(/_sherd$/, "_pattern") : "decorated_pot_side";
83698
- });
83699
- return Object.fromEntries(["back", "left", "right", "front"].map((side, index) => [
83700
- side,
83701
- new AssetKey("minecraft", `decorated_pot/${textures[index] ?? "decorated_pot_side"}`, "textures", "entity", "assets", ".png", root)
83702
- ]));
83703
- }
83704
- };
83705
- }
83706
- });
83707
-
83708
83615
  // src/assets/Entities.ts
83709
83616
  var Entities;
83710
83617
  var init_Entities = __esm({
@@ -83713,6 +83620,7 @@ ${key}` : key, async () => {
83713
83620
  init_buffer2();
83714
83621
  init_process2();
83715
83622
  init_AssetKey();
83623
+ init_DatasetVersions();
83716
83624
  init_AssetLoader();
83717
83625
  init_source();
83718
83626
  init_Caching();
@@ -83720,11 +83628,36 @@ ${key}` : key, async () => {
83720
83628
  init_MineRenderError();
83721
83629
  init_ModelTextures();
83722
83630
  Entities = class {
83631
+ /**
83632
+ * Resolves `root` (default: the active version). Uses the exact dataset when published or when the
83633
+ * version is not a release; otherwise selects the nearest published release, like {@link MineRenderData.resolve}.
83634
+ * Textures keep the requested root.
83635
+ */
83636
+ static async getDatasetRoot(root) {
83637
+ const requestRoot = (root ?? AssetLoader.ROOT).replace(/\/+$/, "");
83638
+ const requestedVersion = requestRoot.slice(requestRoot.lastIndexOf("/") + 1);
83639
+ const base = requestRoot.slice(0, requestRoot.lastIndexOf("/"));
83640
+ const selected = await Caching.entityDatasetVersionCache.get(root ?? `sources:${AssetLoader.ROOT}`, async () => {
83641
+ const key = new AssetKey("entity-models", "version", void 0, void 0, void 0, ".json", root);
83642
+ key.rootType = void 0;
83643
+ if (!parseRelease(requestedVersion) || await AssetLoader.get(key, "json" /* JSON */) !== void 0) return requestedVersion;
83644
+ const indexKey = new AssetKey("entity-models", "versions", void 0, void 0, void 0, ".json", base);
83645
+ indexKey.rootType = void 0;
83646
+ const index = await AssetLoader.get(indexKey, "json" /* JSON */);
83647
+ if (index === void 0) return requestedVersion;
83648
+ if (!index || typeof index !== "object" || Array.isArray(index) || !Array.isArray(index.versions) || !index.versions.every((entry) => entry && typeof entry === "object" && !Array.isArray(entry) && typeof entry.name === "string")) {
83649
+ throw new MineRenderError(`Invalid entity model version index at ${base}/entity-models/versions.json`);
83650
+ }
83651
+ return nearestRelease(requestedVersion, index.versions.map((entry) => entry.name)) ?? requestedVersion;
83652
+ });
83653
+ return selected === requestedVersion ? root : `${base}/${selected}`;
83654
+ }
83723
83655
  /** Lists model paths in the `minecraft` namespace, including subdirectories and excluding `.json`. */
83724
83656
  static async getEntityList() {
83657
+ const root = await this.getDatasetRoot();
83725
83658
  const collect = async (path) => {
83726
83659
  const prefix2 = path ? `${path}/` : "";
83727
- const key = new AssetKey(DEFAULT_NAMESPACE, `${prefix2}_list`, void 0, void 0, "entity-models", ".json");
83660
+ const key = new AssetKey(DEFAULT_NAMESPACE, `${prefix2}_list`, void 0, void 0, "entity-models", ".json", root);
83728
83661
  const list2 = await Caching.listAssetCache.get(key.serialize(), () => AssetLoader.get(key, "list" /* LIST */));
83729
83662
  if (!list2) return [];
83730
83663
  const files = list2.files.filter((file) => file.endsWith(".json") && file !== "_list.json").map((file) => `${prefix2}${file.slice(0, -5)}`);
@@ -83735,7 +83668,7 @@ ${key}` : key, async () => {
83735
83668
  }
83736
83669
  static async getModelFile(modelKey) {
83737
83670
  const path = isAssetKey(modelKey) ? modelKey.getFullPath() : modelKey.path;
83738
- const key = new AssetKey(modelKey.namespace, path, void 0, void 0, "entity-models", ".json", isAssetKey(modelKey) ? modelKey.root : void 0);
83671
+ const key = new AssetKey(modelKey.namespace, path, void 0, void 0, "entity-models", ".json", await this.getDatasetRoot(isAssetKey(modelKey) ? modelKey.root : void 0));
83739
83672
  return Caching.entityModelCache.get(key.serialize(), () => AssetLoader.get(key, "json" /* JSON */));
83740
83673
  }
83741
83674
  /** Returns selectable geometry-layer names, or an empty list when the model is missing. */
@@ -83796,7 +83729,7 @@ ${key}` : key, async () => {
83796
83729
  */
83797
83730
  static async getAnimations(modelKey) {
83798
83731
  const path = isAssetKey(modelKey) ? modelKey.getFullPath() : modelKey.path;
83799
- const key = new AssetKey(modelKey.namespace, path, void 0, void 0, "entity-models/animations", ".json", isAssetKey(modelKey) ? modelKey.root : void 0);
83732
+ const key = new AssetKey(modelKey.namespace, path, void 0, void 0, "entity-models/animations", ".json", await this.getDatasetRoot(isAssetKey(modelKey) ? modelKey.root : void 0));
83800
83733
  const file = await Caching.entityAnimationCache.get(key.serialize(), () => AssetLoader.get(key, "json" /* JSON */));
83801
83734
  return file?.animations;
83802
83735
  }
@@ -83838,6 +83771,121 @@ ${key}` : key, async () => {
83838
83771
  }
83839
83772
  });
83840
83773
 
83774
+ // src/assets/BlockEntities.ts
83775
+ var log12, BlockEntities;
83776
+ var init_BlockEntities = __esm({
83777
+ "src/assets/BlockEntities.ts"() {
83778
+ init_dirname();
83779
+ init_buffer2();
83780
+ init_process2();
83781
+ init_three_module();
83782
+ init_AssetKey();
83783
+ init_Entities();
83784
+ init_AssetLoader();
83785
+ init_source();
83786
+ init_Caching();
83787
+ init_log();
83788
+ log12 = logger("BlockEntities");
83789
+ BlockEntities = class {
83790
+ /**
83791
+ * Loads the block index of a version. Versions and sources without one yield an empty index, and so does
83792
+ * a failed load: the index is optional, and blocks must not retry or fail with it one by one. The empty
83793
+ * result is cached like any other; `Caching.clear()` or `AssetLoader.setVersion()` forces a new attempt.
83794
+ */
83795
+ static async getIndex(root) {
83796
+ const key = new AssetKey("entity-models", "blocks", void 0, void 0, void 0, ".json", root);
83797
+ key.rootType = void 0;
83798
+ const index = await Caching.blockEntityIndexCache.get(key.serialize(), async () => {
83799
+ try {
83800
+ key.root = await Entities.getDatasetRoot(root);
83801
+ return await AssetLoader.get(key, "json" /* JSON */) ?? {};
83802
+ } catch (error2) {
83803
+ log12.warn("Could not load the block entity index; block entities are drawn as plain block models", error2);
83804
+ return {};
83805
+ }
83806
+ });
83807
+ return index ?? {};
83808
+ }
83809
+ /** The index entry of a block ID such as `minecraft:chest`. */
83810
+ static entry(index, block) {
83811
+ const entry = Object.prototype.hasOwnProperty.call(index, block) ? index[block] : void 0;
83812
+ return Array.isArray(entry?.parts) ? entry : void 0;
83813
+ }
83814
+ /** Selects the parts and placement for a block ID such as `minecraft:chest`; undefined when nothing is drawn. */
83815
+ static resolve(index, block, state = {}) {
83816
+ const entry = this.entry(index, block);
83817
+ if (!entry) return void 0;
83818
+ const value = (property) => String(state[property]).toLowerCase();
83819
+ const parts = entry.parts.filter((part) => Object.entries(part.when ?? {}).every(([property, values]) => String(values).split("|").includes(value(property))));
83820
+ if (!parts.length) return void 0;
83821
+ let rotation = 0;
83822
+ if (entry.rotation) {
83823
+ const selected = value(entry.rotation.property);
83824
+ rotation = "degrees" in entry.rotation ? entry.rotation.degrees[selected] : Number(selected) * entry.rotation.step;
83825
+ if (!Number.isFinite(rotation)) rotation = 0;
83826
+ }
83827
+ return { parts, rotation, translation: entry.translation ?? [0, 0, 0] };
83828
+ }
83829
+ /** Placement in block space (0..16 per axis), applied on top of the model's own transform. */
83830
+ static matrix(resolved, matrix = new Matrix4()) {
83831
+ return matrix.makeTranslation(8, 0, 8).multiply(new Matrix4().makeRotationY(resolved.rotation * Math.PI / 180)).multiply(new Matrix4().makeTranslation(resolved.translation[0] - 8, resolved.translation[1], resolved.translation[2] - 8));
83832
+ }
83833
+ };
83834
+ }
83835
+ });
83836
+
83837
+ // src/assets/DecoratedPots.ts
83838
+ var POTTERY_SHERDS, DecoratedPots;
83839
+ var init_DecoratedPots = __esm({
83840
+ "src/assets/DecoratedPots.ts"() {
83841
+ init_dirname();
83842
+ init_buffer2();
83843
+ init_process2();
83844
+ init_AssetKey();
83845
+ POTTERY_SHERDS = Object.freeze([
83846
+ "angler",
83847
+ "archer",
83848
+ "arms_up",
83849
+ "blade",
83850
+ "brewer",
83851
+ "burn",
83852
+ "danger",
83853
+ "explorer",
83854
+ "flow",
83855
+ "friend",
83856
+ "guster",
83857
+ "heart",
83858
+ "heartbreak",
83859
+ "howl",
83860
+ "miner",
83861
+ "mourner",
83862
+ "plenty",
83863
+ "prize",
83864
+ "scrape",
83865
+ "sheaf",
83866
+ "shelter",
83867
+ "skull",
83868
+ "snort"
83869
+ ].map((pattern2) => `minecraft:${pattern2}_pottery_sherd`));
83870
+ DecoratedPots = class {
83871
+ /** Reads up to four item IDs in back, left, right, front order; missing and unmapped items use plain sides. */
83872
+ static getSideTextures(value, root) {
83873
+ const items = value === void 0 ? [] : value;
83874
+ if (!Array.isArray(items) || items.length > 4) throw new Error("pot_decorations must be an array of at most four item IDs");
83875
+ const textures = items.map((item) => {
83876
+ if (!isResourceLocation(item)) throw new Error("Pot decorations must be item identifiers");
83877
+ const id = item.includes(":") ? item : `minecraft:${item}`;
83878
+ return POTTERY_SHERDS.includes(id) ? id.slice("minecraft:".length).replace(/_sherd$/, "_pattern") : "decorated_pot_side";
83879
+ });
83880
+ return Object.fromEntries(["back", "left", "right", "front"].map((side, index) => [
83881
+ side,
83882
+ new AssetKey("minecraft", `decorated_pot/${textures[index] ?? "decorated_pot_side"}`, "textures", "entity", "assets", ".png", root)
83883
+ ]));
83884
+ }
83885
+ };
83886
+ }
83887
+ });
83888
+
83841
83889
  // src/assets/_fonts/Unihex.ts
83842
83890
  var Unihex_exports = {};
83843
83891
  __export(Unihex_exports, {
@@ -103140,7 +103188,7 @@ gl_FragDepth=readDepth(vUv);
103140
103188
  read.waiters++;
103141
103189
  return new Promise((resolve, reject) => {
103142
103190
  let finished = false;
103143
- const release3 = () => {
103191
+ const release2 = () => {
103144
103192
  if (finished) return false;
103145
103193
  finished = true;
103146
103194
  signal?.removeEventListener("abort", abort2);
@@ -103148,7 +103196,7 @@ gl_FragDepth=readDepth(vUv);
103148
103196
  return true;
103149
103197
  };
103150
103198
  const abort2 = () => {
103151
- if (!release3()) return;
103199
+ if (!release2()) return;
103152
103200
  if (!read.waiters && !read.settled) {
103153
103201
  if (this.pending.get(key) === read) this.pending.delete(key);
103154
103202
  read.controller.abort(signal.reason);
@@ -103158,10 +103206,10 @@ gl_FragDepth=readDepth(vUv);
103158
103206
  signal?.addEventListener("abort", abort2, { once: true });
103159
103207
  read.promise.then(
103160
103208
  (data) => {
103161
- if (release3()) resolve(data);
103209
+ if (release2()) resolve(data);
103162
103210
  },
103163
103211
  (error2) => {
103164
- if (release3()) reject(error2);
103212
+ if (release2()) reject(error2);
103165
103213
  }
103166
103214
  );
103167
103215
  if (signal?.aborted) abort2();
@@ -104816,6 +104864,9 @@ gl_FragDepth=readDepth(vUv);
104816
104864
  var SectionWorker = _SectionWorker;
104817
104865
 
104818
104866
  // src/world/SectionMesh.ts
104867
+ var BLOCK_SIZE = 16;
104868
+ var QUAD_VERTICES = 4;
104869
+ var QUAD_INDICES = 6;
104819
104870
  var templateCache = /* @__PURE__ */ new WeakMap();
104820
104871
  var WATER_TINT = new Color(4159204).toArray();
104821
104872
  function toInput(entries, maxAtlasSize, fluids, lighting) {
@@ -104852,8 +104903,8 @@ gl_FragDepth=readDepth(vUv);
104852
104903
  if (!data) {
104853
104904
  const indices = template.geometry.getIndex();
104854
104905
  const position = template.geometry.getAttribute("position");
104855
- const quads = indices.count / 6;
104856
- if (indices.count % 6 !== 0 || position.count !== quads * 4) {
104906
+ const quads = indices.count / QUAD_INDICES;
104907
+ if (indices.count % QUAD_INDICES !== 0 || position.count !== quads * QUAD_VERTICES) {
104857
104908
  throw new RangeError("Section template geometry must hold four vertices and six indices per quad");
104858
104909
  }
104859
104910
  data = {
@@ -104863,8 +104914,8 @@ gl_FragDepth=readDepth(vUv);
104863
104914
  uvs: new Float32Array(quads * 8),
104864
104915
  uvBounds: new Float32Array(quads * 16),
104865
104916
  colors: new Float32Array(quads * 12),
104866
- shade: new Float32Array(quads * 4),
104867
- indices: new Uint16Array(quads * 6),
104917
+ shade: new Float32Array(quads * QUAD_VERTICES),
104918
+ indices: new Uint16Array(quads * QUAD_INDICES),
104868
104919
  cullFaces: new Uint8Array(template.cullFaces),
104869
104920
  biomeTint: template.biomeTint ? new Uint8Array(template.biomeTint) : void 0,
104870
104921
  atlas: 0,
@@ -104876,7 +104927,7 @@ gl_FragDepth=readDepth(vUv);
104876
104927
  const bounds = template.geometry.getAttribute("uvBounds");
104877
104928
  const color3 = template.geometry.getAttribute("color");
104878
104929
  const shade = template.geometry.getAttribute("shade");
104879
- for (let vertex2 = 0; vertex2 < quads * 4; vertex2++) {
104930
+ for (let vertex2 = 0; vertex2 < quads * QUAD_VERTICES; vertex2++) {
104880
104931
  data.positions.set([position.getX(vertex2), position.getY(vertex2), position.getZ(vertex2)], vertex2 * 3);
104881
104932
  data.normals.set([normal.getX(vertex2), normal.getY(vertex2), normal.getZ(vertex2)], vertex2 * 3);
104882
104933
  data.uvs.set([uv.getX(vertex2), uv.getY(vertex2)], vertex2 * 2);
@@ -104889,7 +104940,7 @@ gl_FragDepth=readDepth(vUv);
104889
104940
  data.colors.set([color3?.getX(vertex2) ?? 1, color3?.getY(vertex2) ?? 1, color3?.getZ(vertex2) ?? 1], vertex2 * 3);
104890
104941
  data.shade[vertex2] = shade?.getX(vertex2) ?? 1;
104891
104942
  }
104892
- for (let i5 = 0; i5 < data.indices.length; i5++) data.indices[i5] = indices.getX(i5) - 4 * Math.floor(i5 / 6);
104943
+ for (let i5 = 0; i5 < data.indices.length; i5++) data.indices[i5] = indices.getX(i5) - QUAD_VERTICES * Math.floor(i5 / QUAD_INDICES);
104893
104944
  templateCache.set(template, data);
104894
104945
  }
104895
104946
  id = input.templateData.length;
@@ -104922,6 +104973,54 @@ gl_FragDepth=readDepth(vUv);
104922
104973
  }
104923
104974
  return { input, atlases: atlases2 };
104924
104975
  }
104976
+ function sortTransparentQuads(mesh) {
104977
+ const index = mesh.geometry.getIndex();
104978
+ if (index.count <= QUAD_INDICES) return;
104979
+ index.setUsage(DynamicDrawUsage);
104980
+ const count = index.count / QUAD_INDICES;
104981
+ let source, centers, depths, order;
104982
+ const view = new Matrix4(), localCamera = new Vector3(), key = new Vector3(), previous = new Vector3();
104983
+ let previousOrthographic;
104984
+ mesh.onBeforeRender = (_renderer, _scene, camera) => {
104985
+ localCamera.setFromMatrixPosition(camera.matrixWorld).applyMatrix4(view.copy(mesh.matrixWorld).invert());
104986
+ const orthographic = !!camera.isOrthographicCamera;
104987
+ if (orthographic) {
104988
+ view.multiplyMatrices(camera.matrixWorldInverse, mesh.matrixWorld);
104989
+ key.set(view.elements[2], view.elements[6], view.elements[10]);
104990
+ } else {
104991
+ key.copy(localCamera).divideScalar(BLOCK_SIZE).floor();
104992
+ }
104993
+ if (orthographic === previousOrthographic && key.equals(previous)) return;
104994
+ previous.copy(key);
104995
+ previousOrthographic = orthographic;
104996
+ if (!centers) {
104997
+ source = new Uint32Array(index.array);
104998
+ centers = new Float32Array(count * 3);
104999
+ depths = new Float32Array(count);
105000
+ order = Uint32Array.from({ length: count }, (_4, quad) => quad);
105001
+ const positions = mesh.geometry.getAttribute("position");
105002
+ for (let quad = 0; quad < count; quad++) {
105003
+ for (let axis = 0; axis < 3; axis++) {
105004
+ let center = 0;
105005
+ for (let corner = 0; corner < QUAD_VERTICES; corner++) center += positions.getComponent(quad * QUAD_VERTICES + corner, axis);
105006
+ centers[quad * 3 + axis] = center / QUAD_VERTICES;
105007
+ }
105008
+ }
105009
+ }
105010
+ for (let quad = 0; quad < count; quad++) {
105011
+ const x4 = centers[quad * 3], y5 = centers[quad * 3 + 1], z4 = centers[quad * 3 + 2];
105012
+ depths[quad] = orthographic ? key.x * x4 + key.y * y5 + key.z * z4 : -((x4 - localCamera.x) ** 2 + (y5 - localCamera.y) ** 2 + (z4 - localCamera.z) ** 2);
105013
+ }
105014
+ order.sort((a4, b4) => depths[a4] - depths[b4] || a4 - b4);
105015
+ if (!order.some((quad, offset) => index.array[offset * QUAD_INDICES] !== source[quad * QUAD_INDICES])) return;
105016
+ for (let offset = 0; offset < count; offset++) {
105017
+ for (let indexOffset = 0; indexOffset < QUAD_INDICES; indexOffset++) {
105018
+ index.array[offset * QUAD_INDICES + indexOffset] = source[order[offset] * QUAD_INDICES + indexOffset];
105019
+ }
105020
+ }
105021
+ index.needsUpdate = true;
105022
+ };
105023
+ }
104925
105024
  var SectionMesh = class _SectionMesh extends Group {
104926
105025
  constructor() {
104927
105026
  super(...arguments);
@@ -104931,7 +105030,11 @@ gl_FragDepth=readDepth(vUv);
104931
105030
  /** Returns the owning section cell for a triangle hit on this mesh's merged geometry. */
104932
105031
  getBlockIndex(hit) {
104933
105032
  if (hit.faceIndex === void 0 || hit.faceIndex === null) return void 0;
104934
- return this.blockIndices.get(hit.object)?.[Math.floor(hit.faceIndex / 2)];
105033
+ const mesh = hit.object;
105034
+ const owners = this.blockIndices.get(mesh);
105035
+ if (!owners) return void 0;
105036
+ const vertex2 = mesh.geometry.getIndex().getX(hit.faceIndex * 3);
105037
+ return owners[Math.floor(vertex2 / QUAD_VERTICES)];
104935
105038
  }
104936
105039
  /** Builds section-local meshes from visible quads. `maxAtlasSize` limits each atlas dimension in pixels. */
104937
105040
  static build(entries, maxAtlasSize = 2048, fluids, lighting) {
@@ -104967,13 +105070,14 @@ gl_FragDepth=readDepth(vUv);
104967
105070
  const material = Materials.createShadedCanvasMaterial(canvas, transparent, false, true);
104968
105071
  material.side = FrontSide;
104969
105072
  if (page.layer === 2) {
105073
+ material.depthWrite = !material.transparent;
104970
105074
  material.side = DoubleSide;
104971
105075
  material.forceSinglePass = true;
104972
- material.depthWrite = !material.transparent;
104973
105076
  }
104974
105077
  material.vertexColors = true;
104975
105078
  const texture = material.uniforms?.map?.value ?? material.map;
104976
105079
  const mesh = new Mesh(geometry, material);
105080
+ if (transparent) sortTransparentQuads(mesh);
104977
105081
  section.add(mesh);
104978
105082
  section.blockIndices.set(mesh, page.blockIndices);
104979
105083
  const unsubscribe = [];