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/node/index.d.mts
CHANGED
|
@@ -2050,6 +2050,29 @@ interface MultiBlockBlock extends Block {
|
|
|
2050
2050
|
position: TripleArray;
|
|
2051
2051
|
}
|
|
2052
2052
|
|
|
2053
|
+
/** A named region with block and entity positions relative to the schematic origin. */
|
|
2054
|
+
interface LitematicaRegion extends MultiBlockStructure {
|
|
2055
|
+
readonly name: string;
|
|
2056
|
+
/** The selected first corner, relative to the schematic origin. */
|
|
2057
|
+
readonly position: TripleArray;
|
|
2058
|
+
/** Signed source dimensions. The inherited size contains their absolute values. */
|
|
2059
|
+
readonly signedSize: TripleArray;
|
|
2060
|
+
}
|
|
2061
|
+
/** Combined blocks and the named regions that produced them. */
|
|
2062
|
+
interface LitematicaStructure extends MultiBlockStructure {
|
|
2063
|
+
readonly regions: LitematicaRegion[];
|
|
2064
|
+
}
|
|
2065
|
+
/** Reads v5–7 `.litematic` files without migrating block states or entity NBT. */
|
|
2066
|
+
declare class LitematicaParser {
|
|
2067
|
+
/**
|
|
2068
|
+
* Parses decoded NBT, preserving subregion placement and omitting air.
|
|
2069
|
+
* Later entries in regions replace earlier cells, including with air.
|
|
2070
|
+
* Size encloses all region bounds; positions retain the schematic origin.
|
|
2071
|
+
* Metadata and scheduled ticks are not imported. Named regions can be placed individually.
|
|
2072
|
+
*/
|
|
2073
|
+
static parse(nbt: NBT): Promise<LitematicaStructure>;
|
|
2074
|
+
}
|
|
2075
|
+
|
|
2053
2076
|
/** Converts legacy Alpha `.schematic` NBT with numeric block IDs into modern block names and properties. */
|
|
2054
2077
|
declare class SchematicParser {
|
|
2055
2078
|
/**
|
|
@@ -3555,4 +3578,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
|
|
|
3555
3578
|
forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
|
|
3556
3579
|
}
|
|
3557
3580
|
|
|
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 };
|
|
3581
|
+
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, 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, 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
|
@@ -2050,6 +2050,29 @@ interface MultiBlockBlock extends Block {
|
|
|
2050
2050
|
position: TripleArray;
|
|
2051
2051
|
}
|
|
2052
2052
|
|
|
2053
|
+
/** A named region with block and entity positions relative to the schematic origin. */
|
|
2054
|
+
interface LitematicaRegion extends MultiBlockStructure {
|
|
2055
|
+
readonly name: string;
|
|
2056
|
+
/** The selected first corner, relative to the schematic origin. */
|
|
2057
|
+
readonly position: TripleArray;
|
|
2058
|
+
/** Signed source dimensions. The inherited size contains their absolute values. */
|
|
2059
|
+
readonly signedSize: TripleArray;
|
|
2060
|
+
}
|
|
2061
|
+
/** Combined blocks and the named regions that produced them. */
|
|
2062
|
+
interface LitematicaStructure extends MultiBlockStructure {
|
|
2063
|
+
readonly regions: LitematicaRegion[];
|
|
2064
|
+
}
|
|
2065
|
+
/** Reads v5–7 `.litematic` files without migrating block states or entity NBT. */
|
|
2066
|
+
declare class LitematicaParser {
|
|
2067
|
+
/**
|
|
2068
|
+
* Parses decoded NBT, preserving subregion placement and omitting air.
|
|
2069
|
+
* Later entries in regions replace earlier cells, including with air.
|
|
2070
|
+
* Size encloses all region bounds; positions retain the schematic origin.
|
|
2071
|
+
* Metadata and scheduled ticks are not imported. Named regions can be placed individually.
|
|
2072
|
+
*/
|
|
2073
|
+
static parse(nbt: NBT): Promise<LitematicaStructure>;
|
|
2074
|
+
}
|
|
2075
|
+
|
|
2053
2076
|
/** Converts legacy Alpha `.schematic` NBT with numeric block IDs into modern block names and properties. */
|
|
2054
2077
|
declare class SchematicParser {
|
|
2055
2078
|
/**
|
|
@@ -3555,4 +3578,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
|
|
|
3555
3578
|
forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
|
|
3556
3579
|
}
|
|
3557
3580
|
|
|
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 };
|
|
3581
|
+
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, 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, 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
|
@@ -18853,6 +18853,7 @@ __export(index_node_exports, {
|
|
|
18853
18853
|
InstanceManager: () => InstanceManager,
|
|
18854
18854
|
InstanceReference: () => InstanceReference,
|
|
18855
18855
|
ItemTints: () => ItemTints,
|
|
18856
|
+
LitematicaParser: () => LitematicaParser,
|
|
18856
18857
|
MapControls: () => MapControls,
|
|
18857
18858
|
Materials: () => Materials,
|
|
18858
18859
|
Meshes: () => Meshes,
|
|
@@ -23386,46 +23387,46 @@ function matchesCondition(condition, state) {
|
|
|
23386
23387
|
}
|
|
23387
23388
|
var BlockStateResolver = class {
|
|
23388
23389
|
/** Loads vanilla property defaults, falling back to preview values inferred from the blockstate file. */
|
|
23389
|
-
static async defaults(
|
|
23390
|
-
const defaults =
|
|
23390
|
+
static async defaults(blockState3) {
|
|
23391
|
+
const defaults = blockState3.key ? await BlockStates.getDefaultState(blockState3.key) : void 0;
|
|
23391
23392
|
const state = {};
|
|
23392
23393
|
if (defaults && Object.keys(defaults).length > 0) {
|
|
23393
23394
|
for (const key in defaults) state[key] = defaults[key].default;
|
|
23394
|
-
} else if (
|
|
23395
|
-
const variant = Object.keys(
|
|
23395
|
+
} else if (blockState3.variants) {
|
|
23396
|
+
const variant = Object.keys(blockState3.variants)[0];
|
|
23396
23397
|
if (variant) {
|
|
23397
23398
|
for (const property of variant.split(",")) {
|
|
23398
23399
|
const [key, value] = property.split("=");
|
|
23399
23400
|
state[key] = value;
|
|
23400
23401
|
}
|
|
23401
23402
|
}
|
|
23402
|
-
} else if (
|
|
23403
|
-
const condition =
|
|
23403
|
+
} else if (blockState3.multipart) {
|
|
23404
|
+
const condition = blockState3.multipart.map((part) => part.when).find((when) => when !== void 0 && Object.values(when).every((value) => typeof value === "string"));
|
|
23404
23405
|
for (const [key, value] of Object.entries(condition ?? {})) state[key] = value.split("|")[0];
|
|
23405
23406
|
}
|
|
23406
23407
|
return state;
|
|
23407
23408
|
}
|
|
23408
23409
|
/** Selects matching models. Supply `choose` to control selection within each alternatives array. */
|
|
23409
|
-
static select(
|
|
23410
|
-
return this.matching(
|
|
23410
|
+
static select(blockState3, state, choose = this.choose) {
|
|
23411
|
+
return this.matching(blockState3, state).map(choose);
|
|
23411
23412
|
}
|
|
23412
23413
|
/** Returns matching model groups before choosing weighted alternatives. */
|
|
23413
|
-
static matching(
|
|
23414
|
+
static matching(blockState3, state) {
|
|
23414
23415
|
const out = [];
|
|
23415
|
-
if (
|
|
23416
|
-
if (Object.keys(
|
|
23417
|
-
out.push(
|
|
23416
|
+
if (blockState3.variants) {
|
|
23417
|
+
if (Object.keys(blockState3.variants).length === 1 && "" in blockState3.variants) {
|
|
23418
|
+
out.push(blockState3.variants[""]);
|
|
23418
23419
|
} else {
|
|
23419
|
-
for (const variantKey in
|
|
23420
|
+
for (const variantKey in blockState3.variants) {
|
|
23420
23421
|
const matches = variantKey.split(",").every((property) => {
|
|
23421
23422
|
const [key, value] = property.split("=");
|
|
23422
23423
|
return `${state[key]}` === `${value}`;
|
|
23423
23424
|
});
|
|
23424
|
-
if (matches) out.push(
|
|
23425
|
+
if (matches) out.push(blockState3.variants[variantKey]);
|
|
23425
23426
|
}
|
|
23426
23427
|
}
|
|
23427
|
-
} else if (
|
|
23428
|
-
for (const part of
|
|
23428
|
+
} else if (blockState3.multipart) {
|
|
23429
|
+
for (const part of blockState3.multipart) {
|
|
23429
23430
|
if (part.apply && (!part.when || matchesCondition(part.when, state))) {
|
|
23430
23431
|
out.push(part.apply);
|
|
23431
23432
|
}
|
|
@@ -23553,9 +23554,9 @@ init_ModelCulling();
|
|
|
23553
23554
|
init_FluidGeometry();
|
|
23554
23555
|
init_Entities();
|
|
23555
23556
|
var BlockObject = class _BlockObject extends SceneObject {
|
|
23556
|
-
constructor(
|
|
23557
|
+
constructor(blockState3, options) {
|
|
23557
23558
|
super(options);
|
|
23558
|
-
this.blockState =
|
|
23559
|
+
this.blockState = blockState3;
|
|
23559
23560
|
this.isBlockObject = true;
|
|
23560
23561
|
this._previousState = {};
|
|
23561
23562
|
this._state = {};
|
|
@@ -23944,6 +23945,155 @@ function isBlockObject(obj) {
|
|
|
23944
23945
|
init_FluidGeometry();
|
|
23945
23946
|
init_FluidModelObject();
|
|
23946
23947
|
|
|
23948
|
+
// src/model/multiblock/LitematicaParser.ts
|
|
23949
|
+
init_MineRenderError();
|
|
23950
|
+
var LitematicaParser = class {
|
|
23951
|
+
/**
|
|
23952
|
+
* Parses decoded NBT, preserving subregion placement and omitting air.
|
|
23953
|
+
* Later entries in regions replace earlier cells, including with air.
|
|
23954
|
+
* Size encloses all region bounds; positions retain the schematic origin.
|
|
23955
|
+
* Metadata and scheduled ticks are not imported. Named regions can be placed individually.
|
|
23956
|
+
*/
|
|
23957
|
+
static async parse(nbt) {
|
|
23958
|
+
const tags = nbt.value;
|
|
23959
|
+
const version2 = integer2(tags.Version, "Version");
|
|
23960
|
+
if (version2 < 5 || version2 > 7) throw new MineRenderError(`Unsupported Litematica version ${version2}; expected 5, 6, or 7`);
|
|
23961
|
+
const dataVersion = tags.MinecraftDataVersion === void 0 ? void 0 : integer2(tags.MinecraftDataVersion, "MinecraftDataVersion");
|
|
23962
|
+
const blocks = /* @__PURE__ */ new Map();
|
|
23963
|
+
const regions = [];
|
|
23964
|
+
const min = [Infinity, Infinity, Infinity];
|
|
23965
|
+
const max = [-Infinity, -Infinity, -Infinity];
|
|
23966
|
+
for (const [name, tag] of Object.entries(compound(tags.Regions, "Regions"))) {
|
|
23967
|
+
const region = readRegion(compound(tag, `region ${name}`), name, dataVersion, blocks);
|
|
23968
|
+
regions.push(region);
|
|
23969
|
+
for (let axis = 0; axis < 3; axis++) {
|
|
23970
|
+
const start = minimum(region.position[axis], region.signedSize[axis]);
|
|
23971
|
+
min[axis] = Math.min(min[axis], start);
|
|
23972
|
+
max[axis] = Math.max(max[axis], start + region.size[axis]);
|
|
23973
|
+
}
|
|
23974
|
+
}
|
|
23975
|
+
return {
|
|
23976
|
+
size: regions.length ? min.map((value, axis) => max[axis] - value) : [0, 0, 0],
|
|
23977
|
+
blocks: [...blocks.values()],
|
|
23978
|
+
entities: regions.flatMap((region) => region.entities ?? []),
|
|
23979
|
+
dataVersion,
|
|
23980
|
+
regions
|
|
23981
|
+
};
|
|
23982
|
+
}
|
|
23983
|
+
};
|
|
23984
|
+
function readRegion(tags, name, dataVersion, combined) {
|
|
23985
|
+
const position = blockPosition(compound(tags.Position, `region ${name} Position`));
|
|
23986
|
+
const signedSize = blockPosition(compound(tags.Size, `region ${name} Size`));
|
|
23987
|
+
if (signedSize.some((value) => value === 0)) throw new MineRenderError(`Litematica region ${name} dimensions must be nonzero`);
|
|
23988
|
+
const size = signedSize.map(Math.abs);
|
|
23989
|
+
const min = position.map((value, axis) => minimum(value, signedSize[axis]));
|
|
23990
|
+
const [width, height, length] = size;
|
|
23991
|
+
const volume = width * height * length;
|
|
23992
|
+
const palette = compounds(tags.BlockStatePalette, "BlockStatePalette").map(blockState);
|
|
23993
|
+
if (!palette.length) throw new MineRenderError(`Litematica region ${name} has no block palette`);
|
|
23994
|
+
const bits = Math.max(2, Math.ceil(Math.log2(palette.length)));
|
|
23995
|
+
if (!Number.isSafeInteger(volume * bits)) throw new MineRenderError(`Litematica region ${name} volume is too large`);
|
|
23996
|
+
const packed = tags.BlockStates;
|
|
23997
|
+
const expected = Math.ceil(volume * bits / 64);
|
|
23998
|
+
if (packed?.type !== "longArray" || !Array.isArray(packed.value) || packed.value.length !== expected) {
|
|
23999
|
+
throw new MineRenderError(`Litematica region ${name} BlockStates must contain ${expected} longs`);
|
|
24000
|
+
}
|
|
24001
|
+
const words = packed.value.map((pair) => {
|
|
24002
|
+
if (!Array.isArray(pair) || pair.length !== 2 || !pair.every((value) => Number.isInteger(value) && value >= -2147483648 && value <= 4294967295)) {
|
|
24003
|
+
throw new MineRenderError(`Litematica region ${name} has an invalid BlockStates long`);
|
|
24004
|
+
}
|
|
24005
|
+
return [pair[0] >>> 0, pair[1] >>> 0];
|
|
24006
|
+
});
|
|
24007
|
+
const blockEntities = /* @__PURE__ */ new Map();
|
|
24008
|
+
for (const tile of compounds(tags.TileEntities, "TileEntities")) {
|
|
24009
|
+
const pos = blockPosition(tile);
|
|
24010
|
+
if (pos.some((value2, axis) => value2 < 0 || value2 >= size[axis])) {
|
|
24011
|
+
throw new MineRenderError(`Litematica region ${name} block entity is outside its dimensions`);
|
|
24012
|
+
}
|
|
24013
|
+
const index = pos[0] + pos[2] * width + pos[1] * width * length;
|
|
24014
|
+
if (blockEntities.has(index)) throw new MineRenderError(`Duplicate Litematica block entity at index ${index}`);
|
|
24015
|
+
const value = { ...tile };
|
|
24016
|
+
for (const [axis, key] of ["x", "y", "z"].entries()) value[key] = { type: "int", value: pos[axis] + min[axis] };
|
|
24017
|
+
blockEntities.set(index, { type: "compound", value });
|
|
24018
|
+
}
|
|
24019
|
+
const blocks = [];
|
|
24020
|
+
const mask = 2 ** bits - 1;
|
|
24021
|
+
for (let index = 0; index < volume; index++) {
|
|
24022
|
+
const word = Math.floor(index * bits / 64);
|
|
24023
|
+
const shift = index * bits % 64;
|
|
24024
|
+
const [high, low] = words[word];
|
|
24025
|
+
let value = shift < 32 ? low >>> shift : high >>> shift - 32;
|
|
24026
|
+
if (shift < 32 && shift + bits > 32) value |= high << 32 - shift;
|
|
24027
|
+
if (shift + bits > 64) value |= words[word + 1][1] << 64 - shift;
|
|
24028
|
+
const id = (value & mask) >>> 0;
|
|
24029
|
+
const state = palette[id];
|
|
24030
|
+
if (!state) throw new MineRenderError(`Litematica region ${name} palette index ${id} does not exist`);
|
|
24031
|
+
const pos = [
|
|
24032
|
+
index % width + min[0],
|
|
24033
|
+
Math.floor(index / (width * length)) + min[1],
|
|
24034
|
+
Math.floor(index / width) % length + min[2]
|
|
24035
|
+
];
|
|
24036
|
+
const key = pos.join(",");
|
|
24037
|
+
if (["minecraft:air", "minecraft:cave_air", "minecraft:void_air"].includes(state.type)) {
|
|
24038
|
+
combined.delete(key);
|
|
24039
|
+
continue;
|
|
24040
|
+
}
|
|
24041
|
+
const block = { type: state.type, properties: { ...state.properties }, position: pos, nbt: blockEntities.get(index) };
|
|
24042
|
+
blocks.push(block);
|
|
24043
|
+
combined.set(key, block);
|
|
24044
|
+
}
|
|
24045
|
+
const entities = compounds(tags.Entities, "Entities").map((entity) => {
|
|
24046
|
+
const pos = entity.Pos;
|
|
24047
|
+
if (pos?.type !== "list" || pos.value.type !== "double" || pos.value.value.length !== 3 || !pos.value.value.every(Number.isFinite)) {
|
|
24048
|
+
throw new MineRenderError(`Litematica region ${name} entity Pos must contain three doubles`);
|
|
24049
|
+
}
|
|
24050
|
+
const absolute = pos.value.value.map((value2, axis) => value2 + position[axis]);
|
|
24051
|
+
const value = { ...entity, Pos: { type: "list", value: { type: "double", value: [...absolute] } } };
|
|
24052
|
+
return { position: absolute, nbt: { type: "compound", value } };
|
|
24053
|
+
});
|
|
24054
|
+
return { name, position, signedSize, size, blocks, entities, dataVersion };
|
|
24055
|
+
}
|
|
24056
|
+
function minimum(position, size) {
|
|
24057
|
+
return position + Math.min(0, size + 1);
|
|
24058
|
+
}
|
|
24059
|
+
function integer2(tag, name) {
|
|
24060
|
+
if (tag?.type !== "int" || !Number.isInteger(tag.value) || tag.value < -2147483648 || tag.value > 2147483647) {
|
|
24061
|
+
throw new MineRenderError(`Litematica ${name} must be an int`);
|
|
24062
|
+
}
|
|
24063
|
+
return tag.value;
|
|
24064
|
+
}
|
|
24065
|
+
function compound(tag, name) {
|
|
24066
|
+
if (tag?.type !== "compound" || !tag.value || typeof tag.value !== "object" || Array.isArray(tag.value)) {
|
|
24067
|
+
throw new MineRenderError(`Litematica ${name} must be a compound`);
|
|
24068
|
+
}
|
|
24069
|
+
return tag.value;
|
|
24070
|
+
}
|
|
24071
|
+
function blockPosition(tags) {
|
|
24072
|
+
return ["x", "y", "z"].map((axis) => integer2(tags[axis], axis));
|
|
24073
|
+
}
|
|
24074
|
+
function compounds(tag, name) {
|
|
24075
|
+
if (tag === void 0) return [];
|
|
24076
|
+
if (tag.type === "list" && Array.isArray(tag.value.value)) {
|
|
24077
|
+
if (tag.value.value.length === 0) return [];
|
|
24078
|
+
if (tag.value.type === "compound") return tag.value.value;
|
|
24079
|
+
}
|
|
24080
|
+
throw new MineRenderError(`Litematica ${name} must be a compound list`);
|
|
24081
|
+
}
|
|
24082
|
+
function blockState(tags) {
|
|
24083
|
+
const name = tags.Name;
|
|
24084
|
+
if (name?.type !== "string" || !/^(?:[a-z0-9_.-]+:)?[a-z0-9_./-]+$/.test(name.value)) {
|
|
24085
|
+
throw new MineRenderError("Litematica palette entry must have a block Name");
|
|
24086
|
+
}
|
|
24087
|
+
const properties = {};
|
|
24088
|
+
if (tags.Properties !== void 0) {
|
|
24089
|
+
for (const [key, tag] of Object.entries(compound(tags.Properties, "block Properties"))) {
|
|
24090
|
+
if (tag?.type !== "string") throw new MineRenderError("Litematica block properties must be strings");
|
|
24091
|
+
Object.defineProperty(properties, key, { value: tag.value, enumerable: true, writable: true, configurable: true });
|
|
24092
|
+
}
|
|
24093
|
+
}
|
|
24094
|
+
return { type: name.value.includes(":") ? name.value : `minecraft:${name.value}`, properties };
|
|
24095
|
+
}
|
|
24096
|
+
|
|
23947
24097
|
// src/model/multiblock/SchematicParser.ts
|
|
23948
24098
|
init_MineRenderError();
|
|
23949
24099
|
|
|
@@ -25744,12 +25894,12 @@ var SpongeSchematicParser = class {
|
|
|
25744
25894
|
* Biomes and metadata are not imported, and DataVersion does not trigger migration.
|
|
25745
25895
|
*/
|
|
25746
25896
|
static async parse(nbt) {
|
|
25747
|
-
const tags = nbt.value.Schematic === void 0 ? nbt.value :
|
|
25748
|
-
const version2 =
|
|
25897
|
+
const tags = nbt.value.Schematic === void 0 ? nbt.value : compound2(nbt.value.Schematic, "Schematic");
|
|
25898
|
+
const version2 = integer3(tags.Version, "Version");
|
|
25749
25899
|
if (version2 !== 2 && version2 !== 3) {
|
|
25750
25900
|
throw new MineRenderError(`Unsupported Sponge schematic version ${version2}; expected 2 or 3`);
|
|
25751
25901
|
}
|
|
25752
|
-
const dataVersion =
|
|
25902
|
+
const dataVersion = integer3(tags.DataVersion, "DataVersion");
|
|
25753
25903
|
const size = ["Width", "Height", "Length"].map((name) => {
|
|
25754
25904
|
const tag = tags[name];
|
|
25755
25905
|
if (tag?.type !== "short" || !Number.isInteger(tag.value) || tag.value < -32768 || tag.value > 65535 || tag.value === 0) {
|
|
@@ -25759,19 +25909,19 @@ var SpongeSchematicParser = class {
|
|
|
25759
25909
|
});
|
|
25760
25910
|
const offset = tags.Offset === void 0 ? [0, 0, 0] : intPosition(tags.Offset, "Offset");
|
|
25761
25911
|
const blocks = [];
|
|
25762
|
-
const container = version2 === 2 ? tags : tags.Blocks === void 0 ? void 0 :
|
|
25912
|
+
const container = version2 === 2 ? tags : tags.Blocks === void 0 ? void 0 : compound2(tags.Blocks, "Blocks");
|
|
25763
25913
|
if (container) {
|
|
25764
25914
|
const paletteTag = container.Palette;
|
|
25765
25915
|
if (!paletteTag) throw new MineRenderError("Sponge schematic requires a local Palette; global block IDs are not supported");
|
|
25766
25916
|
const palette = /* @__PURE__ */ new Map();
|
|
25767
|
-
const paletteMax = version2 === 2 && tags.PaletteMax !== void 0 ?
|
|
25917
|
+
const paletteMax = version2 === 2 && tags.PaletteMax !== void 0 ? integer3(tags.PaletteMax, "PaletteMax") : void 0;
|
|
25768
25918
|
if (paletteMax !== void 0 && paletteMax <= 0) throw new MineRenderError("Sponge schematic PaletteMax must be positive");
|
|
25769
|
-
for (const [state, tag] of Object.entries(
|
|
25770
|
-
const id =
|
|
25919
|
+
for (const [state, tag] of Object.entries(compound2(paletteTag, "Palette"))) {
|
|
25920
|
+
const id = integer3(tag, "Palette index");
|
|
25771
25921
|
if (id < 0 || palette.has(id) || paletteMax !== void 0 && id >= paletteMax) {
|
|
25772
25922
|
throw new MineRenderError(`Invalid or duplicate Sponge schematic palette index ${id}`);
|
|
25773
25923
|
}
|
|
25774
|
-
palette.set(id,
|
|
25924
|
+
palette.set(id, blockState2(state));
|
|
25775
25925
|
}
|
|
25776
25926
|
const [width, height, length] = size;
|
|
25777
25927
|
const volume = width * height * length;
|
|
@@ -25837,13 +25987,13 @@ var SpongeSchematicParser = class {
|
|
|
25837
25987
|
return { size, blocks, entities, dataVersion };
|
|
25838
25988
|
}
|
|
25839
25989
|
};
|
|
25840
|
-
function
|
|
25990
|
+
function integer3(tag, name) {
|
|
25841
25991
|
if (tag?.type !== "int" || !Number.isInteger(tag.value) || tag.value < -2147483648 || tag.value > 2147483647) {
|
|
25842
25992
|
throw new MineRenderError(`Sponge schematic ${name} must be an int`);
|
|
25843
25993
|
}
|
|
25844
25994
|
return tag.value;
|
|
25845
25995
|
}
|
|
25846
|
-
function
|
|
25996
|
+
function compound2(tag, name) {
|
|
25847
25997
|
if (tag?.type !== "compound" || !tag.value || typeof tag.value !== "object" || Array.isArray(tag.value)) {
|
|
25848
25998
|
throw new MineRenderError(`Sponge schematic ${name} must be a compound`);
|
|
25849
25999
|
}
|
|
@@ -25864,7 +26014,7 @@ function compoundList2(tags, name) {
|
|
|
25864
26014
|
}
|
|
25865
26015
|
throw new MineRenderError(`Sponge schematic ${name} must be a compound list`);
|
|
25866
26016
|
}
|
|
25867
|
-
function
|
|
26017
|
+
function blockState2(state) {
|
|
25868
26018
|
const match = /^((?:[a-z0-9_.-]+:)?[a-z0-9_./-]+)(?:\[([^\[\]]*)\])?$/.exec(state);
|
|
25869
26019
|
if (!match) throw new MineRenderError(`Invalid Sponge schematic block state ${state}`);
|
|
25870
26020
|
const properties = {};
|
|
@@ -25881,7 +26031,7 @@ function entityData(entity, version2) {
|
|
|
25881
26031
|
const id = entity.Id;
|
|
25882
26032
|
if (id?.type !== "string" || !id.value) throw new MineRenderError("Sponge schematic entity Id must be a nonempty string");
|
|
25883
26033
|
const { Id, Pos, ...extra } = entity;
|
|
25884
|
-
const value = version2 === 2 ? extra : entity.Data === void 0 ? {} : { ...
|
|
26034
|
+
const value = version2 === 2 ? extra : entity.Data === void 0 ? {} : { ...compound2(entity.Data, "entity Data") };
|
|
25885
26035
|
value.id = { type: "string", value: id.value.includes(":") ? id.value : `minecraft:${id.value}` };
|
|
25886
26036
|
return value;
|
|
25887
26037
|
}
|
|
@@ -27113,8 +27263,8 @@ var MineRenderScene = class _MineRenderScene extends import_three34.Scene {
|
|
|
27113
27263
|
* Set `options.initialState` to choose block properties such as `facing` or `axis`.
|
|
27114
27264
|
* Use the returned object's `setPosition` method to move all of its model parts.
|
|
27115
27265
|
*/
|
|
27116
|
-
async addBlock(
|
|
27117
|
-
return this.addSceneObject(
|
|
27266
|
+
async addBlock(blockState3, options, parent = this) {
|
|
27267
|
+
return this.addSceneObject(blockState3, () => new BlockObject(blockState3, options), options, parent);
|
|
27118
27268
|
}
|
|
27119
27269
|
/**
|
|
27120
27270
|
* Loads a skin and adds an initialized player model.
|
|
@@ -29162,8 +29312,8 @@ async function abortable2(promise, signal) {
|
|
|
29162
29312
|
}
|
|
29163
29313
|
}
|
|
29164
29314
|
var AnvilWorldSource = class {
|
|
29165
|
-
constructor(
|
|
29166
|
-
this.readRegion =
|
|
29315
|
+
constructor(readRegion2, options = {}) {
|
|
29316
|
+
this.readRegion = readRegion2;
|
|
29167
29317
|
this.regions = /* @__PURE__ */ new Map();
|
|
29168
29318
|
this.pending = /* @__PURE__ */ new Map();
|
|
29169
29319
|
this.cachedBytes = 0;
|
|
@@ -29318,18 +29468,18 @@ var SectionModels = class {
|
|
|
29318
29468
|
if (!Number.isInteger(maxAtlasSize) || maxAtlasSize < 1) throw new RangeError("maxAtlasSize must be a positive integer");
|
|
29319
29469
|
}
|
|
29320
29470
|
/** Returns a cube template, or `undefined` when the block requires an individual render object. */
|
|
29321
|
-
async get(
|
|
29322
|
-
if (!
|
|
29323
|
-
let states = this.states.get(
|
|
29324
|
-
if (!states) this.states.set(
|
|
29471
|
+
async get(blockState3, properties = {}) {
|
|
29472
|
+
if (!blockState3.variants || blockState3.multipart) return void 0;
|
|
29473
|
+
let states = this.states.get(blockState3);
|
|
29474
|
+
if (!states) this.states.set(blockState3, states = /* @__PURE__ */ new Map());
|
|
29325
29475
|
const key = JSON.stringify(Object.entries(properties).sort(([a], [b]) => a.localeCompare(b)));
|
|
29326
|
-
const prepared = await cached(states, key, () => this.prepare(
|
|
29476
|
+
const prepared = await cached(states, key, () => this.prepare(blockState3, properties));
|
|
29327
29477
|
if (!prepared) return void 0;
|
|
29328
29478
|
return prepared.templates.get(BlockStateResolver.choose(prepared.variants));
|
|
29329
29479
|
}
|
|
29330
|
-
async prepare(
|
|
29331
|
-
const state = { ...await BlockStateResolver.defaults(
|
|
29332
|
-
const groups = BlockStateResolver.matching(
|
|
29480
|
+
async prepare(blockState3, properties) {
|
|
29481
|
+
const state = { ...await BlockStateResolver.defaults(blockState3), ...properties };
|
|
29482
|
+
const groups = BlockStateResolver.matching(blockState3, state);
|
|
29333
29483
|
if (groups.length !== 1) return void 0;
|
|
29334
29484
|
const variants = groups[0];
|
|
29335
29485
|
const choices = Array.isArray(variants) ? variants : [variants];
|
|
@@ -29341,7 +29491,7 @@ var SectionModels = class {
|
|
|
29341
29491
|
const atlas = await UVMapper.getAtlas(model);
|
|
29342
29492
|
const rotation = BlockStateResolver.rotation(variant);
|
|
29343
29493
|
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;
|
|
29344
|
-
const tints = await BlockTints.get(
|
|
29494
|
+
const tints = await BlockTints.get(blockState3.key, state, model);
|
|
29345
29495
|
let models = this.models.get(model);
|
|
29346
29496
|
if (!models) this.models.set(model, models = /* @__PURE__ */ new Map());
|
|
29347
29497
|
const key = JSON.stringify([rotation.x, rotation.y, rotation.z, variant.uvlock, tints]);
|
|
@@ -30048,10 +30198,10 @@ var Chunk = class _Chunk {
|
|
|
30048
30198
|
if (resolutions.has(key)) continue;
|
|
30049
30199
|
const stored = { type: block.type, properties: block.properties ? { ...block.properties } : void 0 };
|
|
30050
30200
|
const resolved = (async () => {
|
|
30051
|
-
const
|
|
30052
|
-
const perBlock = !
|
|
30053
|
-
if (!perBlock) await this.sectionModels.get(
|
|
30054
|
-
return { blockState:
|
|
30201
|
+
const blockState3 = await BlockStates.get(AssetKey.parse("blockstates", stored.type));
|
|
30202
|
+
const perBlock = !blockState3 || !this.sectionModels || !!getFluidKind(blockState3.key, stored.properties) || !!(blockState3.key && BlockEntities.entry(await BlockEntities.getIndex(blockState3.key.root), blockState3.key.toNamespacedString()));
|
|
30203
|
+
if (!perBlock) await this.sectionModels.get(blockState3, stored.properties);
|
|
30204
|
+
return { blockState: blockState3, perBlock };
|
|
30055
30205
|
})();
|
|
30056
30206
|
resolutions.set(key, resolved);
|
|
30057
30207
|
void resolved.catch(() => void 0);
|
|
@@ -30076,17 +30226,17 @@ var Chunk = class _Chunk {
|
|
|
30076
30226
|
if (!readBlock) continue;
|
|
30077
30227
|
const stored = readBlock();
|
|
30078
30228
|
const key = ChunkData.paletteKey(stored);
|
|
30079
|
-
const { blockState:
|
|
30080
|
-
if (!
|
|
30229
|
+
const { blockState: blockState3, perBlock } = await resolutions.get(key);
|
|
30230
|
+
if (!blockState3) {
|
|
30081
30231
|
this.data.set(index, void 0);
|
|
30082
30232
|
continue;
|
|
30083
30233
|
}
|
|
30084
|
-
const template = perBlock ? void 0 : await this.sectionModels.get(
|
|
30234
|
+
const template = perBlock ? void 0 : await this.sectionModels.get(blockState3, stored.properties);
|
|
30085
30235
|
if (template) {
|
|
30086
30236
|
this.sectionBlocks.set(index, { index, template, cullMask: 0 });
|
|
30087
30237
|
this.meshDirty = true;
|
|
30088
30238
|
} else {
|
|
30089
|
-
object3 = await this.scene.addBlock(
|
|
30239
|
+
object3 = await this.scene.addBlock(blockState3, {
|
|
30090
30240
|
mergeMeshes: true,
|
|
30091
30241
|
instanceMeshes: true,
|
|
30092
30242
|
maxInstanceCount: 2e3,
|
|
@@ -30452,6 +30602,7 @@ var WorldStreamer = class {
|
|
|
30452
30602
|
InstanceManager,
|
|
30453
30603
|
InstanceReference,
|
|
30454
30604
|
ItemTints,
|
|
30605
|
+
LitematicaParser,
|
|
30455
30606
|
MapControls,
|
|
30456
30607
|
Materials,
|
|
30457
30608
|
Meshes,
|