minerender 2.1.0-alpha.20 → 2.1.0-alpha.21

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.
@@ -793,6 +793,12 @@ interface Block {
793
793
  nbt?: any;
794
794
  }
795
795
 
796
+ declare class BlockTints {
797
+ /** Resolves block preview colors without biome context; explicit tints take precedence. */
798
+ static get(key: AssetKey | undefined, state: BlockStateProperties, model: Model, tints?: Record<number, number>): Promise<Record<number, number> | undefined>;
799
+ private static grassColor;
800
+ }
801
+
796
802
  interface Instanceable {
797
803
  nextInstance(): InstanceReference<SceneObject>;
798
804
  getMatrixAt(index: number, matrix?: Matrix4): Matrix4;
@@ -1278,6 +1284,7 @@ declare class Caching {
1278
1284
  static readonly blockStateCache: AsyncLoadingCache<CacheKey, BlockState>;
1279
1285
  static readonly listAssetCache: AsyncLoadingCache<CacheKey, ListAsset>;
1280
1286
  static readonly defaultBlockStatesCache: AsyncLoadingCache<CacheKey, DefaultBlockStates>;
1287
+ static readonly blockTintCache: AsyncLoadingCache<CacheKey, number>;
1281
1288
  static readonly entityModelsCache: AsyncLoadingCache<CacheKey, EntityModels>;
1282
1289
  private static createAssetCache;
1283
1290
  /** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
@@ -1682,4 +1689,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
1682
1689
  forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
1683
1690
  }
1684
1691
 
1685
- export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, ArchiveAssetSource, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Block, BlockEntityModels, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, type BlockStateVariant, type BlockStateVariants, BlockStates, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, type CacheKey, Caching, type CameraOptions, CanvasImage, Chunk, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, type Cube, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, type Disposable, type DoubleArray, type ElementFace, type ElementRotation, Entities, type EntityModel, EntityModels, EntityObject, type EntityObjectOptions, Env, type EnvProvider, type ExtractableImageData, type FromTo, Geometries, GuiLight, GuiObject, type GuiObjectOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelTextures, type ListAsset, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, type ModelPart, ModelTextures, Models, type MultiBlockBlock, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, NodeCache, NodeEnv, OrbitControls, PersistentCache, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResponseParser, SKIN_PARTS, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, type Serializable, type SkinGeometries, SkinObject, type SkinObjectOptions, SkinPart, type SkinTextureCoordinates, Skins, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, applyModelPartRotation, axisToVec3, base64decode, base64encode, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createImage, estimateBytesUsed, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, registerNodeEnv, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
1692
+ export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, ArchiveAssetSource, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Block, BlockEntityModels, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, type CacheKey, Caching, type CameraOptions, CanvasImage, Chunk, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, type Cube, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, type Disposable, type DoubleArray, type ElementFace, type ElementRotation, Entities, type EntityModel, EntityModels, EntityObject, type EntityObjectOptions, Env, type EnvProvider, type ExtractableImageData, type FromTo, Geometries, GuiLight, GuiObject, type GuiObjectOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelTextures, type ListAsset, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, type ModelPart, ModelTextures, Models, type MultiBlockBlock, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, NodeCache, NodeEnv, OrbitControls, PersistentCache, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResponseParser, SKIN_PARTS, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, type Serializable, type SkinGeometries, SkinObject, type SkinObjectOptions, SkinPart, type SkinTextureCoordinates, Skins, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, applyModelPartRotation, axisToVec3, base64decode, base64encode, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createImage, estimateBytesUsed, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, registerNodeEnv, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
@@ -793,6 +793,12 @@ interface Block {
793
793
  nbt?: any;
794
794
  }
795
795
 
796
+ declare class BlockTints {
797
+ /** Resolves block preview colors without biome context; explicit tints take precedence. */
798
+ static get(key: AssetKey | undefined, state: BlockStateProperties, model: Model, tints?: Record<number, number>): Promise<Record<number, number> | undefined>;
799
+ private static grassColor;
800
+ }
801
+
796
802
  interface Instanceable {
797
803
  nextInstance(): InstanceReference<SceneObject>;
798
804
  getMatrixAt(index: number, matrix?: Matrix4): Matrix4;
@@ -1278,6 +1284,7 @@ declare class Caching {
1278
1284
  static readonly blockStateCache: AsyncLoadingCache<CacheKey, BlockState>;
1279
1285
  static readonly listAssetCache: AsyncLoadingCache<CacheKey, ListAsset>;
1280
1286
  static readonly defaultBlockStatesCache: AsyncLoadingCache<CacheKey, DefaultBlockStates>;
1287
+ static readonly blockTintCache: AsyncLoadingCache<CacheKey, number>;
1281
1288
  static readonly entityModelsCache: AsyncLoadingCache<CacheKey, EntityModels>;
1282
1289
  private static createAssetCache;
1283
1290
  /** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
@@ -1682,4 +1689,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
1682
1689
  forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
1683
1690
  }
1684
1691
 
1685
- export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, ArchiveAssetSource, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Block, BlockEntityModels, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, type BlockStateVariant, type BlockStateVariants, BlockStates, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, type CacheKey, Caching, type CameraOptions, CanvasImage, Chunk, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, type Cube, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, type Disposable, type DoubleArray, type ElementFace, type ElementRotation, Entities, type EntityModel, EntityModels, EntityObject, type EntityObjectOptions, Env, type EnvProvider, type ExtractableImageData, type FromTo, Geometries, GuiLight, GuiObject, type GuiObjectOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelTextures, type ListAsset, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, type ModelPart, ModelTextures, Models, type MultiBlockBlock, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, NodeCache, NodeEnv, OrbitControls, PersistentCache, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResponseParser, SKIN_PARTS, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, type Serializable, type SkinGeometries, SkinObject, type SkinObjectOptions, SkinPart, type SkinTextureCoordinates, Skins, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, applyModelPartRotation, axisToVec3, base64decode, base64encode, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createImage, estimateBytesUsed, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, registerNodeEnv, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
1692
+ export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, ArchiveAssetSource, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Block, BlockEntityModels, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, type CacheKey, Caching, type CameraOptions, CanvasImage, Chunk, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, type Cube, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, type Disposable, type DoubleArray, type ElementFace, type ElementRotation, Entities, type EntityModel, EntityModels, EntityObject, type EntityObjectOptions, Env, type EnvProvider, type ExtractableImageData, type FromTo, Geometries, GuiLight, GuiObject, type GuiObjectOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelTextures, type ListAsset, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, type ModelPart, ModelTextures, Models, type MultiBlockBlock, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, NodeCache, NodeEnv, OrbitControls, PersistentCache, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResponseParser, SKIN_PARTS, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, type Serializable, type SkinGeometries, SkinObject, type SkinObjectOptions, SkinPart, type SkinTextureCoordinates, Skins, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, applyModelPartRotation, axisToVec3, base64decode, base64encode, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createImage, estimateBytesUsed, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, registerNodeEnv, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
@@ -140,6 +140,7 @@ __export(index_node_exports, {
140
140
  BlockEntityModels: () => BlockEntityModels,
141
141
  BlockObject: () => BlockObject,
142
142
  BlockStates: () => BlockStates,
143
+ BlockTints: () => BlockTints,
143
144
  BrowserArchiveProxy: () => BrowserArchiveProxy,
144
145
  CUBE_FACES: () => CUBE_FACES,
145
146
  Caching: () => Caching,
@@ -556,6 +557,9 @@ var Caching = class _Caching {
556
557
  static {
557
558
  this.defaultBlockStatesCache = _Caching.createAssetCache();
558
559
  }
560
+ static {
561
+ this.blockTintCache = _Caching.createAssetCache();
562
+ }
559
563
  static {
560
564
  this.entityModelsCache = _Caching.createAssetCache();
561
565
  }
@@ -581,6 +585,7 @@ var Caching = class _Caching {
581
585
  this.blockStateCache,
582
586
  this.listAssetCache,
583
587
  this.defaultBlockStatesCache,
588
+ this.blockTintCache,
584
589
  this.entityModelsCache
585
590
  ];
586
591
  }
@@ -3816,6 +3821,91 @@ function isQuadArray(obj) {
3816
3821
  return Array.isArray(obj) && obj.length === 4;
3817
3822
  }
3818
3823
 
3824
+ // src/model/block/blockTints.json
3825
+ var blockTints_default = {
3826
+ "minecraft:large_fern": { source: "grass" },
3827
+ "minecraft:tall_grass": { source: "grass" },
3828
+ "minecraft:grass_block": { source: "grass" },
3829
+ "minecraft:fern": { source: "grass" },
3830
+ "minecraft:grass": { source: "grass" },
3831
+ "minecraft:short_grass": { source: "grass" },
3832
+ "minecraft:potted_fern": { source: "grass" },
3833
+ "minecraft:bush": { source: "grass" },
3834
+ "minecraft:pink_petals": { source: "grass", untinted: [0] },
3835
+ "minecraft:wildflowers": { source: "grass", untinted: [0] },
3836
+ "minecraft:spruce_leaves": { source: "constant", color: 6396257 },
3837
+ "minecraft:birch_leaves": { source: "constant", color: 8431445 },
3838
+ "minecraft:oak_leaves": { source: "constant", color: 4764952 },
3839
+ "minecraft:jungle_leaves": { source: "constant", color: 4764952 },
3840
+ "minecraft:acacia_leaves": { source: "constant", color: 4764952 },
3841
+ "minecraft:dark_oak_leaves": { source: "constant", color: 4764952 },
3842
+ "minecraft:vine": { source: "constant", color: 4764952 },
3843
+ "minecraft:mangrove_leaves": { source: "constant", color: 4764952 },
3844
+ "minecraft:leaf_litter": { source: "constant", color: 6044722 },
3845
+ "minecraft:water_cauldron": { source: "constant", color: 4159204 },
3846
+ "minecraft:redstone_wire": { source: "redstone" },
3847
+ "minecraft:attached_melon_stem": { source: "constant", color: 14731036 },
3848
+ "minecraft:attached_pumpkin_stem": { source: "constant", color: 14731036 },
3849
+ "minecraft:melon_stem": { source: "stem" },
3850
+ "minecraft:pumpkin_stem": { source: "stem" },
3851
+ "minecraft:lily_pad": { source: "constant", color: 7455580 }
3852
+ };
3853
+
3854
+ // src/model/block/BlockTints.ts
3855
+ var rules = blockTints_default;
3856
+ var BlockTints = class {
3857
+ /** Resolves block preview colors without biome context; explicit tints take precedence. */
3858
+ static async get(key, state, model, tints) {
3859
+ const rule = key && rules[key.toNamespacedString()];
3860
+ if (!key || !rule) return tints;
3861
+ const indices = /* @__PURE__ */ new Set();
3862
+ for (const element of model.elements ?? []) {
3863
+ for (const face of Object.values(element.faces)) {
3864
+ const index = face?.tintindex;
3865
+ if (index !== void 0 && index >= 0 && tints?.[index] === void 0 && !rule.untinted?.includes(index)) {
3866
+ indices.add(index);
3867
+ }
3868
+ }
3869
+ }
3870
+ if (!indices.size) return tints;
3871
+ let color;
3872
+ switch (rule.source) {
3873
+ case "constant":
3874
+ color = rule.color;
3875
+ break;
3876
+ case "grass":
3877
+ color = await this.grassColor(key);
3878
+ break;
3879
+ case "redstone": {
3880
+ const power = Number(state.power ?? 0) / 15;
3881
+ const red = power * 0.6 + (power > 0 ? 0.4 : 0.3);
3882
+ const green = Math.max(0, power * power * 0.7 - 0.5);
3883
+ const blue = Math.max(0, power * power * 0.6 - 0.7);
3884
+ color = Math.floor(red * 255) << 16 | Math.floor(green * 255) << 8 | Math.floor(blue * 255);
3885
+ break;
3886
+ }
3887
+ case "stem": {
3888
+ const age = Number(state.age ?? 0);
3889
+ color = age * 32 << 16 | 255 - age * 8 << 8 | age * 4;
3890
+ break;
3891
+ }
3892
+ }
3893
+ return { ...Object.fromEntries([...indices].map((index) => [index, color])), ...tints };
3894
+ }
3895
+ static async grassColor(origin) {
3896
+ const key = AssetKey.parse("textures", "minecraft:colormap/grass", origin);
3897
+ return await Caching.blockTintCache.get(key.serialize(), async () => {
3898
+ const image = await ModelTextures.get(key);
3899
+ if (!image) throw new MineRenderError(`Missing grass colormap: ${key.toNamespacedString()}`);
3900
+ if (image.width !== 256 || image.height !== 256) {
3901
+ throw new MineRenderError("Grass colormaps must be 256 \xD7 256 pixels");
3902
+ }
3903
+ const [red, green, blue] = image.data.getImageData(127, 127, 1, 1).data;
3904
+ return red << 16 | green << 8 | blue;
3905
+ });
3906
+ }
3907
+ };
3908
+
3819
3909
  // src/model/scene/ModelObject.ts
3820
3910
  var import_three15 = require("three");
3821
3911
 
@@ -4656,6 +4746,7 @@ var BlockObject = class _BlockObject extends SceneObject {
4656
4746
  const model = await Models.getMerged(AssetKey.parse("models", variant.model));
4657
4747
  const options = {
4658
4748
  ...this.options,
4749
+ tints: model ? await BlockTints.get(this.blockState.key, this.state, model, this.options.tints) : this.options.tints,
4659
4750
  uvLockRotation: variant.uvlock && (rotation.x !== 0 || rotation.y !== 0) ? [rotation.x, rotation.y, rotation.z] : void 0
4660
4751
  };
4661
4752
  const obj = await this.scene.addModel(model, options);
@@ -7173,6 +7264,7 @@ var Chunk = class _Chunk {
7173
7264
  BlockEntityModels,
7174
7265
  BlockObject,
7175
7266
  BlockStates,
7267
+ BlockTints,
7176
7268
  BrowserArchiveProxy,
7177
7269
  CUBE_FACES,
7178
7270
  Caching,