minerender 2.1.0-alpha.44 → 2.1.0-alpha.46
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 +11 -3
- package/dist/browser/index.d.ts +11 -3
- package/dist/browser/index.js +54 -18
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +54 -18
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +54 -18
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +11 -3
- package/dist/node/index.d.ts +11 -3
- package/dist/node/index.js +55 -18
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +54 -18
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.d.mts
CHANGED
|
@@ -1113,7 +1113,13 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
|
|
|
1113
1113
|
declare function isSceneObject(obj: any): obj is SceneObject;
|
|
1114
1114
|
|
|
1115
1115
|
type FluidKind = "water" | "lava";
|
|
1116
|
-
|
|
1116
|
+
interface BlockFluidState {
|
|
1117
|
+
kind: FluidKind;
|
|
1118
|
+
level: number;
|
|
1119
|
+
renderModel: boolean;
|
|
1120
|
+
}
|
|
1121
|
+
declare function getBlockFluidState(key?: AssetKey, state?: BlockStateProperties): BlockFluidState | undefined;
|
|
1122
|
+
declare function getFluidKind(key?: AssetKey, state?: BlockStateProperties): FluidKind | undefined;
|
|
1117
1123
|
interface FluidSample {
|
|
1118
1124
|
fluid?: FluidKind;
|
|
1119
1125
|
level?: number;
|
|
@@ -1139,6 +1145,7 @@ declare class BlockObject extends SceneObject {
|
|
|
1139
1145
|
private _cullMask;
|
|
1140
1146
|
private _fluidKey?;
|
|
1141
1147
|
private _fluidSampler?;
|
|
1148
|
+
private _fluidModel?;
|
|
1142
1149
|
constructor(blockState: BlockState, options?: Partial<BlockObjectOptions>);
|
|
1143
1150
|
init(): Promise<void>;
|
|
1144
1151
|
dispose(): void;
|
|
@@ -1153,6 +1160,7 @@ declare class BlockObject extends SceneObject {
|
|
|
1153
1160
|
[key: string]: string;
|
|
1154
1161
|
};
|
|
1155
1162
|
get fluidKind(): FluidKind | undefined;
|
|
1163
|
+
get fluidLevel(): number;
|
|
1156
1164
|
/** Refreshes fluid surfaces from relative neighbors; standalone previews use air around the block. */
|
|
1157
1165
|
updateFluid(sample?: FluidSampler): Promise<void>;
|
|
1158
1166
|
nextInstance(): InstanceReference<SceneObject>;
|
|
@@ -1187,7 +1195,7 @@ declare class FluidModelObject extends ModelObject {
|
|
|
1187
1195
|
readonly kind: FluidKind;
|
|
1188
1196
|
private readonly sample;
|
|
1189
1197
|
private geometry?;
|
|
1190
|
-
constructor(kind: FluidKind, sample: FluidSampler, origin
|
|
1198
|
+
constructor(kind: FluidKind, sample: FluidSampler, origin?: AssetKey, options?: Partial<ModelObjectOptions>);
|
|
1191
1199
|
protected createMeshes(): void;
|
|
1192
1200
|
protected applyTextures(): void;
|
|
1193
1201
|
disposeAndRemoveAllChildren(): void;
|
|
@@ -1980,4 +1988,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
|
|
|
1980
1988
|
forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
|
|
1981
1989
|
}
|
|
1982
1990
|
|
|
1983
|
-
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, 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, type ElementFace, type ElementRotation, Entities, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, EntityObject, type EntityObjectOptions, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, 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 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 RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResponseParser, SKIN_PARTS, 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 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, estimateBytesUsed, getFluidKind, 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, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
|
|
1991
|
+
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, 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, type ElementFace, type ElementRotation, Entities, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, EntityObject, type EntityObjectOptions, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, 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 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 RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResponseParser, SKIN_PARTS, 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 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, estimateBytesUsed, getBlockFluidState, getFluidKind, 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, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1113,7 +1113,13 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
|
|
|
1113
1113
|
declare function isSceneObject(obj: any): obj is SceneObject;
|
|
1114
1114
|
|
|
1115
1115
|
type FluidKind = "water" | "lava";
|
|
1116
|
-
|
|
1116
|
+
interface BlockFluidState {
|
|
1117
|
+
kind: FluidKind;
|
|
1118
|
+
level: number;
|
|
1119
|
+
renderModel: boolean;
|
|
1120
|
+
}
|
|
1121
|
+
declare function getBlockFluidState(key?: AssetKey, state?: BlockStateProperties): BlockFluidState | undefined;
|
|
1122
|
+
declare function getFluidKind(key?: AssetKey, state?: BlockStateProperties): FluidKind | undefined;
|
|
1117
1123
|
interface FluidSample {
|
|
1118
1124
|
fluid?: FluidKind;
|
|
1119
1125
|
level?: number;
|
|
@@ -1139,6 +1145,7 @@ declare class BlockObject extends SceneObject {
|
|
|
1139
1145
|
private _cullMask;
|
|
1140
1146
|
private _fluidKey?;
|
|
1141
1147
|
private _fluidSampler?;
|
|
1148
|
+
private _fluidModel?;
|
|
1142
1149
|
constructor(blockState: BlockState, options?: Partial<BlockObjectOptions>);
|
|
1143
1150
|
init(): Promise<void>;
|
|
1144
1151
|
dispose(): void;
|
|
@@ -1153,6 +1160,7 @@ declare class BlockObject extends SceneObject {
|
|
|
1153
1160
|
[key: string]: string;
|
|
1154
1161
|
};
|
|
1155
1162
|
get fluidKind(): FluidKind | undefined;
|
|
1163
|
+
get fluidLevel(): number;
|
|
1156
1164
|
/** Refreshes fluid surfaces from relative neighbors; standalone previews use air around the block. */
|
|
1157
1165
|
updateFluid(sample?: FluidSampler): Promise<void>;
|
|
1158
1166
|
nextInstance(): InstanceReference<SceneObject>;
|
|
@@ -1187,7 +1195,7 @@ declare class FluidModelObject extends ModelObject {
|
|
|
1187
1195
|
readonly kind: FluidKind;
|
|
1188
1196
|
private readonly sample;
|
|
1189
1197
|
private geometry?;
|
|
1190
|
-
constructor(kind: FluidKind, sample: FluidSampler, origin
|
|
1198
|
+
constructor(kind: FluidKind, sample: FluidSampler, origin?: AssetKey, options?: Partial<ModelObjectOptions>);
|
|
1191
1199
|
protected createMeshes(): void;
|
|
1192
1200
|
protected applyTextures(): void;
|
|
1193
1201
|
disposeAndRemoveAllChildren(): void;
|
|
@@ -1980,4 +1988,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
|
|
|
1980
1988
|
forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
|
|
1981
1989
|
}
|
|
1982
1990
|
|
|
1983
|
-
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, 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, type ElementFace, type ElementRotation, Entities, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, EntityObject, type EntityObjectOptions, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, 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 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 RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResponseParser, SKIN_PARTS, 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 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, estimateBytesUsed, getFluidKind, 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, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
|
|
1991
|
+
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, 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, type ElementFace, type ElementRotation, Entities, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, EntityObject, type EntityObjectOptions, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, 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 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 RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResponseParser, SKIN_PARTS, 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 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, estimateBytesUsed, getBlockFluidState, getFluidKind, 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, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
|
package/dist/node/index.js
CHANGED
|
@@ -4213,10 +4213,34 @@ var init_ModelObject = __esm({
|
|
|
4213
4213
|
}
|
|
4214
4214
|
});
|
|
4215
4215
|
|
|
4216
|
+
// src/model/fluid/fluidBlocks.json
|
|
4217
|
+
var fluidBlocks_default;
|
|
4218
|
+
var init_fluidBlocks = __esm({
|
|
4219
|
+
"src/model/fluid/fluidBlocks.json"() {
|
|
4220
|
+
fluidBlocks_default = {
|
|
4221
|
+
"minecraft:water": { kind: "water", levelProperty: "level", renderModel: false },
|
|
4222
|
+
"minecraft:lava": { kind: "lava", levelProperty: "level", renderModel: false },
|
|
4223
|
+
"minecraft:kelp": { kind: "water", renderModel: true },
|
|
4224
|
+
"minecraft:kelp_plant": { kind: "water", renderModel: true },
|
|
4225
|
+
"minecraft:seagrass": { kind: "water", renderModel: true },
|
|
4226
|
+
"minecraft:tall_seagrass": { kind: "water", renderModel: true },
|
|
4227
|
+
"minecraft:bubble_column": { kind: "water", renderModel: false }
|
|
4228
|
+
};
|
|
4229
|
+
}
|
|
4230
|
+
});
|
|
4231
|
+
|
|
4216
4232
|
// src/model/fluid/FluidGeometry.ts
|
|
4217
|
-
function
|
|
4218
|
-
|
|
4219
|
-
|
|
4233
|
+
function getBlockFluidState(key, state) {
|
|
4234
|
+
const rule = key && fluidRules[key.toNamespacedString()];
|
|
4235
|
+
if (rule) return {
|
|
4236
|
+
kind: rule.kind,
|
|
4237
|
+
level: rule.levelProperty ? Number(state?.[rule.levelProperty] ?? 0) : 0,
|
|
4238
|
+
renderModel: rule.renderModel
|
|
4239
|
+
};
|
|
4240
|
+
return state?.waterlogged === "true" ? { kind: "water", level: 0, renderModel: true } : void 0;
|
|
4241
|
+
}
|
|
4242
|
+
function getFluidKind(key, state) {
|
|
4243
|
+
return getBlockFluidState(key, state)?.kind;
|
|
4220
4244
|
}
|
|
4221
4245
|
function ownHeight(sample) {
|
|
4222
4246
|
const level = sample.level ?? 0;
|
|
@@ -4328,10 +4352,12 @@ function createFluidGeometry(kind, sample) {
|
|
|
4328
4352
|
geometry.setIndex(indices);
|
|
4329
4353
|
return geometry;
|
|
4330
4354
|
}
|
|
4331
|
-
var import_three20, HORIZONTAL, EPSILON;
|
|
4355
|
+
var import_three20, fluidRules, HORIZONTAL, EPSILON;
|
|
4332
4356
|
var init_FluidGeometry = __esm({
|
|
4333
4357
|
"src/model/fluid/FluidGeometry.ts"() {
|
|
4334
4358
|
import_three20 = require("three");
|
|
4359
|
+
init_fluidBlocks();
|
|
4360
|
+
fluidRules = fluidBlocks_default;
|
|
4335
4361
|
HORIZONTAL = [[0, -1], [0, 1], [-1, 0], [1, 0]];
|
|
4336
4362
|
EPSILON = 1e-3;
|
|
4337
4363
|
}
|
|
@@ -4369,7 +4395,7 @@ var init_FluidModelObject = __esm({
|
|
|
4369
4395
|
FluidModelObject = class extends ModelObject {
|
|
4370
4396
|
constructor(kind, sample, origin, options) {
|
|
4371
4397
|
super({
|
|
4372
|
-
key: new AssetKey("minecraft", kind, "models", "fluid", "assets", ".json", origin
|
|
4398
|
+
key: new AssetKey("minecraft", kind, "models", "fluid", "assets", ".json", origin?.root),
|
|
4373
4399
|
textures: { still: `minecraft:block/${kind}_still`, flow: `minecraft:block/${kind}_flow` },
|
|
4374
4400
|
elements: []
|
|
4375
4401
|
}, options);
|
|
@@ -4538,6 +4564,7 @@ __export(index_node_exports, {
|
|
|
4538
4564
|
createFluidGeometry: () => createFluidGeometry,
|
|
4539
4565
|
createImage: () => createImage,
|
|
4540
4566
|
estimateBytesUsed: () => estimateBytesUsed,
|
|
4567
|
+
getBlockFluidState: () => getBlockFluidState,
|
|
4541
4568
|
getFluidKind: () => getFluidKind,
|
|
4542
4569
|
interleaveAttributes: () => interleaveAttributes,
|
|
4543
4570
|
isAssetKey: () => isAssetKey,
|
|
@@ -5718,6 +5745,7 @@ var BlockObject = class _BlockObject extends SceneObject {
|
|
|
5718
5745
|
clearModels() {
|
|
5719
5746
|
this.removeModels(this._models.splice(0));
|
|
5720
5747
|
this._fluidKey = void 0;
|
|
5748
|
+
this._fluidModel = void 0;
|
|
5721
5749
|
this._isInstanced = false;
|
|
5722
5750
|
this._instanceCounter = 0;
|
|
5723
5751
|
}
|
|
@@ -5749,11 +5777,14 @@ var BlockObject = class _BlockObject extends SceneObject {
|
|
|
5749
5777
|
return ModelCulling.toLocalMask(worldMask, new import_three22.Euler().setFromQuaternion(rotation));
|
|
5750
5778
|
}
|
|
5751
5779
|
async setCullMask(worldMask) {
|
|
5752
|
-
if (this.fluidKind) return;
|
|
5753
5780
|
worldMask &= 63;
|
|
5754
5781
|
const replacements = [];
|
|
5755
5782
|
try {
|
|
5756
5783
|
for (const model of this._models) {
|
|
5784
|
+
if (model === this._fluidModel) {
|
|
5785
|
+
replacements.push(model);
|
|
5786
|
+
continue;
|
|
5787
|
+
}
|
|
5757
5788
|
const object = isInstanceReference(model) ? model.instanceable : model;
|
|
5758
5789
|
const cullMask = this.getModelCullMask(model, worldMask);
|
|
5759
5790
|
if (cullMask === (object.options.cullMask ?? 0)) {
|
|
@@ -5786,7 +5817,10 @@ var BlockObject = class _BlockObject extends SceneObject {
|
|
|
5786
5817
|
return this._state;
|
|
5787
5818
|
}
|
|
5788
5819
|
get fluidKind() {
|
|
5789
|
-
return getFluidKind(this.blockState.key);
|
|
5820
|
+
return getFluidKind(this.blockState.key, this.state);
|
|
5821
|
+
}
|
|
5822
|
+
get fluidLevel() {
|
|
5823
|
+
return getBlockFluidState(this.blockState.key, this.state)?.level ?? 0;
|
|
5790
5824
|
}
|
|
5791
5825
|
/** Refreshes fluid surfaces from relative neighbors; standalone previews use air around the block. */
|
|
5792
5826
|
async updateFluid(sample) {
|
|
@@ -5794,22 +5828,24 @@ var BlockObject = class _BlockObject extends SceneObject {
|
|
|
5794
5828
|
if (!kind) return;
|
|
5795
5829
|
const { FluidModelObject: FluidModelObject2, sampleFluid: sampleFluid2 } = await Promise.resolve().then(() => (init_FluidModelObject(), FluidModelObject_exports));
|
|
5796
5830
|
this._fluidSampler = sample;
|
|
5797
|
-
const surface = sampleFluid2(kind, (x, y, z) => x === 0 && y === 0 && z === 0 ? { fluid: kind, level:
|
|
5831
|
+
const surface = sampleFluid2(kind, (x, y, z) => x === 0 && y === 0 && z === 0 ? { fluid: kind, level: this.fluidLevel } : sample?.(x, y, z) ?? {});
|
|
5798
5832
|
if (this._fluidKey === surface.key) return;
|
|
5799
|
-
const key = new AssetKey("minecraft", `${kind}/${surface.key}`, "models", "fluid", "assets", ".json", this.blockState.key
|
|
5833
|
+
const key = new AssetKey("minecraft", `${kind}/${surface.key}`, "models", "fluid", "assets", ".json", this.blockState.key?.root);
|
|
5800
5834
|
const replacement = await this.scene.addSceneObject(
|
|
5801
5835
|
{ key },
|
|
5802
5836
|
() => new FluidModelObject2(kind, surface.sample, this.blockState.key, this.options)
|
|
5803
5837
|
);
|
|
5804
|
-
const previous = this.
|
|
5805
|
-
const matrix = previous
|
|
5838
|
+
const previous = this._fluidModel;
|
|
5839
|
+
const matrix = previous ? this.getModelMatrix(previous) : new import_three22.Matrix4().makeTranslation(...this.position.toArray());
|
|
5806
5840
|
if (isInstanceReference(replacement)) replacement.setMatrix(matrix);
|
|
5807
5841
|
else matrix.decompose(replacement.position, replacement.quaternion, replacement.scale);
|
|
5808
|
-
this._models =
|
|
5842
|
+
this._models = this._models.filter((model) => model !== previous);
|
|
5843
|
+
this._models.push(replacement);
|
|
5844
|
+
this._fluidModel = replacement;
|
|
5809
5845
|
this._fluidKey = surface.key;
|
|
5810
|
-
this._isInstanced
|
|
5846
|
+
this._isInstanced ||= isInstanceReference(replacement);
|
|
5811
5847
|
this._instanceCounter = this._isInstanced ? 1 : 0;
|
|
5812
|
-
this.removeModels(previous);
|
|
5848
|
+
if (previous) this.removeModels([previous]);
|
|
5813
5849
|
this.notifyDirty();
|
|
5814
5850
|
}
|
|
5815
5851
|
nextInstance() {
|
|
@@ -5826,7 +5862,7 @@ var BlockObject = class _BlockObject extends SceneObject {
|
|
|
5826
5862
|
}
|
|
5827
5863
|
async recreateModels() {
|
|
5828
5864
|
this.clearModels();
|
|
5829
|
-
if (this.
|
|
5865
|
+
if (getBlockFluidState(this.blockState.key, this.state)?.renderModel === false) {
|
|
5830
5866
|
await this.updateFluid(this._fluidSampler);
|
|
5831
5867
|
return;
|
|
5832
5868
|
}
|
|
@@ -5835,6 +5871,7 @@ var BlockObject = class _BlockObject extends SceneObject {
|
|
|
5835
5871
|
for (let blockStateVariant of variantsToCreate) {
|
|
5836
5872
|
this._models.push(await this.createVariant(blockStateVariant));
|
|
5837
5873
|
}
|
|
5874
|
+
await this.updateFluid(this._fluidSampler);
|
|
5838
5875
|
}
|
|
5839
5876
|
getSingleVariant(variants) {
|
|
5840
5877
|
return BlockStateResolver.choose(variants);
|
|
@@ -10652,11 +10689,10 @@ var MineRenderWorld = class {
|
|
|
10652
10689
|
const object = section?.getBlockAt(neighbor)?.object;
|
|
10653
10690
|
return {
|
|
10654
10691
|
fluid: object?.fluidKind,
|
|
10655
|
-
level:
|
|
10692
|
+
level: object?.fluidLevel,
|
|
10656
10693
|
solid: section?.isOccludingAt(neighbor) ?? false
|
|
10657
10694
|
};
|
|
10658
10695
|
});
|
|
10659
|
-
continue;
|
|
10660
10696
|
}
|
|
10661
10697
|
let mask = 0;
|
|
10662
10698
|
for (const [face, offset] of CUBE_FACE_OFFSETS.entries()) {
|
|
@@ -10885,7 +10921,7 @@ var Chunk = class _Chunk {
|
|
|
10885
10921
|
this.data.set(index, void 0);
|
|
10886
10922
|
return void 0;
|
|
10887
10923
|
}
|
|
10888
|
-
const template = getFluidKind(blockState.key) ? void 0 : await this.sectionModels?.get(blockState, stored.properties);
|
|
10924
|
+
const template = getFluidKind(blockState.key, stored.properties) ? void 0 : await this.sectionModels?.get(blockState, stored.properties);
|
|
10889
10925
|
if (template) {
|
|
10890
10926
|
this.sectionBlocks.set(index, { index, template, cullMask: 0 });
|
|
10891
10927
|
this.meshDirty = true;
|
|
@@ -11091,6 +11127,7 @@ var Chunk = class _Chunk {
|
|
|
11091
11127
|
createFluidGeometry,
|
|
11092
11128
|
createImage,
|
|
11093
11129
|
estimateBytesUsed,
|
|
11130
|
+
getBlockFluidState,
|
|
11094
11131
|
getFluidKind,
|
|
11095
11132
|
interleaveAttributes,
|
|
11096
11133
|
isAssetKey,
|