minerender 2.1.0-alpha.122 → 2.1.0-alpha.124

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.
@@ -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 };
@@ -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 };
@@ -3869,11 +3869,14 @@ var init_UVMapper = __esm({
3869
3869
  });
3870
3870
  }
3871
3871
  static fillMissingTextureKeys(textures, target) {
3872
- for (let faceName of CUBE_FACES) {
3873
- let v = textures[faceName];
3874
- if (v && v.startsWith("#")) {
3875
- target[faceName] = target[v.substr(1)];
3872
+ for (const key in textures) {
3873
+ let name = key;
3874
+ const seen = /* @__PURE__ */ new Set();
3875
+ while (textures[name]?.startsWith("#") && !seen.has(name)) {
3876
+ seen.add(name);
3877
+ name = textures[name].substr(1);
3876
3878
  }
3879
+ if (name !== key) target[key] = target[name];
3877
3880
  }
3878
3881
  return target;
3879
3882
  }
@@ -17355,12 +17358,12 @@ var AnvilWorldSource = class {
17355
17358
  };
17356
17359
 
17357
17360
  // src/world/Chunk.ts
17358
- var import_three44 = require("three");
17361
+ var import_three47 = require("three");
17359
17362
  init_BlockStates();
17360
17363
  init_AssetKey();
17361
17364
 
17362
17365
  // src/world/MineRenderWorld.ts
17363
- var import_three42 = require("three");
17366
+ var import_three45 = require("three");
17364
17367
  init_Model();
17365
17368
  init_util();
17366
17369
  init_AssetKey();
@@ -17625,11 +17628,74 @@ function resolveSavedEntity(entity) {
17625
17628
 
17626
17629
  // src/world/_entities/WorldEntities.ts
17627
17630
  init_BannerPatterns();
17631
+ var import_three44 = require("three");
17632
+
17633
+ // src/world/_picking/Picking.ts
17634
+ var import_three42 = require("three");
17635
+ init_three();
17636
+ function pickableMeshes(root, scene, raycaster) {
17637
+ const result = [];
17638
+ let attached = false;
17639
+ for (let parent = root; parent; parent = parent.parent) {
17640
+ if (!parent.visible) return result;
17641
+ if (parent === scene) attached = true;
17642
+ }
17643
+ if (!attached) return result;
17644
+ root.updateWorldMatrix(true, true);
17645
+ root.traverseVisible((object4) => {
17646
+ if (isMesh(object4) && raycaster.layers.test(object4.layers)) result.push(object4);
17647
+ });
17648
+ return result;
17649
+ }
17650
+ function visibleHits(raycaster, meshes) {
17651
+ return raycaster.intersectObjects(meshes, false).filter((hit) => {
17652
+ if (!hit.face) return false;
17653
+ const mesh = hit.object;
17654
+ const material = Array.isArray(mesh.material) ? mesh.material[hit.face.materialIndex] : mesh.material;
17655
+ return material?.visible;
17656
+ });
17657
+ }
17658
+ function hitNormal(hit) {
17659
+ const mesh = hit.object;
17660
+ const matrix = mesh.matrixWorld.clone();
17661
+ if (isInstancedMesh(mesh) && hit.instanceId !== void 0) {
17662
+ const instance = new import_three42.Matrix4();
17663
+ mesh.getMatrixAt(hit.instanceId, instance);
17664
+ matrix.multiply(instance);
17665
+ }
17666
+ return hit.face.normal.clone().applyNormalMatrix(new import_three42.Matrix3().getNormalMatrix(matrix));
17667
+ }
17668
+
17669
+ // src/world/_entities/WorldEntities.ts
17628
17670
  var WorldEntities = class {
17629
17671
  constructor(scene) {
17630
17672
  this.scene = scene;
17631
17673
  this.columns = /* @__PURE__ */ new Map();
17632
17674
  }
17675
+ /** Finds the nearest visible triangle belonging to an entity owned by this world. */
17676
+ raycast(raycaster) {
17677
+ const owners = /* @__PURE__ */ new Map();
17678
+ for (const column of this.columns.values()) {
17679
+ for (const [object4, placement] of column) {
17680
+ for (const mesh of pickableMeshes(object4, this.scene, raycaster)) {
17681
+ owners.set(mesh, { object: object4, ...placement });
17682
+ }
17683
+ }
17684
+ }
17685
+ for (const hit of visibleHits(raycaster, [...owners.keys()])) {
17686
+ const mesh = hit.object;
17687
+ const owner = owners.get(mesh);
17688
+ return {
17689
+ type: owner.type,
17690
+ position: new import_three44.Vector3(...owner.position),
17691
+ object: owner.object,
17692
+ point: hit.point.clone(),
17693
+ normal: hitNormal(hit),
17694
+ distance: hit.distance
17695
+ };
17696
+ }
17697
+ return void 0;
17698
+ }
17633
17699
  /** Captures column ownership before asynchronous block or asset loading starts. */
17634
17700
  prepare(entities = [], column) {
17635
17701
  const placements = entities.flatMap((entity) => {
@@ -17638,7 +17704,7 @@ var WorldEntities = class {
17638
17704
  const position = [...entity.position];
17639
17705
  const key = column?.join(",") ?? `${Math.floor(position[0] / 16)},${Math.floor(position[2] / 16)}`;
17640
17706
  let owner = this.columns.get(key);
17641
- if (!owner) this.columns.set(key, owner = /* @__PURE__ */ new Set());
17707
+ if (!owner) this.columns.set(key, owner = /* @__PURE__ */ new Map());
17642
17708
  return [{ ...resolved, position, column: key, owner }];
17643
17709
  });
17644
17710
  return async () => {
@@ -17664,7 +17730,7 @@ var WorldEntities = class {
17664
17730
  object4.rotation.y = placement.yaw;
17665
17731
  await object4.init();
17666
17732
  if (!current()) return;
17667
- placement.owner.add(object4);
17733
+ placement.owner.set(object4, { type: placement.key.toNamespacedString(), position: placement.position });
17668
17734
  this.scene.add(object4);
17669
17735
  } catch (error) {
17670
17736
  console.warn(`Could not draw saved entity ${placement.key.toNamespacedString()}, skipping it`, error);
@@ -17679,7 +17745,7 @@ var WorldEntities = class {
17679
17745
  const objects = this.columns.get(key);
17680
17746
  this.columns.delete(key);
17681
17747
  if (!objects) return;
17682
- for (const object4 of objects) {
17748
+ for (const object4 of objects.keys()) {
17683
17749
  object4.removeFromScene();
17684
17750
  object4.dispose();
17685
17751
  }
@@ -17747,6 +17813,14 @@ var MineRenderWorld = class {
17747
17813
  raycast(raycaster) {
17748
17814
  return Chunk.raycast(this._chunks.values(), raycaster);
17749
17815
  }
17816
+ /**
17817
+ * Returns the nearest visible mob geometry hit when renderEntities is enabled.
17818
+ * Respects layers and near/far; compare its distance with raycast() to account for blocks.
17819
+ * Texture alpha does not change triangle intersections.
17820
+ */
17821
+ raycastEntities(raycaster) {
17822
+ return this.entities?.raycast(raycaster);
17823
+ }
17750
17824
  /** Whether neighboring opaque cubes shade block-face corners. Defaults to false. */
17751
17825
  get ambientOcclusion() {
17752
17826
  return this._ambientOcclusion;
@@ -17767,25 +17841,25 @@ var MineRenderWorld = class {
17767
17841
  }
17768
17842
  getBlockAt(posOrX, y, z) {
17769
17843
  if (typeof posOrX == "number") {
17770
- return this.getBlockAt(new import_three42.Vector3(posOrX, y, z));
17844
+ return this.getBlockAt(new import_three45.Vector3(posOrX, y, z));
17771
17845
  }
17772
17846
  if (isTripleArray(posOrX)) {
17773
- return this.getBlockAt(new import_three42.Vector3(posOrX[0], posOrX[1], posOrX[2]));
17847
+ return this.getBlockAt(new import_three45.Vector3(posOrX[0], posOrX[1], posOrX[2]));
17774
17848
  }
17775
17849
  this.validatePosBounds(posOrX);
17776
17850
  return this.getChunkAt(posOrX)?.getBlockAt(posOrX);
17777
17851
  }
17778
17852
  getBiomeAt(posOrX, y, z) {
17779
- if (typeof posOrX === "number") return this.getBiomeAt(new import_three42.Vector3(posOrX, y, z));
17780
- if (isTripleArray(posOrX)) return this.getBiomeAt(new import_three42.Vector3(...posOrX));
17853
+ if (typeof posOrX === "number") return this.getBiomeAt(new import_three45.Vector3(posOrX, y, z));
17854
+ if (isTripleArray(posOrX)) return this.getBiomeAt(new import_three45.Vector3(...posOrX));
17781
17855
  this.validatePosBounds(posOrX);
17782
17856
  const cx = Math.floor(posOrX.x / 16), cy = Math.floor(posOrX.y / 16), cz = Math.floor(posOrX.z / 16);
17783
17857
  const lx = posOrX.x - cx * 16, ly = posOrX.y - cy * 16, lz = posOrX.z - cz * 16;
17784
17858
  return this.biomes.get(`${cx}_${cz}`)?.get(cy)?.[Math.floor(lx / 4) + Math.floor(lz / 4) * 4 + Math.floor(ly / 4) * 16];
17785
17859
  }
17786
17860
  getLightAt(posOrX, y, z) {
17787
- if (typeof posOrX === "number") return this.getLightAt(new import_three42.Vector3(posOrX, y, z));
17788
- if (isTripleArray(posOrX)) return this.getLightAt(new import_three42.Vector3(...posOrX));
17861
+ if (typeof posOrX === "number") return this.getLightAt(new import_three45.Vector3(posOrX, y, z));
17862
+ if (isTripleArray(posOrX)) return this.getLightAt(new import_three45.Vector3(...posOrX));
17789
17863
  this.validatePosBounds(posOrX);
17790
17864
  const { x, y: py, z: pz } = posOrX;
17791
17865
  const cx = Math.floor(x / 16), cy = Math.floor(py / 16), cz = Math.floor(pz / 16);
@@ -17803,10 +17877,10 @@ var MineRenderWorld = class {
17803
17877
  }
17804
17878
  async setBlockAt(posOrX, yOrBlock, z, block) {
17805
17879
  if (typeof posOrX == "number") {
17806
- return this.setBlockAt(new import_three42.Vector3(posOrX, yOrBlock, z), block);
17880
+ return this.setBlockAt(new import_three45.Vector3(posOrX, yOrBlock, z), block);
17807
17881
  }
17808
17882
  if (isTripleArray(posOrX)) {
17809
- return this.setBlockAt(new import_three42.Vector3(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
17883
+ return this.setBlockAt(new import_three45.Vector3(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
17810
17884
  }
17811
17885
  return this.placeBlock(posOrX, yOrBlock);
17812
17886
  }
@@ -17817,10 +17891,10 @@ var MineRenderWorld = class {
17817
17891
  }
17818
17892
  async setBlockVisibleAt(posOrX, yOrVisible, z, visible) {
17819
17893
  if (typeof posOrX === "number") {
17820
- return this.setBlockVisibleAt(new import_three42.Vector3(posOrX, yOrVisible, z), visible);
17894
+ return this.setBlockVisibleAt(new import_three45.Vector3(posOrX, yOrVisible, z), visible);
17821
17895
  }
17822
17896
  if (isTripleArray(posOrX)) {
17823
- return this.setBlockVisibleAt(new import_three42.Vector3(...posOrX), yOrVisible);
17897
+ return this.setBlockVisibleAt(new import_three45.Vector3(...posOrX), yOrVisible);
17824
17898
  }
17825
17899
  this.validatePosBounds(posOrX);
17826
17900
  await this.getChunkAt(posOrX)?.setBlockVisibleAt(posOrX, yOrVisible);
@@ -17846,7 +17920,7 @@ var MineRenderWorld = class {
17846
17920
  const collect = async (positions2) => {
17847
17921
  for (const pos of positions2) changes.set(pos.toArray().join(","), pos);
17848
17922
  };
17849
- const place = (block) => this.placeBlock(new import_three42.Vector3(...block.position), block, collect);
17923
+ const place = (block) => this.placeBlock(new import_three45.Vector3(...block.position), block, collect);
17850
17924
  const keys = /* @__PURE__ */ new Map();
17851
17925
  const types = /* @__PURE__ */ new Set();
17852
17926
  for (const block of multiblock.blocks) {
@@ -17862,7 +17936,7 @@ var MineRenderWorld = class {
17862
17936
  }
17863
17937
  if (!executor) {
17864
17938
  const groups2 = /* @__PURE__ */ new Map();
17865
- const position = new import_three42.Vector3();
17939
+ const position = new import_three45.Vector3();
17866
17940
  for (const block of multiblock.blocks) {
17867
17941
  const [x, y, z] = block.position;
17868
17942
  this.validatePosBounds(position.set(x, y, z));
@@ -17902,7 +17976,7 @@ var MineRenderWorld = class {
17902
17976
  try {
17903
17977
  positions = await chunk.placeBlocks(blocks);
17904
17978
  } finally {
17905
- positions ?? (positions = blocks.map(({ index }) => new import_three42.Vector3(
17979
+ positions ?? (positions = blocks.map(({ index }) => new import_three45.Vector3(
17906
17980
  chunk.x * 16 + index % 16,
17907
17981
  chunk.y * 16 + Math.floor(index / 256),
17908
17982
  chunk.z * 16 + Math.floor(index / 16) % 16
@@ -17954,7 +18028,7 @@ var MineRenderWorld = class {
17954
18028
  }
17955
18029
  for (const section of chunk.sections) {
17956
18030
  if (section.biomes) {
17957
- const position = new import_three42.Vector3(chunk.x * 16, section.y * 16, chunk.z * 16);
18031
+ const position = new import_three45.Vector3(chunk.x * 16, section.y * 16, chunk.z * 16);
17958
18032
  this.validatePosBounds(position);
17959
18033
  const copy = [...section.biomes];
17960
18034
  if (copy.length !== 64 || !copy.every((id) => typeof id === "string" && id.length > 0)) {
@@ -17970,7 +18044,7 @@ var MineRenderWorld = class {
17970
18044
  for (const section of chunk.sections) {
17971
18045
  if (!executor) {
17972
18046
  if (!occupiedSections.has(section.y)) continue;
17973
- const position = new import_three42.Vector3(chunk.x * 16, section.y * 16, chunk.z * 16);
18047
+ const position = new import_three45.Vector3(chunk.x * 16, section.y * 16, chunk.z * 16);
17974
18048
  this.validatePosBounds(position);
17975
18049
  const target = this.getOrCreateChunkAt(position);
17976
18050
  try {
@@ -18074,7 +18148,7 @@ var MineRenderWorld = class {
18074
18148
  this.sectionModels?.clear();
18075
18149
  }
18076
18150
  updateCulling(positions) {
18077
- const neighbor = new import_three42.Vector3();
18151
+ const neighbor = new import_three45.Vector3();
18078
18152
  for (const pos of positions) {
18079
18153
  const cx = Math.floor(pos.x / 16), cy = Math.floor(pos.y / 16), cz = Math.floor(pos.z / 16);
18080
18154
  const chunk = this._chunks.get(`${cx}_${cy}_${cz}`);
@@ -18205,7 +18279,7 @@ var MineRenderWorld = class {
18205
18279
  }
18206
18280
  /** Converts block coordinates to scene units by multiplying each component by 16. */
18207
18281
  static worldToScenePosition(pos) {
18208
- return new import_three42.Vector3(
18282
+ return new import_three45.Vector3(
18209
18283
  pos.x * 16,
18210
18284
  pos.y * 16,
18211
18285
  pos.z * 16
@@ -18213,7 +18287,7 @@ var MineRenderWorld = class {
18213
18287
  }
18214
18288
  /** Converts scene units to block coordinates without rounding to an integer block. */
18215
18289
  static sceneToWorldPosition(pos) {
18216
- return new import_three42.Vector3(
18290
+ return new import_three45.Vector3(
18217
18291
  pos.x / 16,
18218
18292
  pos.y / 16,
18219
18293
  pos.z / 16
@@ -18236,7 +18310,7 @@ var MineRenderWorld = class {
18236
18310
  init_Model();
18237
18311
 
18238
18312
  // src/world/SectionMesh.ts
18239
- var import_three43 = require("three");
18313
+ var import_three46 = require("three");
18240
18314
  init_CanvasCompat();
18241
18315
  init_Materials();
18242
18316
 
@@ -18561,7 +18635,7 @@ var SectionWorker = _SectionWorker;
18561
18635
 
18562
18636
  // src/world/SectionMesh.ts
18563
18637
  var templateCache = /* @__PURE__ */ new WeakMap();
18564
- var WATER_TINT = new import_three43.Color(4159204).toArray();
18638
+ var WATER_TINT = new import_three46.Color(4159204).toArray();
18565
18639
  function toInput(entries, maxAtlasSize, fluids, lighting) {
18566
18640
  if (!Number.isInteger(maxAtlasSize) || maxAtlasSize < 1) throw new RangeError("Section atlas size must be a positive integer");
18567
18641
  const atlases = [];
@@ -18658,7 +18732,7 @@ function toInput(entries, maxAtlasSize, fluids, lighting) {
18658
18732
  }
18659
18733
  return { input, atlases };
18660
18734
  }
18661
- var SectionMesh = class _SectionMesh extends import_three43.Group {
18735
+ var SectionMesh = class _SectionMesh extends import_three46.Group {
18662
18736
  constructor() {
18663
18737
  super(...arguments);
18664
18738
  this.ownedMeshes = [];
@@ -18689,26 +18763,26 @@ var SectionMesh = class _SectionMesh extends import_three43.Group {
18689
18763
  for (const { atlas, x, y } of page.placements) {
18690
18764
  context.drawImage(atlases[atlas].image.canvas, x, y);
18691
18765
  }
18692
- const geometry = new import_three43.BufferGeometry();
18693
- geometry.setAttribute("position", new import_three43.Float32BufferAttribute(page.positions.buffer, 3));
18694
- geometry.setAttribute("normal", new import_three43.Float32BufferAttribute(page.normals.buffer, 3));
18695
- geometry.setAttribute("uv", new import_three43.Float32BufferAttribute(page.uvs.buffer, 2));
18696
- geometry.setAttribute("uvBounds", new import_three43.Float32BufferAttribute(page.uvBounds.buffer, 4));
18697
- geometry.setAttribute("color", new import_three43.Float32BufferAttribute(page.colors.buffer, 3));
18698
- geometry.setIndex(new import_three43.Uint32BufferAttribute(page.indices.buffer, 1));
18766
+ const geometry = new import_three46.BufferGeometry();
18767
+ geometry.setAttribute("position", new import_three46.Float32BufferAttribute(page.positions.buffer, 3));
18768
+ geometry.setAttribute("normal", new import_three46.Float32BufferAttribute(page.normals.buffer, 3));
18769
+ geometry.setAttribute("uv", new import_three46.Float32BufferAttribute(page.uvs.buffer, 2));
18770
+ geometry.setAttribute("uvBounds", new import_three46.Float32BufferAttribute(page.uvBounds.buffer, 4));
18771
+ geometry.setAttribute("color", new import_three46.Float32BufferAttribute(page.colors.buffer, 3));
18772
+ geometry.setIndex(new import_three46.Uint32BufferAttribute(page.indices.buffer, 1));
18699
18773
  geometry.computeBoundingBox();
18700
18774
  geometry.computeBoundingSphere();
18701
18775
  const transparent = page.layer === 2 ? atlases[page.placements[0].atlas].hasTranslucency : page.layer === 1;
18702
18776
  const material = Materials.createShadedCanvasMaterial(canvas, transparent, false, true);
18703
- material.side = import_three43.FrontSide;
18777
+ material.side = import_three46.FrontSide;
18704
18778
  if (page.layer === 2) {
18705
- material.side = import_three43.DoubleSide;
18779
+ material.side = import_three46.DoubleSide;
18706
18780
  material.forceSinglePass = true;
18707
18781
  material.depthWrite = !material.transparent;
18708
18782
  }
18709
18783
  material.vertexColors = true;
18710
18784
  const texture = material.uniforms?.map?.value ?? material.map;
18711
- const mesh = new import_three43.Mesh(geometry, material);
18785
+ const mesh = new import_three46.Mesh(geometry, material);
18712
18786
  section.add(mesh);
18713
18787
  section.blockIndices.set(mesh, page.blockIndices);
18714
18788
  const unsubscribe = [];
@@ -18747,8 +18821,7 @@ init_FluidGeometry();
18747
18821
  init_FluidQuads();
18748
18822
  init_CubeFace();
18749
18823
  init_InstanceReference();
18750
- init_three();
18751
- var WATER_TINT2 = new import_three44.Color(4159204).toArray();
18824
+ var WATER_TINT2 = new import_three47.Color(4159204).toArray();
18752
18825
  var Chunk = class _Chunk {
18753
18826
  constructor(scene, x, y, z, onBlocksChanged, sectionModels, neighborCell, biomeAt, onBiomesChanged, lightAt, onLightCleared, ambientLight = 0) {
18754
18827
  this.onBlocksChanged = onBlocksChanged;
@@ -18765,7 +18838,7 @@ var Chunk = class _Chunk {
18765
18838
  this.sectionBlocks = /* @__PURE__ */ new Map();
18766
18839
  this.hiddenBlocks = /* @__PURE__ */ new Set();
18767
18840
  this.fluidCells = new Uint8Array(4096);
18768
- this.blockPosition = new import_three44.Vector3();
18841
+ this.blockPosition = new import_three47.Vector3();
18769
18842
  this.meshDirty = false;
18770
18843
  this.meshGeneration = 0;
18771
18844
  this.scene = scene;
@@ -18780,18 +18853,8 @@ var Chunk = class _Chunk {
18780
18853
  const meshes = (root, scene) => {
18781
18854
  const cached2 = roots.get(root);
18782
18855
  if (cached2) return cached2;
18783
- const result = [];
18856
+ const result = pickableMeshes(root, scene, raycaster);
18784
18857
  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
18858
  return result;
18796
18859
  };
18797
18860
  const add = (root, owner, reference) => {
@@ -18822,11 +18885,8 @@ var Chunk = class _Chunk {
18822
18885
  }
18823
18886
  }
18824
18887
  }
18825
- for (const hit of raycaster.intersectObjects([...targets.keys()], false)) {
18826
- if (!hit.face) continue;
18888
+ for (const hit of visibleHits(raycaster, [...targets.keys()])) {
18827
18889
  const mesh = hit.object;
18828
- const material = Array.isArray(mesh.material) ? mesh.material[hit.face.materialIndex] : mesh.material;
18829
- if (!material?.visible) continue;
18830
18890
  const entry = targets.get(mesh);
18831
18891
  let owner = entry.owners.get(hit.instanceId) ?? entry.owners.get(void 0);
18832
18892
  if (entry.section) {
@@ -18836,21 +18896,15 @@ var Chunk = class _Chunk {
18836
18896
  if (!owner || owner.chunk.hiddenBlocks.has(owner.index)) continue;
18837
18897
  const info = owner.chunk.renderedBlocks.get(owner.index);
18838
18898
  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
18899
  return {
18846
- position: new import_three44.Vector3(
18900
+ position: new import_three47.Vector3(
18847
18901
  owner.chunk.x * 16 + owner.index % 16,
18848
18902
  owner.chunk.y * 16 + Math.floor(owner.index / 256),
18849
18903
  owner.chunk.z * 16 + Math.floor(owner.index / 16) % 16
18850
18904
  ),
18851
18905
  block: info.block,
18852
18906
  point: hit.point.clone(),
18853
- normal: hit.face.normal.clone().applyNormalMatrix(new import_three44.Matrix3().getNormalMatrix(matrix)),
18907
+ normal: hitNormal(hit),
18854
18908
  distance: hit.distance
18855
18909
  };
18856
18910
  }
@@ -18858,18 +18912,18 @@ var Chunk = class _Chunk {
18858
18912
  }
18859
18913
  getBlockAt(posOrX, y, z) {
18860
18914
  if (typeof posOrX == "number") {
18861
- return this.getBlockAt(new import_three44.Vector3(posOrX, y, z));
18915
+ return this.getBlockAt(new import_three47.Vector3(posOrX, y, z));
18862
18916
  }
18863
18917
  if (isTripleArray(posOrX)) {
18864
- return this.getBlockAt(new import_three44.Vector3(posOrX[0], posOrX[1], posOrX[2]));
18918
+ return this.getBlockAt(new import_three47.Vector3(posOrX[0], posOrX[1], posOrX[2]));
18865
18919
  }
18866
18920
  const pos = this.blockPosition.set(posOrX.x - this.x * 16, posOrX.y - this.y * 16, posOrX.z - this.z * 16);
18867
18921
  const index = _Chunk.chunkPosToBlockIndex(pos);
18868
18922
  return this.renderedBlocks.get(index);
18869
18923
  }
18870
18924
  getBiomeAt(posOrX, y, z) {
18871
- if (typeof posOrX === "number") return this.getBiomeAt(new import_three44.Vector3(posOrX, y, z));
18872
- if (isTripleArray(posOrX)) return this.getBiomeAt(new import_three44.Vector3(...posOrX));
18925
+ if (typeof posOrX === "number") return this.getBiomeAt(new import_three47.Vector3(posOrX, y, z));
18926
+ if (isTripleArray(posOrX)) return this.getBiomeAt(new import_three47.Vector3(...posOrX));
18873
18927
  const pos = this.worldPosToChunkPos(posOrX);
18874
18928
  _Chunk.chunkPosToBlockIndex(pos);
18875
18929
  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 +18966,17 @@ var Chunk = class _Chunk {
18912
18966
  this.hiddenBlocks.add(index);
18913
18967
  this.renderedBlocks.get(index)?.object?.setVisible(false);
18914
18968
  }
18915
- const positions = blocks.map(({ index }) => new import_three44.Vector3(...this.positionAt(index)));
18969
+ const positions = blocks.map(({ index }) => new import_three47.Vector3(...this.positionAt(index)));
18916
18970
  if (this.onBlocksChanged) await this.onBlocksChanged(positions);
18917
18971
  else await this.rebuildSectionMesh();
18918
18972
  }
18919
18973
  }
18920
18974
  async setBlockAt(posOrX, yOrBlock, z, block) {
18921
18975
  if (typeof posOrX == "number") {
18922
- return this.setBlockAt(new import_three44.Vector3(posOrX, yOrBlock, z), block);
18976
+ return this.setBlockAt(new import_three47.Vector3(posOrX, yOrBlock, z), block);
18923
18977
  }
18924
18978
  if (isTripleArray(posOrX)) {
18925
- return this.setBlockAt(new import_three44.Vector3(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
18979
+ return this.setBlockAt(new import_three47.Vector3(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
18926
18980
  }
18927
18981
  const worldPos = posOrX;
18928
18982
  const pos = this.worldPosToChunkPos(worldPos);
@@ -18977,7 +19031,7 @@ var Chunk = class _Chunk {
18977
19031
  this.fluidCells[index] = 0;
18978
19032
  this.renderedBlocks.delete(index);
18979
19033
  this.objectBlocks.delete(index);
18980
- const worldPos = new import_three44.Vector3(
19034
+ const worldPos = new import_three47.Vector3(
18981
19035
  this.x * 16 + index % 16,
18982
19036
  this.y * 16 + Math.floor(index / 256),
18983
19037
  this.z * 16 + Math.floor(index / 16) % 16
@@ -19108,7 +19162,7 @@ var Chunk = class _Chunk {
19108
19162
  biome,
19109
19163
  biomePosition: this.biomePosition(index, blockState3, this.data.stateAt(this.data.idAt(index)))
19110
19164
  });
19111
- object4.setPosition(new import_three44.Vector3(
19165
+ object4.setPosition(new import_three47.Vector3(
19112
19166
  this.x * 256 + index % 16 * 16,
19113
19167
  this.y * 256 + Math.floor(index / 256) * 16,
19114
19168
  this.z * 256 + Math.floor(index / 16) % 16 * 16
@@ -19200,7 +19254,7 @@ var Chunk = class _Chunk {
19200
19254
  context.prepared = await prepare(async () => await available() ? BlockTints.getBiomeColor(blockState3?.key, biome, position) : void 0);
19201
19255
  if (fluid?.kind === "water" && await available()) {
19202
19256
  const color2 = await Biomes.getColor(biome, "water", blockState3?.key);
19203
- if (color2 !== void 0 && color2 !== 4159204) context.waterTint = new import_three44.Color(color2).toArray();
19257
+ if (color2 !== void 0 && color2 !== 4159204) context.waterTint = new import_three47.Color(color2).toArray();
19204
19258
  }
19205
19259
  }
19206
19260
  for (const index of indices2) contexts.set(index, context);
@@ -19371,7 +19425,7 @@ var Chunk = class _Chunk {
19371
19425
  /** Removes stored blocks and render objects. Set `notify` to false to skip the owning world's update. */
19372
19426
  async clear(notify = true) {
19373
19427
  const positions = notify && this.onBlocksChanged ? [...this.renderedBlocks.keys()].map((index) => this.chunkPosToWorldPos(
19374
- new import_three44.Vector3(index % 16, Math.floor(index / 256), Math.floor(index / 16) % 16)
19428
+ new import_three47.Vector3(index % 16, Math.floor(index / 256), Math.floor(index / 16) % 16)
19375
19429
  )) : [];
19376
19430
  for (const info of this.renderedBlocks.values()) info.object?.removeFromScene();
19377
19431
  this.sectionBlocks.clear();
@@ -19407,14 +19461,14 @@ var Chunk = class _Chunk {
19407
19461
  return pos.y * 16 * 16 + pos.z * 16 + pos.x;
19408
19462
  }
19409
19463
  worldPosToChunkPos(pos) {
19410
- return new import_three44.Vector3(
19464
+ return new import_three47.Vector3(
19411
19465
  pos.x - this.x * 16,
19412
19466
  pos.y - this.y * 16,
19413
19467
  pos.z - this.z * 16
19414
19468
  );
19415
19469
  }
19416
19470
  chunkPosToWorldPos(pos) {
19417
- return new import_three44.Vector3(
19471
+ return new import_three47.Vector3(
19418
19472
  this.x * 16 + pos.x,
19419
19473
  this.y * 16 + pos.y,
19420
19474
  this.z * 16 + pos.z