minerender 2.1.0-alpha.60 → 2.1.0-alpha.61
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 +29 -2
- package/dist/browser/index.d.ts +29 -2
- package/dist/browser/index.js +94 -20
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +94 -20
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +100 -20
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +29 -2
- package/dist/node/index.d.ts +29 -2
- package/dist/node/index.js +96 -20
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +94 -20
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.d.mts
CHANGED
|
@@ -449,7 +449,24 @@ interface ItemModel extends Model {
|
|
|
449
449
|
textures?: ItemModelTextures;
|
|
450
450
|
gui_light?: GuiLight;
|
|
451
451
|
special?: SpecialItemRenderer;
|
|
452
|
+
tints?: ItemTintSource[];
|
|
452
453
|
}
|
|
454
|
+
type ItemTintColor = number | TripleArray;
|
|
455
|
+
type ItemTintSource = {
|
|
456
|
+
type: "constant" | "minecraft:constant";
|
|
457
|
+
value: ItemTintColor;
|
|
458
|
+
} | {
|
|
459
|
+
type: "grass" | "minecraft:grass";
|
|
460
|
+
temperature: number;
|
|
461
|
+
downfall: number;
|
|
462
|
+
} | {
|
|
463
|
+
type: "dye" | "minecraft:dye" | "potion" | "minecraft:potion" | "map_color" | "minecraft:map_color" | "firework" | "minecraft:firework" | "team" | "minecraft:team";
|
|
464
|
+
default: ItemTintColor;
|
|
465
|
+
} | {
|
|
466
|
+
type: "custom_model_data" | "minecraft:custom_model_data";
|
|
467
|
+
index?: number;
|
|
468
|
+
default: ItemTintColor;
|
|
469
|
+
};
|
|
453
470
|
type SpecialItemRenderer = {
|
|
454
471
|
type: "chest" | "minecraft:chest";
|
|
455
472
|
texture: string;
|
|
@@ -974,6 +991,12 @@ declare class DisplayTransforms {
|
|
|
974
991
|
static apply(geometry: BufferGeometry, matrix: Matrix4): void;
|
|
975
992
|
}
|
|
976
993
|
|
|
994
|
+
declare class ItemTints {
|
|
995
|
+
/** Resolves preview colors from item definitions; explicit per-index colors take precedence. */
|
|
996
|
+
static get(model: Model, tints?: Record<number, number>): Promise<Record<number, number> | undefined>;
|
|
997
|
+
private static rgb;
|
|
998
|
+
}
|
|
999
|
+
|
|
977
1000
|
declare class ModelCulling {
|
|
978
1001
|
static toLocalMask(worldMask: number, rotation: Euler): number;
|
|
979
1002
|
static isOpaqueFullCube(atlas: Maybe<TextureAtlas>): boolean;
|
|
@@ -1022,7 +1045,6 @@ declare class BlockStateResolver {
|
|
|
1022
1045
|
declare class BlockTints {
|
|
1023
1046
|
/** Resolves block preview colors without biome context; explicit tints take precedence. */
|
|
1024
1047
|
static get(key: AssetKey | undefined, state: BlockStateProperties, model: Model, tints?: Record<number, number>): Promise<Record<number, number> | undefined>;
|
|
1025
|
-
private static grassColor;
|
|
1026
1048
|
}
|
|
1027
1049
|
|
|
1028
1050
|
interface Instanceable {
|
|
@@ -2161,6 +2183,11 @@ declare class Skins {
|
|
|
2161
2183
|
private static getMcProxyCapeUrl;
|
|
2162
2184
|
}
|
|
2163
2185
|
|
|
2186
|
+
declare class Colormaps {
|
|
2187
|
+
/** Samples the selected resource pack's grass colormap using Minecraft's climate coordinates. */
|
|
2188
|
+
static grassColor(origin?: AssetKey, temperature?: number, downfall?: number): Promise<number>;
|
|
2189
|
+
}
|
|
2190
|
+
|
|
2164
2191
|
declare class TextureLoader {
|
|
2165
2192
|
private static readonly failedTextures;
|
|
2166
2193
|
/** Reports whether image loading failed, so cached textures can be retried. */
|
|
@@ -2374,4 +2401,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
|
|
|
2374
2401
|
forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
|
|
2375
2402
|
}
|
|
2376
2403
|
|
|
2377
|
-
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, AnvilParser, type AnvilRegion, 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, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, type FrameCallback, type FromTo, Geometries, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiTextureLayer, 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 MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, NodeCache, NodeEnv, OrbitControls, PersistentCache, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererFrame, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResponseParser, SKIN_PARTS, SceneExporter, type SceneGLTFExportOptions, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, 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, axisToVec3, base64decode, base64encode, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createFluidGeometry, createImage, entityAnimationTime, estimateBytesUsed, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, registerNodeEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
|
|
2404
|
+
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, AnvilParser, type AnvilRegion, 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, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, type FrameCallback, type FromTo, Geometries, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiTextureLayer, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, NodeCache, NodeEnv, OrbitControls, PersistentCache, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererFrame, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResponseParser, SKIN_PARTS, SceneExporter, type SceneGLTFExportOptions, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, 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, axisToVec3, base64decode, base64encode, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createFluidGeometry, createImage, entityAnimationTime, estimateBytesUsed, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, registerNodeEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
|
package/dist/node/index.d.ts
CHANGED
|
@@ -449,7 +449,24 @@ interface ItemModel extends Model {
|
|
|
449
449
|
textures?: ItemModelTextures;
|
|
450
450
|
gui_light?: GuiLight;
|
|
451
451
|
special?: SpecialItemRenderer;
|
|
452
|
+
tints?: ItemTintSource[];
|
|
452
453
|
}
|
|
454
|
+
type ItemTintColor = number | TripleArray;
|
|
455
|
+
type ItemTintSource = {
|
|
456
|
+
type: "constant" | "minecraft:constant";
|
|
457
|
+
value: ItemTintColor;
|
|
458
|
+
} | {
|
|
459
|
+
type: "grass" | "minecraft:grass";
|
|
460
|
+
temperature: number;
|
|
461
|
+
downfall: number;
|
|
462
|
+
} | {
|
|
463
|
+
type: "dye" | "minecraft:dye" | "potion" | "minecraft:potion" | "map_color" | "minecraft:map_color" | "firework" | "minecraft:firework" | "team" | "minecraft:team";
|
|
464
|
+
default: ItemTintColor;
|
|
465
|
+
} | {
|
|
466
|
+
type: "custom_model_data" | "minecraft:custom_model_data";
|
|
467
|
+
index?: number;
|
|
468
|
+
default: ItemTintColor;
|
|
469
|
+
};
|
|
453
470
|
type SpecialItemRenderer = {
|
|
454
471
|
type: "chest" | "minecraft:chest";
|
|
455
472
|
texture: string;
|
|
@@ -974,6 +991,12 @@ declare class DisplayTransforms {
|
|
|
974
991
|
static apply(geometry: BufferGeometry, matrix: Matrix4): void;
|
|
975
992
|
}
|
|
976
993
|
|
|
994
|
+
declare class ItemTints {
|
|
995
|
+
/** Resolves preview colors from item definitions; explicit per-index colors take precedence. */
|
|
996
|
+
static get(model: Model, tints?: Record<number, number>): Promise<Record<number, number> | undefined>;
|
|
997
|
+
private static rgb;
|
|
998
|
+
}
|
|
999
|
+
|
|
977
1000
|
declare class ModelCulling {
|
|
978
1001
|
static toLocalMask(worldMask: number, rotation: Euler): number;
|
|
979
1002
|
static isOpaqueFullCube(atlas: Maybe<TextureAtlas>): boolean;
|
|
@@ -1022,7 +1045,6 @@ declare class BlockStateResolver {
|
|
|
1022
1045
|
declare class BlockTints {
|
|
1023
1046
|
/** Resolves block preview colors without biome context; explicit tints take precedence. */
|
|
1024
1047
|
static get(key: AssetKey | undefined, state: BlockStateProperties, model: Model, tints?: Record<number, number>): Promise<Record<number, number> | undefined>;
|
|
1025
|
-
private static grassColor;
|
|
1026
1048
|
}
|
|
1027
1049
|
|
|
1028
1050
|
interface Instanceable {
|
|
@@ -2161,6 +2183,11 @@ declare class Skins {
|
|
|
2161
2183
|
private static getMcProxyCapeUrl;
|
|
2162
2184
|
}
|
|
2163
2185
|
|
|
2186
|
+
declare class Colormaps {
|
|
2187
|
+
/** Samples the selected resource pack's grass colormap using Minecraft's climate coordinates. */
|
|
2188
|
+
static grassColor(origin?: AssetKey, temperature?: number, downfall?: number): Promise<number>;
|
|
2189
|
+
}
|
|
2190
|
+
|
|
2164
2191
|
declare class TextureLoader {
|
|
2165
2192
|
private static readonly failedTextures;
|
|
2166
2193
|
/** Reports whether image loading failed, so cached textures can be retried. */
|
|
@@ -2374,4 +2401,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
|
|
|
2374
2401
|
forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
|
|
2375
2402
|
}
|
|
2376
2403
|
|
|
2377
|
-
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, AnvilParser, type AnvilRegion, 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, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, type FrameCallback, type FromTo, Geometries, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiTextureLayer, 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 MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, NodeCache, NodeEnv, OrbitControls, PersistentCache, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererFrame, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResponseParser, SKIN_PARTS, SceneExporter, type SceneGLTFExportOptions, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, 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, axisToVec3, base64decode, base64encode, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createFluidGeometry, createImage, entityAnimationTime, estimateBytesUsed, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, registerNodeEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
|
|
2404
|
+
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, AnvilParser, type AnvilRegion, 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, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, type FrameCallback, type FromTo, Geometries, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiTextureLayer, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, NodeCache, NodeEnv, OrbitControls, PersistentCache, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererFrame, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResponseParser, SKIN_PARTS, SceneExporter, type SceneGLTFExportOptions, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, 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, axisToVec3, base64decode, base64encode, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createFluidGeometry, createImage, entityAnimationTime, estimateBytesUsed, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, registerNodeEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
|
package/dist/node/index.js
CHANGED
|
@@ -1501,7 +1501,7 @@ var init_Models = __esm({
|
|
|
1501
1501
|
}
|
|
1502
1502
|
static async getItemModel(key) {
|
|
1503
1503
|
const itemKey = new AssetKey(key.namespace, key.path, "items", void 0, key.rootType, ".json", key.root);
|
|
1504
|
-
const model = await this.PERSISTENT_CACHE.getOrLoad(AssetLoader.persistentKey(itemKey.serialize())
|
|
1504
|
+
const model = await this.PERSISTENT_CACHE.getOrLoad(`item-v2:${AssetLoader.persistentKey(itemKey.serialize())}`, async () => {
|
|
1505
1505
|
const result = await AssetLoader.getFirst([itemKey, key], "json" /* JSON */);
|
|
1506
1506
|
if (!result) return void 0;
|
|
1507
1507
|
if (result.key.assetType !== "items") return { ...result.asset, key };
|
|
@@ -1510,7 +1510,7 @@ var init_Models = __esm({
|
|
|
1510
1510
|
modelKey.root = key.root;
|
|
1511
1511
|
const model2 = await this.getRaw(modelKey);
|
|
1512
1512
|
if (!model2) throw new Error(`Item ${key.toNamespacedString()} references missing model ${selected.model}`);
|
|
1513
|
-
return selected.special
|
|
1513
|
+
return { ...model2, ...selected.special && { special: selected.special }, ...selected.tints && { tints: selected.tints } };
|
|
1514
1514
|
});
|
|
1515
1515
|
return model ? { ...model, key: Object.assign(new AssetKey("", ""), model.key) } : void 0;
|
|
1516
1516
|
}
|
|
@@ -1521,7 +1521,7 @@ var init_Models = __esm({
|
|
|
1521
1521
|
}
|
|
1522
1522
|
switch (node.type.replace(/^minecraft:/, "")) {
|
|
1523
1523
|
case "model":
|
|
1524
|
-
if (typeof node.model === "string" && node.model) return { model: node.model };
|
|
1524
|
+
if (typeof node.model === "string" && node.model) return { model: node.model, tints: node.tints };
|
|
1525
1525
|
break;
|
|
1526
1526
|
case "special": {
|
|
1527
1527
|
if (!node.base || !node.model || typeof node.model !== "object") break;
|
|
@@ -4918,6 +4918,87 @@ var init_GuiLight = __esm({
|
|
|
4918
4918
|
}
|
|
4919
4919
|
});
|
|
4920
4920
|
|
|
4921
|
+
// src/texture/Colormaps.ts
|
|
4922
|
+
var Colormaps;
|
|
4923
|
+
var init_Colormaps = __esm({
|
|
4924
|
+
"src/texture/Colormaps.ts"() {
|
|
4925
|
+
init_AssetKey();
|
|
4926
|
+
init_ModelTextures();
|
|
4927
|
+
init_Caching();
|
|
4928
|
+
init_MineRenderError();
|
|
4929
|
+
Colormaps = class {
|
|
4930
|
+
/** Samples the selected resource pack's grass colormap using Minecraft's climate coordinates. */
|
|
4931
|
+
static async grassColor(origin, temperature = 0.5, downfall = 1) {
|
|
4932
|
+
const key = AssetKey.parse("textures", "minecraft:colormap/grass", origin);
|
|
4933
|
+
const temp = Math.fround(temperature);
|
|
4934
|
+
const rain = Math.fround(downfall) * temp;
|
|
4935
|
+
const x = Math.floor((1 - temp) * 255), y = Math.floor((1 - rain) * 255);
|
|
4936
|
+
return await Caching.blockTintCache.get(`${key.serialize()}|${x},${y}`, async () => {
|
|
4937
|
+
const image = await ModelTextures.get(key);
|
|
4938
|
+
if (!image) throw new MineRenderError(`Missing grass colormap: ${key.toNamespacedString()}`);
|
|
4939
|
+
if (image.width !== 256 || image.height !== 256) {
|
|
4940
|
+
throw new MineRenderError("Grass colormaps must be 256 \xD7 256 pixels");
|
|
4941
|
+
}
|
|
4942
|
+
const [red, green, blue] = image.data.getImageData(x, y, 1, 1).data;
|
|
4943
|
+
return red << 16 | green << 8 | blue;
|
|
4944
|
+
});
|
|
4945
|
+
}
|
|
4946
|
+
};
|
|
4947
|
+
}
|
|
4948
|
+
});
|
|
4949
|
+
|
|
4950
|
+
// src/model/ItemTints.ts
|
|
4951
|
+
var ItemTints;
|
|
4952
|
+
var init_ItemTints = __esm({
|
|
4953
|
+
"src/model/ItemTints.ts"() {
|
|
4954
|
+
init_MineRenderError();
|
|
4955
|
+
init_Colormaps();
|
|
4956
|
+
ItemTints = class {
|
|
4957
|
+
/** Resolves preview colors from item definitions; explicit per-index colors take precedence. */
|
|
4958
|
+
static async get(model, tints) {
|
|
4959
|
+
const sources = model.tints;
|
|
4960
|
+
if (!sources?.length) return tints;
|
|
4961
|
+
const colors = { ...tints };
|
|
4962
|
+
await Promise.all(sources.map(async (source, index) => {
|
|
4963
|
+
if (colors[index] !== void 0) return;
|
|
4964
|
+
switch (source.type) {
|
|
4965
|
+
case "constant":
|
|
4966
|
+
case "minecraft:constant":
|
|
4967
|
+
colors[index] = this.rgb(source.value);
|
|
4968
|
+
break;
|
|
4969
|
+
case "grass":
|
|
4970
|
+
case "minecraft:grass":
|
|
4971
|
+
colors[index] = await Colormaps.grassColor(model.key, source.temperature, source.downfall);
|
|
4972
|
+
break;
|
|
4973
|
+
case "dye":
|
|
4974
|
+
case "minecraft:dye":
|
|
4975
|
+
case "potion":
|
|
4976
|
+
case "minecraft:potion":
|
|
4977
|
+
case "map_color":
|
|
4978
|
+
case "minecraft:map_color":
|
|
4979
|
+
case "firework":
|
|
4980
|
+
case "minecraft:firework":
|
|
4981
|
+
case "team":
|
|
4982
|
+
case "minecraft:team":
|
|
4983
|
+
case "custom_model_data":
|
|
4984
|
+
case "minecraft:custom_model_data":
|
|
4985
|
+
colors[index] = this.rgb(source.default);
|
|
4986
|
+
break;
|
|
4987
|
+
default:
|
|
4988
|
+
throw new MineRenderError(`Unsupported item tint source ${source.type}`);
|
|
4989
|
+
}
|
|
4990
|
+
}));
|
|
4991
|
+
return colors;
|
|
4992
|
+
}
|
|
4993
|
+
static rgb(color) {
|
|
4994
|
+
if (!Array.isArray(color)) return color & 16777215;
|
|
4995
|
+
const [red, green, blue] = color.map((channel) => Math.floor(Math.fround(Math.fround(channel) * 255)));
|
|
4996
|
+
return red << 16 | green << 8 | blue;
|
|
4997
|
+
}
|
|
4998
|
+
};
|
|
4999
|
+
}
|
|
5000
|
+
});
|
|
5001
|
+
|
|
4921
5002
|
// src/model/scene/ModelObject.ts
|
|
4922
5003
|
function isModelObject(obj) {
|
|
4923
5004
|
return obj.isModelObject;
|
|
@@ -4940,6 +5021,7 @@ var init_ModelObject = __esm({
|
|
|
4940
5021
|
init_SpecialItems();
|
|
4941
5022
|
init_EntityObject();
|
|
4942
5023
|
init_GuiLight();
|
|
5024
|
+
init_ItemTints();
|
|
4943
5025
|
p7 = prefix("ModelObject");
|
|
4944
5026
|
ModelObject = class _ModelObject extends SceneObject {
|
|
4945
5027
|
constructor(originalModel, options) {
|
|
@@ -4958,6 +5040,7 @@ var init_ModelObject = __esm({
|
|
|
4958
5040
|
this.DEFAULT_OPTIONS = (0, import_ts_deepmerge5.default)({}, SceneObject.DEFAULT_OPTIONS, {});
|
|
4959
5041
|
}
|
|
4960
5042
|
async init() {
|
|
5043
|
+
this.options.tints = await ItemTints.get(this.originalModel, this.options.tints);
|
|
4961
5044
|
const special = this.originalModel.special;
|
|
4962
5045
|
if (special) {
|
|
4963
5046
|
const parts = await SpecialItems.getParts(special, this.originalModel.key?.root);
|
|
@@ -5410,6 +5493,7 @@ __export(index_node_exports, {
|
|
|
5410
5493
|
CanvasImage: () => CanvasImage,
|
|
5411
5494
|
Chunk: () => Chunk,
|
|
5412
5495
|
ChunkData: () => ChunkData,
|
|
5496
|
+
Colormaps: () => Colormaps,
|
|
5413
5497
|
CubeFace: () => CubeFace,
|
|
5414
5498
|
CubeFaceIndex: () => CubeFaceIndex,
|
|
5415
5499
|
DEFAULT_ELEMENTS: () => DEFAULT_ELEMENTS,
|
|
@@ -5435,6 +5519,7 @@ __export(index_node_exports, {
|
|
|
5435
5519
|
ImageLoader: () => ImageLoader,
|
|
5436
5520
|
InstanceManager: () => InstanceManager,
|
|
5437
5521
|
InstanceReference: () => InstanceReference,
|
|
5522
|
+
ItemTints: () => ItemTints,
|
|
5438
5523
|
MapControls: () => MapControls,
|
|
5439
5524
|
Materials: () => Materials,
|
|
5440
5525
|
Meshes: () => Meshes,
|
|
@@ -8935,6 +9020,7 @@ function isInstanceable(obj) {
|
|
|
8935
9020
|
init_DisplayPosition();
|
|
8936
9021
|
init_DisplayTransforms();
|
|
8937
9022
|
init_GuiLight();
|
|
9023
|
+
init_ItemTints();
|
|
8938
9024
|
init_Model();
|
|
8939
9025
|
init_ModelCulling();
|
|
8940
9026
|
init_ModelGenerator();
|
|
@@ -9032,10 +9118,7 @@ var BlockStateResolver = class {
|
|
|
9032
9118
|
};
|
|
9033
9119
|
|
|
9034
9120
|
// src/model/block/BlockTints.ts
|
|
9035
|
-
|
|
9036
|
-
init_ModelTextures();
|
|
9037
|
-
init_Caching();
|
|
9038
|
-
init_MineRenderError();
|
|
9121
|
+
init_Colormaps();
|
|
9039
9122
|
|
|
9040
9123
|
// src/model/block/blockTints.json
|
|
9041
9124
|
var blockTints_default = {
|
|
@@ -9090,7 +9173,7 @@ var BlockTints = class {
|
|
|
9090
9173
|
color = rule.color;
|
|
9091
9174
|
break;
|
|
9092
9175
|
case "grass":
|
|
9093
|
-
color = await
|
|
9176
|
+
color = await Colormaps.grassColor(key);
|
|
9094
9177
|
break;
|
|
9095
9178
|
case "redstone": {
|
|
9096
9179
|
const power = Number(state.power ?? 0) / 15;
|
|
@@ -9108,18 +9191,6 @@ var BlockTints = class {
|
|
|
9108
9191
|
}
|
|
9109
9192
|
return { ...Object.fromEntries([...indices].map((index) => [index, color])), ...tints };
|
|
9110
9193
|
}
|
|
9111
|
-
static async grassColor(origin) {
|
|
9112
|
-
const key = AssetKey.parse("textures", "minecraft:colormap/grass", origin);
|
|
9113
|
-
return await Caching.blockTintCache.get(key.serialize(), async () => {
|
|
9114
|
-
const image = await ModelTextures.get(key);
|
|
9115
|
-
if (!image) throw new MineRenderError(`Missing grass colormap: ${key.toNamespacedString()}`);
|
|
9116
|
-
if (image.width !== 256 || image.height !== 256) {
|
|
9117
|
-
throw new MineRenderError("Grass colormaps must be 256 \xD7 256 pixels");
|
|
9118
|
-
}
|
|
9119
|
-
const [red, green, blue] = image.data.getImageData(127, 127, 1, 1).data;
|
|
9120
|
-
return red << 16 | green << 8 | blue;
|
|
9121
|
-
});
|
|
9122
|
-
}
|
|
9123
9194
|
};
|
|
9124
9195
|
|
|
9125
9196
|
// src/model/block/scene/BlockObject.ts
|
|
@@ -12375,6 +12446,7 @@ var SkinObject = class extends SceneObject {
|
|
|
12375
12446
|
|
|
12376
12447
|
// src/renderer/MineRenderScene.ts
|
|
12377
12448
|
init_EntityObject();
|
|
12449
|
+
init_ItemTints();
|
|
12378
12450
|
var MineRenderScene = class _MineRenderScene extends import_three32.Scene {
|
|
12379
12451
|
constructor(options) {
|
|
12380
12452
|
super();
|
|
@@ -12470,6 +12542,7 @@ var MineRenderScene = class _MineRenderScene extends import_three32.Scene {
|
|
|
12470
12542
|
}
|
|
12471
12543
|
}
|
|
12472
12544
|
async addModel(model, options, parent = this) {
|
|
12545
|
+
options = { ...options, tints: await ItemTints.get(model, options?.tints) };
|
|
12473
12546
|
return this.addSceneObject(model, () => new ModelObject(model, options), options, parent);
|
|
12474
12547
|
}
|
|
12475
12548
|
async addBlock(blockState, options, parent = this) {
|
|
@@ -13732,6 +13805,7 @@ var Skins = class {
|
|
|
13732
13805
|
};
|
|
13733
13806
|
|
|
13734
13807
|
// src/texture/index.ts
|
|
13808
|
+
init_Colormaps();
|
|
13735
13809
|
init_TextureAtlas();
|
|
13736
13810
|
init_TextureLoader();
|
|
13737
13811
|
init_Textures();
|
|
@@ -14617,6 +14691,7 @@ var Chunk = class _Chunk {
|
|
|
14617
14691
|
CanvasImage,
|
|
14618
14692
|
Chunk,
|
|
14619
14693
|
ChunkData,
|
|
14694
|
+
Colormaps,
|
|
14620
14695
|
CubeFace,
|
|
14621
14696
|
CubeFaceIndex,
|
|
14622
14697
|
DEFAULT_ELEMENTS,
|
|
@@ -14642,6 +14717,7 @@ var Chunk = class _Chunk {
|
|
|
14642
14717
|
ImageLoader,
|
|
14643
14718
|
InstanceManager,
|
|
14644
14719
|
InstanceReference,
|
|
14720
|
+
ItemTints,
|
|
14645
14721
|
MapControls,
|
|
14646
14722
|
Materials,
|
|
14647
14723
|
Meshes,
|