minerender 2.1.0-alpha.122 → 2.1.0-alpha.123
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 +23 -1
- package/dist/browser/index.d.ts +23 -1
- package/dist/browser/index.js +126 -75
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +113 -62
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +85 -26
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +23 -1
- package/dist/node/index.d.ts +23 -1
- package/dist/node/index.js +126 -75
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +113 -62
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.d.mts
CHANGED
|
@@ -3988,6 +3988,22 @@ declare class Chunk<SectionMeshing extends boolean = false> {
|
|
|
3988
3988
|
chunkPosToWorldPos(pos: Vector3): Vector3;
|
|
3989
3989
|
}
|
|
3990
3990
|
|
|
3991
|
+
/** The nearest rendered mob triangle hit by a world entity raycast. */
|
|
3992
|
+
interface WorldEntityIntersection {
|
|
3993
|
+
/** Minecraft entity ID, such as minecraft:pig. */
|
|
3994
|
+
type: string;
|
|
3995
|
+
/** Copied saved position in Minecraft block units, including fractional coordinates. */
|
|
3996
|
+
position: Vector3;
|
|
3997
|
+
/** Live rendered root, removed and disposed when its column unloads or the world clears. */
|
|
3998
|
+
object: EntityObject;
|
|
3999
|
+
/** Hit position in scene units. */
|
|
4000
|
+
point: Vector3;
|
|
4001
|
+
/** Unit face normal in scene space. */
|
|
4002
|
+
normal: Vector3;
|
|
4003
|
+
/** Distance from the ray origin, in scene units. */
|
|
4004
|
+
distance: number;
|
|
4005
|
+
}
|
|
4006
|
+
|
|
3991
4007
|
/**
|
|
3992
4008
|
* Stores and renders blocks in sparse 16×16×16 chunks.
|
|
3993
4009
|
* Positions use integer block coordinates, including negatives. One block is 16 scene units.
|
|
@@ -4014,6 +4030,12 @@ declare class MineRenderWorld<SectionMeshing extends boolean = false> {
|
|
|
4014
4030
|
* Includes fluids and block entities; texture alpha does not change triangle intersections.
|
|
4015
4031
|
*/
|
|
4016
4032
|
raycast(raycaster: Raycaster): WorldBlockIntersection | undefined;
|
|
4033
|
+
/**
|
|
4034
|
+
* Returns the nearest visible mob geometry hit when renderEntities is enabled.
|
|
4035
|
+
* Respects layers and near/far; compare its distance with raycast() to account for blocks.
|
|
4036
|
+
* Texture alpha does not change triangle intersections.
|
|
4037
|
+
*/
|
|
4038
|
+
raycastEntities(raycaster: Raycaster): WorldEntityIntersection | undefined;
|
|
4017
4039
|
/** Whether neighboring opaque cubes shade block-face corners. Defaults to false. */
|
|
4018
4040
|
get ambientOcclusion(): boolean;
|
|
4019
4041
|
/** Rebuilds loaded blocks with or without corner shading. Block data and saved lighting are preserved. */
|
|
@@ -4224,4 +4246,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
|
|
|
4224
4246
|
*/
|
|
4225
4247
|
declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
|
|
4226
4248
|
|
|
4227
|
-
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, type AnvilEntityChunk, type AnvilExternalChunkReader, type AnvilParseOptions, AnvilParser, type AnvilRegion, type AnvilRegionReader, AnvilWorldSource, type AnvilWorldSourceOptions, ArchiveAssetSource, type ArchiveAssetSourceOptions, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, type BannerPattern, type BannerPatternDraw, BannerPatterns, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Biome, type BiomeColorKind, Biomes, type BitmapFont, type BitmapGlyph, 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, BrowserCache, BrowserEnv, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsMode, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, DYE_COLORS, type DebugOptions, type DecoratedPotSide, DecoratedPots, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type DyeColor, 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 FluidQuads, type FluidRules, type FluidSample, type FluidSampler, type FlyAction, FlyControls, type FlyControlsEventMap, Fonts, type FrameCallback, type FromTo, GUI_CONTAINER_LAYOUTS, Geometries, type GuiBookButtonState, type GuiBookOptions, type GuiBossBarColor, type GuiBossBarOptions, type GuiContainerType, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiSpriteScaling, type GuiText, type GuiTextLayer, type GuiTextLayout, type GuiTextOptions, type GuiTextRun, type GuiTextStyle, type GuiTextureLayer, type GuiTooltipOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, ItemDefaults, ItemGlint, type ItemModel, type ItemModelContext, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, LitematicaParser, type LitematicaRegion, type LitematicaStructure, type LoadedSceneDocument, type LoadedSceneObject, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderData, type MineRenderDataManifest, type MineRenderDatasets, 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, type PackFormat, PackFormats, PackMetadata, PersistentCache, PlayerHeadTextures, type PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererControls, type RendererFrame, type RendererOptions, type RendererSurface, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResolvedMineRenderData, type ResponseParser, SCENE_DOCUMENT_MAX_BYTES, SKIN_PARTS, type SavedLightSample, type SceneBlockDefinition, type SceneDocument, SceneDocumentLoader, type SceneEntityDefinition, SceneExporter, type SceneGLTFExportOptions, type SceneGuiDefinition, type SceneGuiLayer, SceneInspector, type SceneItemContext, type SceneModelDefinition, SceneObject, type SceneObjectDefinition, type SceneObjectDefinitionBase, type SceneObjectOptions, type SceneSkinDefinition, type SceneSkinPosePart, SceneStats, SceneStatsDisplay, SchematicParser, type SchematicParserOptions, type SectionAtlasSize, type SectionFluidInput, type SectionFluidKind, type SectionFluids, type SectionGeometryInput, type SectionGeometryPage, type SectionLightData, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type SectionTemplateData, SectionWorker, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, SpongeSchematicParser, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, type VideoExportOptions, VideoExporter, type WorldBlockIntersection, type WorldChunkSource, WorldStreamer, type WorldStreamerOptions, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, buildFluidQuads, buildSectionGeometry, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, copySectionLight, createCanvas, createFluidGeometry, createGuiTextGeometry, createGuiTextureGeometry, createImage, decodeSceneDocument, encodeSceneDocument, entityAnimationTime, estimateBytesUsed, fluidKindOf, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isFlyControls, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isResourceLocation, isSceneObject, isTransformable, isTripleArray, isVector3, layoutGuiText, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, parseSceneDocument, prefix, probeImageSize, registerBrowserEnv, resolveBlockFluidState, resolveLegacyBlock, resolveLegacyBlockState, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, sampleSectionLight, sectionGeometryTransferables, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas, yieldToEventLoop };
|
|
4249
|
+
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, type AnvilEntityChunk, type AnvilExternalChunkReader, type AnvilParseOptions, AnvilParser, type AnvilRegion, type AnvilRegionReader, AnvilWorldSource, type AnvilWorldSourceOptions, ArchiveAssetSource, type ArchiveAssetSourceOptions, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, type BannerPattern, type BannerPatternDraw, BannerPatterns, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Biome, type BiomeColorKind, Biomes, type BitmapFont, type BitmapGlyph, 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, BrowserCache, BrowserEnv, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsMode, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, DYE_COLORS, type DebugOptions, type DecoratedPotSide, DecoratedPots, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type DyeColor, 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 FluidQuads, type FluidRules, type FluidSample, type FluidSampler, type FlyAction, FlyControls, type FlyControlsEventMap, Fonts, type FrameCallback, type FromTo, GUI_CONTAINER_LAYOUTS, Geometries, type GuiBookButtonState, type GuiBookOptions, type GuiBossBarColor, type GuiBossBarOptions, type GuiContainerType, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiSpriteScaling, type GuiText, type GuiTextLayer, type GuiTextLayout, type GuiTextOptions, type GuiTextRun, type GuiTextStyle, type GuiTextureLayer, type GuiTooltipOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, ItemDefaults, ItemGlint, type ItemModel, type ItemModelContext, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, LitematicaParser, type LitematicaRegion, type LitematicaStructure, type LoadedSceneDocument, type LoadedSceneObject, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderData, type MineRenderDataManifest, type MineRenderDatasets, 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, type PackFormat, PackFormats, PackMetadata, PersistentCache, PlayerHeadTextures, type PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererControls, type RendererFrame, type RendererOptions, type RendererSurface, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResolvedMineRenderData, type ResponseParser, SCENE_DOCUMENT_MAX_BYTES, SKIN_PARTS, type SavedLightSample, type SceneBlockDefinition, type SceneDocument, SceneDocumentLoader, type SceneEntityDefinition, SceneExporter, type SceneGLTFExportOptions, type SceneGuiDefinition, type SceneGuiLayer, SceneInspector, type SceneItemContext, type SceneModelDefinition, SceneObject, type SceneObjectDefinition, type SceneObjectDefinitionBase, type SceneObjectOptions, type SceneSkinDefinition, type SceneSkinPosePart, SceneStats, SceneStatsDisplay, SchematicParser, type SchematicParserOptions, type SectionAtlasSize, type SectionFluidInput, type SectionFluidKind, type SectionFluids, type SectionGeometryInput, type SectionGeometryPage, type SectionLightData, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type SectionTemplateData, SectionWorker, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, SpongeSchematicParser, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, type VideoExportOptions, VideoExporter, type WorldBlockIntersection, type WorldChunkSource, type WorldEntityIntersection, WorldStreamer, type WorldStreamerOptions, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, buildFluidQuads, buildSectionGeometry, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, copySectionLight, createCanvas, createFluidGeometry, createGuiTextGeometry, createGuiTextureGeometry, createImage, decodeSceneDocument, encodeSceneDocument, entityAnimationTime, estimateBytesUsed, fluidKindOf, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isFlyControls, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isResourceLocation, isSceneObject, isTransformable, isTripleArray, isVector3, layoutGuiText, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, parseSceneDocument, prefix, probeImageSize, registerBrowserEnv, resolveBlockFluidState, resolveLegacyBlock, resolveLegacyBlockState, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, sampleSectionLight, sectionGeometryTransferables, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas, yieldToEventLoop };
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -3988,6 +3988,22 @@ declare class Chunk<SectionMeshing extends boolean = false> {
|
|
|
3988
3988
|
chunkPosToWorldPos(pos: Vector3): Vector3;
|
|
3989
3989
|
}
|
|
3990
3990
|
|
|
3991
|
+
/** The nearest rendered mob triangle hit by a world entity raycast. */
|
|
3992
|
+
interface WorldEntityIntersection {
|
|
3993
|
+
/** Minecraft entity ID, such as minecraft:pig. */
|
|
3994
|
+
type: string;
|
|
3995
|
+
/** Copied saved position in Minecraft block units, including fractional coordinates. */
|
|
3996
|
+
position: Vector3;
|
|
3997
|
+
/** Live rendered root, removed and disposed when its column unloads or the world clears. */
|
|
3998
|
+
object: EntityObject;
|
|
3999
|
+
/** Hit position in scene units. */
|
|
4000
|
+
point: Vector3;
|
|
4001
|
+
/** Unit face normal in scene space. */
|
|
4002
|
+
normal: Vector3;
|
|
4003
|
+
/** Distance from the ray origin, in scene units. */
|
|
4004
|
+
distance: number;
|
|
4005
|
+
}
|
|
4006
|
+
|
|
3991
4007
|
/**
|
|
3992
4008
|
* Stores and renders blocks in sparse 16×16×16 chunks.
|
|
3993
4009
|
* Positions use integer block coordinates, including negatives. One block is 16 scene units.
|
|
@@ -4014,6 +4030,12 @@ declare class MineRenderWorld<SectionMeshing extends boolean = false> {
|
|
|
4014
4030
|
* Includes fluids and block entities; texture alpha does not change triangle intersections.
|
|
4015
4031
|
*/
|
|
4016
4032
|
raycast(raycaster: Raycaster): WorldBlockIntersection | undefined;
|
|
4033
|
+
/**
|
|
4034
|
+
* Returns the nearest visible mob geometry hit when renderEntities is enabled.
|
|
4035
|
+
* Respects layers and near/far; compare its distance with raycast() to account for blocks.
|
|
4036
|
+
* Texture alpha does not change triangle intersections.
|
|
4037
|
+
*/
|
|
4038
|
+
raycastEntities(raycaster: Raycaster): WorldEntityIntersection | undefined;
|
|
4017
4039
|
/** Whether neighboring opaque cubes shade block-face corners. Defaults to false. */
|
|
4018
4040
|
get ambientOcclusion(): boolean;
|
|
4019
4041
|
/** Rebuilds loaded blocks with or without corner shading. Block data and saved lighting are preserved. */
|
|
@@ -4224,4 +4246,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
|
|
|
4224
4246
|
*/
|
|
4225
4247
|
declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
|
|
4226
4248
|
|
|
4227
|
-
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, type AnvilEntityChunk, type AnvilExternalChunkReader, type AnvilParseOptions, AnvilParser, type AnvilRegion, type AnvilRegionReader, AnvilWorldSource, type AnvilWorldSourceOptions, ArchiveAssetSource, type ArchiveAssetSourceOptions, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, type BannerPattern, type BannerPatternDraw, BannerPatterns, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Biome, type BiomeColorKind, Biomes, type BitmapFont, type BitmapGlyph, 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, BrowserCache, BrowserEnv, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsMode, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, DYE_COLORS, type DebugOptions, type DecoratedPotSide, DecoratedPots, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type DyeColor, 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 FluidQuads, type FluidRules, type FluidSample, type FluidSampler, type FlyAction, FlyControls, type FlyControlsEventMap, Fonts, type FrameCallback, type FromTo, GUI_CONTAINER_LAYOUTS, Geometries, type GuiBookButtonState, type GuiBookOptions, type GuiBossBarColor, type GuiBossBarOptions, type GuiContainerType, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiSpriteScaling, type GuiText, type GuiTextLayer, type GuiTextLayout, type GuiTextOptions, type GuiTextRun, type GuiTextStyle, type GuiTextureLayer, type GuiTooltipOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, ItemDefaults, ItemGlint, type ItemModel, type ItemModelContext, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, LitematicaParser, type LitematicaRegion, type LitematicaStructure, type LoadedSceneDocument, type LoadedSceneObject, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderData, type MineRenderDataManifest, type MineRenderDatasets, 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, type PackFormat, PackFormats, PackMetadata, PersistentCache, PlayerHeadTextures, type PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererControls, type RendererFrame, type RendererOptions, type RendererSurface, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResolvedMineRenderData, type ResponseParser, SCENE_DOCUMENT_MAX_BYTES, SKIN_PARTS, type SavedLightSample, type SceneBlockDefinition, type SceneDocument, SceneDocumentLoader, type SceneEntityDefinition, SceneExporter, type SceneGLTFExportOptions, type SceneGuiDefinition, type SceneGuiLayer, SceneInspector, type SceneItemContext, type SceneModelDefinition, SceneObject, type SceneObjectDefinition, type SceneObjectDefinitionBase, type SceneObjectOptions, type SceneSkinDefinition, type SceneSkinPosePart, SceneStats, SceneStatsDisplay, SchematicParser, type SchematicParserOptions, type SectionAtlasSize, type SectionFluidInput, type SectionFluidKind, type SectionFluids, type SectionGeometryInput, type SectionGeometryPage, type SectionLightData, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type SectionTemplateData, SectionWorker, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, SpongeSchematicParser, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, type VideoExportOptions, VideoExporter, type WorldBlockIntersection, type WorldChunkSource, WorldStreamer, type WorldStreamerOptions, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, buildFluidQuads, buildSectionGeometry, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, copySectionLight, createCanvas, createFluidGeometry, createGuiTextGeometry, createGuiTextureGeometry, createImage, decodeSceneDocument, encodeSceneDocument, entityAnimationTime, estimateBytesUsed, fluidKindOf, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isFlyControls, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isResourceLocation, isSceneObject, isTransformable, isTripleArray, isVector3, layoutGuiText, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, parseSceneDocument, prefix, probeImageSize, registerBrowserEnv, resolveBlockFluidState, resolveLegacyBlock, resolveLegacyBlockState, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, sampleSectionLight, sectionGeometryTransferables, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas, yieldToEventLoop };
|
|
4249
|
+
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, type AnvilEntityChunk, type AnvilExternalChunkReader, type AnvilParseOptions, AnvilParser, type AnvilRegion, type AnvilRegionReader, AnvilWorldSource, type AnvilWorldSourceOptions, ArchiveAssetSource, type ArchiveAssetSourceOptions, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, type BannerPattern, type BannerPatternDraw, BannerPatterns, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Biome, type BiomeColorKind, Biomes, type BitmapFont, type BitmapGlyph, 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, BrowserCache, BrowserEnv, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsMode, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, DYE_COLORS, type DebugOptions, type DecoratedPotSide, DecoratedPots, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type DyeColor, 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 FluidQuads, type FluidRules, type FluidSample, type FluidSampler, type FlyAction, FlyControls, type FlyControlsEventMap, Fonts, type FrameCallback, type FromTo, GUI_CONTAINER_LAYOUTS, Geometries, type GuiBookButtonState, type GuiBookOptions, type GuiBossBarColor, type GuiBossBarOptions, type GuiContainerType, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiSpriteScaling, type GuiText, type GuiTextLayer, type GuiTextLayout, type GuiTextOptions, type GuiTextRun, type GuiTextStyle, type GuiTextureLayer, type GuiTooltipOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, ItemDefaults, ItemGlint, type ItemModel, type ItemModelContext, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, LitematicaParser, type LitematicaRegion, type LitematicaStructure, type LoadedSceneDocument, type LoadedSceneObject, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderData, type MineRenderDataManifest, type MineRenderDatasets, 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, type PackFormat, PackFormats, PackMetadata, PersistentCache, PlayerHeadTextures, type PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererControls, type RendererFrame, type RendererOptions, type RendererSurface, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResolvedMineRenderData, type ResponseParser, SCENE_DOCUMENT_MAX_BYTES, SKIN_PARTS, type SavedLightSample, type SceneBlockDefinition, type SceneDocument, SceneDocumentLoader, type SceneEntityDefinition, SceneExporter, type SceneGLTFExportOptions, type SceneGuiDefinition, type SceneGuiLayer, SceneInspector, type SceneItemContext, type SceneModelDefinition, SceneObject, type SceneObjectDefinition, type SceneObjectDefinitionBase, type SceneObjectOptions, type SceneSkinDefinition, type SceneSkinPosePart, SceneStats, SceneStatsDisplay, SchematicParser, type SchematicParserOptions, type SectionAtlasSize, type SectionFluidInput, type SectionFluidKind, type SectionFluids, type SectionGeometryInput, type SectionGeometryPage, type SectionLightData, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type SectionTemplateData, SectionWorker, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, SpongeSchematicParser, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, type VideoExportOptions, VideoExporter, type WorldBlockIntersection, type WorldChunkSource, type WorldEntityIntersection, WorldStreamer, type WorldStreamerOptions, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, buildFluidQuads, buildSectionGeometry, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, copySectionLight, createCanvas, createFluidGeometry, createGuiTextGeometry, createGuiTextureGeometry, createImage, decodeSceneDocument, encodeSceneDocument, entityAnimationTime, estimateBytesUsed, fluidKindOf, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isFlyControls, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isResourceLocation, isSceneObject, isTransformable, isTripleArray, isVector3, layoutGuiText, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, parseSceneDocument, prefix, probeImageSize, registerBrowserEnv, resolveBlockFluidState, resolveLegacyBlock, resolveLegacyBlockState, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, sampleSectionLight, sectionGeometryTransferables, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas, yieldToEventLoop };
|
package/dist/browser/index.js
CHANGED
|
@@ -17355,12 +17355,12 @@ var AnvilWorldSource = class {
|
|
|
17355
17355
|
};
|
|
17356
17356
|
|
|
17357
17357
|
// src/world/Chunk.ts
|
|
17358
|
-
var
|
|
17358
|
+
var import_three47 = require("three");
|
|
17359
17359
|
init_BlockStates();
|
|
17360
17360
|
init_AssetKey();
|
|
17361
17361
|
|
|
17362
17362
|
// src/world/MineRenderWorld.ts
|
|
17363
|
-
var
|
|
17363
|
+
var import_three45 = require("three");
|
|
17364
17364
|
init_Model();
|
|
17365
17365
|
init_util();
|
|
17366
17366
|
init_AssetKey();
|
|
@@ -17625,11 +17625,74 @@ function resolveSavedEntity(entity) {
|
|
|
17625
17625
|
|
|
17626
17626
|
// src/world/_entities/WorldEntities.ts
|
|
17627
17627
|
init_BannerPatterns();
|
|
17628
|
+
var import_three44 = require("three");
|
|
17629
|
+
|
|
17630
|
+
// src/world/_picking/Picking.ts
|
|
17631
|
+
var import_three42 = require("three");
|
|
17632
|
+
init_three();
|
|
17633
|
+
function pickableMeshes(root, scene, raycaster) {
|
|
17634
|
+
const result = [];
|
|
17635
|
+
let attached = false;
|
|
17636
|
+
for (let parent = root; parent; parent = parent.parent) {
|
|
17637
|
+
if (!parent.visible) return result;
|
|
17638
|
+
if (parent === scene) attached = true;
|
|
17639
|
+
}
|
|
17640
|
+
if (!attached) return result;
|
|
17641
|
+
root.updateWorldMatrix(true, true);
|
|
17642
|
+
root.traverseVisible((object4) => {
|
|
17643
|
+
if (isMesh(object4) && raycaster.layers.test(object4.layers)) result.push(object4);
|
|
17644
|
+
});
|
|
17645
|
+
return result;
|
|
17646
|
+
}
|
|
17647
|
+
function visibleHits(raycaster, meshes) {
|
|
17648
|
+
return raycaster.intersectObjects(meshes, false).filter((hit) => {
|
|
17649
|
+
if (!hit.face) return false;
|
|
17650
|
+
const mesh = hit.object;
|
|
17651
|
+
const material = Array.isArray(mesh.material) ? mesh.material[hit.face.materialIndex] : mesh.material;
|
|
17652
|
+
return material?.visible;
|
|
17653
|
+
});
|
|
17654
|
+
}
|
|
17655
|
+
function hitNormal(hit) {
|
|
17656
|
+
const mesh = hit.object;
|
|
17657
|
+
const matrix = mesh.matrixWorld.clone();
|
|
17658
|
+
if (isInstancedMesh(mesh) && hit.instanceId !== void 0) {
|
|
17659
|
+
const instance = new import_three42.Matrix4();
|
|
17660
|
+
mesh.getMatrixAt(hit.instanceId, instance);
|
|
17661
|
+
matrix.multiply(instance);
|
|
17662
|
+
}
|
|
17663
|
+
return hit.face.normal.clone().applyNormalMatrix(new import_three42.Matrix3().getNormalMatrix(matrix));
|
|
17664
|
+
}
|
|
17665
|
+
|
|
17666
|
+
// src/world/_entities/WorldEntities.ts
|
|
17628
17667
|
var WorldEntities = class {
|
|
17629
17668
|
constructor(scene) {
|
|
17630
17669
|
this.scene = scene;
|
|
17631
17670
|
this.columns = /* @__PURE__ */ new Map();
|
|
17632
17671
|
}
|
|
17672
|
+
/** Finds the nearest visible triangle belonging to an entity owned by this world. */
|
|
17673
|
+
raycast(raycaster) {
|
|
17674
|
+
const owners = /* @__PURE__ */ new Map();
|
|
17675
|
+
for (const column of this.columns.values()) {
|
|
17676
|
+
for (const [object4, placement] of column) {
|
|
17677
|
+
for (const mesh of pickableMeshes(object4, this.scene, raycaster)) {
|
|
17678
|
+
owners.set(mesh, { object: object4, ...placement });
|
|
17679
|
+
}
|
|
17680
|
+
}
|
|
17681
|
+
}
|
|
17682
|
+
for (const hit of visibleHits(raycaster, [...owners.keys()])) {
|
|
17683
|
+
const mesh = hit.object;
|
|
17684
|
+
const owner = owners.get(mesh);
|
|
17685
|
+
return {
|
|
17686
|
+
type: owner.type,
|
|
17687
|
+
position: new import_three44.Vector3(...owner.position),
|
|
17688
|
+
object: owner.object,
|
|
17689
|
+
point: hit.point.clone(),
|
|
17690
|
+
normal: hitNormal(hit),
|
|
17691
|
+
distance: hit.distance
|
|
17692
|
+
};
|
|
17693
|
+
}
|
|
17694
|
+
return void 0;
|
|
17695
|
+
}
|
|
17633
17696
|
/** Captures column ownership before asynchronous block or asset loading starts. */
|
|
17634
17697
|
prepare(entities = [], column) {
|
|
17635
17698
|
const placements = entities.flatMap((entity) => {
|
|
@@ -17638,7 +17701,7 @@ var WorldEntities = class {
|
|
|
17638
17701
|
const position = [...entity.position];
|
|
17639
17702
|
const key = column?.join(",") ?? `${Math.floor(position[0] / 16)},${Math.floor(position[2] / 16)}`;
|
|
17640
17703
|
let owner = this.columns.get(key);
|
|
17641
|
-
if (!owner) this.columns.set(key, owner = /* @__PURE__ */ new
|
|
17704
|
+
if (!owner) this.columns.set(key, owner = /* @__PURE__ */ new Map());
|
|
17642
17705
|
return [{ ...resolved, position, column: key, owner }];
|
|
17643
17706
|
});
|
|
17644
17707
|
return async () => {
|
|
@@ -17664,7 +17727,7 @@ var WorldEntities = class {
|
|
|
17664
17727
|
object4.rotation.y = placement.yaw;
|
|
17665
17728
|
await object4.init();
|
|
17666
17729
|
if (!current()) return;
|
|
17667
|
-
placement.owner.
|
|
17730
|
+
placement.owner.set(object4, { type: placement.key.toNamespacedString(), position: placement.position });
|
|
17668
17731
|
this.scene.add(object4);
|
|
17669
17732
|
} catch (error) {
|
|
17670
17733
|
console.warn(`Could not draw saved entity ${placement.key.toNamespacedString()}, skipping it`, error);
|
|
@@ -17679,7 +17742,7 @@ var WorldEntities = class {
|
|
|
17679
17742
|
const objects = this.columns.get(key);
|
|
17680
17743
|
this.columns.delete(key);
|
|
17681
17744
|
if (!objects) return;
|
|
17682
|
-
for (const object4 of objects) {
|
|
17745
|
+
for (const object4 of objects.keys()) {
|
|
17683
17746
|
object4.removeFromScene();
|
|
17684
17747
|
object4.dispose();
|
|
17685
17748
|
}
|
|
@@ -17747,6 +17810,14 @@ var MineRenderWorld = class {
|
|
|
17747
17810
|
raycast(raycaster) {
|
|
17748
17811
|
return Chunk.raycast(this._chunks.values(), raycaster);
|
|
17749
17812
|
}
|
|
17813
|
+
/**
|
|
17814
|
+
* Returns the nearest visible mob geometry hit when renderEntities is enabled.
|
|
17815
|
+
* Respects layers and near/far; compare its distance with raycast() to account for blocks.
|
|
17816
|
+
* Texture alpha does not change triangle intersections.
|
|
17817
|
+
*/
|
|
17818
|
+
raycastEntities(raycaster) {
|
|
17819
|
+
return this.entities?.raycast(raycaster);
|
|
17820
|
+
}
|
|
17750
17821
|
/** Whether neighboring opaque cubes shade block-face corners. Defaults to false. */
|
|
17751
17822
|
get ambientOcclusion() {
|
|
17752
17823
|
return this._ambientOcclusion;
|
|
@@ -17767,25 +17838,25 @@ var MineRenderWorld = class {
|
|
|
17767
17838
|
}
|
|
17768
17839
|
getBlockAt(posOrX, y, z) {
|
|
17769
17840
|
if (typeof posOrX == "number") {
|
|
17770
|
-
return this.getBlockAt(new
|
|
17841
|
+
return this.getBlockAt(new import_three45.Vector3(posOrX, y, z));
|
|
17771
17842
|
}
|
|
17772
17843
|
if (isTripleArray(posOrX)) {
|
|
17773
|
-
return this.getBlockAt(new
|
|
17844
|
+
return this.getBlockAt(new import_three45.Vector3(posOrX[0], posOrX[1], posOrX[2]));
|
|
17774
17845
|
}
|
|
17775
17846
|
this.validatePosBounds(posOrX);
|
|
17776
17847
|
return this.getChunkAt(posOrX)?.getBlockAt(posOrX);
|
|
17777
17848
|
}
|
|
17778
17849
|
getBiomeAt(posOrX, y, z) {
|
|
17779
|
-
if (typeof posOrX === "number") return this.getBiomeAt(new
|
|
17780
|
-
if (isTripleArray(posOrX)) return this.getBiomeAt(new
|
|
17850
|
+
if (typeof posOrX === "number") return this.getBiomeAt(new import_three45.Vector3(posOrX, y, z));
|
|
17851
|
+
if (isTripleArray(posOrX)) return this.getBiomeAt(new import_three45.Vector3(...posOrX));
|
|
17781
17852
|
this.validatePosBounds(posOrX);
|
|
17782
17853
|
const cx = Math.floor(posOrX.x / 16), cy = Math.floor(posOrX.y / 16), cz = Math.floor(posOrX.z / 16);
|
|
17783
17854
|
const lx = posOrX.x - cx * 16, ly = posOrX.y - cy * 16, lz = posOrX.z - cz * 16;
|
|
17784
17855
|
return this.biomes.get(`${cx}_${cz}`)?.get(cy)?.[Math.floor(lx / 4) + Math.floor(lz / 4) * 4 + Math.floor(ly / 4) * 16];
|
|
17785
17856
|
}
|
|
17786
17857
|
getLightAt(posOrX, y, z) {
|
|
17787
|
-
if (typeof posOrX === "number") return this.getLightAt(new
|
|
17788
|
-
if (isTripleArray(posOrX)) return this.getLightAt(new
|
|
17858
|
+
if (typeof posOrX === "number") return this.getLightAt(new import_three45.Vector3(posOrX, y, z));
|
|
17859
|
+
if (isTripleArray(posOrX)) return this.getLightAt(new import_three45.Vector3(...posOrX));
|
|
17789
17860
|
this.validatePosBounds(posOrX);
|
|
17790
17861
|
const { x, y: py, z: pz } = posOrX;
|
|
17791
17862
|
const cx = Math.floor(x / 16), cy = Math.floor(py / 16), cz = Math.floor(pz / 16);
|
|
@@ -17803,10 +17874,10 @@ var MineRenderWorld = class {
|
|
|
17803
17874
|
}
|
|
17804
17875
|
async setBlockAt(posOrX, yOrBlock, z, block) {
|
|
17805
17876
|
if (typeof posOrX == "number") {
|
|
17806
|
-
return this.setBlockAt(new
|
|
17877
|
+
return this.setBlockAt(new import_three45.Vector3(posOrX, yOrBlock, z), block);
|
|
17807
17878
|
}
|
|
17808
17879
|
if (isTripleArray(posOrX)) {
|
|
17809
|
-
return this.setBlockAt(new
|
|
17880
|
+
return this.setBlockAt(new import_three45.Vector3(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
|
|
17810
17881
|
}
|
|
17811
17882
|
return this.placeBlock(posOrX, yOrBlock);
|
|
17812
17883
|
}
|
|
@@ -17817,10 +17888,10 @@ var MineRenderWorld = class {
|
|
|
17817
17888
|
}
|
|
17818
17889
|
async setBlockVisibleAt(posOrX, yOrVisible, z, visible) {
|
|
17819
17890
|
if (typeof posOrX === "number") {
|
|
17820
|
-
return this.setBlockVisibleAt(new
|
|
17891
|
+
return this.setBlockVisibleAt(new import_three45.Vector3(posOrX, yOrVisible, z), visible);
|
|
17821
17892
|
}
|
|
17822
17893
|
if (isTripleArray(posOrX)) {
|
|
17823
|
-
return this.setBlockVisibleAt(new
|
|
17894
|
+
return this.setBlockVisibleAt(new import_three45.Vector3(...posOrX), yOrVisible);
|
|
17824
17895
|
}
|
|
17825
17896
|
this.validatePosBounds(posOrX);
|
|
17826
17897
|
await this.getChunkAt(posOrX)?.setBlockVisibleAt(posOrX, yOrVisible);
|
|
@@ -17846,7 +17917,7 @@ var MineRenderWorld = class {
|
|
|
17846
17917
|
const collect = async (positions2) => {
|
|
17847
17918
|
for (const pos of positions2) changes.set(pos.toArray().join(","), pos);
|
|
17848
17919
|
};
|
|
17849
|
-
const place = (block) => this.placeBlock(new
|
|
17920
|
+
const place = (block) => this.placeBlock(new import_three45.Vector3(...block.position), block, collect);
|
|
17850
17921
|
const keys = /* @__PURE__ */ new Map();
|
|
17851
17922
|
const types = /* @__PURE__ */ new Set();
|
|
17852
17923
|
for (const block of multiblock.blocks) {
|
|
@@ -17862,7 +17933,7 @@ var MineRenderWorld = class {
|
|
|
17862
17933
|
}
|
|
17863
17934
|
if (!executor) {
|
|
17864
17935
|
const groups2 = /* @__PURE__ */ new Map();
|
|
17865
|
-
const position = new
|
|
17936
|
+
const position = new import_three45.Vector3();
|
|
17866
17937
|
for (const block of multiblock.blocks) {
|
|
17867
17938
|
const [x, y, z] = block.position;
|
|
17868
17939
|
this.validatePosBounds(position.set(x, y, z));
|
|
@@ -17902,7 +17973,7 @@ var MineRenderWorld = class {
|
|
|
17902
17973
|
try {
|
|
17903
17974
|
positions = await chunk.placeBlocks(blocks);
|
|
17904
17975
|
} finally {
|
|
17905
|
-
positions ?? (positions = blocks.map(({ index }) => new
|
|
17976
|
+
positions ?? (positions = blocks.map(({ index }) => new import_three45.Vector3(
|
|
17906
17977
|
chunk.x * 16 + index % 16,
|
|
17907
17978
|
chunk.y * 16 + Math.floor(index / 256),
|
|
17908
17979
|
chunk.z * 16 + Math.floor(index / 16) % 16
|
|
@@ -17954,7 +18025,7 @@ var MineRenderWorld = class {
|
|
|
17954
18025
|
}
|
|
17955
18026
|
for (const section of chunk.sections) {
|
|
17956
18027
|
if (section.biomes) {
|
|
17957
|
-
const position = new
|
|
18028
|
+
const position = new import_three45.Vector3(chunk.x * 16, section.y * 16, chunk.z * 16);
|
|
17958
18029
|
this.validatePosBounds(position);
|
|
17959
18030
|
const copy = [...section.biomes];
|
|
17960
18031
|
if (copy.length !== 64 || !copy.every((id) => typeof id === "string" && id.length > 0)) {
|
|
@@ -17970,7 +18041,7 @@ var MineRenderWorld = class {
|
|
|
17970
18041
|
for (const section of chunk.sections) {
|
|
17971
18042
|
if (!executor) {
|
|
17972
18043
|
if (!occupiedSections.has(section.y)) continue;
|
|
17973
|
-
const position = new
|
|
18044
|
+
const position = new import_three45.Vector3(chunk.x * 16, section.y * 16, chunk.z * 16);
|
|
17974
18045
|
this.validatePosBounds(position);
|
|
17975
18046
|
const target = this.getOrCreateChunkAt(position);
|
|
17976
18047
|
try {
|
|
@@ -18074,7 +18145,7 @@ var MineRenderWorld = class {
|
|
|
18074
18145
|
this.sectionModels?.clear();
|
|
18075
18146
|
}
|
|
18076
18147
|
updateCulling(positions) {
|
|
18077
|
-
const neighbor = new
|
|
18148
|
+
const neighbor = new import_three45.Vector3();
|
|
18078
18149
|
for (const pos of positions) {
|
|
18079
18150
|
const cx = Math.floor(pos.x / 16), cy = Math.floor(pos.y / 16), cz = Math.floor(pos.z / 16);
|
|
18080
18151
|
const chunk = this._chunks.get(`${cx}_${cy}_${cz}`);
|
|
@@ -18205,7 +18276,7 @@ var MineRenderWorld = class {
|
|
|
18205
18276
|
}
|
|
18206
18277
|
/** Converts block coordinates to scene units by multiplying each component by 16. */
|
|
18207
18278
|
static worldToScenePosition(pos) {
|
|
18208
|
-
return new
|
|
18279
|
+
return new import_three45.Vector3(
|
|
18209
18280
|
pos.x * 16,
|
|
18210
18281
|
pos.y * 16,
|
|
18211
18282
|
pos.z * 16
|
|
@@ -18213,7 +18284,7 @@ var MineRenderWorld = class {
|
|
|
18213
18284
|
}
|
|
18214
18285
|
/** Converts scene units to block coordinates without rounding to an integer block. */
|
|
18215
18286
|
static sceneToWorldPosition(pos) {
|
|
18216
|
-
return new
|
|
18287
|
+
return new import_three45.Vector3(
|
|
18217
18288
|
pos.x / 16,
|
|
18218
18289
|
pos.y / 16,
|
|
18219
18290
|
pos.z / 16
|
|
@@ -18236,7 +18307,7 @@ var MineRenderWorld = class {
|
|
|
18236
18307
|
init_Model();
|
|
18237
18308
|
|
|
18238
18309
|
// src/world/SectionMesh.ts
|
|
18239
|
-
var
|
|
18310
|
+
var import_three46 = require("three");
|
|
18240
18311
|
init_CanvasCompat();
|
|
18241
18312
|
init_Materials();
|
|
18242
18313
|
|
|
@@ -18561,7 +18632,7 @@ var SectionWorker = _SectionWorker;
|
|
|
18561
18632
|
|
|
18562
18633
|
// src/world/SectionMesh.ts
|
|
18563
18634
|
var templateCache = /* @__PURE__ */ new WeakMap();
|
|
18564
|
-
var WATER_TINT = new
|
|
18635
|
+
var WATER_TINT = new import_three46.Color(4159204).toArray();
|
|
18565
18636
|
function toInput(entries, maxAtlasSize, fluids, lighting) {
|
|
18566
18637
|
if (!Number.isInteger(maxAtlasSize) || maxAtlasSize < 1) throw new RangeError("Section atlas size must be a positive integer");
|
|
18567
18638
|
const atlases = [];
|
|
@@ -18658,7 +18729,7 @@ function toInput(entries, maxAtlasSize, fluids, lighting) {
|
|
|
18658
18729
|
}
|
|
18659
18730
|
return { input, atlases };
|
|
18660
18731
|
}
|
|
18661
|
-
var SectionMesh = class _SectionMesh extends
|
|
18732
|
+
var SectionMesh = class _SectionMesh extends import_three46.Group {
|
|
18662
18733
|
constructor() {
|
|
18663
18734
|
super(...arguments);
|
|
18664
18735
|
this.ownedMeshes = [];
|
|
@@ -18689,26 +18760,26 @@ var SectionMesh = class _SectionMesh extends import_three43.Group {
|
|
|
18689
18760
|
for (const { atlas, x, y } of page.placements) {
|
|
18690
18761
|
context.drawImage(atlases[atlas].image.canvas, x, y);
|
|
18691
18762
|
}
|
|
18692
|
-
const geometry = new
|
|
18693
|
-
geometry.setAttribute("position", new
|
|
18694
|
-
geometry.setAttribute("normal", new
|
|
18695
|
-
geometry.setAttribute("uv", new
|
|
18696
|
-
geometry.setAttribute("uvBounds", new
|
|
18697
|
-
geometry.setAttribute("color", new
|
|
18698
|
-
geometry.setIndex(new
|
|
18763
|
+
const geometry = new import_three46.BufferGeometry();
|
|
18764
|
+
geometry.setAttribute("position", new import_three46.Float32BufferAttribute(page.positions.buffer, 3));
|
|
18765
|
+
geometry.setAttribute("normal", new import_three46.Float32BufferAttribute(page.normals.buffer, 3));
|
|
18766
|
+
geometry.setAttribute("uv", new import_three46.Float32BufferAttribute(page.uvs.buffer, 2));
|
|
18767
|
+
geometry.setAttribute("uvBounds", new import_three46.Float32BufferAttribute(page.uvBounds.buffer, 4));
|
|
18768
|
+
geometry.setAttribute("color", new import_three46.Float32BufferAttribute(page.colors.buffer, 3));
|
|
18769
|
+
geometry.setIndex(new import_three46.Uint32BufferAttribute(page.indices.buffer, 1));
|
|
18699
18770
|
geometry.computeBoundingBox();
|
|
18700
18771
|
geometry.computeBoundingSphere();
|
|
18701
18772
|
const transparent = page.layer === 2 ? atlases[page.placements[0].atlas].hasTranslucency : page.layer === 1;
|
|
18702
18773
|
const material = Materials.createShadedCanvasMaterial(canvas, transparent, false, true);
|
|
18703
|
-
material.side =
|
|
18774
|
+
material.side = import_three46.FrontSide;
|
|
18704
18775
|
if (page.layer === 2) {
|
|
18705
|
-
material.side =
|
|
18776
|
+
material.side = import_three46.DoubleSide;
|
|
18706
18777
|
material.forceSinglePass = true;
|
|
18707
18778
|
material.depthWrite = !material.transparent;
|
|
18708
18779
|
}
|
|
18709
18780
|
material.vertexColors = true;
|
|
18710
18781
|
const texture = material.uniforms?.map?.value ?? material.map;
|
|
18711
|
-
const mesh = new
|
|
18782
|
+
const mesh = new import_three46.Mesh(geometry, material);
|
|
18712
18783
|
section.add(mesh);
|
|
18713
18784
|
section.blockIndices.set(mesh, page.blockIndices);
|
|
18714
18785
|
const unsubscribe = [];
|
|
@@ -18747,8 +18818,7 @@ init_FluidGeometry();
|
|
|
18747
18818
|
init_FluidQuads();
|
|
18748
18819
|
init_CubeFace();
|
|
18749
18820
|
init_InstanceReference();
|
|
18750
|
-
|
|
18751
|
-
var WATER_TINT2 = new import_three44.Color(4159204).toArray();
|
|
18821
|
+
var WATER_TINT2 = new import_three47.Color(4159204).toArray();
|
|
18752
18822
|
var Chunk = class _Chunk {
|
|
18753
18823
|
constructor(scene, x, y, z, onBlocksChanged, sectionModels, neighborCell, biomeAt, onBiomesChanged, lightAt, onLightCleared, ambientLight = 0) {
|
|
18754
18824
|
this.onBlocksChanged = onBlocksChanged;
|
|
@@ -18765,7 +18835,7 @@ var Chunk = class _Chunk {
|
|
|
18765
18835
|
this.sectionBlocks = /* @__PURE__ */ new Map();
|
|
18766
18836
|
this.hiddenBlocks = /* @__PURE__ */ new Set();
|
|
18767
18837
|
this.fluidCells = new Uint8Array(4096);
|
|
18768
|
-
this.blockPosition = new
|
|
18838
|
+
this.blockPosition = new import_three47.Vector3();
|
|
18769
18839
|
this.meshDirty = false;
|
|
18770
18840
|
this.meshGeneration = 0;
|
|
18771
18841
|
this.scene = scene;
|
|
@@ -18780,18 +18850,8 @@ var Chunk = class _Chunk {
|
|
|
18780
18850
|
const meshes = (root, scene) => {
|
|
18781
18851
|
const cached2 = roots.get(root);
|
|
18782
18852
|
if (cached2) return cached2;
|
|
18783
|
-
const result =
|
|
18853
|
+
const result = pickableMeshes(root, scene, raycaster);
|
|
18784
18854
|
roots.set(root, result);
|
|
18785
|
-
let attached = false;
|
|
18786
|
-
for (let parent = root; parent; parent = parent.parent) {
|
|
18787
|
-
if (!parent.visible) return result;
|
|
18788
|
-
if (parent === scene) attached = true;
|
|
18789
|
-
}
|
|
18790
|
-
if (!attached) return result;
|
|
18791
|
-
root.updateWorldMatrix(true, true);
|
|
18792
|
-
root.traverseVisible((object4) => {
|
|
18793
|
-
if (isMesh(object4) && raycaster.layers.test(object4.layers)) result.push(object4);
|
|
18794
|
-
});
|
|
18795
18855
|
return result;
|
|
18796
18856
|
};
|
|
18797
18857
|
const add = (root, owner, reference) => {
|
|
@@ -18822,11 +18882,8 @@ var Chunk = class _Chunk {
|
|
|
18822
18882
|
}
|
|
18823
18883
|
}
|
|
18824
18884
|
}
|
|
18825
|
-
for (const hit of raycaster
|
|
18826
|
-
if (!hit.face) continue;
|
|
18885
|
+
for (const hit of visibleHits(raycaster, [...targets.keys()])) {
|
|
18827
18886
|
const mesh = hit.object;
|
|
18828
|
-
const material = Array.isArray(mesh.material) ? mesh.material[hit.face.materialIndex] : mesh.material;
|
|
18829
|
-
if (!material?.visible) continue;
|
|
18830
18887
|
const entry = targets.get(mesh);
|
|
18831
18888
|
let owner = entry.owners.get(hit.instanceId) ?? entry.owners.get(void 0);
|
|
18832
18889
|
if (entry.section) {
|
|
@@ -18836,21 +18893,15 @@ var Chunk = class _Chunk {
|
|
|
18836
18893
|
if (!owner || owner.chunk.hiddenBlocks.has(owner.index)) continue;
|
|
18837
18894
|
const info = owner.chunk.renderedBlocks.get(owner.index);
|
|
18838
18895
|
if (!info) continue;
|
|
18839
|
-
const matrix = mesh.matrixWorld.clone();
|
|
18840
|
-
if (isInstancedMesh(mesh) && hit.instanceId !== void 0) {
|
|
18841
|
-
const instance = new import_three44.Matrix4();
|
|
18842
|
-
mesh.getMatrixAt(hit.instanceId, instance);
|
|
18843
|
-
matrix.multiply(instance);
|
|
18844
|
-
}
|
|
18845
18896
|
return {
|
|
18846
|
-
position: new
|
|
18897
|
+
position: new import_three47.Vector3(
|
|
18847
18898
|
owner.chunk.x * 16 + owner.index % 16,
|
|
18848
18899
|
owner.chunk.y * 16 + Math.floor(owner.index / 256),
|
|
18849
18900
|
owner.chunk.z * 16 + Math.floor(owner.index / 16) % 16
|
|
18850
18901
|
),
|
|
18851
18902
|
block: info.block,
|
|
18852
18903
|
point: hit.point.clone(),
|
|
18853
|
-
normal: hit
|
|
18904
|
+
normal: hitNormal(hit),
|
|
18854
18905
|
distance: hit.distance
|
|
18855
18906
|
};
|
|
18856
18907
|
}
|
|
@@ -18858,18 +18909,18 @@ var Chunk = class _Chunk {
|
|
|
18858
18909
|
}
|
|
18859
18910
|
getBlockAt(posOrX, y, z) {
|
|
18860
18911
|
if (typeof posOrX == "number") {
|
|
18861
|
-
return this.getBlockAt(new
|
|
18912
|
+
return this.getBlockAt(new import_three47.Vector3(posOrX, y, z));
|
|
18862
18913
|
}
|
|
18863
18914
|
if (isTripleArray(posOrX)) {
|
|
18864
|
-
return this.getBlockAt(new
|
|
18915
|
+
return this.getBlockAt(new import_three47.Vector3(posOrX[0], posOrX[1], posOrX[2]));
|
|
18865
18916
|
}
|
|
18866
18917
|
const pos = this.blockPosition.set(posOrX.x - this.x * 16, posOrX.y - this.y * 16, posOrX.z - this.z * 16);
|
|
18867
18918
|
const index = _Chunk.chunkPosToBlockIndex(pos);
|
|
18868
18919
|
return this.renderedBlocks.get(index);
|
|
18869
18920
|
}
|
|
18870
18921
|
getBiomeAt(posOrX, y, z) {
|
|
18871
|
-
if (typeof posOrX === "number") return this.getBiomeAt(new
|
|
18872
|
-
if (isTripleArray(posOrX)) return this.getBiomeAt(new
|
|
18922
|
+
if (typeof posOrX === "number") return this.getBiomeAt(new import_three47.Vector3(posOrX, y, z));
|
|
18923
|
+
if (isTripleArray(posOrX)) return this.getBiomeAt(new import_three47.Vector3(...posOrX));
|
|
18873
18924
|
const pos = this.worldPosToChunkPos(posOrX);
|
|
18874
18925
|
_Chunk.chunkPosToBlockIndex(pos);
|
|
18875
18926
|
return this.biomeAt ? this.biomeAt(posOrX.x, posOrX.y, posOrX.z) : this.biomes?.[Math.floor(pos.x / 4) + Math.floor(pos.z / 4) * 4 + Math.floor(pos.y / 4) * 16];
|
|
@@ -18912,17 +18963,17 @@ var Chunk = class _Chunk {
|
|
|
18912
18963
|
this.hiddenBlocks.add(index);
|
|
18913
18964
|
this.renderedBlocks.get(index)?.object?.setVisible(false);
|
|
18914
18965
|
}
|
|
18915
|
-
const positions = blocks.map(({ index }) => new
|
|
18966
|
+
const positions = blocks.map(({ index }) => new import_three47.Vector3(...this.positionAt(index)));
|
|
18916
18967
|
if (this.onBlocksChanged) await this.onBlocksChanged(positions);
|
|
18917
18968
|
else await this.rebuildSectionMesh();
|
|
18918
18969
|
}
|
|
18919
18970
|
}
|
|
18920
18971
|
async setBlockAt(posOrX, yOrBlock, z, block) {
|
|
18921
18972
|
if (typeof posOrX == "number") {
|
|
18922
|
-
return this.setBlockAt(new
|
|
18973
|
+
return this.setBlockAt(new import_three47.Vector3(posOrX, yOrBlock, z), block);
|
|
18923
18974
|
}
|
|
18924
18975
|
if (isTripleArray(posOrX)) {
|
|
18925
|
-
return this.setBlockAt(new
|
|
18976
|
+
return this.setBlockAt(new import_three47.Vector3(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
|
|
18926
18977
|
}
|
|
18927
18978
|
const worldPos = posOrX;
|
|
18928
18979
|
const pos = this.worldPosToChunkPos(worldPos);
|
|
@@ -18977,7 +19028,7 @@ var Chunk = class _Chunk {
|
|
|
18977
19028
|
this.fluidCells[index] = 0;
|
|
18978
19029
|
this.renderedBlocks.delete(index);
|
|
18979
19030
|
this.objectBlocks.delete(index);
|
|
18980
|
-
const worldPos = new
|
|
19031
|
+
const worldPos = new import_three47.Vector3(
|
|
18981
19032
|
this.x * 16 + index % 16,
|
|
18982
19033
|
this.y * 16 + Math.floor(index / 256),
|
|
18983
19034
|
this.z * 16 + Math.floor(index / 16) % 16
|
|
@@ -19108,7 +19159,7 @@ var Chunk = class _Chunk {
|
|
|
19108
19159
|
biome,
|
|
19109
19160
|
biomePosition: this.biomePosition(index, blockState3, this.data.stateAt(this.data.idAt(index)))
|
|
19110
19161
|
});
|
|
19111
|
-
object4.setPosition(new
|
|
19162
|
+
object4.setPosition(new import_three47.Vector3(
|
|
19112
19163
|
this.x * 256 + index % 16 * 16,
|
|
19113
19164
|
this.y * 256 + Math.floor(index / 256) * 16,
|
|
19114
19165
|
this.z * 256 + Math.floor(index / 16) % 16 * 16
|
|
@@ -19200,7 +19251,7 @@ var Chunk = class _Chunk {
|
|
|
19200
19251
|
context.prepared = await prepare(async () => await available() ? BlockTints.getBiomeColor(blockState3?.key, biome, position) : void 0);
|
|
19201
19252
|
if (fluid?.kind === "water" && await available()) {
|
|
19202
19253
|
const color2 = await Biomes.getColor(biome, "water", blockState3?.key);
|
|
19203
|
-
if (color2 !== void 0 && color2 !== 4159204) context.waterTint = new
|
|
19254
|
+
if (color2 !== void 0 && color2 !== 4159204) context.waterTint = new import_three47.Color(color2).toArray();
|
|
19204
19255
|
}
|
|
19205
19256
|
}
|
|
19206
19257
|
for (const index of indices2) contexts.set(index, context);
|
|
@@ -19371,7 +19422,7 @@ var Chunk = class _Chunk {
|
|
|
19371
19422
|
/** Removes stored blocks and render objects. Set `notify` to false to skip the owning world's update. */
|
|
19372
19423
|
async clear(notify = true) {
|
|
19373
19424
|
const positions = notify && this.onBlocksChanged ? [...this.renderedBlocks.keys()].map((index) => this.chunkPosToWorldPos(
|
|
19374
|
-
new
|
|
19425
|
+
new import_three47.Vector3(index % 16, Math.floor(index / 256), Math.floor(index / 16) % 16)
|
|
19375
19426
|
)) : [];
|
|
19376
19427
|
for (const info of this.renderedBlocks.values()) info.object?.removeFromScene();
|
|
19377
19428
|
this.sectionBlocks.clear();
|
|
@@ -19407,14 +19458,14 @@ var Chunk = class _Chunk {
|
|
|
19407
19458
|
return pos.y * 16 * 16 + pos.z * 16 + pos.x;
|
|
19408
19459
|
}
|
|
19409
19460
|
worldPosToChunkPos(pos) {
|
|
19410
|
-
return new
|
|
19461
|
+
return new import_three47.Vector3(
|
|
19411
19462
|
pos.x - this.x * 16,
|
|
19412
19463
|
pos.y - this.y * 16,
|
|
19413
19464
|
pos.z - this.z * 16
|
|
19414
19465
|
);
|
|
19415
19466
|
}
|
|
19416
19467
|
chunkPosToWorldPos(pos) {
|
|
19417
|
-
return new
|
|
19468
|
+
return new import_three47.Vector3(
|
|
19418
19469
|
this.x * 16 + pos.x,
|
|
19419
19470
|
this.y * 16 + pos.y,
|
|
19420
19471
|
this.z * 16 + pos.z
|