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/browser/index.d.mts
CHANGED
|
@@ -1112,7 +1112,13 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
|
|
|
1112
1112
|
declare function isSceneObject(obj: any): obj is SceneObject;
|
|
1113
1113
|
|
|
1114
1114
|
type FluidKind = "water" | "lava";
|
|
1115
|
-
|
|
1115
|
+
interface BlockFluidState {
|
|
1116
|
+
kind: FluidKind;
|
|
1117
|
+
level: number;
|
|
1118
|
+
renderModel: boolean;
|
|
1119
|
+
}
|
|
1120
|
+
declare function getBlockFluidState(key?: AssetKey, state?: BlockStateProperties): BlockFluidState | undefined;
|
|
1121
|
+
declare function getFluidKind(key?: AssetKey, state?: BlockStateProperties): FluidKind | undefined;
|
|
1116
1122
|
interface FluidSample {
|
|
1117
1123
|
fluid?: FluidKind;
|
|
1118
1124
|
level?: number;
|
|
@@ -1138,6 +1144,7 @@ declare class BlockObject extends SceneObject {
|
|
|
1138
1144
|
private _cullMask;
|
|
1139
1145
|
private _fluidKey?;
|
|
1140
1146
|
private _fluidSampler?;
|
|
1147
|
+
private _fluidModel?;
|
|
1141
1148
|
constructor(blockState: BlockState, options?: Partial<BlockObjectOptions>);
|
|
1142
1149
|
init(): Promise<void>;
|
|
1143
1150
|
dispose(): void;
|
|
@@ -1152,6 +1159,7 @@ declare class BlockObject extends SceneObject {
|
|
|
1152
1159
|
[key: string]: string;
|
|
1153
1160
|
};
|
|
1154
1161
|
get fluidKind(): FluidKind | undefined;
|
|
1162
|
+
get fluidLevel(): number;
|
|
1155
1163
|
/** Refreshes fluid surfaces from relative neighbors; standalone previews use air around the block. */
|
|
1156
1164
|
updateFluid(sample?: FluidSampler): Promise<void>;
|
|
1157
1165
|
nextInstance(): InstanceReference<SceneObject>;
|
|
@@ -1186,7 +1194,7 @@ declare class FluidModelObject extends ModelObject {
|
|
|
1186
1194
|
readonly kind: FluidKind;
|
|
1187
1195
|
private readonly sample;
|
|
1188
1196
|
private geometry?;
|
|
1189
|
-
constructor(kind: FluidKind, sample: FluidSampler, origin
|
|
1197
|
+
constructor(kind: FluidKind, sample: FluidSampler, origin?: AssetKey, options?: Partial<ModelObjectOptions>);
|
|
1190
1198
|
protected createMeshes(): void;
|
|
1191
1199
|
protected applyTextures(): void;
|
|
1192
1200
|
disposeAndRemoveAllChildren(): void;
|
|
@@ -1977,4 +1985,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
|
|
|
1977
1985
|
*/
|
|
1978
1986
|
declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
|
|
1979
1987
|
|
|
1980
|
-
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, BrowserCache, BrowserEnv, 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, 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, probeImageSize, registerBrowserEnv, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
|
|
1988
|
+
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, BrowserCache, BrowserEnv, 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, 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, probeImageSize, registerBrowserEnv, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -1112,7 +1112,13 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
|
|
|
1112
1112
|
declare function isSceneObject(obj: any): obj is SceneObject;
|
|
1113
1113
|
|
|
1114
1114
|
type FluidKind = "water" | "lava";
|
|
1115
|
-
|
|
1115
|
+
interface BlockFluidState {
|
|
1116
|
+
kind: FluidKind;
|
|
1117
|
+
level: number;
|
|
1118
|
+
renderModel: boolean;
|
|
1119
|
+
}
|
|
1120
|
+
declare function getBlockFluidState(key?: AssetKey, state?: BlockStateProperties): BlockFluidState | undefined;
|
|
1121
|
+
declare function getFluidKind(key?: AssetKey, state?: BlockStateProperties): FluidKind | undefined;
|
|
1116
1122
|
interface FluidSample {
|
|
1117
1123
|
fluid?: FluidKind;
|
|
1118
1124
|
level?: number;
|
|
@@ -1138,6 +1144,7 @@ declare class BlockObject extends SceneObject {
|
|
|
1138
1144
|
private _cullMask;
|
|
1139
1145
|
private _fluidKey?;
|
|
1140
1146
|
private _fluidSampler?;
|
|
1147
|
+
private _fluidModel?;
|
|
1141
1148
|
constructor(blockState: BlockState, options?: Partial<BlockObjectOptions>);
|
|
1142
1149
|
init(): Promise<void>;
|
|
1143
1150
|
dispose(): void;
|
|
@@ -1152,6 +1159,7 @@ declare class BlockObject extends SceneObject {
|
|
|
1152
1159
|
[key: string]: string;
|
|
1153
1160
|
};
|
|
1154
1161
|
get fluidKind(): FluidKind | undefined;
|
|
1162
|
+
get fluidLevel(): number;
|
|
1155
1163
|
/** Refreshes fluid surfaces from relative neighbors; standalone previews use air around the block. */
|
|
1156
1164
|
updateFluid(sample?: FluidSampler): Promise<void>;
|
|
1157
1165
|
nextInstance(): InstanceReference<SceneObject>;
|
|
@@ -1186,7 +1194,7 @@ declare class FluidModelObject extends ModelObject {
|
|
|
1186
1194
|
readonly kind: FluidKind;
|
|
1187
1195
|
private readonly sample;
|
|
1188
1196
|
private geometry?;
|
|
1189
|
-
constructor(kind: FluidKind, sample: FluidSampler, origin
|
|
1197
|
+
constructor(kind: FluidKind, sample: FluidSampler, origin?: AssetKey, options?: Partial<ModelObjectOptions>);
|
|
1190
1198
|
protected createMeshes(): void;
|
|
1191
1199
|
protected applyTextures(): void;
|
|
1192
1200
|
disposeAndRemoveAllChildren(): void;
|
|
@@ -1977,4 +1985,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
|
|
|
1977
1985
|
*/
|
|
1978
1986
|
declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
|
|
1979
1987
|
|
|
1980
|
-
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, BrowserCache, BrowserEnv, 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, 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, probeImageSize, registerBrowserEnv, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
|
|
1988
|
+
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, BrowserCache, BrowserEnv, 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, 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, probeImageSize, registerBrowserEnv, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
|
package/dist/browser/index.js
CHANGED
|
@@ -4129,10 +4129,34 @@ var init_ModelObject = __esm({
|
|
|
4129
4129
|
}
|
|
4130
4130
|
});
|
|
4131
4131
|
|
|
4132
|
+
// src/model/fluid/fluidBlocks.json
|
|
4133
|
+
var fluidBlocks_default;
|
|
4134
|
+
var init_fluidBlocks = __esm({
|
|
4135
|
+
"src/model/fluid/fluidBlocks.json"() {
|
|
4136
|
+
fluidBlocks_default = {
|
|
4137
|
+
"minecraft:water": { kind: "water", levelProperty: "level", renderModel: false },
|
|
4138
|
+
"minecraft:lava": { kind: "lava", levelProperty: "level", renderModel: false },
|
|
4139
|
+
"minecraft:kelp": { kind: "water", renderModel: true },
|
|
4140
|
+
"minecraft:kelp_plant": { kind: "water", renderModel: true },
|
|
4141
|
+
"minecraft:seagrass": { kind: "water", renderModel: true },
|
|
4142
|
+
"minecraft:tall_seagrass": { kind: "water", renderModel: true },
|
|
4143
|
+
"minecraft:bubble_column": { kind: "water", renderModel: false }
|
|
4144
|
+
};
|
|
4145
|
+
}
|
|
4146
|
+
});
|
|
4147
|
+
|
|
4132
4148
|
// src/model/fluid/FluidGeometry.ts
|
|
4133
|
-
function
|
|
4134
|
-
|
|
4135
|
-
|
|
4149
|
+
function getBlockFluidState(key, state) {
|
|
4150
|
+
const rule = key && fluidRules[key.toNamespacedString()];
|
|
4151
|
+
if (rule) return {
|
|
4152
|
+
kind: rule.kind,
|
|
4153
|
+
level: rule.levelProperty ? Number(state?.[rule.levelProperty] ?? 0) : 0,
|
|
4154
|
+
renderModel: rule.renderModel
|
|
4155
|
+
};
|
|
4156
|
+
return state?.waterlogged === "true" ? { kind: "water", level: 0, renderModel: true } : void 0;
|
|
4157
|
+
}
|
|
4158
|
+
function getFluidKind(key, state) {
|
|
4159
|
+
return getBlockFluidState(key, state)?.kind;
|
|
4136
4160
|
}
|
|
4137
4161
|
function ownHeight(sample) {
|
|
4138
4162
|
const level = sample.level ?? 0;
|
|
@@ -4244,10 +4268,12 @@ function createFluidGeometry(kind, sample) {
|
|
|
4244
4268
|
geometry.setIndex(indices);
|
|
4245
4269
|
return geometry;
|
|
4246
4270
|
}
|
|
4247
|
-
var import_three20, HORIZONTAL, EPSILON;
|
|
4271
|
+
var import_three20, fluidRules, HORIZONTAL, EPSILON;
|
|
4248
4272
|
var init_FluidGeometry = __esm({
|
|
4249
4273
|
"src/model/fluid/FluidGeometry.ts"() {
|
|
4250
4274
|
import_three20 = require("three");
|
|
4275
|
+
init_fluidBlocks();
|
|
4276
|
+
fluidRules = fluidBlocks_default;
|
|
4251
4277
|
HORIZONTAL = [[0, -1], [0, 1], [-1, 0], [1, 0]];
|
|
4252
4278
|
EPSILON = 1e-3;
|
|
4253
4279
|
}
|
|
@@ -4285,7 +4311,7 @@ var init_FluidModelObject = __esm({
|
|
|
4285
4311
|
FluidModelObject = class extends ModelObject {
|
|
4286
4312
|
constructor(kind, sample, origin, options) {
|
|
4287
4313
|
super({
|
|
4288
|
-
key: new AssetKey("minecraft", kind, "models", "fluid", "assets", ".json", origin
|
|
4314
|
+
key: new AssetKey("minecraft", kind, "models", "fluid", "assets", ".json", origin?.root),
|
|
4289
4315
|
textures: { still: `minecraft:block/${kind}_still`, flow: `minecraft:block/${kind}_flow` },
|
|
4290
4316
|
elements: []
|
|
4291
4317
|
}, options);
|
|
@@ -4454,6 +4480,7 @@ __export(index_browser_exports, {
|
|
|
4454
4480
|
createFluidGeometry: () => createFluidGeometry,
|
|
4455
4481
|
createImage: () => createImage,
|
|
4456
4482
|
estimateBytesUsed: () => estimateBytesUsed,
|
|
4483
|
+
getBlockFluidState: () => getBlockFluidState,
|
|
4457
4484
|
getFluidKind: () => getFluidKind,
|
|
4458
4485
|
interleaveAttributes: () => interleaveAttributes,
|
|
4459
4486
|
isAssetKey: () => isAssetKey,
|
|
@@ -5667,6 +5694,7 @@ var _BlockObject = class _BlockObject extends SceneObject {
|
|
|
5667
5694
|
clearModels() {
|
|
5668
5695
|
this.removeModels(this._models.splice(0));
|
|
5669
5696
|
this._fluidKey = void 0;
|
|
5697
|
+
this._fluidModel = void 0;
|
|
5670
5698
|
this._isInstanced = false;
|
|
5671
5699
|
this._instanceCounter = 0;
|
|
5672
5700
|
}
|
|
@@ -5698,11 +5726,14 @@ var _BlockObject = class _BlockObject extends SceneObject {
|
|
|
5698
5726
|
return ModelCulling.toLocalMask(worldMask, new import_three22.Euler().setFromQuaternion(rotation));
|
|
5699
5727
|
}
|
|
5700
5728
|
async setCullMask(worldMask) {
|
|
5701
|
-
if (this.fluidKind) return;
|
|
5702
5729
|
worldMask &= 63;
|
|
5703
5730
|
const replacements = [];
|
|
5704
5731
|
try {
|
|
5705
5732
|
for (const model of this._models) {
|
|
5733
|
+
if (model === this._fluidModel) {
|
|
5734
|
+
replacements.push(model);
|
|
5735
|
+
continue;
|
|
5736
|
+
}
|
|
5706
5737
|
const object = isInstanceReference(model) ? model.instanceable : model;
|
|
5707
5738
|
const cullMask = this.getModelCullMask(model, worldMask);
|
|
5708
5739
|
if (cullMask === (object.options.cullMask ?? 0)) {
|
|
@@ -5735,7 +5766,10 @@ var _BlockObject = class _BlockObject extends SceneObject {
|
|
|
5735
5766
|
return this._state;
|
|
5736
5767
|
}
|
|
5737
5768
|
get fluidKind() {
|
|
5738
|
-
return getFluidKind(this.blockState.key);
|
|
5769
|
+
return getFluidKind(this.blockState.key, this.state);
|
|
5770
|
+
}
|
|
5771
|
+
get fluidLevel() {
|
|
5772
|
+
return getBlockFluidState(this.blockState.key, this.state)?.level ?? 0;
|
|
5739
5773
|
}
|
|
5740
5774
|
/** Refreshes fluid surfaces from relative neighbors; standalone previews use air around the block. */
|
|
5741
5775
|
async updateFluid(sample) {
|
|
@@ -5743,22 +5777,24 @@ var _BlockObject = class _BlockObject extends SceneObject {
|
|
|
5743
5777
|
if (!kind) return;
|
|
5744
5778
|
const { FluidModelObject: FluidModelObject2, sampleFluid: sampleFluid2 } = await Promise.resolve().then(() => (init_FluidModelObject(), FluidModelObject_exports));
|
|
5745
5779
|
this._fluidSampler = sample;
|
|
5746
|
-
const surface = sampleFluid2(kind, (x, y, z) => x === 0 && y === 0 && z === 0 ? { fluid: kind, level:
|
|
5780
|
+
const surface = sampleFluid2(kind, (x, y, z) => x === 0 && y === 0 && z === 0 ? { fluid: kind, level: this.fluidLevel } : sample?.(x, y, z) ?? {});
|
|
5747
5781
|
if (this._fluidKey === surface.key) return;
|
|
5748
|
-
const key = new AssetKey("minecraft", `${kind}/${surface.key}`, "models", "fluid", "assets", ".json", this.blockState.key
|
|
5782
|
+
const key = new AssetKey("minecraft", `${kind}/${surface.key}`, "models", "fluid", "assets", ".json", this.blockState.key?.root);
|
|
5749
5783
|
const replacement = await this.scene.addSceneObject(
|
|
5750
5784
|
{ key },
|
|
5751
5785
|
() => new FluidModelObject2(kind, surface.sample, this.blockState.key, this.options)
|
|
5752
5786
|
);
|
|
5753
|
-
const previous = this.
|
|
5754
|
-
const matrix = previous
|
|
5787
|
+
const previous = this._fluidModel;
|
|
5788
|
+
const matrix = previous ? this.getModelMatrix(previous) : new import_three22.Matrix4().makeTranslation(...this.position.toArray());
|
|
5755
5789
|
if (isInstanceReference(replacement)) replacement.setMatrix(matrix);
|
|
5756
5790
|
else matrix.decompose(replacement.position, replacement.quaternion, replacement.scale);
|
|
5757
|
-
this._models =
|
|
5791
|
+
this._models = this._models.filter((model) => model !== previous);
|
|
5792
|
+
this._models.push(replacement);
|
|
5793
|
+
this._fluidModel = replacement;
|
|
5758
5794
|
this._fluidKey = surface.key;
|
|
5759
|
-
this._isInstanced = isInstanceReference(replacement);
|
|
5795
|
+
this._isInstanced || (this._isInstanced = isInstanceReference(replacement));
|
|
5760
5796
|
this._instanceCounter = this._isInstanced ? 1 : 0;
|
|
5761
|
-
this.removeModels(previous);
|
|
5797
|
+
if (previous) this.removeModels([previous]);
|
|
5762
5798
|
this.notifyDirty();
|
|
5763
5799
|
}
|
|
5764
5800
|
nextInstance() {
|
|
@@ -5775,7 +5811,7 @@ var _BlockObject = class _BlockObject extends SceneObject {
|
|
|
5775
5811
|
}
|
|
5776
5812
|
async recreateModels() {
|
|
5777
5813
|
this.clearModels();
|
|
5778
|
-
if (this.
|
|
5814
|
+
if (getBlockFluidState(this.blockState.key, this.state)?.renderModel === false) {
|
|
5779
5815
|
await this.updateFluid(this._fluidSampler);
|
|
5780
5816
|
return;
|
|
5781
5817
|
}
|
|
@@ -5784,6 +5820,7 @@ var _BlockObject = class _BlockObject extends SceneObject {
|
|
|
5784
5820
|
for (let blockStateVariant of variantsToCreate) {
|
|
5785
5821
|
this._models.push(await this.createVariant(blockStateVariant));
|
|
5786
5822
|
}
|
|
5823
|
+
await this.updateFluid(this._fluidSampler);
|
|
5787
5824
|
}
|
|
5788
5825
|
getSingleVariant(variants) {
|
|
5789
5826
|
return BlockStateResolver.choose(variants);
|
|
@@ -10603,11 +10640,10 @@ var MineRenderWorld = class {
|
|
|
10603
10640
|
const object = section?.getBlockAt(neighbor)?.object;
|
|
10604
10641
|
return {
|
|
10605
10642
|
fluid: object?.fluidKind,
|
|
10606
|
-
level:
|
|
10643
|
+
level: object?.fluidLevel,
|
|
10607
10644
|
solid: section?.isOccludingAt(neighbor) ?? false
|
|
10608
10645
|
};
|
|
10609
10646
|
});
|
|
10610
|
-
continue;
|
|
10611
10647
|
}
|
|
10612
10648
|
let mask = 0;
|
|
10613
10649
|
for (const [face, offset] of CUBE_FACE_OFFSETS.entries()) {
|
|
@@ -10836,7 +10872,7 @@ var Chunk = class _Chunk {
|
|
|
10836
10872
|
this.data.set(index, void 0);
|
|
10837
10873
|
return void 0;
|
|
10838
10874
|
}
|
|
10839
|
-
const template = getFluidKind(blockState.key) ? void 0 : await this.sectionModels?.get(blockState, stored.properties);
|
|
10875
|
+
const template = getFluidKind(blockState.key, stored.properties) ? void 0 : await this.sectionModels?.get(blockState, stored.properties);
|
|
10840
10876
|
if (template) {
|
|
10841
10877
|
this.sectionBlocks.set(index, { index, template, cullMask: 0 });
|
|
10842
10878
|
this.meshDirty = true;
|