minerender 2.1.0-alpha.88 → 2.1.0-alpha.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.d.mts +11 -1
- package/dist/browser/index.d.ts +11 -1
- package/dist/browser/index.js +189 -37
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +189 -37
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +197 -42
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +11 -1
- package/dist/node/index.d.ts +11 -1
- package/dist/node/index.js +190 -37
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +189 -37
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.d.mts
CHANGED
|
@@ -2065,6 +2065,16 @@ interface SchematicParserOptions {
|
|
|
2065
2065
|
lenient?: boolean;
|
|
2066
2066
|
}
|
|
2067
2067
|
|
|
2068
|
+
/** Converts Sponge v2/v3 `.schem` NBT into blocks and preserved entity data. */
|
|
2069
|
+
declare class SpongeSchematicParser {
|
|
2070
|
+
/**
|
|
2071
|
+
* Parses decoded NBT with a local block palette, omitting air blocks.
|
|
2072
|
+
* Applies Offset to block and entity positions; size remains the source dimensions.
|
|
2073
|
+
* Biomes and metadata are not imported, and DataVersion does not trigger migration.
|
|
2074
|
+
*/
|
|
2075
|
+
static parse(nbt: NBT): Promise<MultiBlockStructure>;
|
|
2076
|
+
}
|
|
2077
|
+
|
|
2068
2078
|
/** Converts Java structure NBT into blocks and preserved entity data for world placement. */
|
|
2069
2079
|
declare class StructureParser {
|
|
2070
2080
|
/**
|
|
@@ -3543,4 +3553,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
|
|
|
3543
3553
|
*/
|
|
3544
3554
|
declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
|
|
3545
3555
|
|
|
3546
|
-
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, 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 BitmapFont, type BitmapGlyph, type Block, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, BrowserCache, BrowserEnv, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, DYE_COLORS, type DebugOptions, 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 FluidSample, type FluidSampler, 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, type ItemModel, type ItemModelContext, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, type LoadedSceneDocument, type LoadedSceneObject, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, OrbitControls, type PackFormat, PackFormats, PackMetadata, PersistentCache, type PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererFrame, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResponseParser, SKIN_PARTS, type SceneBlockDefinition, type SceneDocument, SceneDocumentLoader, type SceneEntityDefinition, SceneExporter, type SceneGLTFExportOptions, type SceneGuiDefinition, type SceneGuiLayer, SceneInspector, type SceneModelDefinition, SceneObject, type SceneObjectDefinition, type SceneObjectDefinitionBase, type SceneObjectOptions, type SceneSkinDefinition, type SceneSkinPosePart, SceneStats, SceneStatsDisplay, SchematicParser, type SchematicParserOptions, type SectionAtlasSize, type SectionGeometryInput, type SectionGeometryPage, 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, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, type VideoExportOptions, VideoExporter, type WorldChunkSource, WorldStreamer, type WorldStreamerOptions, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, buildSectionGeometry, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createFluidGeometry, createGuiTextGeometry, createGuiTextureGeometry, createImage, entityAnimationTime, estimateBytesUsed, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, layoutGuiText, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, parseSceneDocument, prefix, probeImageSize, registerBrowserEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, sectionGeometryTransferables, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas, yieldToEventLoop };
|
|
3556
|
+
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, 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 BitmapFont, type BitmapGlyph, type Block, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, BrowserCache, BrowserEnv, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, DYE_COLORS, type DebugOptions, 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 FluidSample, type FluidSampler, 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, type ItemModel, type ItemModelContext, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, type LoadedSceneDocument, type LoadedSceneObject, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, OrbitControls, type PackFormat, PackFormats, PackMetadata, PersistentCache, type PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererFrame, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResponseParser, SKIN_PARTS, type SceneBlockDefinition, type SceneDocument, SceneDocumentLoader, type SceneEntityDefinition, SceneExporter, type SceneGLTFExportOptions, type SceneGuiDefinition, type SceneGuiLayer, SceneInspector, type SceneModelDefinition, SceneObject, type SceneObjectDefinition, type SceneObjectDefinitionBase, type SceneObjectOptions, type SceneSkinDefinition, type SceneSkinPosePart, SceneStats, SceneStatsDisplay, SchematicParser, type SchematicParserOptions, type SectionAtlasSize, type SectionGeometryInput, type SectionGeometryPage, 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 WorldChunkSource, WorldStreamer, type WorldStreamerOptions, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, buildSectionGeometry, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createFluidGeometry, createGuiTextGeometry, createGuiTextureGeometry, createImage, entityAnimationTime, estimateBytesUsed, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, layoutGuiText, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, parseSceneDocument, prefix, probeImageSize, registerBrowserEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, sectionGeometryTransferables, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas, yieldToEventLoop };
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -2065,6 +2065,16 @@ interface SchematicParserOptions {
|
|
|
2065
2065
|
lenient?: boolean;
|
|
2066
2066
|
}
|
|
2067
2067
|
|
|
2068
|
+
/** Converts Sponge v2/v3 `.schem` NBT into blocks and preserved entity data. */
|
|
2069
|
+
declare class SpongeSchematicParser {
|
|
2070
|
+
/**
|
|
2071
|
+
* Parses decoded NBT with a local block palette, omitting air blocks.
|
|
2072
|
+
* Applies Offset to block and entity positions; size remains the source dimensions.
|
|
2073
|
+
* Biomes and metadata are not imported, and DataVersion does not trigger migration.
|
|
2074
|
+
*/
|
|
2075
|
+
static parse(nbt: NBT): Promise<MultiBlockStructure>;
|
|
2076
|
+
}
|
|
2077
|
+
|
|
2068
2078
|
/** Converts Java structure NBT into blocks and preserved entity data for world placement. */
|
|
2069
2079
|
declare class StructureParser {
|
|
2070
2080
|
/**
|
|
@@ -3543,4 +3553,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
|
|
|
3543
3553
|
*/
|
|
3544
3554
|
declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
|
|
3545
3555
|
|
|
3546
|
-
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, 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 BitmapFont, type BitmapGlyph, type Block, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, BrowserCache, BrowserEnv, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, DYE_COLORS, type DebugOptions, 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 FluidSample, type FluidSampler, 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, type ItemModel, type ItemModelContext, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, type LoadedSceneDocument, type LoadedSceneObject, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, OrbitControls, type PackFormat, PackFormats, PackMetadata, PersistentCache, type PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererFrame, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResponseParser, SKIN_PARTS, type SceneBlockDefinition, type SceneDocument, SceneDocumentLoader, type SceneEntityDefinition, SceneExporter, type SceneGLTFExportOptions, type SceneGuiDefinition, type SceneGuiLayer, SceneInspector, type SceneModelDefinition, SceneObject, type SceneObjectDefinition, type SceneObjectDefinitionBase, type SceneObjectOptions, type SceneSkinDefinition, type SceneSkinPosePart, SceneStats, SceneStatsDisplay, SchematicParser, type SchematicParserOptions, type SectionAtlasSize, type SectionGeometryInput, type SectionGeometryPage, 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, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, type VideoExportOptions, VideoExporter, type WorldChunkSource, WorldStreamer, type WorldStreamerOptions, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, buildSectionGeometry, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createFluidGeometry, createGuiTextGeometry, createGuiTextureGeometry, createImage, entityAnimationTime, estimateBytesUsed, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, layoutGuiText, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, parseSceneDocument, prefix, probeImageSize, registerBrowserEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, sectionGeometryTransferables, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas, yieldToEventLoop };
|
|
3556
|
+
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, 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 BitmapFont, type BitmapGlyph, type Block, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, BrowserCache, BrowserEnv, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, DYE_COLORS, type DebugOptions, 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 FluidSample, type FluidSampler, 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, type ItemModel, type ItemModelContext, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, type LoadedSceneDocument, type LoadedSceneObject, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, OrbitControls, type PackFormat, PackFormats, PackMetadata, PersistentCache, type PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererFrame, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResponseParser, SKIN_PARTS, type SceneBlockDefinition, type SceneDocument, SceneDocumentLoader, type SceneEntityDefinition, SceneExporter, type SceneGLTFExportOptions, type SceneGuiDefinition, type SceneGuiLayer, SceneInspector, type SceneModelDefinition, SceneObject, type SceneObjectDefinition, type SceneObjectDefinitionBase, type SceneObjectOptions, type SceneSkinDefinition, type SceneSkinPosePart, SceneStats, SceneStatsDisplay, SchematicParser, type SchematicParserOptions, type SectionAtlasSize, type SectionGeometryInput, type SectionGeometryPage, 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 WorldChunkSource, WorldStreamer, type WorldStreamerOptions, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, buildSectionGeometry, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createFluidGeometry, createGuiTextGeometry, createGuiTextureGeometry, createImage, entityAnimationTime, estimateBytesUsed, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, layoutGuiText, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, parseSceneDocument, prefix, probeImageSize, registerBrowserEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, sectionGeometryTransferables, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas, yieldToEventLoop };
|
package/dist/browser/index.js
CHANGED
|
@@ -18802,6 +18802,7 @@ __export(index_browser_exports, {
|
|
|
18802
18802
|
SkinTextures: () => SkinTextures,
|
|
18803
18803
|
Skins: () => Skins,
|
|
18804
18804
|
SpecialItems: () => SpecialItems,
|
|
18805
|
+
SpongeSchematicParser: () => SpongeSchematicParser,
|
|
18805
18806
|
StructureParser: () => StructureParser,
|
|
18806
18807
|
TextureAtlas: () => TextureAtlas,
|
|
18807
18808
|
TextureLoader: () => TextureLoader,
|
|
@@ -23341,46 +23342,46 @@ function matchesCondition(condition, state) {
|
|
|
23341
23342
|
}
|
|
23342
23343
|
var BlockStateResolver = class {
|
|
23343
23344
|
/** Loads vanilla property defaults, falling back to preview values inferred from the blockstate file. */
|
|
23344
|
-
static async defaults(
|
|
23345
|
-
const defaults =
|
|
23345
|
+
static async defaults(blockState2) {
|
|
23346
|
+
const defaults = blockState2.key ? await BlockStates.getDefaultState(blockState2.key) : void 0;
|
|
23346
23347
|
const state = {};
|
|
23347
23348
|
if (defaults && Object.keys(defaults).length > 0) {
|
|
23348
23349
|
for (const key in defaults) state[key] = defaults[key].default;
|
|
23349
|
-
} else if (
|
|
23350
|
-
const variant = Object.keys(
|
|
23350
|
+
} else if (blockState2.variants) {
|
|
23351
|
+
const variant = Object.keys(blockState2.variants)[0];
|
|
23351
23352
|
if (variant) {
|
|
23352
23353
|
for (const property of variant.split(",")) {
|
|
23353
23354
|
const [key, value] = property.split("=");
|
|
23354
23355
|
state[key] = value;
|
|
23355
23356
|
}
|
|
23356
23357
|
}
|
|
23357
|
-
} else if (
|
|
23358
|
-
const condition =
|
|
23358
|
+
} else if (blockState2.multipart) {
|
|
23359
|
+
const condition = blockState2.multipart.map((part) => part.when).find((when) => when !== void 0 && Object.values(when).every((value) => typeof value === "string"));
|
|
23359
23360
|
for (const [key, value] of Object.entries(condition ?? {})) state[key] = value.split("|")[0];
|
|
23360
23361
|
}
|
|
23361
23362
|
return state;
|
|
23362
23363
|
}
|
|
23363
23364
|
/** Selects matching models. Supply `choose` to control selection within each alternatives array. */
|
|
23364
|
-
static select(
|
|
23365
|
-
return this.matching(
|
|
23365
|
+
static select(blockState2, state, choose = this.choose) {
|
|
23366
|
+
return this.matching(blockState2, state).map(choose);
|
|
23366
23367
|
}
|
|
23367
23368
|
/** Returns matching model groups before choosing weighted alternatives. */
|
|
23368
|
-
static matching(
|
|
23369
|
+
static matching(blockState2, state) {
|
|
23369
23370
|
const out = [];
|
|
23370
|
-
if (
|
|
23371
|
-
if (Object.keys(
|
|
23372
|
-
out.push(
|
|
23371
|
+
if (blockState2.variants) {
|
|
23372
|
+
if (Object.keys(blockState2.variants).length === 1 && "" in blockState2.variants) {
|
|
23373
|
+
out.push(blockState2.variants[""]);
|
|
23373
23374
|
} else {
|
|
23374
|
-
for (const variantKey in
|
|
23375
|
+
for (const variantKey in blockState2.variants) {
|
|
23375
23376
|
const matches = variantKey.split(",").every((property) => {
|
|
23376
23377
|
const [key, value] = property.split("=");
|
|
23377
23378
|
return `${state[key]}` === `${value}`;
|
|
23378
23379
|
});
|
|
23379
|
-
if (matches) out.push(
|
|
23380
|
+
if (matches) out.push(blockState2.variants[variantKey]);
|
|
23380
23381
|
}
|
|
23381
23382
|
}
|
|
23382
|
-
} else if (
|
|
23383
|
-
for (const part of
|
|
23383
|
+
} else if (blockState2.multipart) {
|
|
23384
|
+
for (const part of blockState2.multipart) {
|
|
23384
23385
|
if (part.apply && (!part.when || matchesCondition(part.when, state))) {
|
|
23385
23386
|
out.push(part.apply);
|
|
23386
23387
|
}
|
|
@@ -23508,9 +23509,9 @@ init_ModelCulling();
|
|
|
23508
23509
|
init_FluidGeometry();
|
|
23509
23510
|
init_Entities();
|
|
23510
23511
|
var _BlockObject = class _BlockObject extends SceneObject {
|
|
23511
|
-
constructor(
|
|
23512
|
+
constructor(blockState2, options) {
|
|
23512
23513
|
super(options);
|
|
23513
|
-
this.blockState =
|
|
23514
|
+
this.blockState = blockState2;
|
|
23514
23515
|
this.isBlockObject = true;
|
|
23515
23516
|
this._previousState = {};
|
|
23516
23517
|
this._state = {};
|
|
@@ -25689,6 +25690,157 @@ function compoundList(tags, name) {
|
|
|
25689
25690
|
throw new MineRenderError(`Schematic ${name} must be a compound list`);
|
|
25690
25691
|
}
|
|
25691
25692
|
|
|
25693
|
+
// src/model/multiblock/SpongeSchematicParser.ts
|
|
25694
|
+
init_MineRenderError();
|
|
25695
|
+
var SpongeSchematicParser = class {
|
|
25696
|
+
/**
|
|
25697
|
+
* Parses decoded NBT with a local block palette, omitting air blocks.
|
|
25698
|
+
* Applies Offset to block and entity positions; size remains the source dimensions.
|
|
25699
|
+
* Biomes and metadata are not imported, and DataVersion does not trigger migration.
|
|
25700
|
+
*/
|
|
25701
|
+
static async parse(nbt) {
|
|
25702
|
+
const tags = nbt.value.Schematic === void 0 ? nbt.value : compound(nbt.value.Schematic, "Schematic");
|
|
25703
|
+
const version2 = integer2(tags.Version, "Version");
|
|
25704
|
+
if (version2 !== 2 && version2 !== 3) {
|
|
25705
|
+
throw new MineRenderError(`Unsupported Sponge schematic version ${version2}; expected 2 or 3`);
|
|
25706
|
+
}
|
|
25707
|
+
const dataVersion = integer2(tags.DataVersion, "DataVersion");
|
|
25708
|
+
const size = ["Width", "Height", "Length"].map((name) => {
|
|
25709
|
+
const tag = tags[name];
|
|
25710
|
+
if (tag?.type !== "short" || !Number.isInteger(tag.value) || tag.value < -32768 || tag.value > 65535 || tag.value === 0) {
|
|
25711
|
+
throw new MineRenderError(`Sponge schematic ${name} must be a positive unsigned short`);
|
|
25712
|
+
}
|
|
25713
|
+
return tag.value & 65535;
|
|
25714
|
+
});
|
|
25715
|
+
const offset = tags.Offset === void 0 ? [0, 0, 0] : intPosition(tags.Offset, "Offset");
|
|
25716
|
+
const blocks = [];
|
|
25717
|
+
const container = version2 === 2 ? tags : tags.Blocks === void 0 ? void 0 : compound(tags.Blocks, "Blocks");
|
|
25718
|
+
if (container) {
|
|
25719
|
+
const paletteTag = container.Palette;
|
|
25720
|
+
if (!paletteTag) throw new MineRenderError("Sponge schematic requires a local Palette; global block IDs are not supported");
|
|
25721
|
+
const palette = /* @__PURE__ */ new Map();
|
|
25722
|
+
const paletteMax = version2 === 2 && tags.PaletteMax !== void 0 ? integer2(tags.PaletteMax, "PaletteMax") : void 0;
|
|
25723
|
+
if (paletteMax !== void 0 && paletteMax <= 0) throw new MineRenderError("Sponge schematic PaletteMax must be positive");
|
|
25724
|
+
for (const [state, tag] of Object.entries(compound(paletteTag, "Palette"))) {
|
|
25725
|
+
const id = integer2(tag, "Palette index");
|
|
25726
|
+
if (id < 0 || palette.has(id) || paletteMax !== void 0 && id >= paletteMax) {
|
|
25727
|
+
throw new MineRenderError(`Invalid or duplicate Sponge schematic palette index ${id}`);
|
|
25728
|
+
}
|
|
25729
|
+
palette.set(id, blockState(state));
|
|
25730
|
+
}
|
|
25731
|
+
const [width, height, length] = size;
|
|
25732
|
+
const volume = width * height * length;
|
|
25733
|
+
const data = container[version2 === 2 ? "BlockData" : "Data"];
|
|
25734
|
+
if (data?.type !== "byteArray" || !Array.isArray(data.value) || data.value.length < volume) {
|
|
25735
|
+
throw new MineRenderError(`Sponge schematic block data must contain ${volume} varints`);
|
|
25736
|
+
}
|
|
25737
|
+
const blockEntities = /* @__PURE__ */ new Map();
|
|
25738
|
+
for (const entity of compoundList2(container, "BlockEntities")) {
|
|
25739
|
+
const pos = intPosition(entity.Pos, "BlockEntities Pos");
|
|
25740
|
+
if (pos.some((value2, axis) => value2 < 0 || value2 >= size[axis])) {
|
|
25741
|
+
throw new MineRenderError("Sponge schematic block entity position is outside its dimensions");
|
|
25742
|
+
}
|
|
25743
|
+
const index = pos[0] + pos[2] * width + pos[1] * width * length;
|
|
25744
|
+
if (blockEntities.has(index)) throw new MineRenderError(`Duplicate Sponge schematic block entity at index ${index}`);
|
|
25745
|
+
const value = entityData(entity, version2);
|
|
25746
|
+
for (const [axis, name] of ["x", "y", "z"].entries()) {
|
|
25747
|
+
value[name] = { type: "int", value: pos[axis] + offset[axis] };
|
|
25748
|
+
}
|
|
25749
|
+
blockEntities.set(index, { type: "compound", value });
|
|
25750
|
+
}
|
|
25751
|
+
let cursor = 0;
|
|
25752
|
+
for (let index = 0; index < volume; index++) {
|
|
25753
|
+
let id = 0;
|
|
25754
|
+
for (let shift = 0; ; shift += 7) {
|
|
25755
|
+
const byte = data.value[cursor++];
|
|
25756
|
+
if (!Number.isInteger(byte) || byte < -128 || byte > 255) {
|
|
25757
|
+
throw new MineRenderError(`Invalid or truncated Sponge schematic varint at index ${index}`);
|
|
25758
|
+
}
|
|
25759
|
+
const unsigned = byte & 255;
|
|
25760
|
+
if (shift === 28 && unsigned > 7) {
|
|
25761
|
+
throw new MineRenderError(`Sponge schematic varint exceeds a nonnegative int at index ${index}`);
|
|
25762
|
+
}
|
|
25763
|
+
id += (unsigned & 127) * 2 ** shift;
|
|
25764
|
+
if ((unsigned & 128) === 0) break;
|
|
25765
|
+
}
|
|
25766
|
+
const state = palette.get(id);
|
|
25767
|
+
if (!state) throw new MineRenderError(`Sponge schematic palette index ${id} does not exist`);
|
|
25768
|
+
if (["minecraft:air", "minecraft:cave_air", "minecraft:void_air"].includes(state.type)) continue;
|
|
25769
|
+
blocks.push({
|
|
25770
|
+
type: state.type,
|
|
25771
|
+
properties: { ...state.properties },
|
|
25772
|
+
position: [
|
|
25773
|
+
index % width + offset[0],
|
|
25774
|
+
Math.floor(index / (width * length)) + offset[1],
|
|
25775
|
+
Math.floor(index / width) % length + offset[2]
|
|
25776
|
+
],
|
|
25777
|
+
nbt: blockEntities.get(index)
|
|
25778
|
+
});
|
|
25779
|
+
}
|
|
25780
|
+
if (cursor !== data.value.length) throw new MineRenderError("Sponge schematic block data has trailing bytes");
|
|
25781
|
+
}
|
|
25782
|
+
const entities = compoundList2(tags, "Entities").map((entity) => {
|
|
25783
|
+
const pos = entity.Pos;
|
|
25784
|
+
if (pos?.type !== "list" || pos.value.type !== "double" || pos.value.value.length !== 3 || !pos.value.value.every(Number.isFinite)) {
|
|
25785
|
+
throw new MineRenderError("Sponge schematic entity Pos must contain three doubles");
|
|
25786
|
+
}
|
|
25787
|
+
const position = pos.value.value.map((value2, axis) => value2 + offset[axis]);
|
|
25788
|
+
const value = entityData(entity, version2);
|
|
25789
|
+
value.Pos = { type: "list", value: { type: "double", value: [...position] } };
|
|
25790
|
+
return { position, nbt: { type: "compound", value } };
|
|
25791
|
+
});
|
|
25792
|
+
return { size, blocks, entities, dataVersion };
|
|
25793
|
+
}
|
|
25794
|
+
};
|
|
25795
|
+
function integer2(tag, name) {
|
|
25796
|
+
if (tag?.type !== "int" || !Number.isInteger(tag.value) || tag.value < -2147483648 || tag.value > 2147483647) {
|
|
25797
|
+
throw new MineRenderError(`Sponge schematic ${name} must be an int`);
|
|
25798
|
+
}
|
|
25799
|
+
return tag.value;
|
|
25800
|
+
}
|
|
25801
|
+
function compound(tag, name) {
|
|
25802
|
+
if (tag?.type !== "compound" || !tag.value || typeof tag.value !== "object" || Array.isArray(tag.value)) {
|
|
25803
|
+
throw new MineRenderError(`Sponge schematic ${name} must be a compound`);
|
|
25804
|
+
}
|
|
25805
|
+
return tag.value;
|
|
25806
|
+
}
|
|
25807
|
+
function intPosition(tag, name) {
|
|
25808
|
+
if (tag?.type !== "intArray" || !Array.isArray(tag.value) || tag.value.length !== 3 || !tag.value.every((value) => Number.isInteger(value) && value >= -2147483648 && value <= 2147483647)) {
|
|
25809
|
+
throw new MineRenderError(`Sponge schematic ${name} must contain three ints`);
|
|
25810
|
+
}
|
|
25811
|
+
return [...tag.value];
|
|
25812
|
+
}
|
|
25813
|
+
function compoundList2(tags, name) {
|
|
25814
|
+
const tag = tags[name];
|
|
25815
|
+
if (tag === void 0) return [];
|
|
25816
|
+
if (tag.type === "list" && Array.isArray(tag.value.value)) {
|
|
25817
|
+
if (tag.value.value.length === 0) return [];
|
|
25818
|
+
if (tag.value.type === "compound") return tag.value.value;
|
|
25819
|
+
}
|
|
25820
|
+
throw new MineRenderError(`Sponge schematic ${name} must be a compound list`);
|
|
25821
|
+
}
|
|
25822
|
+
function blockState(state) {
|
|
25823
|
+
const match = /^((?:[a-z0-9_.-]+:)?[a-z0-9_./-]+)(?:\[([^\[\]]*)\])?$/.exec(state);
|
|
25824
|
+
if (!match) throw new MineRenderError(`Invalid Sponge schematic block state ${state}`);
|
|
25825
|
+
const properties = {};
|
|
25826
|
+
if (match[2]) {
|
|
25827
|
+
for (const entry of match[2].split(",")) {
|
|
25828
|
+
const pair = /^([a-z0-9_]+)=([^\s=,\[\]]+)$/.exec(entry);
|
|
25829
|
+
if (!pair || Object.prototype.hasOwnProperty.call(properties, pair[1])) throw new MineRenderError(`Invalid Sponge schematic block state ${state}`);
|
|
25830
|
+
Object.defineProperty(properties, pair[1], { value: pair[2], enumerable: true, writable: true, configurable: true });
|
|
25831
|
+
}
|
|
25832
|
+
}
|
|
25833
|
+
return { type: match[1].includes(":") ? match[1] : `minecraft:${match[1]}`, properties };
|
|
25834
|
+
}
|
|
25835
|
+
function entityData(entity, version2) {
|
|
25836
|
+
const id = entity.Id;
|
|
25837
|
+
if (id?.type !== "string" || !id.value) throw new MineRenderError("Sponge schematic entity Id must be a nonempty string");
|
|
25838
|
+
const { Id, Pos, ...extra } = entity;
|
|
25839
|
+
const value = version2 === 2 ? extra : entity.Data === void 0 ? {} : { ...compound(entity.Data, "entity Data") };
|
|
25840
|
+
value.id = { type: "string", value: id.value.includes(":") ? id.value : `minecraft:${id.value}` };
|
|
25841
|
+
return value;
|
|
25842
|
+
}
|
|
25843
|
+
|
|
25692
25844
|
// src/model/multiblock/StructureParser.ts
|
|
25693
25845
|
init_MineRenderError();
|
|
25694
25846
|
var StructureParser = class {
|
|
@@ -26913,8 +27065,8 @@ var _MineRenderScene = class _MineRenderScene extends import_three34.Scene {
|
|
|
26913
27065
|
* Set `options.initialState` to choose block properties such as `facing` or `axis`.
|
|
26914
27066
|
* Use the returned object's `setPosition` method to move all of its model parts.
|
|
26915
27067
|
*/
|
|
26916
|
-
async addBlock(
|
|
26917
|
-
return this.addSceneObject(
|
|
27068
|
+
async addBlock(blockState2, options, parent = this) {
|
|
27069
|
+
return this.addSceneObject(blockState2, () => new BlockObject(blockState2, options), options, parent);
|
|
26918
27070
|
}
|
|
26919
27071
|
/**
|
|
26920
27072
|
* Loads a skin and adds an initialized player model.
|
|
@@ -29119,18 +29271,18 @@ var SectionModels = class {
|
|
|
29119
29271
|
if (!Number.isInteger(maxAtlasSize) || maxAtlasSize < 1) throw new RangeError("maxAtlasSize must be a positive integer");
|
|
29120
29272
|
}
|
|
29121
29273
|
/** Returns a cube template, or `undefined` when the block requires an individual render object. */
|
|
29122
|
-
async get(
|
|
29123
|
-
if (!
|
|
29124
|
-
let states = this.states.get(
|
|
29125
|
-
if (!states) this.states.set(
|
|
29274
|
+
async get(blockState2, properties = {}) {
|
|
29275
|
+
if (!blockState2.variants || blockState2.multipart) return void 0;
|
|
29276
|
+
let states = this.states.get(blockState2);
|
|
29277
|
+
if (!states) this.states.set(blockState2, states = /* @__PURE__ */ new Map());
|
|
29126
29278
|
const key = JSON.stringify(Object.entries(properties).sort(([a], [b]) => a.localeCompare(b)));
|
|
29127
|
-
const prepared = await cached(states, key, () => this.prepare(
|
|
29279
|
+
const prepared = await cached(states, key, () => this.prepare(blockState2, properties));
|
|
29128
29280
|
if (!prepared) return void 0;
|
|
29129
29281
|
return prepared.templates.get(BlockStateResolver.choose(prepared.variants));
|
|
29130
29282
|
}
|
|
29131
|
-
async prepare(
|
|
29132
|
-
const state = { ...await BlockStateResolver.defaults(
|
|
29133
|
-
const groups = BlockStateResolver.matching(
|
|
29283
|
+
async prepare(blockState2, properties) {
|
|
29284
|
+
const state = { ...await BlockStateResolver.defaults(blockState2), ...properties };
|
|
29285
|
+
const groups = BlockStateResolver.matching(blockState2, state);
|
|
29134
29286
|
if (groups.length !== 1) return void 0;
|
|
29135
29287
|
const variants = groups[0];
|
|
29136
29288
|
const choices = Array.isArray(variants) ? variants : [variants];
|
|
@@ -29142,7 +29294,7 @@ var SectionModels = class {
|
|
|
29142
29294
|
const atlas = await UVMapper.getAtlas(model);
|
|
29143
29295
|
const rotation = BlockStateResolver.rotation(variant);
|
|
29144
29296
|
if (!atlas || atlas.hasAnimation || !ModelCulling.isOpaqueFullCube(atlas) || atlas.image.width > this.maxAtlasSize || atlas.image.height > this.maxAtlasSize || ModelCulling.toLocalMask(63, rotation) !== 63) return void 0;
|
|
29145
|
-
const tints = await BlockTints.get(
|
|
29297
|
+
const tints = await BlockTints.get(blockState2.key, state, model);
|
|
29146
29298
|
let models = this.models.get(model);
|
|
29147
29299
|
if (!models) this.models.set(model, models = /* @__PURE__ */ new Map());
|
|
29148
29300
|
const key = JSON.stringify([rotation.x, rotation.y, rotation.z, variant.uvlock, tints]);
|
|
@@ -29848,10 +30000,10 @@ var Chunk = class _Chunk {
|
|
|
29848
30000
|
if (resolutions.has(key)) continue;
|
|
29849
30001
|
const stored = { type: block.type, properties: block.properties ? { ...block.properties } : void 0 };
|
|
29850
30002
|
const resolved = (async () => {
|
|
29851
|
-
const
|
|
29852
|
-
const perBlock = !
|
|
29853
|
-
if (!perBlock) await this.sectionModels.get(
|
|
29854
|
-
return { blockState, perBlock };
|
|
30003
|
+
const blockState2 = await BlockStates.get(AssetKey.parse("blockstates", stored.type));
|
|
30004
|
+
const perBlock = !blockState2 || !this.sectionModels || !!getFluidKind(blockState2.key, stored.properties) || !!(blockState2.key && BlockEntities.entry(await BlockEntities.getIndex(blockState2.key.root), blockState2.key.toNamespacedString()));
|
|
30005
|
+
if (!perBlock) await this.sectionModels.get(blockState2, stored.properties);
|
|
30006
|
+
return { blockState: blockState2, perBlock };
|
|
29855
30007
|
})();
|
|
29856
30008
|
resolutions.set(key, resolved);
|
|
29857
30009
|
void resolved.catch(() => void 0);
|
|
@@ -29876,17 +30028,17 @@ var Chunk = class _Chunk {
|
|
|
29876
30028
|
if (!readBlock) continue;
|
|
29877
30029
|
const stored = readBlock();
|
|
29878
30030
|
const key = ChunkData.paletteKey(stored);
|
|
29879
|
-
const { blockState, perBlock } = await resolutions.get(key);
|
|
29880
|
-
if (!
|
|
30031
|
+
const { blockState: blockState2, perBlock } = await resolutions.get(key);
|
|
30032
|
+
if (!blockState2) {
|
|
29881
30033
|
this.data.set(index, void 0);
|
|
29882
30034
|
continue;
|
|
29883
30035
|
}
|
|
29884
|
-
const template = perBlock ? void 0 : await this.sectionModels.get(
|
|
30036
|
+
const template = perBlock ? void 0 : await this.sectionModels.get(blockState2, stored.properties);
|
|
29885
30037
|
if (template) {
|
|
29886
30038
|
this.sectionBlocks.set(index, { index, template, cullMask: 0 });
|
|
29887
30039
|
this.meshDirty = true;
|
|
29888
30040
|
} else {
|
|
29889
|
-
object3 = await this.scene.addBlock(
|
|
30041
|
+
object3 = await this.scene.addBlock(blockState2, {
|
|
29890
30042
|
mergeMeshes: true,
|
|
29891
30043
|
instanceMeshes: true,
|
|
29892
30044
|
maxInstanceCount: 2e3,
|