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.
- package/dist/browser/index.d.mts +8 -1
- package/dist/browser/index.d.ts +8 -1
- package/dist/browser/index.js +89 -0
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +89 -0
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +110 -16
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +8 -1
- package/dist/node/index.d.ts +8 -1
- package/dist/node/index.js +92 -0
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +91 -0
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.d.mts
CHANGED
|
@@ -792,6 +792,12 @@ interface Block {
|
|
|
792
792
|
nbt?: any;
|
|
793
793
|
}
|
|
794
794
|
|
|
795
|
+
declare class BlockTints {
|
|
796
|
+
/** Resolves block preview colors without biome context; explicit tints take precedence. */
|
|
797
|
+
static get(key: AssetKey | undefined, state: BlockStateProperties, model: Model, tints?: Record<number, number>): Promise<Record<number, number> | undefined>;
|
|
798
|
+
private static grassColor;
|
|
799
|
+
}
|
|
800
|
+
|
|
795
801
|
interface Instanceable {
|
|
796
802
|
nextInstance(): InstanceReference<SceneObject>;
|
|
797
803
|
getMatrixAt(index: number, matrix?: Matrix4): Matrix4;
|
|
@@ -1277,6 +1283,7 @@ declare class Caching {
|
|
|
1277
1283
|
static readonly blockStateCache: AsyncLoadingCache<CacheKey, BlockState>;
|
|
1278
1284
|
static readonly listAssetCache: AsyncLoadingCache<CacheKey, ListAsset>;
|
|
1279
1285
|
static readonly defaultBlockStatesCache: AsyncLoadingCache<CacheKey, DefaultBlockStates>;
|
|
1286
|
+
static readonly blockTintCache: AsyncLoadingCache<CacheKey, number>;
|
|
1280
1287
|
static readonly entityModelsCache: AsyncLoadingCache<CacheKey, EntityModels>;
|
|
1281
1288
|
private static createAssetCache;
|
|
1282
1289
|
/** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
|
|
@@ -1679,4 +1686,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
|
|
|
1679
1686
|
*/
|
|
1680
1687
|
declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
|
|
1681
1688
|
|
|
1682
|
-
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, BrowserCache, BrowserEnv, 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, 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, probeImageSize, registerBrowserEnv, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
|
|
1689
|
+
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, BrowserCache, BrowserEnv, 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, 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, probeImageSize, registerBrowserEnv, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -792,6 +792,12 @@ interface Block {
|
|
|
792
792
|
nbt?: any;
|
|
793
793
|
}
|
|
794
794
|
|
|
795
|
+
declare class BlockTints {
|
|
796
|
+
/** Resolves block preview colors without biome context; explicit tints take precedence. */
|
|
797
|
+
static get(key: AssetKey | undefined, state: BlockStateProperties, model: Model, tints?: Record<number, number>): Promise<Record<number, number> | undefined>;
|
|
798
|
+
private static grassColor;
|
|
799
|
+
}
|
|
800
|
+
|
|
795
801
|
interface Instanceable {
|
|
796
802
|
nextInstance(): InstanceReference<SceneObject>;
|
|
797
803
|
getMatrixAt(index: number, matrix?: Matrix4): Matrix4;
|
|
@@ -1277,6 +1283,7 @@ declare class Caching {
|
|
|
1277
1283
|
static readonly blockStateCache: AsyncLoadingCache<CacheKey, BlockState>;
|
|
1278
1284
|
static readonly listAssetCache: AsyncLoadingCache<CacheKey, ListAsset>;
|
|
1279
1285
|
static readonly defaultBlockStatesCache: AsyncLoadingCache<CacheKey, DefaultBlockStates>;
|
|
1286
|
+
static readonly blockTintCache: AsyncLoadingCache<CacheKey, number>;
|
|
1280
1287
|
static readonly entityModelsCache: AsyncLoadingCache<CacheKey, EntityModels>;
|
|
1281
1288
|
private static createAssetCache;
|
|
1282
1289
|
/** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
|
|
@@ -1679,4 +1686,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
|
|
|
1679
1686
|
*/
|
|
1680
1687
|
declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
|
|
1681
1688
|
|
|
1682
|
-
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, BrowserCache, BrowserEnv, 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, 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, probeImageSize, registerBrowserEnv, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
|
|
1689
|
+
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, BrowserCache, BrowserEnv, 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, 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, probeImageSize, registerBrowserEnv, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
|
package/dist/browser/index.js
CHANGED
|
@@ -140,6 +140,7 @@ __export(index_browser_exports, {
|
|
|
140
140
|
BlockEntityModels: () => BlockEntityModels,
|
|
141
141
|
BlockObject: () => BlockObject,
|
|
142
142
|
BlockStates: () => BlockStates,
|
|
143
|
+
BlockTints: () => BlockTints,
|
|
143
144
|
BrowserArchiveProxy: () => BrowserArchiveProxy,
|
|
144
145
|
BrowserCache: () => BrowserCache,
|
|
145
146
|
BrowserEnv: () => BrowserEnv,
|
|
@@ -568,6 +569,7 @@ var _Caching = class _Caching {
|
|
|
568
569
|
this.blockStateCache,
|
|
569
570
|
this.listAssetCache,
|
|
570
571
|
this.defaultBlockStatesCache,
|
|
572
|
+
this.blockTintCache,
|
|
571
573
|
this.entityModelsCache
|
|
572
574
|
];
|
|
573
575
|
}
|
|
@@ -610,6 +612,7 @@ _Caching.modelTextureAtlasCache = import_loading_cache.Caches.builder().expireAf
|
|
|
610
612
|
_Caching.blockStateCache = import_loading_cache.Caches.builder().expireAfterWrite(import_time.Time.minutes(10)).expireAfterAccess(import_time.Time.minutes(5)).expirationInterval(import_time.Time.seconds(30)).buildAsync();
|
|
611
613
|
_Caching.listAssetCache = _Caching.createAssetCache();
|
|
612
614
|
_Caching.defaultBlockStatesCache = _Caching.createAssetCache();
|
|
615
|
+
_Caching.blockTintCache = _Caching.createAssetCache();
|
|
613
616
|
_Caching.entityModelsCache = _Caching.createAssetCache();
|
|
614
617
|
var Caching = _Caching;
|
|
615
618
|
|
|
@@ -3776,6 +3779,91 @@ function isQuadArray(obj) {
|
|
|
3776
3779
|
return Array.isArray(obj) && obj.length === 4;
|
|
3777
3780
|
}
|
|
3778
3781
|
|
|
3782
|
+
// src/model/block/blockTints.json
|
|
3783
|
+
var blockTints_default = {
|
|
3784
|
+
"minecraft:large_fern": { source: "grass" },
|
|
3785
|
+
"minecraft:tall_grass": { source: "grass" },
|
|
3786
|
+
"minecraft:grass_block": { source: "grass" },
|
|
3787
|
+
"minecraft:fern": { source: "grass" },
|
|
3788
|
+
"minecraft:grass": { source: "grass" },
|
|
3789
|
+
"minecraft:short_grass": { source: "grass" },
|
|
3790
|
+
"minecraft:potted_fern": { source: "grass" },
|
|
3791
|
+
"minecraft:bush": { source: "grass" },
|
|
3792
|
+
"minecraft:pink_petals": { source: "grass", untinted: [0] },
|
|
3793
|
+
"minecraft:wildflowers": { source: "grass", untinted: [0] },
|
|
3794
|
+
"minecraft:spruce_leaves": { source: "constant", color: 6396257 },
|
|
3795
|
+
"minecraft:birch_leaves": { source: "constant", color: 8431445 },
|
|
3796
|
+
"minecraft:oak_leaves": { source: "constant", color: 4764952 },
|
|
3797
|
+
"minecraft:jungle_leaves": { source: "constant", color: 4764952 },
|
|
3798
|
+
"minecraft:acacia_leaves": { source: "constant", color: 4764952 },
|
|
3799
|
+
"minecraft:dark_oak_leaves": { source: "constant", color: 4764952 },
|
|
3800
|
+
"minecraft:vine": { source: "constant", color: 4764952 },
|
|
3801
|
+
"minecraft:mangrove_leaves": { source: "constant", color: 4764952 },
|
|
3802
|
+
"minecraft:leaf_litter": { source: "constant", color: 6044722 },
|
|
3803
|
+
"minecraft:water_cauldron": { source: "constant", color: 4159204 },
|
|
3804
|
+
"minecraft:redstone_wire": { source: "redstone" },
|
|
3805
|
+
"minecraft:attached_melon_stem": { source: "constant", color: 14731036 },
|
|
3806
|
+
"minecraft:attached_pumpkin_stem": { source: "constant", color: 14731036 },
|
|
3807
|
+
"minecraft:melon_stem": { source: "stem" },
|
|
3808
|
+
"minecraft:pumpkin_stem": { source: "stem" },
|
|
3809
|
+
"minecraft:lily_pad": { source: "constant", color: 7455580 }
|
|
3810
|
+
};
|
|
3811
|
+
|
|
3812
|
+
// src/model/block/BlockTints.ts
|
|
3813
|
+
var rules = blockTints_default;
|
|
3814
|
+
var BlockTints = class {
|
|
3815
|
+
/** Resolves block preview colors without biome context; explicit tints take precedence. */
|
|
3816
|
+
static async get(key, state, model, tints) {
|
|
3817
|
+
const rule = key && rules[key.toNamespacedString()];
|
|
3818
|
+
if (!key || !rule) return tints;
|
|
3819
|
+
const indices = /* @__PURE__ */ new Set();
|
|
3820
|
+
for (const element of model.elements ?? []) {
|
|
3821
|
+
for (const face of Object.values(element.faces)) {
|
|
3822
|
+
const index = face?.tintindex;
|
|
3823
|
+
if (index !== void 0 && index >= 0 && tints?.[index] === void 0 && !rule.untinted?.includes(index)) {
|
|
3824
|
+
indices.add(index);
|
|
3825
|
+
}
|
|
3826
|
+
}
|
|
3827
|
+
}
|
|
3828
|
+
if (!indices.size) return tints;
|
|
3829
|
+
let color;
|
|
3830
|
+
switch (rule.source) {
|
|
3831
|
+
case "constant":
|
|
3832
|
+
color = rule.color;
|
|
3833
|
+
break;
|
|
3834
|
+
case "grass":
|
|
3835
|
+
color = await this.grassColor(key);
|
|
3836
|
+
break;
|
|
3837
|
+
case "redstone": {
|
|
3838
|
+
const power = Number(state.power ?? 0) / 15;
|
|
3839
|
+
const red = power * 0.6 + (power > 0 ? 0.4 : 0.3);
|
|
3840
|
+
const green = Math.max(0, power * power * 0.7 - 0.5);
|
|
3841
|
+
const blue = Math.max(0, power * power * 0.6 - 0.7);
|
|
3842
|
+
color = Math.floor(red * 255) << 16 | Math.floor(green * 255) << 8 | Math.floor(blue * 255);
|
|
3843
|
+
break;
|
|
3844
|
+
}
|
|
3845
|
+
case "stem": {
|
|
3846
|
+
const age = Number(state.age ?? 0);
|
|
3847
|
+
color = age * 32 << 16 | 255 - age * 8 << 8 | age * 4;
|
|
3848
|
+
break;
|
|
3849
|
+
}
|
|
3850
|
+
}
|
|
3851
|
+
return { ...Object.fromEntries([...indices].map((index) => [index, color])), ...tints };
|
|
3852
|
+
}
|
|
3853
|
+
static async grassColor(origin) {
|
|
3854
|
+
const key = AssetKey.parse("textures", "minecraft:colormap/grass", origin);
|
|
3855
|
+
return await Caching.blockTintCache.get(key.serialize(), async () => {
|
|
3856
|
+
const image = await ModelTextures.get(key);
|
|
3857
|
+
if (!image) throw new MineRenderError(`Missing grass colormap: ${key.toNamespacedString()}`);
|
|
3858
|
+
if (image.width !== 256 || image.height !== 256) {
|
|
3859
|
+
throw new MineRenderError("Grass colormaps must be 256 \xD7 256 pixels");
|
|
3860
|
+
}
|
|
3861
|
+
const [red, green, blue] = image.data.getImageData(127, 127, 1, 1).data;
|
|
3862
|
+
return red << 16 | green << 8 | blue;
|
|
3863
|
+
});
|
|
3864
|
+
}
|
|
3865
|
+
};
|
|
3866
|
+
|
|
3779
3867
|
// src/model/scene/ModelObject.ts
|
|
3780
3868
|
var import_three15 = require("three");
|
|
3781
3869
|
|
|
@@ -4610,6 +4698,7 @@ var _BlockObject = class _BlockObject extends SceneObject {
|
|
|
4610
4698
|
const model = await Models.getMerged(AssetKey.parse("models", variant.model));
|
|
4611
4699
|
const options = {
|
|
4612
4700
|
...this.options,
|
|
4701
|
+
tints: model ? await BlockTints.get(this.blockState.key, this.state, model, this.options.tints) : this.options.tints,
|
|
4613
4702
|
uvLockRotation: variant.uvlock && (rotation.x !== 0 || rotation.y !== 0) ? [rotation.x, rotation.y, rotation.z] : void 0
|
|
4614
4703
|
};
|
|
4615
4704
|
const obj = await this.scene.addModel(model, options);
|