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/node/index.d.mts
CHANGED
|
@@ -3990,6 +3990,22 @@ declare class Chunk<SectionMeshing extends boolean = false> {
|
|
|
3990
3990
|
chunkPosToWorldPos(pos: Vector3): Vector3;
|
|
3991
3991
|
}
|
|
3992
3992
|
|
|
3993
|
+
/** The nearest rendered mob triangle hit by a world entity raycast. */
|
|
3994
|
+
interface WorldEntityIntersection {
|
|
3995
|
+
/** Minecraft entity ID, such as minecraft:pig. */
|
|
3996
|
+
type: string;
|
|
3997
|
+
/** Copied saved position in Minecraft block units, including fractional coordinates. */
|
|
3998
|
+
position: Vector3;
|
|
3999
|
+
/** Live rendered root, removed and disposed when its column unloads or the world clears. */
|
|
4000
|
+
object: EntityObject;
|
|
4001
|
+
/** Hit position in scene units. */
|
|
4002
|
+
point: Vector3;
|
|
4003
|
+
/** Unit face normal in scene space. */
|
|
4004
|
+
normal: Vector3;
|
|
4005
|
+
/** Distance from the ray origin, in scene units. */
|
|
4006
|
+
distance: number;
|
|
4007
|
+
}
|
|
4008
|
+
|
|
3993
4009
|
/**
|
|
3994
4010
|
* Stores and renders blocks in sparse 16×16×16 chunks.
|
|
3995
4011
|
* Positions use integer block coordinates, including negatives. One block is 16 scene units.
|
|
@@ -4016,6 +4032,12 @@ declare class MineRenderWorld<SectionMeshing extends boolean = false> {
|
|
|
4016
4032
|
* Includes fluids and block entities; texture alpha does not change triangle intersections.
|
|
4017
4033
|
*/
|
|
4018
4034
|
raycast(raycaster: Raycaster): WorldBlockIntersection | undefined;
|
|
4035
|
+
/**
|
|
4036
|
+
* Returns the nearest visible mob geometry hit when renderEntities is enabled.
|
|
4037
|
+
* Respects layers and near/far; compare its distance with raycast() to account for blocks.
|
|
4038
|
+
* Texture alpha does not change triangle intersections.
|
|
4039
|
+
*/
|
|
4040
|
+
raycastEntities(raycaster: Raycaster): WorldEntityIntersection | undefined;
|
|
4019
4041
|
/** Whether neighboring opaque cubes shade block-face corners. Defaults to false. */
|
|
4020
4042
|
get ambientOcclusion(): boolean;
|
|
4021
4043
|
/** Rebuilds loaded blocks with or without corner shading. Block data and saved lighting are preserved. */
|
|
@@ -4256,4 +4278,4 @@ declare class NodeRenderer extends Renderer {
|
|
|
4256
4278
|
dispose(): void;
|
|
4257
4279
|
}
|
|
4258
4280
|
|
|
4259
|
-
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, 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, NodeCache, NodeEnv, type NodeImageOptions, NodeRenderer, type NodeRendererOptions, 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, registerNodeEnv, 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 };
|
|
4281
|
+
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, 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, NodeCache, NodeEnv, type NodeImageOptions, NodeRenderer, type NodeRendererOptions, 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, registerNodeEnv, 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/node/index.d.ts
CHANGED
|
@@ -3990,6 +3990,22 @@ declare class Chunk<SectionMeshing extends boolean = false> {
|
|
|
3990
3990
|
chunkPosToWorldPos(pos: Vector3): Vector3;
|
|
3991
3991
|
}
|
|
3992
3992
|
|
|
3993
|
+
/** The nearest rendered mob triangle hit by a world entity raycast. */
|
|
3994
|
+
interface WorldEntityIntersection {
|
|
3995
|
+
/** Minecraft entity ID, such as minecraft:pig. */
|
|
3996
|
+
type: string;
|
|
3997
|
+
/** Copied saved position in Minecraft block units, including fractional coordinates. */
|
|
3998
|
+
position: Vector3;
|
|
3999
|
+
/** Live rendered root, removed and disposed when its column unloads or the world clears. */
|
|
4000
|
+
object: EntityObject;
|
|
4001
|
+
/** Hit position in scene units. */
|
|
4002
|
+
point: Vector3;
|
|
4003
|
+
/** Unit face normal in scene space. */
|
|
4004
|
+
normal: Vector3;
|
|
4005
|
+
/** Distance from the ray origin, in scene units. */
|
|
4006
|
+
distance: number;
|
|
4007
|
+
}
|
|
4008
|
+
|
|
3993
4009
|
/**
|
|
3994
4010
|
* Stores and renders blocks in sparse 16×16×16 chunks.
|
|
3995
4011
|
* Positions use integer block coordinates, including negatives. One block is 16 scene units.
|
|
@@ -4016,6 +4032,12 @@ declare class MineRenderWorld<SectionMeshing extends boolean = false> {
|
|
|
4016
4032
|
* Includes fluids and block entities; texture alpha does not change triangle intersections.
|
|
4017
4033
|
*/
|
|
4018
4034
|
raycast(raycaster: Raycaster): WorldBlockIntersection | undefined;
|
|
4035
|
+
/**
|
|
4036
|
+
* Returns the nearest visible mob geometry hit when renderEntities is enabled.
|
|
4037
|
+
* Respects layers and near/far; compare its distance with raycast() to account for blocks.
|
|
4038
|
+
* Texture alpha does not change triangle intersections.
|
|
4039
|
+
*/
|
|
4040
|
+
raycastEntities(raycaster: Raycaster): WorldEntityIntersection | undefined;
|
|
4019
4041
|
/** Whether neighboring opaque cubes shade block-face corners. Defaults to false. */
|
|
4020
4042
|
get ambientOcclusion(): boolean;
|
|
4021
4043
|
/** Rebuilds loaded blocks with or without corner shading. Block data and saved lighting are preserved. */
|
|
@@ -4256,4 +4278,4 @@ declare class NodeRenderer extends Renderer {
|
|
|
4256
4278
|
dispose(): void;
|
|
4257
4279
|
}
|
|
4258
4280
|
|
|
4259
|
-
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, 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, NodeCache, NodeEnv, type NodeImageOptions, NodeRenderer, type NodeRendererOptions, 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, registerNodeEnv, 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 };
|
|
4281
|
+
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, 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, NodeCache, NodeEnv, type NodeImageOptions, NodeRenderer, type NodeRendererOptions, 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, registerNodeEnv, 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/node/index.js
CHANGED
|
@@ -17390,12 +17390,12 @@ var AnvilWorldSource = class {
|
|
|
17390
17390
|
};
|
|
17391
17391
|
|
|
17392
17392
|
// src/world/Chunk.ts
|
|
17393
|
-
var
|
|
17393
|
+
var import_three47 = require("three");
|
|
17394
17394
|
init_BlockStates();
|
|
17395
17395
|
init_AssetKey();
|
|
17396
17396
|
|
|
17397
17397
|
// src/world/MineRenderWorld.ts
|
|
17398
|
-
var
|
|
17398
|
+
var import_three45 = require("three");
|
|
17399
17399
|
init_Model();
|
|
17400
17400
|
init_util();
|
|
17401
17401
|
init_AssetKey();
|
|
@@ -17660,11 +17660,74 @@ function resolveSavedEntity(entity) {
|
|
|
17660
17660
|
|
|
17661
17661
|
// src/world/_entities/WorldEntities.ts
|
|
17662
17662
|
init_BannerPatterns();
|
|
17663
|
+
var import_three44 = require("three");
|
|
17664
|
+
|
|
17665
|
+
// src/world/_picking/Picking.ts
|
|
17666
|
+
var import_three42 = require("three");
|
|
17667
|
+
init_three();
|
|
17668
|
+
function pickableMeshes(root, scene, raycaster) {
|
|
17669
|
+
const result = [];
|
|
17670
|
+
let attached = false;
|
|
17671
|
+
for (let parent = root; parent; parent = parent.parent) {
|
|
17672
|
+
if (!parent.visible) return result;
|
|
17673
|
+
if (parent === scene) attached = true;
|
|
17674
|
+
}
|
|
17675
|
+
if (!attached) return result;
|
|
17676
|
+
root.updateWorldMatrix(true, true);
|
|
17677
|
+
root.traverseVisible((object4) => {
|
|
17678
|
+
if (isMesh(object4) && raycaster.layers.test(object4.layers)) result.push(object4);
|
|
17679
|
+
});
|
|
17680
|
+
return result;
|
|
17681
|
+
}
|
|
17682
|
+
function visibleHits(raycaster, meshes) {
|
|
17683
|
+
return raycaster.intersectObjects(meshes, false).filter((hit) => {
|
|
17684
|
+
if (!hit.face) return false;
|
|
17685
|
+
const mesh = hit.object;
|
|
17686
|
+
const material = Array.isArray(mesh.material) ? mesh.material[hit.face.materialIndex] : mesh.material;
|
|
17687
|
+
return material?.visible;
|
|
17688
|
+
});
|
|
17689
|
+
}
|
|
17690
|
+
function hitNormal(hit) {
|
|
17691
|
+
const mesh = hit.object;
|
|
17692
|
+
const matrix = mesh.matrixWorld.clone();
|
|
17693
|
+
if (isInstancedMesh(mesh) && hit.instanceId !== void 0) {
|
|
17694
|
+
const instance = new import_three42.Matrix4();
|
|
17695
|
+
mesh.getMatrixAt(hit.instanceId, instance);
|
|
17696
|
+
matrix.multiply(instance);
|
|
17697
|
+
}
|
|
17698
|
+
return hit.face.normal.clone().applyNormalMatrix(new import_three42.Matrix3().getNormalMatrix(matrix));
|
|
17699
|
+
}
|
|
17700
|
+
|
|
17701
|
+
// src/world/_entities/WorldEntities.ts
|
|
17663
17702
|
var WorldEntities = class {
|
|
17664
17703
|
constructor(scene) {
|
|
17665
17704
|
this.scene = scene;
|
|
17666
17705
|
this.columns = /* @__PURE__ */ new Map();
|
|
17667
17706
|
}
|
|
17707
|
+
/** Finds the nearest visible triangle belonging to an entity owned by this world. */
|
|
17708
|
+
raycast(raycaster) {
|
|
17709
|
+
const owners = /* @__PURE__ */ new Map();
|
|
17710
|
+
for (const column of this.columns.values()) {
|
|
17711
|
+
for (const [object4, placement] of column) {
|
|
17712
|
+
for (const mesh of pickableMeshes(object4, this.scene, raycaster)) {
|
|
17713
|
+
owners.set(mesh, { object: object4, ...placement });
|
|
17714
|
+
}
|
|
17715
|
+
}
|
|
17716
|
+
}
|
|
17717
|
+
for (const hit of visibleHits(raycaster, [...owners.keys()])) {
|
|
17718
|
+
const mesh = hit.object;
|
|
17719
|
+
const owner = owners.get(mesh);
|
|
17720
|
+
return {
|
|
17721
|
+
type: owner.type,
|
|
17722
|
+
position: new import_three44.Vector3(...owner.position),
|
|
17723
|
+
object: owner.object,
|
|
17724
|
+
point: hit.point.clone(),
|
|
17725
|
+
normal: hitNormal(hit),
|
|
17726
|
+
distance: hit.distance
|
|
17727
|
+
};
|
|
17728
|
+
}
|
|
17729
|
+
return void 0;
|
|
17730
|
+
}
|
|
17668
17731
|
/** Captures column ownership before asynchronous block or asset loading starts. */
|
|
17669
17732
|
prepare(entities = [], column) {
|
|
17670
17733
|
const placements = entities.flatMap((entity) => {
|
|
@@ -17673,7 +17736,7 @@ var WorldEntities = class {
|
|
|
17673
17736
|
const position = [...entity.position];
|
|
17674
17737
|
const key = column?.join(",") ?? `${Math.floor(position[0] / 16)},${Math.floor(position[2] / 16)}`;
|
|
17675
17738
|
let owner = this.columns.get(key);
|
|
17676
|
-
if (!owner) this.columns.set(key, owner = /* @__PURE__ */ new
|
|
17739
|
+
if (!owner) this.columns.set(key, owner = /* @__PURE__ */ new Map());
|
|
17677
17740
|
return [{ ...resolved, position, column: key, owner }];
|
|
17678
17741
|
});
|
|
17679
17742
|
return async () => {
|
|
@@ -17699,7 +17762,7 @@ var WorldEntities = class {
|
|
|
17699
17762
|
object4.rotation.y = placement.yaw;
|
|
17700
17763
|
await object4.init();
|
|
17701
17764
|
if (!current()) return;
|
|
17702
|
-
placement.owner.
|
|
17765
|
+
placement.owner.set(object4, { type: placement.key.toNamespacedString(), position: placement.position });
|
|
17703
17766
|
this.scene.add(object4);
|
|
17704
17767
|
} catch (error) {
|
|
17705
17768
|
console.warn(`Could not draw saved entity ${placement.key.toNamespacedString()}, skipping it`, error);
|
|
@@ -17714,7 +17777,7 @@ var WorldEntities = class {
|
|
|
17714
17777
|
const objects = this.columns.get(key);
|
|
17715
17778
|
this.columns.delete(key);
|
|
17716
17779
|
if (!objects) return;
|
|
17717
|
-
for (const object4 of objects) {
|
|
17780
|
+
for (const object4 of objects.keys()) {
|
|
17718
17781
|
object4.removeFromScene();
|
|
17719
17782
|
object4.dispose();
|
|
17720
17783
|
}
|
|
@@ -17782,6 +17845,14 @@ var MineRenderWorld = class {
|
|
|
17782
17845
|
raycast(raycaster) {
|
|
17783
17846
|
return Chunk.raycast(this._chunks.values(), raycaster);
|
|
17784
17847
|
}
|
|
17848
|
+
/**
|
|
17849
|
+
* Returns the nearest visible mob geometry hit when renderEntities is enabled.
|
|
17850
|
+
* Respects layers and near/far; compare its distance with raycast() to account for blocks.
|
|
17851
|
+
* Texture alpha does not change triangle intersections.
|
|
17852
|
+
*/
|
|
17853
|
+
raycastEntities(raycaster) {
|
|
17854
|
+
return this.entities?.raycast(raycaster);
|
|
17855
|
+
}
|
|
17785
17856
|
/** Whether neighboring opaque cubes shade block-face corners. Defaults to false. */
|
|
17786
17857
|
get ambientOcclusion() {
|
|
17787
17858
|
return this._ambientOcclusion;
|
|
@@ -17802,25 +17873,25 @@ var MineRenderWorld = class {
|
|
|
17802
17873
|
}
|
|
17803
17874
|
getBlockAt(posOrX, y, z) {
|
|
17804
17875
|
if (typeof posOrX == "number") {
|
|
17805
|
-
return this.getBlockAt(new
|
|
17876
|
+
return this.getBlockAt(new import_three45.Vector3(posOrX, y, z));
|
|
17806
17877
|
}
|
|
17807
17878
|
if (isTripleArray(posOrX)) {
|
|
17808
|
-
return this.getBlockAt(new
|
|
17879
|
+
return this.getBlockAt(new import_three45.Vector3(posOrX[0], posOrX[1], posOrX[2]));
|
|
17809
17880
|
}
|
|
17810
17881
|
this.validatePosBounds(posOrX);
|
|
17811
17882
|
return this.getChunkAt(posOrX)?.getBlockAt(posOrX);
|
|
17812
17883
|
}
|
|
17813
17884
|
getBiomeAt(posOrX, y, z) {
|
|
17814
|
-
if (typeof posOrX === "number") return this.getBiomeAt(new
|
|
17815
|
-
if (isTripleArray(posOrX)) return this.getBiomeAt(new
|
|
17885
|
+
if (typeof posOrX === "number") return this.getBiomeAt(new import_three45.Vector3(posOrX, y, z));
|
|
17886
|
+
if (isTripleArray(posOrX)) return this.getBiomeAt(new import_three45.Vector3(...posOrX));
|
|
17816
17887
|
this.validatePosBounds(posOrX);
|
|
17817
17888
|
const cx = Math.floor(posOrX.x / 16), cy = Math.floor(posOrX.y / 16), cz = Math.floor(posOrX.z / 16);
|
|
17818
17889
|
const lx = posOrX.x - cx * 16, ly = posOrX.y - cy * 16, lz = posOrX.z - cz * 16;
|
|
17819
17890
|
return this.biomes.get(`${cx}_${cz}`)?.get(cy)?.[Math.floor(lx / 4) + Math.floor(lz / 4) * 4 + Math.floor(ly / 4) * 16];
|
|
17820
17891
|
}
|
|
17821
17892
|
getLightAt(posOrX, y, z) {
|
|
17822
|
-
if (typeof posOrX === "number") return this.getLightAt(new
|
|
17823
|
-
if (isTripleArray(posOrX)) return this.getLightAt(new
|
|
17893
|
+
if (typeof posOrX === "number") return this.getLightAt(new import_three45.Vector3(posOrX, y, z));
|
|
17894
|
+
if (isTripleArray(posOrX)) return this.getLightAt(new import_three45.Vector3(...posOrX));
|
|
17824
17895
|
this.validatePosBounds(posOrX);
|
|
17825
17896
|
const { x, y: py, z: pz } = posOrX;
|
|
17826
17897
|
const cx = Math.floor(x / 16), cy = Math.floor(py / 16), cz = Math.floor(pz / 16);
|
|
@@ -17838,10 +17909,10 @@ var MineRenderWorld = class {
|
|
|
17838
17909
|
}
|
|
17839
17910
|
async setBlockAt(posOrX, yOrBlock, z, block) {
|
|
17840
17911
|
if (typeof posOrX == "number") {
|
|
17841
|
-
return this.setBlockAt(new
|
|
17912
|
+
return this.setBlockAt(new import_three45.Vector3(posOrX, yOrBlock, z), block);
|
|
17842
17913
|
}
|
|
17843
17914
|
if (isTripleArray(posOrX)) {
|
|
17844
|
-
return this.setBlockAt(new
|
|
17915
|
+
return this.setBlockAt(new import_three45.Vector3(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
|
|
17845
17916
|
}
|
|
17846
17917
|
return this.placeBlock(posOrX, yOrBlock);
|
|
17847
17918
|
}
|
|
@@ -17852,10 +17923,10 @@ var MineRenderWorld = class {
|
|
|
17852
17923
|
}
|
|
17853
17924
|
async setBlockVisibleAt(posOrX, yOrVisible, z, visible) {
|
|
17854
17925
|
if (typeof posOrX === "number") {
|
|
17855
|
-
return this.setBlockVisibleAt(new
|
|
17926
|
+
return this.setBlockVisibleAt(new import_three45.Vector3(posOrX, yOrVisible, z), visible);
|
|
17856
17927
|
}
|
|
17857
17928
|
if (isTripleArray(posOrX)) {
|
|
17858
|
-
return this.setBlockVisibleAt(new
|
|
17929
|
+
return this.setBlockVisibleAt(new import_three45.Vector3(...posOrX), yOrVisible);
|
|
17859
17930
|
}
|
|
17860
17931
|
this.validatePosBounds(posOrX);
|
|
17861
17932
|
await this.getChunkAt(posOrX)?.setBlockVisibleAt(posOrX, yOrVisible);
|
|
@@ -17881,7 +17952,7 @@ var MineRenderWorld = class {
|
|
|
17881
17952
|
const collect = async (positions2) => {
|
|
17882
17953
|
for (const pos of positions2) changes.set(pos.toArray().join(","), pos);
|
|
17883
17954
|
};
|
|
17884
|
-
const place = (block) => this.placeBlock(new
|
|
17955
|
+
const place = (block) => this.placeBlock(new import_three45.Vector3(...block.position), block, collect);
|
|
17885
17956
|
const keys = /* @__PURE__ */ new Map();
|
|
17886
17957
|
const types = /* @__PURE__ */ new Set();
|
|
17887
17958
|
for (const block of multiblock.blocks) {
|
|
@@ -17897,7 +17968,7 @@ var MineRenderWorld = class {
|
|
|
17897
17968
|
}
|
|
17898
17969
|
if (!executor) {
|
|
17899
17970
|
const groups2 = /* @__PURE__ */ new Map();
|
|
17900
|
-
const position = new
|
|
17971
|
+
const position = new import_three45.Vector3();
|
|
17901
17972
|
for (const block of multiblock.blocks) {
|
|
17902
17973
|
const [x, y, z] = block.position;
|
|
17903
17974
|
this.validatePosBounds(position.set(x, y, z));
|
|
@@ -17937,7 +18008,7 @@ var MineRenderWorld = class {
|
|
|
17937
18008
|
try {
|
|
17938
18009
|
positions = await chunk.placeBlocks(blocks);
|
|
17939
18010
|
} finally {
|
|
17940
|
-
positions ??= blocks.map(({ index }) => new
|
|
18011
|
+
positions ??= blocks.map(({ index }) => new import_three45.Vector3(
|
|
17941
18012
|
chunk.x * 16 + index % 16,
|
|
17942
18013
|
chunk.y * 16 + Math.floor(index / 256),
|
|
17943
18014
|
chunk.z * 16 + Math.floor(index / 16) % 16
|
|
@@ -17989,7 +18060,7 @@ var MineRenderWorld = class {
|
|
|
17989
18060
|
}
|
|
17990
18061
|
for (const section of chunk.sections) {
|
|
17991
18062
|
if (section.biomes) {
|
|
17992
|
-
const position = new
|
|
18063
|
+
const position = new import_three45.Vector3(chunk.x * 16, section.y * 16, chunk.z * 16);
|
|
17993
18064
|
this.validatePosBounds(position);
|
|
17994
18065
|
const copy = [...section.biomes];
|
|
17995
18066
|
if (copy.length !== 64 || !copy.every((id) => typeof id === "string" && id.length > 0)) {
|
|
@@ -18005,7 +18076,7 @@ var MineRenderWorld = class {
|
|
|
18005
18076
|
for (const section of chunk.sections) {
|
|
18006
18077
|
if (!executor) {
|
|
18007
18078
|
if (!occupiedSections.has(section.y)) continue;
|
|
18008
|
-
const position = new
|
|
18079
|
+
const position = new import_three45.Vector3(chunk.x * 16, section.y * 16, chunk.z * 16);
|
|
18009
18080
|
this.validatePosBounds(position);
|
|
18010
18081
|
const target = this.getOrCreateChunkAt(position);
|
|
18011
18082
|
try {
|
|
@@ -18109,7 +18180,7 @@ var MineRenderWorld = class {
|
|
|
18109
18180
|
this.sectionModels?.clear();
|
|
18110
18181
|
}
|
|
18111
18182
|
updateCulling(positions) {
|
|
18112
|
-
const neighbor = new
|
|
18183
|
+
const neighbor = new import_three45.Vector3();
|
|
18113
18184
|
for (const pos of positions) {
|
|
18114
18185
|
const cx = Math.floor(pos.x / 16), cy = Math.floor(pos.y / 16), cz = Math.floor(pos.z / 16);
|
|
18115
18186
|
const chunk = this._chunks.get(`${cx}_${cy}_${cz}`);
|
|
@@ -18240,7 +18311,7 @@ var MineRenderWorld = class {
|
|
|
18240
18311
|
}
|
|
18241
18312
|
/** Converts block coordinates to scene units by multiplying each component by 16. */
|
|
18242
18313
|
static worldToScenePosition(pos) {
|
|
18243
|
-
return new
|
|
18314
|
+
return new import_three45.Vector3(
|
|
18244
18315
|
pos.x * 16,
|
|
18245
18316
|
pos.y * 16,
|
|
18246
18317
|
pos.z * 16
|
|
@@ -18248,7 +18319,7 @@ var MineRenderWorld = class {
|
|
|
18248
18319
|
}
|
|
18249
18320
|
/** Converts scene units to block coordinates without rounding to an integer block. */
|
|
18250
18321
|
static sceneToWorldPosition(pos) {
|
|
18251
|
-
return new
|
|
18322
|
+
return new import_three45.Vector3(
|
|
18252
18323
|
pos.x / 16,
|
|
18253
18324
|
pos.y / 16,
|
|
18254
18325
|
pos.z / 16
|
|
@@ -18271,7 +18342,7 @@ var MineRenderWorld = class {
|
|
|
18271
18342
|
init_Model();
|
|
18272
18343
|
|
|
18273
18344
|
// src/world/SectionMesh.ts
|
|
18274
|
-
var
|
|
18345
|
+
var import_three46 = require("three");
|
|
18275
18346
|
init_CanvasCompat();
|
|
18276
18347
|
init_Materials();
|
|
18277
18348
|
|
|
@@ -18597,7 +18668,7 @@ var SectionWorker = class _SectionWorker {
|
|
|
18597
18668
|
|
|
18598
18669
|
// src/world/SectionMesh.ts
|
|
18599
18670
|
var templateCache = /* @__PURE__ */ new WeakMap();
|
|
18600
|
-
var WATER_TINT = new
|
|
18671
|
+
var WATER_TINT = new import_three46.Color(4159204).toArray();
|
|
18601
18672
|
function toInput(entries, maxAtlasSize, fluids, lighting) {
|
|
18602
18673
|
if (!Number.isInteger(maxAtlasSize) || maxAtlasSize < 1) throw new RangeError("Section atlas size must be a positive integer");
|
|
18603
18674
|
const atlases = [];
|
|
@@ -18694,7 +18765,7 @@ function toInput(entries, maxAtlasSize, fluids, lighting) {
|
|
|
18694
18765
|
}
|
|
18695
18766
|
return { input, atlases };
|
|
18696
18767
|
}
|
|
18697
|
-
var SectionMesh = class _SectionMesh extends
|
|
18768
|
+
var SectionMesh = class _SectionMesh extends import_three46.Group {
|
|
18698
18769
|
constructor() {
|
|
18699
18770
|
super(...arguments);
|
|
18700
18771
|
this.ownedMeshes = [];
|
|
@@ -18725,26 +18796,26 @@ var SectionMesh = class _SectionMesh extends import_three43.Group {
|
|
|
18725
18796
|
for (const { atlas, x, y } of page.placements) {
|
|
18726
18797
|
context.drawImage(atlases[atlas].image.canvas, x, y);
|
|
18727
18798
|
}
|
|
18728
|
-
const geometry = new
|
|
18729
|
-
geometry.setAttribute("position", new
|
|
18730
|
-
geometry.setAttribute("normal", new
|
|
18731
|
-
geometry.setAttribute("uv", new
|
|
18732
|
-
geometry.setAttribute("uvBounds", new
|
|
18733
|
-
geometry.setAttribute("color", new
|
|
18734
|
-
geometry.setIndex(new
|
|
18799
|
+
const geometry = new import_three46.BufferGeometry();
|
|
18800
|
+
geometry.setAttribute("position", new import_three46.Float32BufferAttribute(page.positions.buffer, 3));
|
|
18801
|
+
geometry.setAttribute("normal", new import_three46.Float32BufferAttribute(page.normals.buffer, 3));
|
|
18802
|
+
geometry.setAttribute("uv", new import_three46.Float32BufferAttribute(page.uvs.buffer, 2));
|
|
18803
|
+
geometry.setAttribute("uvBounds", new import_three46.Float32BufferAttribute(page.uvBounds.buffer, 4));
|
|
18804
|
+
geometry.setAttribute("color", new import_three46.Float32BufferAttribute(page.colors.buffer, 3));
|
|
18805
|
+
geometry.setIndex(new import_three46.Uint32BufferAttribute(page.indices.buffer, 1));
|
|
18735
18806
|
geometry.computeBoundingBox();
|
|
18736
18807
|
geometry.computeBoundingSphere();
|
|
18737
18808
|
const transparent = page.layer === 2 ? atlases[page.placements[0].atlas].hasTranslucency : page.layer === 1;
|
|
18738
18809
|
const material = Materials.createShadedCanvasMaterial(canvas, transparent, false, true);
|
|
18739
|
-
material.side =
|
|
18810
|
+
material.side = import_three46.FrontSide;
|
|
18740
18811
|
if (page.layer === 2) {
|
|
18741
|
-
material.side =
|
|
18812
|
+
material.side = import_three46.DoubleSide;
|
|
18742
18813
|
material.forceSinglePass = true;
|
|
18743
18814
|
material.depthWrite = !material.transparent;
|
|
18744
18815
|
}
|
|
18745
18816
|
material.vertexColors = true;
|
|
18746
18817
|
const texture = material.uniforms?.map?.value ?? material.map;
|
|
18747
|
-
const mesh = new
|
|
18818
|
+
const mesh = new import_three46.Mesh(geometry, material);
|
|
18748
18819
|
section.add(mesh);
|
|
18749
18820
|
section.blockIndices.set(mesh, page.blockIndices);
|
|
18750
18821
|
const unsubscribe = [];
|
|
@@ -18783,8 +18854,7 @@ init_FluidGeometry();
|
|
|
18783
18854
|
init_FluidQuads();
|
|
18784
18855
|
init_CubeFace();
|
|
18785
18856
|
init_InstanceReference();
|
|
18786
|
-
|
|
18787
|
-
var WATER_TINT2 = new import_three44.Color(4159204).toArray();
|
|
18857
|
+
var WATER_TINT2 = new import_three47.Color(4159204).toArray();
|
|
18788
18858
|
var Chunk = class _Chunk {
|
|
18789
18859
|
constructor(scene, x, y, z, onBlocksChanged, sectionModels, neighborCell, biomeAt, onBiomesChanged, lightAt, onLightCleared, ambientLight = 0) {
|
|
18790
18860
|
this.onBlocksChanged = onBlocksChanged;
|
|
@@ -18801,7 +18871,7 @@ var Chunk = class _Chunk {
|
|
|
18801
18871
|
this.sectionBlocks = /* @__PURE__ */ new Map();
|
|
18802
18872
|
this.hiddenBlocks = /* @__PURE__ */ new Set();
|
|
18803
18873
|
this.fluidCells = new Uint8Array(4096);
|
|
18804
|
-
this.blockPosition = new
|
|
18874
|
+
this.blockPosition = new import_three47.Vector3();
|
|
18805
18875
|
this.meshDirty = false;
|
|
18806
18876
|
this.meshGeneration = 0;
|
|
18807
18877
|
this.scene = scene;
|
|
@@ -18816,18 +18886,8 @@ var Chunk = class _Chunk {
|
|
|
18816
18886
|
const meshes = (root, scene) => {
|
|
18817
18887
|
const cached2 = roots.get(root);
|
|
18818
18888
|
if (cached2) return cached2;
|
|
18819
|
-
const result =
|
|
18889
|
+
const result = pickableMeshes(root, scene, raycaster);
|
|
18820
18890
|
roots.set(root, result);
|
|
18821
|
-
let attached = false;
|
|
18822
|
-
for (let parent = root; parent; parent = parent.parent) {
|
|
18823
|
-
if (!parent.visible) return result;
|
|
18824
|
-
if (parent === scene) attached = true;
|
|
18825
|
-
}
|
|
18826
|
-
if (!attached) return result;
|
|
18827
|
-
root.updateWorldMatrix(true, true);
|
|
18828
|
-
root.traverseVisible((object4) => {
|
|
18829
|
-
if (isMesh(object4) && raycaster.layers.test(object4.layers)) result.push(object4);
|
|
18830
|
-
});
|
|
18831
18891
|
return result;
|
|
18832
18892
|
};
|
|
18833
18893
|
const add = (root, owner, reference) => {
|
|
@@ -18858,11 +18918,8 @@ var Chunk = class _Chunk {
|
|
|
18858
18918
|
}
|
|
18859
18919
|
}
|
|
18860
18920
|
}
|
|
18861
|
-
for (const hit of raycaster
|
|
18862
|
-
if (!hit.face) continue;
|
|
18921
|
+
for (const hit of visibleHits(raycaster, [...targets.keys()])) {
|
|
18863
18922
|
const mesh = hit.object;
|
|
18864
|
-
const material = Array.isArray(mesh.material) ? mesh.material[hit.face.materialIndex] : mesh.material;
|
|
18865
|
-
if (!material?.visible) continue;
|
|
18866
18923
|
const entry = targets.get(mesh);
|
|
18867
18924
|
let owner = entry.owners.get(hit.instanceId) ?? entry.owners.get(void 0);
|
|
18868
18925
|
if (entry.section) {
|
|
@@ -18872,21 +18929,15 @@ var Chunk = class _Chunk {
|
|
|
18872
18929
|
if (!owner || owner.chunk.hiddenBlocks.has(owner.index)) continue;
|
|
18873
18930
|
const info = owner.chunk.renderedBlocks.get(owner.index);
|
|
18874
18931
|
if (!info) continue;
|
|
18875
|
-
const matrix = mesh.matrixWorld.clone();
|
|
18876
|
-
if (isInstancedMesh(mesh) && hit.instanceId !== void 0) {
|
|
18877
|
-
const instance = new import_three44.Matrix4();
|
|
18878
|
-
mesh.getMatrixAt(hit.instanceId, instance);
|
|
18879
|
-
matrix.multiply(instance);
|
|
18880
|
-
}
|
|
18881
18932
|
return {
|
|
18882
|
-
position: new
|
|
18933
|
+
position: new import_three47.Vector3(
|
|
18883
18934
|
owner.chunk.x * 16 + owner.index % 16,
|
|
18884
18935
|
owner.chunk.y * 16 + Math.floor(owner.index / 256),
|
|
18885
18936
|
owner.chunk.z * 16 + Math.floor(owner.index / 16) % 16
|
|
18886
18937
|
),
|
|
18887
18938
|
block: info.block,
|
|
18888
18939
|
point: hit.point.clone(),
|
|
18889
|
-
normal: hit
|
|
18940
|
+
normal: hitNormal(hit),
|
|
18890
18941
|
distance: hit.distance
|
|
18891
18942
|
};
|
|
18892
18943
|
}
|
|
@@ -18894,18 +18945,18 @@ var Chunk = class _Chunk {
|
|
|
18894
18945
|
}
|
|
18895
18946
|
getBlockAt(posOrX, y, z) {
|
|
18896
18947
|
if (typeof posOrX == "number") {
|
|
18897
|
-
return this.getBlockAt(new
|
|
18948
|
+
return this.getBlockAt(new import_three47.Vector3(posOrX, y, z));
|
|
18898
18949
|
}
|
|
18899
18950
|
if (isTripleArray(posOrX)) {
|
|
18900
|
-
return this.getBlockAt(new
|
|
18951
|
+
return this.getBlockAt(new import_three47.Vector3(posOrX[0], posOrX[1], posOrX[2]));
|
|
18901
18952
|
}
|
|
18902
18953
|
const pos = this.blockPosition.set(posOrX.x - this.x * 16, posOrX.y - this.y * 16, posOrX.z - this.z * 16);
|
|
18903
18954
|
const index = _Chunk.chunkPosToBlockIndex(pos);
|
|
18904
18955
|
return this.renderedBlocks.get(index);
|
|
18905
18956
|
}
|
|
18906
18957
|
getBiomeAt(posOrX, y, z) {
|
|
18907
|
-
if (typeof posOrX === "number") return this.getBiomeAt(new
|
|
18908
|
-
if (isTripleArray(posOrX)) return this.getBiomeAt(new
|
|
18958
|
+
if (typeof posOrX === "number") return this.getBiomeAt(new import_three47.Vector3(posOrX, y, z));
|
|
18959
|
+
if (isTripleArray(posOrX)) return this.getBiomeAt(new import_three47.Vector3(...posOrX));
|
|
18909
18960
|
const pos = this.worldPosToChunkPos(posOrX);
|
|
18910
18961
|
_Chunk.chunkPosToBlockIndex(pos);
|
|
18911
18962
|
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];
|
|
@@ -18948,17 +18999,17 @@ var Chunk = class _Chunk {
|
|
|
18948
18999
|
this.hiddenBlocks.add(index);
|
|
18949
19000
|
this.renderedBlocks.get(index)?.object?.setVisible(false);
|
|
18950
19001
|
}
|
|
18951
|
-
const positions = blocks.map(({ index }) => new
|
|
19002
|
+
const positions = blocks.map(({ index }) => new import_three47.Vector3(...this.positionAt(index)));
|
|
18952
19003
|
if (this.onBlocksChanged) await this.onBlocksChanged(positions);
|
|
18953
19004
|
else await this.rebuildSectionMesh();
|
|
18954
19005
|
}
|
|
18955
19006
|
}
|
|
18956
19007
|
async setBlockAt(posOrX, yOrBlock, z, block) {
|
|
18957
19008
|
if (typeof posOrX == "number") {
|
|
18958
|
-
return this.setBlockAt(new
|
|
19009
|
+
return this.setBlockAt(new import_three47.Vector3(posOrX, yOrBlock, z), block);
|
|
18959
19010
|
}
|
|
18960
19011
|
if (isTripleArray(posOrX)) {
|
|
18961
|
-
return this.setBlockAt(new
|
|
19012
|
+
return this.setBlockAt(new import_three47.Vector3(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
|
|
18962
19013
|
}
|
|
18963
19014
|
const worldPos = posOrX;
|
|
18964
19015
|
const pos = this.worldPosToChunkPos(worldPos);
|
|
@@ -19013,7 +19064,7 @@ var Chunk = class _Chunk {
|
|
|
19013
19064
|
this.fluidCells[index] = 0;
|
|
19014
19065
|
this.renderedBlocks.delete(index);
|
|
19015
19066
|
this.objectBlocks.delete(index);
|
|
19016
|
-
const worldPos = new
|
|
19067
|
+
const worldPos = new import_three47.Vector3(
|
|
19017
19068
|
this.x * 16 + index % 16,
|
|
19018
19069
|
this.y * 16 + Math.floor(index / 256),
|
|
19019
19070
|
this.z * 16 + Math.floor(index / 16) % 16
|
|
@@ -19144,7 +19195,7 @@ var Chunk = class _Chunk {
|
|
|
19144
19195
|
biome,
|
|
19145
19196
|
biomePosition: this.biomePosition(index, blockState3, this.data.stateAt(this.data.idAt(index)))
|
|
19146
19197
|
});
|
|
19147
|
-
object4.setPosition(new
|
|
19198
|
+
object4.setPosition(new import_three47.Vector3(
|
|
19148
19199
|
this.x * 256 + index % 16 * 16,
|
|
19149
19200
|
this.y * 256 + Math.floor(index / 256) * 16,
|
|
19150
19201
|
this.z * 256 + Math.floor(index / 16) % 16 * 16
|
|
@@ -19236,7 +19287,7 @@ var Chunk = class _Chunk {
|
|
|
19236
19287
|
context.prepared = await prepare(async () => await available() ? BlockTints.getBiomeColor(blockState3?.key, biome, position) : void 0);
|
|
19237
19288
|
if (fluid?.kind === "water" && await available()) {
|
|
19238
19289
|
const color2 = await Biomes.getColor(biome, "water", blockState3?.key);
|
|
19239
|
-
if (color2 !== void 0 && color2 !== 4159204) context.waterTint = new
|
|
19290
|
+
if (color2 !== void 0 && color2 !== 4159204) context.waterTint = new import_three47.Color(color2).toArray();
|
|
19240
19291
|
}
|
|
19241
19292
|
}
|
|
19242
19293
|
for (const index of indices2) contexts.set(index, context);
|
|
@@ -19407,7 +19458,7 @@ var Chunk = class _Chunk {
|
|
|
19407
19458
|
/** Removes stored blocks and render objects. Set `notify` to false to skip the owning world's update. */
|
|
19408
19459
|
async clear(notify = true) {
|
|
19409
19460
|
const positions = notify && this.onBlocksChanged ? [...this.renderedBlocks.keys()].map((index) => this.chunkPosToWorldPos(
|
|
19410
|
-
new
|
|
19461
|
+
new import_three47.Vector3(index % 16, Math.floor(index / 256), Math.floor(index / 16) % 16)
|
|
19411
19462
|
)) : [];
|
|
19412
19463
|
for (const info of this.renderedBlocks.values()) info.object?.removeFromScene();
|
|
19413
19464
|
this.sectionBlocks.clear();
|
|
@@ -19443,14 +19494,14 @@ var Chunk = class _Chunk {
|
|
|
19443
19494
|
return pos.y * 16 * 16 + pos.z * 16 + pos.x;
|
|
19444
19495
|
}
|
|
19445
19496
|
worldPosToChunkPos(pos) {
|
|
19446
|
-
return new
|
|
19497
|
+
return new import_three47.Vector3(
|
|
19447
19498
|
pos.x - this.x * 16,
|
|
19448
19499
|
pos.y - this.y * 16,
|
|
19449
19500
|
pos.z - this.z * 16
|
|
19450
19501
|
);
|
|
19451
19502
|
}
|
|
19452
19503
|
chunkPosToWorldPos(pos) {
|
|
19453
|
-
return new
|
|
19504
|
+
return new import_three47.Vector3(
|
|
19454
19505
|
this.x * 16 + pos.x,
|
|
19455
19506
|
this.y * 16 + pos.y,
|
|
19456
19507
|
this.z * 16 + pos.z
|