minerender 2.1.0-alpha.89 → 2.1.0-alpha.90
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 +24 -1
- package/dist/browser/index.d.ts +24 -1
- package/dist/browser/index.js +201 -51
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +201 -51
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +209 -56
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +24 -1
- package/dist/node/index.d.ts +24 -1
- package/dist/node/index.js +202 -51
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +201 -51
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.d.mts
CHANGED
|
@@ -2049,6 +2049,29 @@ interface MultiBlockBlock extends Block {
|
|
|
2049
2049
|
position: TripleArray;
|
|
2050
2050
|
}
|
|
2051
2051
|
|
|
2052
|
+
/** A named region with block and entity positions relative to the schematic origin. */
|
|
2053
|
+
interface LitematicaRegion extends MultiBlockStructure {
|
|
2054
|
+
readonly name: string;
|
|
2055
|
+
/** The selected first corner, relative to the schematic origin. */
|
|
2056
|
+
readonly position: TripleArray;
|
|
2057
|
+
/** Signed source dimensions. The inherited size contains their absolute values. */
|
|
2058
|
+
readonly signedSize: TripleArray;
|
|
2059
|
+
}
|
|
2060
|
+
/** Combined blocks and the named regions that produced them. */
|
|
2061
|
+
interface LitematicaStructure extends MultiBlockStructure {
|
|
2062
|
+
readonly regions: LitematicaRegion[];
|
|
2063
|
+
}
|
|
2064
|
+
/** Reads v5–7 `.litematic` files without migrating block states or entity NBT. */
|
|
2065
|
+
declare class LitematicaParser {
|
|
2066
|
+
/**
|
|
2067
|
+
* Parses decoded NBT, preserving subregion placement and omitting air.
|
|
2068
|
+
* Later entries in regions replace earlier cells, including with air.
|
|
2069
|
+
* Size encloses all region bounds; positions retain the schematic origin.
|
|
2070
|
+
* Metadata and scheduled ticks are not imported. Named regions can be placed individually.
|
|
2071
|
+
*/
|
|
2072
|
+
static parse(nbt: NBT): Promise<LitematicaStructure>;
|
|
2073
|
+
}
|
|
2074
|
+
|
|
2052
2075
|
/** Converts legacy Alpha `.schematic` NBT with numeric block IDs into modern block names and properties. */
|
|
2053
2076
|
declare class SchematicParser {
|
|
2054
2077
|
/**
|
|
@@ -3553,4 +3576,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
|
|
|
3553
3576
|
*/
|
|
3554
3577
|
declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
|
|
3555
3578
|
|
|
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 };
|
|
3579
|
+
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, LitematicaParser, type LitematicaRegion, type LitematicaStructure, 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
|
@@ -2049,6 +2049,29 @@ interface MultiBlockBlock extends Block {
|
|
|
2049
2049
|
position: TripleArray;
|
|
2050
2050
|
}
|
|
2051
2051
|
|
|
2052
|
+
/** A named region with block and entity positions relative to the schematic origin. */
|
|
2053
|
+
interface LitematicaRegion extends MultiBlockStructure {
|
|
2054
|
+
readonly name: string;
|
|
2055
|
+
/** The selected first corner, relative to the schematic origin. */
|
|
2056
|
+
readonly position: TripleArray;
|
|
2057
|
+
/** Signed source dimensions. The inherited size contains their absolute values. */
|
|
2058
|
+
readonly signedSize: TripleArray;
|
|
2059
|
+
}
|
|
2060
|
+
/** Combined blocks and the named regions that produced them. */
|
|
2061
|
+
interface LitematicaStructure extends MultiBlockStructure {
|
|
2062
|
+
readonly regions: LitematicaRegion[];
|
|
2063
|
+
}
|
|
2064
|
+
/** Reads v5–7 `.litematic` files without migrating block states or entity NBT. */
|
|
2065
|
+
declare class LitematicaParser {
|
|
2066
|
+
/**
|
|
2067
|
+
* Parses decoded NBT, preserving subregion placement and omitting air.
|
|
2068
|
+
* Later entries in regions replace earlier cells, including with air.
|
|
2069
|
+
* Size encloses all region bounds; positions retain the schematic origin.
|
|
2070
|
+
* Metadata and scheduled ticks are not imported. Named regions can be placed individually.
|
|
2071
|
+
*/
|
|
2072
|
+
static parse(nbt: NBT): Promise<LitematicaStructure>;
|
|
2073
|
+
}
|
|
2074
|
+
|
|
2052
2075
|
/** Converts legacy Alpha `.schematic` NBT with numeric block IDs into modern block names and properties. */
|
|
2053
2076
|
declare class SchematicParser {
|
|
2054
2077
|
/**
|
|
@@ -3553,4 +3576,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
|
|
|
3553
3576
|
*/
|
|
3554
3577
|
declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
|
|
3555
3578
|
|
|
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 };
|
|
3579
|
+
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, LitematicaParser, type LitematicaRegion, type LitematicaStructure, 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
|
@@ -18763,6 +18763,7 @@ __export(index_browser_exports, {
|
|
|
18763
18763
|
InstanceManager: () => InstanceManager,
|
|
18764
18764
|
InstanceReference: () => InstanceReference,
|
|
18765
18765
|
ItemTints: () => ItemTints,
|
|
18766
|
+
LitematicaParser: () => LitematicaParser,
|
|
18766
18767
|
MapControls: () => MapControls,
|
|
18767
18768
|
Materials: () => Materials,
|
|
18768
18769
|
Meshes: () => Meshes,
|
|
@@ -23342,46 +23343,46 @@ function matchesCondition(condition, state) {
|
|
|
23342
23343
|
}
|
|
23343
23344
|
var BlockStateResolver = class {
|
|
23344
23345
|
/** Loads vanilla property defaults, falling back to preview values inferred from the blockstate file. */
|
|
23345
|
-
static async defaults(
|
|
23346
|
-
const defaults =
|
|
23346
|
+
static async defaults(blockState3) {
|
|
23347
|
+
const defaults = blockState3.key ? await BlockStates.getDefaultState(blockState3.key) : void 0;
|
|
23347
23348
|
const state = {};
|
|
23348
23349
|
if (defaults && Object.keys(defaults).length > 0) {
|
|
23349
23350
|
for (const key in defaults) state[key] = defaults[key].default;
|
|
23350
|
-
} else if (
|
|
23351
|
-
const variant = Object.keys(
|
|
23351
|
+
} else if (blockState3.variants) {
|
|
23352
|
+
const variant = Object.keys(blockState3.variants)[0];
|
|
23352
23353
|
if (variant) {
|
|
23353
23354
|
for (const property of variant.split(",")) {
|
|
23354
23355
|
const [key, value] = property.split("=");
|
|
23355
23356
|
state[key] = value;
|
|
23356
23357
|
}
|
|
23357
23358
|
}
|
|
23358
|
-
} else if (
|
|
23359
|
-
const condition =
|
|
23359
|
+
} else if (blockState3.multipart) {
|
|
23360
|
+
const condition = blockState3.multipart.map((part) => part.when).find((when) => when !== void 0 && Object.values(when).every((value) => typeof value === "string"));
|
|
23360
23361
|
for (const [key, value] of Object.entries(condition ?? {})) state[key] = value.split("|")[0];
|
|
23361
23362
|
}
|
|
23362
23363
|
return state;
|
|
23363
23364
|
}
|
|
23364
23365
|
/** Selects matching models. Supply `choose` to control selection within each alternatives array. */
|
|
23365
|
-
static select(
|
|
23366
|
-
return this.matching(
|
|
23366
|
+
static select(blockState3, state, choose = this.choose) {
|
|
23367
|
+
return this.matching(blockState3, state).map(choose);
|
|
23367
23368
|
}
|
|
23368
23369
|
/** Returns matching model groups before choosing weighted alternatives. */
|
|
23369
|
-
static matching(
|
|
23370
|
+
static matching(blockState3, state) {
|
|
23370
23371
|
const out = [];
|
|
23371
|
-
if (
|
|
23372
|
-
if (Object.keys(
|
|
23373
|
-
out.push(
|
|
23372
|
+
if (blockState3.variants) {
|
|
23373
|
+
if (Object.keys(blockState3.variants).length === 1 && "" in blockState3.variants) {
|
|
23374
|
+
out.push(blockState3.variants[""]);
|
|
23374
23375
|
} else {
|
|
23375
|
-
for (const variantKey in
|
|
23376
|
+
for (const variantKey in blockState3.variants) {
|
|
23376
23377
|
const matches = variantKey.split(",").every((property) => {
|
|
23377
23378
|
const [key, value] = property.split("=");
|
|
23378
23379
|
return `${state[key]}` === `${value}`;
|
|
23379
23380
|
});
|
|
23380
|
-
if (matches) out.push(
|
|
23381
|
+
if (matches) out.push(blockState3.variants[variantKey]);
|
|
23381
23382
|
}
|
|
23382
23383
|
}
|
|
23383
|
-
} else if (
|
|
23384
|
-
for (const part of
|
|
23384
|
+
} else if (blockState3.multipart) {
|
|
23385
|
+
for (const part of blockState3.multipart) {
|
|
23385
23386
|
if (part.apply && (!part.when || matchesCondition(part.when, state))) {
|
|
23386
23387
|
out.push(part.apply);
|
|
23387
23388
|
}
|
|
@@ -23509,9 +23510,9 @@ init_ModelCulling();
|
|
|
23509
23510
|
init_FluidGeometry();
|
|
23510
23511
|
init_Entities();
|
|
23511
23512
|
var _BlockObject = class _BlockObject extends SceneObject {
|
|
23512
|
-
constructor(
|
|
23513
|
+
constructor(blockState3, options) {
|
|
23513
23514
|
super(options);
|
|
23514
|
-
this.blockState =
|
|
23515
|
+
this.blockState = blockState3;
|
|
23515
23516
|
this.isBlockObject = true;
|
|
23516
23517
|
this._previousState = {};
|
|
23517
23518
|
this._state = {};
|
|
@@ -23899,6 +23900,155 @@ function isBlockObject(obj) {
|
|
|
23899
23900
|
init_FluidGeometry();
|
|
23900
23901
|
init_FluidModelObject();
|
|
23901
23902
|
|
|
23903
|
+
// src/model/multiblock/LitematicaParser.ts
|
|
23904
|
+
init_MineRenderError();
|
|
23905
|
+
var LitematicaParser = class {
|
|
23906
|
+
/**
|
|
23907
|
+
* Parses decoded NBT, preserving subregion placement and omitting air.
|
|
23908
|
+
* Later entries in regions replace earlier cells, including with air.
|
|
23909
|
+
* Size encloses all region bounds; positions retain the schematic origin.
|
|
23910
|
+
* Metadata and scheduled ticks are not imported. Named regions can be placed individually.
|
|
23911
|
+
*/
|
|
23912
|
+
static async parse(nbt) {
|
|
23913
|
+
const tags = nbt.value;
|
|
23914
|
+
const version2 = integer2(tags.Version, "Version");
|
|
23915
|
+
if (version2 < 5 || version2 > 7) throw new MineRenderError(`Unsupported Litematica version ${version2}; expected 5, 6, or 7`);
|
|
23916
|
+
const dataVersion = tags.MinecraftDataVersion === void 0 ? void 0 : integer2(tags.MinecraftDataVersion, "MinecraftDataVersion");
|
|
23917
|
+
const blocks = /* @__PURE__ */ new Map();
|
|
23918
|
+
const regions = [];
|
|
23919
|
+
const min = [Infinity, Infinity, Infinity];
|
|
23920
|
+
const max = [-Infinity, -Infinity, -Infinity];
|
|
23921
|
+
for (const [name, tag] of Object.entries(compound(tags.Regions, "Regions"))) {
|
|
23922
|
+
const region = readRegion(compound(tag, `region ${name}`), name, dataVersion, blocks);
|
|
23923
|
+
regions.push(region);
|
|
23924
|
+
for (let axis = 0; axis < 3; axis++) {
|
|
23925
|
+
const start = minimum(region.position[axis], region.signedSize[axis]);
|
|
23926
|
+
min[axis] = Math.min(min[axis], start);
|
|
23927
|
+
max[axis] = Math.max(max[axis], start + region.size[axis]);
|
|
23928
|
+
}
|
|
23929
|
+
}
|
|
23930
|
+
return {
|
|
23931
|
+
size: regions.length ? min.map((value, axis) => max[axis] - value) : [0, 0, 0],
|
|
23932
|
+
blocks: [...blocks.values()],
|
|
23933
|
+
entities: regions.flatMap((region) => region.entities ?? []),
|
|
23934
|
+
dataVersion,
|
|
23935
|
+
regions
|
|
23936
|
+
};
|
|
23937
|
+
}
|
|
23938
|
+
};
|
|
23939
|
+
function readRegion(tags, name, dataVersion, combined) {
|
|
23940
|
+
const position = blockPosition(compound(tags.Position, `region ${name} Position`));
|
|
23941
|
+
const signedSize = blockPosition(compound(tags.Size, `region ${name} Size`));
|
|
23942
|
+
if (signedSize.some((value) => value === 0)) throw new MineRenderError(`Litematica region ${name} dimensions must be nonzero`);
|
|
23943
|
+
const size = signedSize.map(Math.abs);
|
|
23944
|
+
const min = position.map((value, axis) => minimum(value, signedSize[axis]));
|
|
23945
|
+
const [width, height, length] = size;
|
|
23946
|
+
const volume = width * height * length;
|
|
23947
|
+
const palette = compounds(tags.BlockStatePalette, "BlockStatePalette").map(blockState);
|
|
23948
|
+
if (!palette.length) throw new MineRenderError(`Litematica region ${name} has no block palette`);
|
|
23949
|
+
const bits = Math.max(2, Math.ceil(Math.log2(palette.length)));
|
|
23950
|
+
if (!Number.isSafeInteger(volume * bits)) throw new MineRenderError(`Litematica region ${name} volume is too large`);
|
|
23951
|
+
const packed = tags.BlockStates;
|
|
23952
|
+
const expected = Math.ceil(volume * bits / 64);
|
|
23953
|
+
if (packed?.type !== "longArray" || !Array.isArray(packed.value) || packed.value.length !== expected) {
|
|
23954
|
+
throw new MineRenderError(`Litematica region ${name} BlockStates must contain ${expected} longs`);
|
|
23955
|
+
}
|
|
23956
|
+
const words = packed.value.map((pair) => {
|
|
23957
|
+
if (!Array.isArray(pair) || pair.length !== 2 || !pair.every((value) => Number.isInteger(value) && value >= -2147483648 && value <= 4294967295)) {
|
|
23958
|
+
throw new MineRenderError(`Litematica region ${name} has an invalid BlockStates long`);
|
|
23959
|
+
}
|
|
23960
|
+
return [pair[0] >>> 0, pair[1] >>> 0];
|
|
23961
|
+
});
|
|
23962
|
+
const blockEntities = /* @__PURE__ */ new Map();
|
|
23963
|
+
for (const tile of compounds(tags.TileEntities, "TileEntities")) {
|
|
23964
|
+
const pos = blockPosition(tile);
|
|
23965
|
+
if (pos.some((value2, axis) => value2 < 0 || value2 >= size[axis])) {
|
|
23966
|
+
throw new MineRenderError(`Litematica region ${name} block entity is outside its dimensions`);
|
|
23967
|
+
}
|
|
23968
|
+
const index = pos[0] + pos[2] * width + pos[1] * width * length;
|
|
23969
|
+
if (blockEntities.has(index)) throw new MineRenderError(`Duplicate Litematica block entity at index ${index}`);
|
|
23970
|
+
const value = { ...tile };
|
|
23971
|
+
for (const [axis, key] of ["x", "y", "z"].entries()) value[key] = { type: "int", value: pos[axis] + min[axis] };
|
|
23972
|
+
blockEntities.set(index, { type: "compound", value });
|
|
23973
|
+
}
|
|
23974
|
+
const blocks = [];
|
|
23975
|
+
const mask = 2 ** bits - 1;
|
|
23976
|
+
for (let index = 0; index < volume; index++) {
|
|
23977
|
+
const word = Math.floor(index * bits / 64);
|
|
23978
|
+
const shift = index * bits % 64;
|
|
23979
|
+
const [high, low] = words[word];
|
|
23980
|
+
let value = shift < 32 ? low >>> shift : high >>> shift - 32;
|
|
23981
|
+
if (shift < 32 && shift + bits > 32) value |= high << 32 - shift;
|
|
23982
|
+
if (shift + bits > 64) value |= words[word + 1][1] << 64 - shift;
|
|
23983
|
+
const id = (value & mask) >>> 0;
|
|
23984
|
+
const state = palette[id];
|
|
23985
|
+
if (!state) throw new MineRenderError(`Litematica region ${name} palette index ${id} does not exist`);
|
|
23986
|
+
const pos = [
|
|
23987
|
+
index % width + min[0],
|
|
23988
|
+
Math.floor(index / (width * length)) + min[1],
|
|
23989
|
+
Math.floor(index / width) % length + min[2]
|
|
23990
|
+
];
|
|
23991
|
+
const key = pos.join(",");
|
|
23992
|
+
if (["minecraft:air", "minecraft:cave_air", "minecraft:void_air"].includes(state.type)) {
|
|
23993
|
+
combined.delete(key);
|
|
23994
|
+
continue;
|
|
23995
|
+
}
|
|
23996
|
+
const block = { type: state.type, properties: { ...state.properties }, position: pos, nbt: blockEntities.get(index) };
|
|
23997
|
+
blocks.push(block);
|
|
23998
|
+
combined.set(key, block);
|
|
23999
|
+
}
|
|
24000
|
+
const entities = compounds(tags.Entities, "Entities").map((entity) => {
|
|
24001
|
+
const pos = entity.Pos;
|
|
24002
|
+
if (pos?.type !== "list" || pos.value.type !== "double" || pos.value.value.length !== 3 || !pos.value.value.every(Number.isFinite)) {
|
|
24003
|
+
throw new MineRenderError(`Litematica region ${name} entity Pos must contain three doubles`);
|
|
24004
|
+
}
|
|
24005
|
+
const absolute = pos.value.value.map((value2, axis) => value2 + position[axis]);
|
|
24006
|
+
const value = { ...entity, Pos: { type: "list", value: { type: "double", value: [...absolute] } } };
|
|
24007
|
+
return { position: absolute, nbt: { type: "compound", value } };
|
|
24008
|
+
});
|
|
24009
|
+
return { name, position, signedSize, size, blocks, entities, dataVersion };
|
|
24010
|
+
}
|
|
24011
|
+
function minimum(position, size) {
|
|
24012
|
+
return position + Math.min(0, size + 1);
|
|
24013
|
+
}
|
|
24014
|
+
function integer2(tag, name) {
|
|
24015
|
+
if (tag?.type !== "int" || !Number.isInteger(tag.value) || tag.value < -2147483648 || tag.value > 2147483647) {
|
|
24016
|
+
throw new MineRenderError(`Litematica ${name} must be an int`);
|
|
24017
|
+
}
|
|
24018
|
+
return tag.value;
|
|
24019
|
+
}
|
|
24020
|
+
function compound(tag, name) {
|
|
24021
|
+
if (tag?.type !== "compound" || !tag.value || typeof tag.value !== "object" || Array.isArray(tag.value)) {
|
|
24022
|
+
throw new MineRenderError(`Litematica ${name} must be a compound`);
|
|
24023
|
+
}
|
|
24024
|
+
return tag.value;
|
|
24025
|
+
}
|
|
24026
|
+
function blockPosition(tags) {
|
|
24027
|
+
return ["x", "y", "z"].map((axis) => integer2(tags[axis], axis));
|
|
24028
|
+
}
|
|
24029
|
+
function compounds(tag, name) {
|
|
24030
|
+
if (tag === void 0) return [];
|
|
24031
|
+
if (tag.type === "list" && Array.isArray(tag.value.value)) {
|
|
24032
|
+
if (tag.value.value.length === 0) return [];
|
|
24033
|
+
if (tag.value.type === "compound") return tag.value.value;
|
|
24034
|
+
}
|
|
24035
|
+
throw new MineRenderError(`Litematica ${name} must be a compound list`);
|
|
24036
|
+
}
|
|
24037
|
+
function blockState(tags) {
|
|
24038
|
+
const name = tags.Name;
|
|
24039
|
+
if (name?.type !== "string" || !/^(?:[a-z0-9_.-]+:)?[a-z0-9_./-]+$/.test(name.value)) {
|
|
24040
|
+
throw new MineRenderError("Litematica palette entry must have a block Name");
|
|
24041
|
+
}
|
|
24042
|
+
const properties = {};
|
|
24043
|
+
if (tags.Properties !== void 0) {
|
|
24044
|
+
for (const [key, tag] of Object.entries(compound(tags.Properties, "block Properties"))) {
|
|
24045
|
+
if (tag?.type !== "string") throw new MineRenderError("Litematica block properties must be strings");
|
|
24046
|
+
Object.defineProperty(properties, key, { value: tag.value, enumerable: true, writable: true, configurable: true });
|
|
24047
|
+
}
|
|
24048
|
+
}
|
|
24049
|
+
return { type: name.value.includes(":") ? name.value : `minecraft:${name.value}`, properties };
|
|
24050
|
+
}
|
|
24051
|
+
|
|
23902
24052
|
// src/model/multiblock/SchematicParser.ts
|
|
23903
24053
|
init_MineRenderError();
|
|
23904
24054
|
|
|
@@ -25699,12 +25849,12 @@ var SpongeSchematicParser = class {
|
|
|
25699
25849
|
* Biomes and metadata are not imported, and DataVersion does not trigger migration.
|
|
25700
25850
|
*/
|
|
25701
25851
|
static async parse(nbt) {
|
|
25702
|
-
const tags = nbt.value.Schematic === void 0 ? nbt.value :
|
|
25703
|
-
const version2 =
|
|
25852
|
+
const tags = nbt.value.Schematic === void 0 ? nbt.value : compound2(nbt.value.Schematic, "Schematic");
|
|
25853
|
+
const version2 = integer3(tags.Version, "Version");
|
|
25704
25854
|
if (version2 !== 2 && version2 !== 3) {
|
|
25705
25855
|
throw new MineRenderError(`Unsupported Sponge schematic version ${version2}; expected 2 or 3`);
|
|
25706
25856
|
}
|
|
25707
|
-
const dataVersion =
|
|
25857
|
+
const dataVersion = integer3(tags.DataVersion, "DataVersion");
|
|
25708
25858
|
const size = ["Width", "Height", "Length"].map((name) => {
|
|
25709
25859
|
const tag = tags[name];
|
|
25710
25860
|
if (tag?.type !== "short" || !Number.isInteger(tag.value) || tag.value < -32768 || tag.value > 65535 || tag.value === 0) {
|
|
@@ -25714,19 +25864,19 @@ var SpongeSchematicParser = class {
|
|
|
25714
25864
|
});
|
|
25715
25865
|
const offset = tags.Offset === void 0 ? [0, 0, 0] : intPosition(tags.Offset, "Offset");
|
|
25716
25866
|
const blocks = [];
|
|
25717
|
-
const container = version2 === 2 ? tags : tags.Blocks === void 0 ? void 0 :
|
|
25867
|
+
const container = version2 === 2 ? tags : tags.Blocks === void 0 ? void 0 : compound2(tags.Blocks, "Blocks");
|
|
25718
25868
|
if (container) {
|
|
25719
25869
|
const paletteTag = container.Palette;
|
|
25720
25870
|
if (!paletteTag) throw new MineRenderError("Sponge schematic requires a local Palette; global block IDs are not supported");
|
|
25721
25871
|
const palette = /* @__PURE__ */ new Map();
|
|
25722
|
-
const paletteMax = version2 === 2 && tags.PaletteMax !== void 0 ?
|
|
25872
|
+
const paletteMax = version2 === 2 && tags.PaletteMax !== void 0 ? integer3(tags.PaletteMax, "PaletteMax") : void 0;
|
|
25723
25873
|
if (paletteMax !== void 0 && paletteMax <= 0) throw new MineRenderError("Sponge schematic PaletteMax must be positive");
|
|
25724
|
-
for (const [state, tag] of Object.entries(
|
|
25725
|
-
const id =
|
|
25874
|
+
for (const [state, tag] of Object.entries(compound2(paletteTag, "Palette"))) {
|
|
25875
|
+
const id = integer3(tag, "Palette index");
|
|
25726
25876
|
if (id < 0 || palette.has(id) || paletteMax !== void 0 && id >= paletteMax) {
|
|
25727
25877
|
throw new MineRenderError(`Invalid or duplicate Sponge schematic palette index ${id}`);
|
|
25728
25878
|
}
|
|
25729
|
-
palette.set(id,
|
|
25879
|
+
palette.set(id, blockState2(state));
|
|
25730
25880
|
}
|
|
25731
25881
|
const [width, height, length] = size;
|
|
25732
25882
|
const volume = width * height * length;
|
|
@@ -25792,13 +25942,13 @@ var SpongeSchematicParser = class {
|
|
|
25792
25942
|
return { size, blocks, entities, dataVersion };
|
|
25793
25943
|
}
|
|
25794
25944
|
};
|
|
25795
|
-
function
|
|
25945
|
+
function integer3(tag, name) {
|
|
25796
25946
|
if (tag?.type !== "int" || !Number.isInteger(tag.value) || tag.value < -2147483648 || tag.value > 2147483647) {
|
|
25797
25947
|
throw new MineRenderError(`Sponge schematic ${name} must be an int`);
|
|
25798
25948
|
}
|
|
25799
25949
|
return tag.value;
|
|
25800
25950
|
}
|
|
25801
|
-
function
|
|
25951
|
+
function compound2(tag, name) {
|
|
25802
25952
|
if (tag?.type !== "compound" || !tag.value || typeof tag.value !== "object" || Array.isArray(tag.value)) {
|
|
25803
25953
|
throw new MineRenderError(`Sponge schematic ${name} must be a compound`);
|
|
25804
25954
|
}
|
|
@@ -25819,7 +25969,7 @@ function compoundList2(tags, name) {
|
|
|
25819
25969
|
}
|
|
25820
25970
|
throw new MineRenderError(`Sponge schematic ${name} must be a compound list`);
|
|
25821
25971
|
}
|
|
25822
|
-
function
|
|
25972
|
+
function blockState2(state) {
|
|
25823
25973
|
const match = /^((?:[a-z0-9_.-]+:)?[a-z0-9_./-]+)(?:\[([^\[\]]*)\])?$/.exec(state);
|
|
25824
25974
|
if (!match) throw new MineRenderError(`Invalid Sponge schematic block state ${state}`);
|
|
25825
25975
|
const properties = {};
|
|
@@ -25836,7 +25986,7 @@ function entityData(entity, version2) {
|
|
|
25836
25986
|
const id = entity.Id;
|
|
25837
25987
|
if (id?.type !== "string" || !id.value) throw new MineRenderError("Sponge schematic entity Id must be a nonempty string");
|
|
25838
25988
|
const { Id, Pos, ...extra } = entity;
|
|
25839
|
-
const value = version2 === 2 ? extra : entity.Data === void 0 ? {} : { ...
|
|
25989
|
+
const value = version2 === 2 ? extra : entity.Data === void 0 ? {} : { ...compound2(entity.Data, "entity Data") };
|
|
25840
25990
|
value.id = { type: "string", value: id.value.includes(":") ? id.value : `minecraft:${id.value}` };
|
|
25841
25991
|
return value;
|
|
25842
25992
|
}
|
|
@@ -27065,8 +27215,8 @@ var _MineRenderScene = class _MineRenderScene extends import_three34.Scene {
|
|
|
27065
27215
|
* Set `options.initialState` to choose block properties such as `facing` or `axis`.
|
|
27066
27216
|
* Use the returned object's `setPosition` method to move all of its model parts.
|
|
27067
27217
|
*/
|
|
27068
|
-
async addBlock(
|
|
27069
|
-
return this.addSceneObject(
|
|
27218
|
+
async addBlock(blockState3, options, parent = this) {
|
|
27219
|
+
return this.addSceneObject(blockState3, () => new BlockObject(blockState3, options), options, parent);
|
|
27070
27220
|
}
|
|
27071
27221
|
/**
|
|
27072
27222
|
* Loads a skin and adds an initialized player model.
|
|
@@ -29115,8 +29265,8 @@ async function abortable2(promise, signal) {
|
|
|
29115
29265
|
}
|
|
29116
29266
|
}
|
|
29117
29267
|
var AnvilWorldSource = class {
|
|
29118
|
-
constructor(
|
|
29119
|
-
this.readRegion =
|
|
29268
|
+
constructor(readRegion2, options = {}) {
|
|
29269
|
+
this.readRegion = readRegion2;
|
|
29120
29270
|
this.regions = /* @__PURE__ */ new Map();
|
|
29121
29271
|
this.pending = /* @__PURE__ */ new Map();
|
|
29122
29272
|
this.cachedBytes = 0;
|
|
@@ -29271,18 +29421,18 @@ var SectionModels = class {
|
|
|
29271
29421
|
if (!Number.isInteger(maxAtlasSize) || maxAtlasSize < 1) throw new RangeError("maxAtlasSize must be a positive integer");
|
|
29272
29422
|
}
|
|
29273
29423
|
/** Returns a cube template, or `undefined` when the block requires an individual render object. */
|
|
29274
|
-
async get(
|
|
29275
|
-
if (!
|
|
29276
|
-
let states = this.states.get(
|
|
29277
|
-
if (!states) this.states.set(
|
|
29424
|
+
async get(blockState3, properties = {}) {
|
|
29425
|
+
if (!blockState3.variants || blockState3.multipart) return void 0;
|
|
29426
|
+
let states = this.states.get(blockState3);
|
|
29427
|
+
if (!states) this.states.set(blockState3, states = /* @__PURE__ */ new Map());
|
|
29278
29428
|
const key = JSON.stringify(Object.entries(properties).sort(([a], [b]) => a.localeCompare(b)));
|
|
29279
|
-
const prepared = await cached(states, key, () => this.prepare(
|
|
29429
|
+
const prepared = await cached(states, key, () => this.prepare(blockState3, properties));
|
|
29280
29430
|
if (!prepared) return void 0;
|
|
29281
29431
|
return prepared.templates.get(BlockStateResolver.choose(prepared.variants));
|
|
29282
29432
|
}
|
|
29283
|
-
async prepare(
|
|
29284
|
-
const state = { ...await BlockStateResolver.defaults(
|
|
29285
|
-
const groups = BlockStateResolver.matching(
|
|
29433
|
+
async prepare(blockState3, properties) {
|
|
29434
|
+
const state = { ...await BlockStateResolver.defaults(blockState3), ...properties };
|
|
29435
|
+
const groups = BlockStateResolver.matching(blockState3, state);
|
|
29286
29436
|
if (groups.length !== 1) return void 0;
|
|
29287
29437
|
const variants = groups[0];
|
|
29288
29438
|
const choices = Array.isArray(variants) ? variants : [variants];
|
|
@@ -29294,7 +29444,7 @@ var SectionModels = class {
|
|
|
29294
29444
|
const atlas = await UVMapper.getAtlas(model);
|
|
29295
29445
|
const rotation = BlockStateResolver.rotation(variant);
|
|
29296
29446
|
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;
|
|
29297
|
-
const tints = await BlockTints.get(
|
|
29447
|
+
const tints = await BlockTints.get(blockState3.key, state, model);
|
|
29298
29448
|
let models = this.models.get(model);
|
|
29299
29449
|
if (!models) this.models.set(model, models = /* @__PURE__ */ new Map());
|
|
29300
29450
|
const key = JSON.stringify([rotation.x, rotation.y, rotation.z, variant.uvlock, tints]);
|
|
@@ -30000,10 +30150,10 @@ var Chunk = class _Chunk {
|
|
|
30000
30150
|
if (resolutions.has(key)) continue;
|
|
30001
30151
|
const stored = { type: block.type, properties: block.properties ? { ...block.properties } : void 0 };
|
|
30002
30152
|
const resolved = (async () => {
|
|
30003
|
-
const
|
|
30004
|
-
const perBlock = !
|
|
30005
|
-
if (!perBlock) await this.sectionModels.get(
|
|
30006
|
-
return { blockState:
|
|
30153
|
+
const blockState3 = await BlockStates.get(AssetKey.parse("blockstates", stored.type));
|
|
30154
|
+
const perBlock = !blockState3 || !this.sectionModels || !!getFluidKind(blockState3.key, stored.properties) || !!(blockState3.key && BlockEntities.entry(await BlockEntities.getIndex(blockState3.key.root), blockState3.key.toNamespacedString()));
|
|
30155
|
+
if (!perBlock) await this.sectionModels.get(blockState3, stored.properties);
|
|
30156
|
+
return { blockState: blockState3, perBlock };
|
|
30007
30157
|
})();
|
|
30008
30158
|
resolutions.set(key, resolved);
|
|
30009
30159
|
void resolved.catch(() => void 0);
|
|
@@ -30028,17 +30178,17 @@ var Chunk = class _Chunk {
|
|
|
30028
30178
|
if (!readBlock) continue;
|
|
30029
30179
|
const stored = readBlock();
|
|
30030
30180
|
const key = ChunkData.paletteKey(stored);
|
|
30031
|
-
const { blockState:
|
|
30032
|
-
if (!
|
|
30181
|
+
const { blockState: blockState3, perBlock } = await resolutions.get(key);
|
|
30182
|
+
if (!blockState3) {
|
|
30033
30183
|
this.data.set(index, void 0);
|
|
30034
30184
|
continue;
|
|
30035
30185
|
}
|
|
30036
|
-
const template = perBlock ? void 0 : await this.sectionModels.get(
|
|
30186
|
+
const template = perBlock ? void 0 : await this.sectionModels.get(blockState3, stored.properties);
|
|
30037
30187
|
if (template) {
|
|
30038
30188
|
this.sectionBlocks.set(index, { index, template, cullMask: 0 });
|
|
30039
30189
|
this.meshDirty = true;
|
|
30040
30190
|
} else {
|
|
30041
|
-
object3 = await this.scene.addBlock(
|
|
30191
|
+
object3 = await this.scene.addBlock(blockState3, {
|
|
30042
30192
|
mergeMeshes: true,
|
|
30043
30193
|
instanceMeshes: true,
|
|
30044
30194
|
maxInstanceCount: 2e3,
|