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/node/index.d.mts
CHANGED
|
@@ -2066,6 +2066,16 @@ interface SchematicParserOptions {
|
|
|
2066
2066
|
lenient?: boolean;
|
|
2067
2067
|
}
|
|
2068
2068
|
|
|
2069
|
+
/** Converts Sponge v2/v3 `.schem` NBT into blocks and preserved entity data. */
|
|
2070
|
+
declare class SpongeSchematicParser {
|
|
2071
|
+
/**
|
|
2072
|
+
* Parses decoded NBT with a local block palette, omitting air blocks.
|
|
2073
|
+
* Applies Offset to block and entity positions; size remains the source dimensions.
|
|
2074
|
+
* Biomes and metadata are not imported, and DataVersion does not trigger migration.
|
|
2075
|
+
*/
|
|
2076
|
+
static parse(nbt: NBT): Promise<MultiBlockStructure>;
|
|
2077
|
+
}
|
|
2078
|
+
|
|
2069
2079
|
/** Converts Java structure NBT into blocks and preserved entity data for world placement. */
|
|
2070
2080
|
declare class StructureParser {
|
|
2071
2081
|
/**
|
|
@@ -3545,4 +3555,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
|
|
|
3545
3555
|
forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
|
|
3546
3556
|
}
|
|
3547
3557
|
|
|
3548
|
-
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, 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, NodeCache, NodeEnv, 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, registerNodeEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, sectionGeometryTransferables, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas, yieldToEventLoop };
|
|
3558
|
+
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, 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, NodeCache, NodeEnv, 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, registerNodeEnv, 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/node/index.d.ts
CHANGED
|
@@ -2066,6 +2066,16 @@ interface SchematicParserOptions {
|
|
|
2066
2066
|
lenient?: boolean;
|
|
2067
2067
|
}
|
|
2068
2068
|
|
|
2069
|
+
/** Converts Sponge v2/v3 `.schem` NBT into blocks and preserved entity data. */
|
|
2070
|
+
declare class SpongeSchematicParser {
|
|
2071
|
+
/**
|
|
2072
|
+
* Parses decoded NBT with a local block palette, omitting air blocks.
|
|
2073
|
+
* Applies Offset to block and entity positions; size remains the source dimensions.
|
|
2074
|
+
* Biomes and metadata are not imported, and DataVersion does not trigger migration.
|
|
2075
|
+
*/
|
|
2076
|
+
static parse(nbt: NBT): Promise<MultiBlockStructure>;
|
|
2077
|
+
}
|
|
2078
|
+
|
|
2069
2079
|
/** Converts Java structure NBT into blocks and preserved entity data for world placement. */
|
|
2070
2080
|
declare class StructureParser {
|
|
2071
2081
|
/**
|
|
@@ -3545,4 +3555,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
|
|
|
3545
3555
|
forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
|
|
3546
3556
|
}
|
|
3547
3557
|
|
|
3548
|
-
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, 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, NodeCache, NodeEnv, 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, registerNodeEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, sectionGeometryTransferables, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas, yieldToEventLoop };
|
|
3558
|
+
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, 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, NodeCache, NodeEnv, 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, registerNodeEnv, 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/node/index.js
CHANGED
|
@@ -18894,6 +18894,7 @@ __export(index_node_exports, {
|
|
|
18894
18894
|
SkinTextures: () => SkinTextures,
|
|
18895
18895
|
Skins: () => Skins,
|
|
18896
18896
|
SpecialItems: () => SpecialItems,
|
|
18897
|
+
SpongeSchematicParser: () => SpongeSchematicParser,
|
|
18897
18898
|
StructureParser: () => StructureParser,
|
|
18898
18899
|
TextureAtlas: () => TextureAtlas,
|
|
18899
18900
|
TextureLoader: () => TextureLoader,
|
|
@@ -23385,46 +23386,46 @@ function matchesCondition(condition, state) {
|
|
|
23385
23386
|
}
|
|
23386
23387
|
var BlockStateResolver = class {
|
|
23387
23388
|
/** Loads vanilla property defaults, falling back to preview values inferred from the blockstate file. */
|
|
23388
|
-
static async defaults(
|
|
23389
|
-
const defaults =
|
|
23389
|
+
static async defaults(blockState2) {
|
|
23390
|
+
const defaults = blockState2.key ? await BlockStates.getDefaultState(blockState2.key) : void 0;
|
|
23390
23391
|
const state = {};
|
|
23391
23392
|
if (defaults && Object.keys(defaults).length > 0) {
|
|
23392
23393
|
for (const key in defaults) state[key] = defaults[key].default;
|
|
23393
|
-
} else if (
|
|
23394
|
-
const variant = Object.keys(
|
|
23394
|
+
} else if (blockState2.variants) {
|
|
23395
|
+
const variant = Object.keys(blockState2.variants)[0];
|
|
23395
23396
|
if (variant) {
|
|
23396
23397
|
for (const property of variant.split(",")) {
|
|
23397
23398
|
const [key, value] = property.split("=");
|
|
23398
23399
|
state[key] = value;
|
|
23399
23400
|
}
|
|
23400
23401
|
}
|
|
23401
|
-
} else if (
|
|
23402
|
-
const condition =
|
|
23402
|
+
} else if (blockState2.multipart) {
|
|
23403
|
+
const condition = blockState2.multipart.map((part) => part.when).find((when) => when !== void 0 && Object.values(when).every((value) => typeof value === "string"));
|
|
23403
23404
|
for (const [key, value] of Object.entries(condition ?? {})) state[key] = value.split("|")[0];
|
|
23404
23405
|
}
|
|
23405
23406
|
return state;
|
|
23406
23407
|
}
|
|
23407
23408
|
/** Selects matching models. Supply `choose` to control selection within each alternatives array. */
|
|
23408
|
-
static select(
|
|
23409
|
-
return this.matching(
|
|
23409
|
+
static select(blockState2, state, choose = this.choose) {
|
|
23410
|
+
return this.matching(blockState2, state).map(choose);
|
|
23410
23411
|
}
|
|
23411
23412
|
/** Returns matching model groups before choosing weighted alternatives. */
|
|
23412
|
-
static matching(
|
|
23413
|
+
static matching(blockState2, state) {
|
|
23413
23414
|
const out = [];
|
|
23414
|
-
if (
|
|
23415
|
-
if (Object.keys(
|
|
23416
|
-
out.push(
|
|
23415
|
+
if (blockState2.variants) {
|
|
23416
|
+
if (Object.keys(blockState2.variants).length === 1 && "" in blockState2.variants) {
|
|
23417
|
+
out.push(blockState2.variants[""]);
|
|
23417
23418
|
} else {
|
|
23418
|
-
for (const variantKey in
|
|
23419
|
+
for (const variantKey in blockState2.variants) {
|
|
23419
23420
|
const matches = variantKey.split(",").every((property) => {
|
|
23420
23421
|
const [key, value] = property.split("=");
|
|
23421
23422
|
return `${state[key]}` === `${value}`;
|
|
23422
23423
|
});
|
|
23423
|
-
if (matches) out.push(
|
|
23424
|
+
if (matches) out.push(blockState2.variants[variantKey]);
|
|
23424
23425
|
}
|
|
23425
23426
|
}
|
|
23426
|
-
} else if (
|
|
23427
|
-
for (const part of
|
|
23427
|
+
} else if (blockState2.multipart) {
|
|
23428
|
+
for (const part of blockState2.multipart) {
|
|
23428
23429
|
if (part.apply && (!part.when || matchesCondition(part.when, state))) {
|
|
23429
23430
|
out.push(part.apply);
|
|
23430
23431
|
}
|
|
@@ -23552,9 +23553,9 @@ init_ModelCulling();
|
|
|
23552
23553
|
init_FluidGeometry();
|
|
23553
23554
|
init_Entities();
|
|
23554
23555
|
var BlockObject = class _BlockObject extends SceneObject {
|
|
23555
|
-
constructor(
|
|
23556
|
+
constructor(blockState2, options) {
|
|
23556
23557
|
super(options);
|
|
23557
|
-
this.blockState =
|
|
23558
|
+
this.blockState = blockState2;
|
|
23558
23559
|
this.isBlockObject = true;
|
|
23559
23560
|
this._previousState = {};
|
|
23560
23561
|
this._state = {};
|
|
@@ -25734,6 +25735,157 @@ function compoundList(tags, name) {
|
|
|
25734
25735
|
throw new MineRenderError(`Schematic ${name} must be a compound list`);
|
|
25735
25736
|
}
|
|
25736
25737
|
|
|
25738
|
+
// src/model/multiblock/SpongeSchematicParser.ts
|
|
25739
|
+
init_MineRenderError();
|
|
25740
|
+
var SpongeSchematicParser = class {
|
|
25741
|
+
/**
|
|
25742
|
+
* Parses decoded NBT with a local block palette, omitting air blocks.
|
|
25743
|
+
* Applies Offset to block and entity positions; size remains the source dimensions.
|
|
25744
|
+
* Biomes and metadata are not imported, and DataVersion does not trigger migration.
|
|
25745
|
+
*/
|
|
25746
|
+
static async parse(nbt) {
|
|
25747
|
+
const tags = nbt.value.Schematic === void 0 ? nbt.value : compound(nbt.value.Schematic, "Schematic");
|
|
25748
|
+
const version2 = integer2(tags.Version, "Version");
|
|
25749
|
+
if (version2 !== 2 && version2 !== 3) {
|
|
25750
|
+
throw new MineRenderError(`Unsupported Sponge schematic version ${version2}; expected 2 or 3`);
|
|
25751
|
+
}
|
|
25752
|
+
const dataVersion = integer2(tags.DataVersion, "DataVersion");
|
|
25753
|
+
const size = ["Width", "Height", "Length"].map((name) => {
|
|
25754
|
+
const tag = tags[name];
|
|
25755
|
+
if (tag?.type !== "short" || !Number.isInteger(tag.value) || tag.value < -32768 || tag.value > 65535 || tag.value === 0) {
|
|
25756
|
+
throw new MineRenderError(`Sponge schematic ${name} must be a positive unsigned short`);
|
|
25757
|
+
}
|
|
25758
|
+
return tag.value & 65535;
|
|
25759
|
+
});
|
|
25760
|
+
const offset = tags.Offset === void 0 ? [0, 0, 0] : intPosition(tags.Offset, "Offset");
|
|
25761
|
+
const blocks = [];
|
|
25762
|
+
const container = version2 === 2 ? tags : tags.Blocks === void 0 ? void 0 : compound(tags.Blocks, "Blocks");
|
|
25763
|
+
if (container) {
|
|
25764
|
+
const paletteTag = container.Palette;
|
|
25765
|
+
if (!paletteTag) throw new MineRenderError("Sponge schematic requires a local Palette; global block IDs are not supported");
|
|
25766
|
+
const palette = /* @__PURE__ */ new Map();
|
|
25767
|
+
const paletteMax = version2 === 2 && tags.PaletteMax !== void 0 ? integer2(tags.PaletteMax, "PaletteMax") : void 0;
|
|
25768
|
+
if (paletteMax !== void 0 && paletteMax <= 0) throw new MineRenderError("Sponge schematic PaletteMax must be positive");
|
|
25769
|
+
for (const [state, tag] of Object.entries(compound(paletteTag, "Palette"))) {
|
|
25770
|
+
const id = integer2(tag, "Palette index");
|
|
25771
|
+
if (id < 0 || palette.has(id) || paletteMax !== void 0 && id >= paletteMax) {
|
|
25772
|
+
throw new MineRenderError(`Invalid or duplicate Sponge schematic palette index ${id}`);
|
|
25773
|
+
}
|
|
25774
|
+
palette.set(id, blockState(state));
|
|
25775
|
+
}
|
|
25776
|
+
const [width, height, length] = size;
|
|
25777
|
+
const volume = width * height * length;
|
|
25778
|
+
const data = container[version2 === 2 ? "BlockData" : "Data"];
|
|
25779
|
+
if (data?.type !== "byteArray" || !Array.isArray(data.value) || data.value.length < volume) {
|
|
25780
|
+
throw new MineRenderError(`Sponge schematic block data must contain ${volume} varints`);
|
|
25781
|
+
}
|
|
25782
|
+
const blockEntities = /* @__PURE__ */ new Map();
|
|
25783
|
+
for (const entity of compoundList2(container, "BlockEntities")) {
|
|
25784
|
+
const pos = intPosition(entity.Pos, "BlockEntities Pos");
|
|
25785
|
+
if (pos.some((value2, axis) => value2 < 0 || value2 >= size[axis])) {
|
|
25786
|
+
throw new MineRenderError("Sponge schematic block entity position is outside its dimensions");
|
|
25787
|
+
}
|
|
25788
|
+
const index = pos[0] + pos[2] * width + pos[1] * width * length;
|
|
25789
|
+
if (blockEntities.has(index)) throw new MineRenderError(`Duplicate Sponge schematic block entity at index ${index}`);
|
|
25790
|
+
const value = entityData(entity, version2);
|
|
25791
|
+
for (const [axis, name] of ["x", "y", "z"].entries()) {
|
|
25792
|
+
value[name] = { type: "int", value: pos[axis] + offset[axis] };
|
|
25793
|
+
}
|
|
25794
|
+
blockEntities.set(index, { type: "compound", value });
|
|
25795
|
+
}
|
|
25796
|
+
let cursor = 0;
|
|
25797
|
+
for (let index = 0; index < volume; index++) {
|
|
25798
|
+
let id = 0;
|
|
25799
|
+
for (let shift = 0; ; shift += 7) {
|
|
25800
|
+
const byte = data.value[cursor++];
|
|
25801
|
+
if (!Number.isInteger(byte) || byte < -128 || byte > 255) {
|
|
25802
|
+
throw new MineRenderError(`Invalid or truncated Sponge schematic varint at index ${index}`);
|
|
25803
|
+
}
|
|
25804
|
+
const unsigned = byte & 255;
|
|
25805
|
+
if (shift === 28 && unsigned > 7) {
|
|
25806
|
+
throw new MineRenderError(`Sponge schematic varint exceeds a nonnegative int at index ${index}`);
|
|
25807
|
+
}
|
|
25808
|
+
id += (unsigned & 127) * 2 ** shift;
|
|
25809
|
+
if ((unsigned & 128) === 0) break;
|
|
25810
|
+
}
|
|
25811
|
+
const state = palette.get(id);
|
|
25812
|
+
if (!state) throw new MineRenderError(`Sponge schematic palette index ${id} does not exist`);
|
|
25813
|
+
if (["minecraft:air", "minecraft:cave_air", "minecraft:void_air"].includes(state.type)) continue;
|
|
25814
|
+
blocks.push({
|
|
25815
|
+
type: state.type,
|
|
25816
|
+
properties: { ...state.properties },
|
|
25817
|
+
position: [
|
|
25818
|
+
index % width + offset[0],
|
|
25819
|
+
Math.floor(index / (width * length)) + offset[1],
|
|
25820
|
+
Math.floor(index / width) % length + offset[2]
|
|
25821
|
+
],
|
|
25822
|
+
nbt: blockEntities.get(index)
|
|
25823
|
+
});
|
|
25824
|
+
}
|
|
25825
|
+
if (cursor !== data.value.length) throw new MineRenderError("Sponge schematic block data has trailing bytes");
|
|
25826
|
+
}
|
|
25827
|
+
const entities = compoundList2(tags, "Entities").map((entity) => {
|
|
25828
|
+
const pos = entity.Pos;
|
|
25829
|
+
if (pos?.type !== "list" || pos.value.type !== "double" || pos.value.value.length !== 3 || !pos.value.value.every(Number.isFinite)) {
|
|
25830
|
+
throw new MineRenderError("Sponge schematic entity Pos must contain three doubles");
|
|
25831
|
+
}
|
|
25832
|
+
const position = pos.value.value.map((value2, axis) => value2 + offset[axis]);
|
|
25833
|
+
const value = entityData(entity, version2);
|
|
25834
|
+
value.Pos = { type: "list", value: { type: "double", value: [...position] } };
|
|
25835
|
+
return { position, nbt: { type: "compound", value } };
|
|
25836
|
+
});
|
|
25837
|
+
return { size, blocks, entities, dataVersion };
|
|
25838
|
+
}
|
|
25839
|
+
};
|
|
25840
|
+
function integer2(tag, name) {
|
|
25841
|
+
if (tag?.type !== "int" || !Number.isInteger(tag.value) || tag.value < -2147483648 || tag.value > 2147483647) {
|
|
25842
|
+
throw new MineRenderError(`Sponge schematic ${name} must be an int`);
|
|
25843
|
+
}
|
|
25844
|
+
return tag.value;
|
|
25845
|
+
}
|
|
25846
|
+
function compound(tag, name) {
|
|
25847
|
+
if (tag?.type !== "compound" || !tag.value || typeof tag.value !== "object" || Array.isArray(tag.value)) {
|
|
25848
|
+
throw new MineRenderError(`Sponge schematic ${name} must be a compound`);
|
|
25849
|
+
}
|
|
25850
|
+
return tag.value;
|
|
25851
|
+
}
|
|
25852
|
+
function intPosition(tag, name) {
|
|
25853
|
+
if (tag?.type !== "intArray" || !Array.isArray(tag.value) || tag.value.length !== 3 || !tag.value.every((value) => Number.isInteger(value) && value >= -2147483648 && value <= 2147483647)) {
|
|
25854
|
+
throw new MineRenderError(`Sponge schematic ${name} must contain three ints`);
|
|
25855
|
+
}
|
|
25856
|
+
return [...tag.value];
|
|
25857
|
+
}
|
|
25858
|
+
function compoundList2(tags, name) {
|
|
25859
|
+
const tag = tags[name];
|
|
25860
|
+
if (tag === void 0) return [];
|
|
25861
|
+
if (tag.type === "list" && Array.isArray(tag.value.value)) {
|
|
25862
|
+
if (tag.value.value.length === 0) return [];
|
|
25863
|
+
if (tag.value.type === "compound") return tag.value.value;
|
|
25864
|
+
}
|
|
25865
|
+
throw new MineRenderError(`Sponge schematic ${name} must be a compound list`);
|
|
25866
|
+
}
|
|
25867
|
+
function blockState(state) {
|
|
25868
|
+
const match = /^((?:[a-z0-9_.-]+:)?[a-z0-9_./-]+)(?:\[([^\[\]]*)\])?$/.exec(state);
|
|
25869
|
+
if (!match) throw new MineRenderError(`Invalid Sponge schematic block state ${state}`);
|
|
25870
|
+
const properties = {};
|
|
25871
|
+
if (match[2]) {
|
|
25872
|
+
for (const entry of match[2].split(",")) {
|
|
25873
|
+
const pair = /^([a-z0-9_]+)=([^\s=,\[\]]+)$/.exec(entry);
|
|
25874
|
+
if (!pair || Object.prototype.hasOwnProperty.call(properties, pair[1])) throw new MineRenderError(`Invalid Sponge schematic block state ${state}`);
|
|
25875
|
+
Object.defineProperty(properties, pair[1], { value: pair[2], enumerable: true, writable: true, configurable: true });
|
|
25876
|
+
}
|
|
25877
|
+
}
|
|
25878
|
+
return { type: match[1].includes(":") ? match[1] : `minecraft:${match[1]}`, properties };
|
|
25879
|
+
}
|
|
25880
|
+
function entityData(entity, version2) {
|
|
25881
|
+
const id = entity.Id;
|
|
25882
|
+
if (id?.type !== "string" || !id.value) throw new MineRenderError("Sponge schematic entity Id must be a nonempty string");
|
|
25883
|
+
const { Id, Pos, ...extra } = entity;
|
|
25884
|
+
const value = version2 === 2 ? extra : entity.Data === void 0 ? {} : { ...compound(entity.Data, "entity Data") };
|
|
25885
|
+
value.id = { type: "string", value: id.value.includes(":") ? id.value : `minecraft:${id.value}` };
|
|
25886
|
+
return value;
|
|
25887
|
+
}
|
|
25888
|
+
|
|
25737
25889
|
// src/model/multiblock/StructureParser.ts
|
|
25738
25890
|
init_MineRenderError();
|
|
25739
25891
|
var StructureParser = class {
|
|
@@ -26961,8 +27113,8 @@ var MineRenderScene = class _MineRenderScene extends import_three34.Scene {
|
|
|
26961
27113
|
* Set `options.initialState` to choose block properties such as `facing` or `axis`.
|
|
26962
27114
|
* Use the returned object's `setPosition` method to move all of its model parts.
|
|
26963
27115
|
*/
|
|
26964
|
-
async addBlock(
|
|
26965
|
-
return this.addSceneObject(
|
|
27116
|
+
async addBlock(blockState2, options, parent = this) {
|
|
27117
|
+
return this.addSceneObject(blockState2, () => new BlockObject(blockState2, options), options, parent);
|
|
26966
27118
|
}
|
|
26967
27119
|
/**
|
|
26968
27120
|
* Loads a skin and adds an initialized player model.
|
|
@@ -29166,18 +29318,18 @@ var SectionModels = class {
|
|
|
29166
29318
|
if (!Number.isInteger(maxAtlasSize) || maxAtlasSize < 1) throw new RangeError("maxAtlasSize must be a positive integer");
|
|
29167
29319
|
}
|
|
29168
29320
|
/** Returns a cube template, or `undefined` when the block requires an individual render object. */
|
|
29169
|
-
async get(
|
|
29170
|
-
if (!
|
|
29171
|
-
let states = this.states.get(
|
|
29172
|
-
if (!states) this.states.set(
|
|
29321
|
+
async get(blockState2, properties = {}) {
|
|
29322
|
+
if (!blockState2.variants || blockState2.multipart) return void 0;
|
|
29323
|
+
let states = this.states.get(blockState2);
|
|
29324
|
+
if (!states) this.states.set(blockState2, states = /* @__PURE__ */ new Map());
|
|
29173
29325
|
const key = JSON.stringify(Object.entries(properties).sort(([a], [b]) => a.localeCompare(b)));
|
|
29174
|
-
const prepared = await cached(states, key, () => this.prepare(
|
|
29326
|
+
const prepared = await cached(states, key, () => this.prepare(blockState2, properties));
|
|
29175
29327
|
if (!prepared) return void 0;
|
|
29176
29328
|
return prepared.templates.get(BlockStateResolver.choose(prepared.variants));
|
|
29177
29329
|
}
|
|
29178
|
-
async prepare(
|
|
29179
|
-
const state = { ...await BlockStateResolver.defaults(
|
|
29180
|
-
const groups = BlockStateResolver.matching(
|
|
29330
|
+
async prepare(blockState2, properties) {
|
|
29331
|
+
const state = { ...await BlockStateResolver.defaults(blockState2), ...properties };
|
|
29332
|
+
const groups = BlockStateResolver.matching(blockState2, state);
|
|
29181
29333
|
if (groups.length !== 1) return void 0;
|
|
29182
29334
|
const variants = groups[0];
|
|
29183
29335
|
const choices = Array.isArray(variants) ? variants : [variants];
|
|
@@ -29189,7 +29341,7 @@ var SectionModels = class {
|
|
|
29189
29341
|
const atlas = await UVMapper.getAtlas(model);
|
|
29190
29342
|
const rotation = BlockStateResolver.rotation(variant);
|
|
29191
29343
|
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;
|
|
29192
|
-
const tints = await BlockTints.get(
|
|
29344
|
+
const tints = await BlockTints.get(blockState2.key, state, model);
|
|
29193
29345
|
let models = this.models.get(model);
|
|
29194
29346
|
if (!models) this.models.set(model, models = /* @__PURE__ */ new Map());
|
|
29195
29347
|
const key = JSON.stringify([rotation.x, rotation.y, rotation.z, variant.uvlock, tints]);
|
|
@@ -29896,10 +30048,10 @@ var Chunk = class _Chunk {
|
|
|
29896
30048
|
if (resolutions.has(key)) continue;
|
|
29897
30049
|
const stored = { type: block.type, properties: block.properties ? { ...block.properties } : void 0 };
|
|
29898
30050
|
const resolved = (async () => {
|
|
29899
|
-
const
|
|
29900
|
-
const perBlock = !
|
|
29901
|
-
if (!perBlock) await this.sectionModels.get(
|
|
29902
|
-
return { blockState, perBlock };
|
|
30051
|
+
const blockState2 = await BlockStates.get(AssetKey.parse("blockstates", stored.type));
|
|
30052
|
+
const perBlock = !blockState2 || !this.sectionModels || !!getFluidKind(blockState2.key, stored.properties) || !!(blockState2.key && BlockEntities.entry(await BlockEntities.getIndex(blockState2.key.root), blockState2.key.toNamespacedString()));
|
|
30053
|
+
if (!perBlock) await this.sectionModels.get(blockState2, stored.properties);
|
|
30054
|
+
return { blockState: blockState2, perBlock };
|
|
29903
30055
|
})();
|
|
29904
30056
|
resolutions.set(key, resolved);
|
|
29905
30057
|
void resolved.catch(() => void 0);
|
|
@@ -29924,17 +30076,17 @@ var Chunk = class _Chunk {
|
|
|
29924
30076
|
if (!readBlock) continue;
|
|
29925
30077
|
const stored = readBlock();
|
|
29926
30078
|
const key = ChunkData.paletteKey(stored);
|
|
29927
|
-
const { blockState, perBlock } = await resolutions.get(key);
|
|
29928
|
-
if (!
|
|
30079
|
+
const { blockState: blockState2, perBlock } = await resolutions.get(key);
|
|
30080
|
+
if (!blockState2) {
|
|
29929
30081
|
this.data.set(index, void 0);
|
|
29930
30082
|
continue;
|
|
29931
30083
|
}
|
|
29932
|
-
const template = perBlock ? void 0 : await this.sectionModels.get(
|
|
30084
|
+
const template = perBlock ? void 0 : await this.sectionModels.get(blockState2, stored.properties);
|
|
29933
30085
|
if (template) {
|
|
29934
30086
|
this.sectionBlocks.set(index, { index, template, cullMask: 0 });
|
|
29935
30087
|
this.meshDirty = true;
|
|
29936
30088
|
} else {
|
|
29937
|
-
object3 = await this.scene.addBlock(
|
|
30089
|
+
object3 = await this.scene.addBlock(blockState2, {
|
|
29938
30090
|
mergeMeshes: true,
|
|
29939
30091
|
instanceMeshes: true,
|
|
29940
30092
|
maxInstanceCount: 2e3,
|
|
@@ -30341,6 +30493,7 @@ var WorldStreamer = class {
|
|
|
30341
30493
|
SkinTextures,
|
|
30342
30494
|
Skins,
|
|
30343
30495
|
SpecialItems,
|
|
30496
|
+
SpongeSchematicParser,
|
|
30344
30497
|
StructureParser,
|
|
30345
30498
|
TextureAtlas,
|
|
30346
30499
|
TextureLoader,
|