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.
- package/dist/browser/index.d.mts +23 -1
- package/dist/browser/index.d.ts +23 -1
- package/dist/browser/index.js +133 -79
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +120 -66
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +92 -30
- 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 +133 -79
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +120 -66
- 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
|
@@ -3966,11 +3966,14 @@ var init_UVMapper = __esm({
|
|
|
3966
3966
|
});
|
|
3967
3967
|
}
|
|
3968
3968
|
static fillMissingTextureKeys(textures, target) {
|
|
3969
|
-
for (
|
|
3970
|
-
let
|
|
3971
|
-
|
|
3972
|
-
|
|
3969
|
+
for (const key in textures) {
|
|
3970
|
+
let name = key;
|
|
3971
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3972
|
+
while (textures[name]?.startsWith("#") && !seen.has(name)) {
|
|
3973
|
+
seen.add(name);
|
|
3974
|
+
name = textures[name].substr(1);
|
|
3973
3975
|
}
|
|
3976
|
+
if (name !== key) target[key] = target[name];
|
|
3974
3977
|
}
|
|
3975
3978
|
return target;
|
|
3976
3979
|
}
|
|
@@ -17390,12 +17393,12 @@ var AnvilWorldSource = class {
|
|
|
17390
17393
|
};
|
|
17391
17394
|
|
|
17392
17395
|
// src/world/Chunk.ts
|
|
17393
|
-
var
|
|
17396
|
+
var import_three47 = require("three");
|
|
17394
17397
|
init_BlockStates();
|
|
17395
17398
|
init_AssetKey();
|
|
17396
17399
|
|
|
17397
17400
|
// src/world/MineRenderWorld.ts
|
|
17398
|
-
var
|
|
17401
|
+
var import_three45 = require("three");
|
|
17399
17402
|
init_Model();
|
|
17400
17403
|
init_util();
|
|
17401
17404
|
init_AssetKey();
|
|
@@ -17660,11 +17663,74 @@ function resolveSavedEntity(entity) {
|
|
|
17660
17663
|
|
|
17661
17664
|
// src/world/_entities/WorldEntities.ts
|
|
17662
17665
|
init_BannerPatterns();
|
|
17666
|
+
var import_three44 = require("three");
|
|
17667
|
+
|
|
17668
|
+
// src/world/_picking/Picking.ts
|
|
17669
|
+
var import_three42 = require("three");
|
|
17670
|
+
init_three();
|
|
17671
|
+
function pickableMeshes(root, scene, raycaster) {
|
|
17672
|
+
const result = [];
|
|
17673
|
+
let attached = false;
|
|
17674
|
+
for (let parent = root; parent; parent = parent.parent) {
|
|
17675
|
+
if (!parent.visible) return result;
|
|
17676
|
+
if (parent === scene) attached = true;
|
|
17677
|
+
}
|
|
17678
|
+
if (!attached) return result;
|
|
17679
|
+
root.updateWorldMatrix(true, true);
|
|
17680
|
+
root.traverseVisible((object4) => {
|
|
17681
|
+
if (isMesh(object4) && raycaster.layers.test(object4.layers)) result.push(object4);
|
|
17682
|
+
});
|
|
17683
|
+
return result;
|
|
17684
|
+
}
|
|
17685
|
+
function visibleHits(raycaster, meshes) {
|
|
17686
|
+
return raycaster.intersectObjects(meshes, false).filter((hit) => {
|
|
17687
|
+
if (!hit.face) return false;
|
|
17688
|
+
const mesh = hit.object;
|
|
17689
|
+
const material = Array.isArray(mesh.material) ? mesh.material[hit.face.materialIndex] : mesh.material;
|
|
17690
|
+
return material?.visible;
|
|
17691
|
+
});
|
|
17692
|
+
}
|
|
17693
|
+
function hitNormal(hit) {
|
|
17694
|
+
const mesh = hit.object;
|
|
17695
|
+
const matrix = mesh.matrixWorld.clone();
|
|
17696
|
+
if (isInstancedMesh(mesh) && hit.instanceId !== void 0) {
|
|
17697
|
+
const instance = new import_three42.Matrix4();
|
|
17698
|
+
mesh.getMatrixAt(hit.instanceId, instance);
|
|
17699
|
+
matrix.multiply(instance);
|
|
17700
|
+
}
|
|
17701
|
+
return hit.face.normal.clone().applyNormalMatrix(new import_three42.Matrix3().getNormalMatrix(matrix));
|
|
17702
|
+
}
|
|
17703
|
+
|
|
17704
|
+
// src/world/_entities/WorldEntities.ts
|
|
17663
17705
|
var WorldEntities = class {
|
|
17664
17706
|
constructor(scene) {
|
|
17665
17707
|
this.scene = scene;
|
|
17666
17708
|
this.columns = /* @__PURE__ */ new Map();
|
|
17667
17709
|
}
|
|
17710
|
+
/** Finds the nearest visible triangle belonging to an entity owned by this world. */
|
|
17711
|
+
raycast(raycaster) {
|
|
17712
|
+
const owners = /* @__PURE__ */ new Map();
|
|
17713
|
+
for (const column of this.columns.values()) {
|
|
17714
|
+
for (const [object4, placement] of column) {
|
|
17715
|
+
for (const mesh of pickableMeshes(object4, this.scene, raycaster)) {
|
|
17716
|
+
owners.set(mesh, { object: object4, ...placement });
|
|
17717
|
+
}
|
|
17718
|
+
}
|
|
17719
|
+
}
|
|
17720
|
+
for (const hit of visibleHits(raycaster, [...owners.keys()])) {
|
|
17721
|
+
const mesh = hit.object;
|
|
17722
|
+
const owner = owners.get(mesh);
|
|
17723
|
+
return {
|
|
17724
|
+
type: owner.type,
|
|
17725
|
+
position: new import_three44.Vector3(...owner.position),
|
|
17726
|
+
object: owner.object,
|
|
17727
|
+
point: hit.point.clone(),
|
|
17728
|
+
normal: hitNormal(hit),
|
|
17729
|
+
distance: hit.distance
|
|
17730
|
+
};
|
|
17731
|
+
}
|
|
17732
|
+
return void 0;
|
|
17733
|
+
}
|
|
17668
17734
|
/** Captures column ownership before asynchronous block or asset loading starts. */
|
|
17669
17735
|
prepare(entities = [], column) {
|
|
17670
17736
|
const placements = entities.flatMap((entity) => {
|
|
@@ -17673,7 +17739,7 @@ var WorldEntities = class {
|
|
|
17673
17739
|
const position = [...entity.position];
|
|
17674
17740
|
const key = column?.join(",") ?? `${Math.floor(position[0] / 16)},${Math.floor(position[2] / 16)}`;
|
|
17675
17741
|
let owner = this.columns.get(key);
|
|
17676
|
-
if (!owner) this.columns.set(key, owner = /* @__PURE__ */ new
|
|
17742
|
+
if (!owner) this.columns.set(key, owner = /* @__PURE__ */ new Map());
|
|
17677
17743
|
return [{ ...resolved, position, column: key, owner }];
|
|
17678
17744
|
});
|
|
17679
17745
|
return async () => {
|
|
@@ -17699,7 +17765,7 @@ var WorldEntities = class {
|
|
|
17699
17765
|
object4.rotation.y = placement.yaw;
|
|
17700
17766
|
await object4.init();
|
|
17701
17767
|
if (!current()) return;
|
|
17702
|
-
placement.owner.
|
|
17768
|
+
placement.owner.set(object4, { type: placement.key.toNamespacedString(), position: placement.position });
|
|
17703
17769
|
this.scene.add(object4);
|
|
17704
17770
|
} catch (error) {
|
|
17705
17771
|
console.warn(`Could not draw saved entity ${placement.key.toNamespacedString()}, skipping it`, error);
|
|
@@ -17714,7 +17780,7 @@ var WorldEntities = class {
|
|
|
17714
17780
|
const objects = this.columns.get(key);
|
|
17715
17781
|
this.columns.delete(key);
|
|
17716
17782
|
if (!objects) return;
|
|
17717
|
-
for (const object4 of objects) {
|
|
17783
|
+
for (const object4 of objects.keys()) {
|
|
17718
17784
|
object4.removeFromScene();
|
|
17719
17785
|
object4.dispose();
|
|
17720
17786
|
}
|
|
@@ -17782,6 +17848,14 @@ var MineRenderWorld = class {
|
|
|
17782
17848
|
raycast(raycaster) {
|
|
17783
17849
|
return Chunk.raycast(this._chunks.values(), raycaster);
|
|
17784
17850
|
}
|
|
17851
|
+
/**
|
|
17852
|
+
* Returns the nearest visible mob geometry hit when renderEntities is enabled.
|
|
17853
|
+
* Respects layers and near/far; compare its distance with raycast() to account for blocks.
|
|
17854
|
+
* Texture alpha does not change triangle intersections.
|
|
17855
|
+
*/
|
|
17856
|
+
raycastEntities(raycaster) {
|
|
17857
|
+
return this.entities?.raycast(raycaster);
|
|
17858
|
+
}
|
|
17785
17859
|
/** Whether neighboring opaque cubes shade block-face corners. Defaults to false. */
|
|
17786
17860
|
get ambientOcclusion() {
|
|
17787
17861
|
return this._ambientOcclusion;
|
|
@@ -17802,25 +17876,25 @@ var MineRenderWorld = class {
|
|
|
17802
17876
|
}
|
|
17803
17877
|
getBlockAt(posOrX, y, z) {
|
|
17804
17878
|
if (typeof posOrX == "number") {
|
|
17805
|
-
return this.getBlockAt(new
|
|
17879
|
+
return this.getBlockAt(new import_three45.Vector3(posOrX, y, z));
|
|
17806
17880
|
}
|
|
17807
17881
|
if (isTripleArray(posOrX)) {
|
|
17808
|
-
return this.getBlockAt(new
|
|
17882
|
+
return this.getBlockAt(new import_three45.Vector3(posOrX[0], posOrX[1], posOrX[2]));
|
|
17809
17883
|
}
|
|
17810
17884
|
this.validatePosBounds(posOrX);
|
|
17811
17885
|
return this.getChunkAt(posOrX)?.getBlockAt(posOrX);
|
|
17812
17886
|
}
|
|
17813
17887
|
getBiomeAt(posOrX, y, z) {
|
|
17814
|
-
if (typeof posOrX === "number") return this.getBiomeAt(new
|
|
17815
|
-
if (isTripleArray(posOrX)) return this.getBiomeAt(new
|
|
17888
|
+
if (typeof posOrX === "number") return this.getBiomeAt(new import_three45.Vector3(posOrX, y, z));
|
|
17889
|
+
if (isTripleArray(posOrX)) return this.getBiomeAt(new import_three45.Vector3(...posOrX));
|
|
17816
17890
|
this.validatePosBounds(posOrX);
|
|
17817
17891
|
const cx = Math.floor(posOrX.x / 16), cy = Math.floor(posOrX.y / 16), cz = Math.floor(posOrX.z / 16);
|
|
17818
17892
|
const lx = posOrX.x - cx * 16, ly = posOrX.y - cy * 16, lz = posOrX.z - cz * 16;
|
|
17819
17893
|
return this.biomes.get(`${cx}_${cz}`)?.get(cy)?.[Math.floor(lx / 4) + Math.floor(lz / 4) * 4 + Math.floor(ly / 4) * 16];
|
|
17820
17894
|
}
|
|
17821
17895
|
getLightAt(posOrX, y, z) {
|
|
17822
|
-
if (typeof posOrX === "number") return this.getLightAt(new
|
|
17823
|
-
if (isTripleArray(posOrX)) return this.getLightAt(new
|
|
17896
|
+
if (typeof posOrX === "number") return this.getLightAt(new import_three45.Vector3(posOrX, y, z));
|
|
17897
|
+
if (isTripleArray(posOrX)) return this.getLightAt(new import_three45.Vector3(...posOrX));
|
|
17824
17898
|
this.validatePosBounds(posOrX);
|
|
17825
17899
|
const { x, y: py, z: pz } = posOrX;
|
|
17826
17900
|
const cx = Math.floor(x / 16), cy = Math.floor(py / 16), cz = Math.floor(pz / 16);
|
|
@@ -17838,10 +17912,10 @@ var MineRenderWorld = class {
|
|
|
17838
17912
|
}
|
|
17839
17913
|
async setBlockAt(posOrX, yOrBlock, z, block) {
|
|
17840
17914
|
if (typeof posOrX == "number") {
|
|
17841
|
-
return this.setBlockAt(new
|
|
17915
|
+
return this.setBlockAt(new import_three45.Vector3(posOrX, yOrBlock, z), block);
|
|
17842
17916
|
}
|
|
17843
17917
|
if (isTripleArray(posOrX)) {
|
|
17844
|
-
return this.setBlockAt(new
|
|
17918
|
+
return this.setBlockAt(new import_three45.Vector3(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
|
|
17845
17919
|
}
|
|
17846
17920
|
return this.placeBlock(posOrX, yOrBlock);
|
|
17847
17921
|
}
|
|
@@ -17852,10 +17926,10 @@ var MineRenderWorld = class {
|
|
|
17852
17926
|
}
|
|
17853
17927
|
async setBlockVisibleAt(posOrX, yOrVisible, z, visible) {
|
|
17854
17928
|
if (typeof posOrX === "number") {
|
|
17855
|
-
return this.setBlockVisibleAt(new
|
|
17929
|
+
return this.setBlockVisibleAt(new import_three45.Vector3(posOrX, yOrVisible, z), visible);
|
|
17856
17930
|
}
|
|
17857
17931
|
if (isTripleArray(posOrX)) {
|
|
17858
|
-
return this.setBlockVisibleAt(new
|
|
17932
|
+
return this.setBlockVisibleAt(new import_three45.Vector3(...posOrX), yOrVisible);
|
|
17859
17933
|
}
|
|
17860
17934
|
this.validatePosBounds(posOrX);
|
|
17861
17935
|
await this.getChunkAt(posOrX)?.setBlockVisibleAt(posOrX, yOrVisible);
|
|
@@ -17881,7 +17955,7 @@ var MineRenderWorld = class {
|
|
|
17881
17955
|
const collect = async (positions2) => {
|
|
17882
17956
|
for (const pos of positions2) changes.set(pos.toArray().join(","), pos);
|
|
17883
17957
|
};
|
|
17884
|
-
const place = (block) => this.placeBlock(new
|
|
17958
|
+
const place = (block) => this.placeBlock(new import_three45.Vector3(...block.position), block, collect);
|
|
17885
17959
|
const keys = /* @__PURE__ */ new Map();
|
|
17886
17960
|
const types = /* @__PURE__ */ new Set();
|
|
17887
17961
|
for (const block of multiblock.blocks) {
|
|
@@ -17897,7 +17971,7 @@ var MineRenderWorld = class {
|
|
|
17897
17971
|
}
|
|
17898
17972
|
if (!executor) {
|
|
17899
17973
|
const groups2 = /* @__PURE__ */ new Map();
|
|
17900
|
-
const position = new
|
|
17974
|
+
const position = new import_three45.Vector3();
|
|
17901
17975
|
for (const block of multiblock.blocks) {
|
|
17902
17976
|
const [x, y, z] = block.position;
|
|
17903
17977
|
this.validatePosBounds(position.set(x, y, z));
|
|
@@ -17937,7 +18011,7 @@ var MineRenderWorld = class {
|
|
|
17937
18011
|
try {
|
|
17938
18012
|
positions = await chunk.placeBlocks(blocks);
|
|
17939
18013
|
} finally {
|
|
17940
|
-
positions ??= blocks.map(({ index }) => new
|
|
18014
|
+
positions ??= blocks.map(({ index }) => new import_three45.Vector3(
|
|
17941
18015
|
chunk.x * 16 + index % 16,
|
|
17942
18016
|
chunk.y * 16 + Math.floor(index / 256),
|
|
17943
18017
|
chunk.z * 16 + Math.floor(index / 16) % 16
|
|
@@ -17989,7 +18063,7 @@ var MineRenderWorld = class {
|
|
|
17989
18063
|
}
|
|
17990
18064
|
for (const section of chunk.sections) {
|
|
17991
18065
|
if (section.biomes) {
|
|
17992
|
-
const position = new
|
|
18066
|
+
const position = new import_three45.Vector3(chunk.x * 16, section.y * 16, chunk.z * 16);
|
|
17993
18067
|
this.validatePosBounds(position);
|
|
17994
18068
|
const copy = [...section.biomes];
|
|
17995
18069
|
if (copy.length !== 64 || !copy.every((id) => typeof id === "string" && id.length > 0)) {
|
|
@@ -18005,7 +18079,7 @@ var MineRenderWorld = class {
|
|
|
18005
18079
|
for (const section of chunk.sections) {
|
|
18006
18080
|
if (!executor) {
|
|
18007
18081
|
if (!occupiedSections.has(section.y)) continue;
|
|
18008
|
-
const position = new
|
|
18082
|
+
const position = new import_three45.Vector3(chunk.x * 16, section.y * 16, chunk.z * 16);
|
|
18009
18083
|
this.validatePosBounds(position);
|
|
18010
18084
|
const target = this.getOrCreateChunkAt(position);
|
|
18011
18085
|
try {
|
|
@@ -18109,7 +18183,7 @@ var MineRenderWorld = class {
|
|
|
18109
18183
|
this.sectionModels?.clear();
|
|
18110
18184
|
}
|
|
18111
18185
|
updateCulling(positions) {
|
|
18112
|
-
const neighbor = new
|
|
18186
|
+
const neighbor = new import_three45.Vector3();
|
|
18113
18187
|
for (const pos of positions) {
|
|
18114
18188
|
const cx = Math.floor(pos.x / 16), cy = Math.floor(pos.y / 16), cz = Math.floor(pos.z / 16);
|
|
18115
18189
|
const chunk = this._chunks.get(`${cx}_${cy}_${cz}`);
|
|
@@ -18240,7 +18314,7 @@ var MineRenderWorld = class {
|
|
|
18240
18314
|
}
|
|
18241
18315
|
/** Converts block coordinates to scene units by multiplying each component by 16. */
|
|
18242
18316
|
static worldToScenePosition(pos) {
|
|
18243
|
-
return new
|
|
18317
|
+
return new import_three45.Vector3(
|
|
18244
18318
|
pos.x * 16,
|
|
18245
18319
|
pos.y * 16,
|
|
18246
18320
|
pos.z * 16
|
|
@@ -18248,7 +18322,7 @@ var MineRenderWorld = class {
|
|
|
18248
18322
|
}
|
|
18249
18323
|
/** Converts scene units to block coordinates without rounding to an integer block. */
|
|
18250
18324
|
static sceneToWorldPosition(pos) {
|
|
18251
|
-
return new
|
|
18325
|
+
return new import_three45.Vector3(
|
|
18252
18326
|
pos.x / 16,
|
|
18253
18327
|
pos.y / 16,
|
|
18254
18328
|
pos.z / 16
|
|
@@ -18271,7 +18345,7 @@ var MineRenderWorld = class {
|
|
|
18271
18345
|
init_Model();
|
|
18272
18346
|
|
|
18273
18347
|
// src/world/SectionMesh.ts
|
|
18274
|
-
var
|
|
18348
|
+
var import_three46 = require("three");
|
|
18275
18349
|
init_CanvasCompat();
|
|
18276
18350
|
init_Materials();
|
|
18277
18351
|
|
|
@@ -18597,7 +18671,7 @@ var SectionWorker = class _SectionWorker {
|
|
|
18597
18671
|
|
|
18598
18672
|
// src/world/SectionMesh.ts
|
|
18599
18673
|
var templateCache = /* @__PURE__ */ new WeakMap();
|
|
18600
|
-
var WATER_TINT = new
|
|
18674
|
+
var WATER_TINT = new import_three46.Color(4159204).toArray();
|
|
18601
18675
|
function toInput(entries, maxAtlasSize, fluids, lighting) {
|
|
18602
18676
|
if (!Number.isInteger(maxAtlasSize) || maxAtlasSize < 1) throw new RangeError("Section atlas size must be a positive integer");
|
|
18603
18677
|
const atlases = [];
|
|
@@ -18694,7 +18768,7 @@ function toInput(entries, maxAtlasSize, fluids, lighting) {
|
|
|
18694
18768
|
}
|
|
18695
18769
|
return { input, atlases };
|
|
18696
18770
|
}
|
|
18697
|
-
var SectionMesh = class _SectionMesh extends
|
|
18771
|
+
var SectionMesh = class _SectionMesh extends import_three46.Group {
|
|
18698
18772
|
constructor() {
|
|
18699
18773
|
super(...arguments);
|
|
18700
18774
|
this.ownedMeshes = [];
|
|
@@ -18725,26 +18799,26 @@ var SectionMesh = class _SectionMesh extends import_three43.Group {
|
|
|
18725
18799
|
for (const { atlas, x, y } of page.placements) {
|
|
18726
18800
|
context.drawImage(atlases[atlas].image.canvas, x, y);
|
|
18727
18801
|
}
|
|
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
|
|
18802
|
+
const geometry = new import_three46.BufferGeometry();
|
|
18803
|
+
geometry.setAttribute("position", new import_three46.Float32BufferAttribute(page.positions.buffer, 3));
|
|
18804
|
+
geometry.setAttribute("normal", new import_three46.Float32BufferAttribute(page.normals.buffer, 3));
|
|
18805
|
+
geometry.setAttribute("uv", new import_three46.Float32BufferAttribute(page.uvs.buffer, 2));
|
|
18806
|
+
geometry.setAttribute("uvBounds", new import_three46.Float32BufferAttribute(page.uvBounds.buffer, 4));
|
|
18807
|
+
geometry.setAttribute("color", new import_three46.Float32BufferAttribute(page.colors.buffer, 3));
|
|
18808
|
+
geometry.setIndex(new import_three46.Uint32BufferAttribute(page.indices.buffer, 1));
|
|
18735
18809
|
geometry.computeBoundingBox();
|
|
18736
18810
|
geometry.computeBoundingSphere();
|
|
18737
18811
|
const transparent = page.layer === 2 ? atlases[page.placements[0].atlas].hasTranslucency : page.layer === 1;
|
|
18738
18812
|
const material = Materials.createShadedCanvasMaterial(canvas, transparent, false, true);
|
|
18739
|
-
material.side =
|
|
18813
|
+
material.side = import_three46.FrontSide;
|
|
18740
18814
|
if (page.layer === 2) {
|
|
18741
|
-
material.side =
|
|
18815
|
+
material.side = import_three46.DoubleSide;
|
|
18742
18816
|
material.forceSinglePass = true;
|
|
18743
18817
|
material.depthWrite = !material.transparent;
|
|
18744
18818
|
}
|
|
18745
18819
|
material.vertexColors = true;
|
|
18746
18820
|
const texture = material.uniforms?.map?.value ?? material.map;
|
|
18747
|
-
const mesh = new
|
|
18821
|
+
const mesh = new import_three46.Mesh(geometry, material);
|
|
18748
18822
|
section.add(mesh);
|
|
18749
18823
|
section.blockIndices.set(mesh, page.blockIndices);
|
|
18750
18824
|
const unsubscribe = [];
|
|
@@ -18783,8 +18857,7 @@ init_FluidGeometry();
|
|
|
18783
18857
|
init_FluidQuads();
|
|
18784
18858
|
init_CubeFace();
|
|
18785
18859
|
init_InstanceReference();
|
|
18786
|
-
|
|
18787
|
-
var WATER_TINT2 = new import_three44.Color(4159204).toArray();
|
|
18860
|
+
var WATER_TINT2 = new import_three47.Color(4159204).toArray();
|
|
18788
18861
|
var Chunk = class _Chunk {
|
|
18789
18862
|
constructor(scene, x, y, z, onBlocksChanged, sectionModels, neighborCell, biomeAt, onBiomesChanged, lightAt, onLightCleared, ambientLight = 0) {
|
|
18790
18863
|
this.onBlocksChanged = onBlocksChanged;
|
|
@@ -18801,7 +18874,7 @@ var Chunk = class _Chunk {
|
|
|
18801
18874
|
this.sectionBlocks = /* @__PURE__ */ new Map();
|
|
18802
18875
|
this.hiddenBlocks = /* @__PURE__ */ new Set();
|
|
18803
18876
|
this.fluidCells = new Uint8Array(4096);
|
|
18804
|
-
this.blockPosition = new
|
|
18877
|
+
this.blockPosition = new import_three47.Vector3();
|
|
18805
18878
|
this.meshDirty = false;
|
|
18806
18879
|
this.meshGeneration = 0;
|
|
18807
18880
|
this.scene = scene;
|
|
@@ -18816,18 +18889,8 @@ var Chunk = class _Chunk {
|
|
|
18816
18889
|
const meshes = (root, scene) => {
|
|
18817
18890
|
const cached2 = roots.get(root);
|
|
18818
18891
|
if (cached2) return cached2;
|
|
18819
|
-
const result =
|
|
18892
|
+
const result = pickableMeshes(root, scene, raycaster);
|
|
18820
18893
|
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
18894
|
return result;
|
|
18832
18895
|
};
|
|
18833
18896
|
const add = (root, owner, reference) => {
|
|
@@ -18858,11 +18921,8 @@ var Chunk = class _Chunk {
|
|
|
18858
18921
|
}
|
|
18859
18922
|
}
|
|
18860
18923
|
}
|
|
18861
|
-
for (const hit of raycaster
|
|
18862
|
-
if (!hit.face) continue;
|
|
18924
|
+
for (const hit of visibleHits(raycaster, [...targets.keys()])) {
|
|
18863
18925
|
const mesh = hit.object;
|
|
18864
|
-
const material = Array.isArray(mesh.material) ? mesh.material[hit.face.materialIndex] : mesh.material;
|
|
18865
|
-
if (!material?.visible) continue;
|
|
18866
18926
|
const entry = targets.get(mesh);
|
|
18867
18927
|
let owner = entry.owners.get(hit.instanceId) ?? entry.owners.get(void 0);
|
|
18868
18928
|
if (entry.section) {
|
|
@@ -18872,21 +18932,15 @@ var Chunk = class _Chunk {
|
|
|
18872
18932
|
if (!owner || owner.chunk.hiddenBlocks.has(owner.index)) continue;
|
|
18873
18933
|
const info = owner.chunk.renderedBlocks.get(owner.index);
|
|
18874
18934
|
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
18935
|
return {
|
|
18882
|
-
position: new
|
|
18936
|
+
position: new import_three47.Vector3(
|
|
18883
18937
|
owner.chunk.x * 16 + owner.index % 16,
|
|
18884
18938
|
owner.chunk.y * 16 + Math.floor(owner.index / 256),
|
|
18885
18939
|
owner.chunk.z * 16 + Math.floor(owner.index / 16) % 16
|
|
18886
18940
|
),
|
|
18887
18941
|
block: info.block,
|
|
18888
18942
|
point: hit.point.clone(),
|
|
18889
|
-
normal: hit
|
|
18943
|
+
normal: hitNormal(hit),
|
|
18890
18944
|
distance: hit.distance
|
|
18891
18945
|
};
|
|
18892
18946
|
}
|
|
@@ -18894,18 +18948,18 @@ var Chunk = class _Chunk {
|
|
|
18894
18948
|
}
|
|
18895
18949
|
getBlockAt(posOrX, y, z) {
|
|
18896
18950
|
if (typeof posOrX == "number") {
|
|
18897
|
-
return this.getBlockAt(new
|
|
18951
|
+
return this.getBlockAt(new import_three47.Vector3(posOrX, y, z));
|
|
18898
18952
|
}
|
|
18899
18953
|
if (isTripleArray(posOrX)) {
|
|
18900
|
-
return this.getBlockAt(new
|
|
18954
|
+
return this.getBlockAt(new import_three47.Vector3(posOrX[0], posOrX[1], posOrX[2]));
|
|
18901
18955
|
}
|
|
18902
18956
|
const pos = this.blockPosition.set(posOrX.x - this.x * 16, posOrX.y - this.y * 16, posOrX.z - this.z * 16);
|
|
18903
18957
|
const index = _Chunk.chunkPosToBlockIndex(pos);
|
|
18904
18958
|
return this.renderedBlocks.get(index);
|
|
18905
18959
|
}
|
|
18906
18960
|
getBiomeAt(posOrX, y, z) {
|
|
18907
|
-
if (typeof posOrX === "number") return this.getBiomeAt(new
|
|
18908
|
-
if (isTripleArray(posOrX)) return this.getBiomeAt(new
|
|
18961
|
+
if (typeof posOrX === "number") return this.getBiomeAt(new import_three47.Vector3(posOrX, y, z));
|
|
18962
|
+
if (isTripleArray(posOrX)) return this.getBiomeAt(new import_three47.Vector3(...posOrX));
|
|
18909
18963
|
const pos = this.worldPosToChunkPos(posOrX);
|
|
18910
18964
|
_Chunk.chunkPosToBlockIndex(pos);
|
|
18911
18965
|
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 +19002,17 @@ var Chunk = class _Chunk {
|
|
|
18948
19002
|
this.hiddenBlocks.add(index);
|
|
18949
19003
|
this.renderedBlocks.get(index)?.object?.setVisible(false);
|
|
18950
19004
|
}
|
|
18951
|
-
const positions = blocks.map(({ index }) => new
|
|
19005
|
+
const positions = blocks.map(({ index }) => new import_three47.Vector3(...this.positionAt(index)));
|
|
18952
19006
|
if (this.onBlocksChanged) await this.onBlocksChanged(positions);
|
|
18953
19007
|
else await this.rebuildSectionMesh();
|
|
18954
19008
|
}
|
|
18955
19009
|
}
|
|
18956
19010
|
async setBlockAt(posOrX, yOrBlock, z, block) {
|
|
18957
19011
|
if (typeof posOrX == "number") {
|
|
18958
|
-
return this.setBlockAt(new
|
|
19012
|
+
return this.setBlockAt(new import_three47.Vector3(posOrX, yOrBlock, z), block);
|
|
18959
19013
|
}
|
|
18960
19014
|
if (isTripleArray(posOrX)) {
|
|
18961
|
-
return this.setBlockAt(new
|
|
19015
|
+
return this.setBlockAt(new import_three47.Vector3(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
|
|
18962
19016
|
}
|
|
18963
19017
|
const worldPos = posOrX;
|
|
18964
19018
|
const pos = this.worldPosToChunkPos(worldPos);
|
|
@@ -19013,7 +19067,7 @@ var Chunk = class _Chunk {
|
|
|
19013
19067
|
this.fluidCells[index] = 0;
|
|
19014
19068
|
this.renderedBlocks.delete(index);
|
|
19015
19069
|
this.objectBlocks.delete(index);
|
|
19016
|
-
const worldPos = new
|
|
19070
|
+
const worldPos = new import_three47.Vector3(
|
|
19017
19071
|
this.x * 16 + index % 16,
|
|
19018
19072
|
this.y * 16 + Math.floor(index / 256),
|
|
19019
19073
|
this.z * 16 + Math.floor(index / 16) % 16
|
|
@@ -19144,7 +19198,7 @@ var Chunk = class _Chunk {
|
|
|
19144
19198
|
biome,
|
|
19145
19199
|
biomePosition: this.biomePosition(index, blockState3, this.data.stateAt(this.data.idAt(index)))
|
|
19146
19200
|
});
|
|
19147
|
-
object4.setPosition(new
|
|
19201
|
+
object4.setPosition(new import_three47.Vector3(
|
|
19148
19202
|
this.x * 256 + index % 16 * 16,
|
|
19149
19203
|
this.y * 256 + Math.floor(index / 256) * 16,
|
|
19150
19204
|
this.z * 256 + Math.floor(index / 16) % 16 * 16
|
|
@@ -19236,7 +19290,7 @@ var Chunk = class _Chunk {
|
|
|
19236
19290
|
context.prepared = await prepare(async () => await available() ? BlockTints.getBiomeColor(blockState3?.key, biome, position) : void 0);
|
|
19237
19291
|
if (fluid?.kind === "water" && await available()) {
|
|
19238
19292
|
const color2 = await Biomes.getColor(biome, "water", blockState3?.key);
|
|
19239
|
-
if (color2 !== void 0 && color2 !== 4159204) context.waterTint = new
|
|
19293
|
+
if (color2 !== void 0 && color2 !== 4159204) context.waterTint = new import_three47.Color(color2).toArray();
|
|
19240
19294
|
}
|
|
19241
19295
|
}
|
|
19242
19296
|
for (const index of indices2) contexts.set(index, context);
|
|
@@ -19407,7 +19461,7 @@ var Chunk = class _Chunk {
|
|
|
19407
19461
|
/** Removes stored blocks and render objects. Set `notify` to false to skip the owning world's update. */
|
|
19408
19462
|
async clear(notify = true) {
|
|
19409
19463
|
const positions = notify && this.onBlocksChanged ? [...this.renderedBlocks.keys()].map((index) => this.chunkPosToWorldPos(
|
|
19410
|
-
new
|
|
19464
|
+
new import_three47.Vector3(index % 16, Math.floor(index / 256), Math.floor(index / 16) % 16)
|
|
19411
19465
|
)) : [];
|
|
19412
19466
|
for (const info of this.renderedBlocks.values()) info.object?.removeFromScene();
|
|
19413
19467
|
this.sectionBlocks.clear();
|
|
@@ -19443,14 +19497,14 @@ var Chunk = class _Chunk {
|
|
|
19443
19497
|
return pos.y * 16 * 16 + pos.z * 16 + pos.x;
|
|
19444
19498
|
}
|
|
19445
19499
|
worldPosToChunkPos(pos) {
|
|
19446
|
-
return new
|
|
19500
|
+
return new import_three47.Vector3(
|
|
19447
19501
|
pos.x - this.x * 16,
|
|
19448
19502
|
pos.y - this.y * 16,
|
|
19449
19503
|
pos.z - this.z * 16
|
|
19450
19504
|
);
|
|
19451
19505
|
}
|
|
19452
19506
|
chunkPosToWorldPos(pos) {
|
|
19453
|
-
return new
|
|
19507
|
+
return new import_three47.Vector3(
|
|
19454
19508
|
this.x * 16 + pos.x,
|
|
19455
19509
|
this.y * 16 + pos.y,
|
|
19456
19510
|
this.z * 16 + pos.z
|