minerender 2.1.0-alpha.82 → 2.1.0-alpha.84
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 +55 -5
- package/dist/browser/index.d.ts +55 -5
- package/dist/browser/index.js +163 -6
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +163 -6
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +166 -6
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +55 -5
- package/dist/node/index.d.ts +55 -5
- package/dist/node/index.js +167 -6
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +165 -6
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.d.mts
CHANGED
|
@@ -269,7 +269,7 @@ interface EntityModelFile extends MinecraftAsset {
|
|
|
269
269
|
passes?: EntityModelPass[];
|
|
270
270
|
}
|
|
271
271
|
/** Vanilla render type of a draw; see the dataset README for the mode table. */
|
|
272
|
-
type EntityRenderMode = "cutout" | "cutout_cull" | "cutout_z_offset" | "solid" | "translucent" | "translucent_emissive" | "eyes" | "energy_swirl" | "breeze_wind" | "water_mask";
|
|
272
|
+
type EntityRenderMode = "cutout" | "cutout_cull" | "cutout_z_offset" | "solid" | "translucent" | "translucent_emissive" | "eyes" | "energy_swirl" | "breeze_wind" | "water_mask" | "no_outline";
|
|
273
273
|
/** An extra draw of a geometry layer, optionally enabled by an entity-state label. */
|
|
274
274
|
interface EntityModelPass {
|
|
275
275
|
/** Geometry layer of the same file; a pass on `main` draws that geometry again. */
|
|
@@ -501,6 +501,46 @@ declare class ImageLoader {
|
|
|
501
501
|
static getWrapped(src: string): Promise<WrappedImage>;
|
|
502
502
|
}
|
|
503
503
|
|
|
504
|
+
/** Vanilla dye colors used by banner and shield textures, as sRGB packed values. */
|
|
505
|
+
declare const DYE_COLORS: Readonly<{
|
|
506
|
+
readonly white: 16383998;
|
|
507
|
+
readonly orange: 16351261;
|
|
508
|
+
readonly magenta: 13061821;
|
|
509
|
+
readonly light_blue: 3847130;
|
|
510
|
+
readonly yellow: 16701501;
|
|
511
|
+
readonly lime: 8439583;
|
|
512
|
+
readonly pink: 15961002;
|
|
513
|
+
readonly gray: 4673362;
|
|
514
|
+
readonly light_gray: 10329495;
|
|
515
|
+
readonly cyan: 1481884;
|
|
516
|
+
readonly purple: 8991416;
|
|
517
|
+
readonly blue: 3949738;
|
|
518
|
+
readonly brown: 8606770;
|
|
519
|
+
readonly green: 6192150;
|
|
520
|
+
readonly red: 11546150;
|
|
521
|
+
readonly black: 1908001;
|
|
522
|
+
}>;
|
|
523
|
+
type DyeColor = keyof typeof DYE_COLORS;
|
|
524
|
+
/** A registry banner pattern or an inline value in a `banner_patterns` component. */
|
|
525
|
+
interface BannerPattern extends MinecraftAsset {
|
|
526
|
+
asset_id: string;
|
|
527
|
+
translation_key: string;
|
|
528
|
+
}
|
|
529
|
+
interface BannerPatternDraw {
|
|
530
|
+
texture: AssetKey;
|
|
531
|
+
color: number;
|
|
532
|
+
}
|
|
533
|
+
/** Loads banner-pattern registry entries and resolves their banner or shield textures. */
|
|
534
|
+
declare class BannerPatterns {
|
|
535
|
+
/** Lists namespaced pattern IDs from the selected namespace's data directory. */
|
|
536
|
+
static getList(namespace?: string, root?: string): Promise<string[]>;
|
|
537
|
+
/** Returns the named dye's sRGB value, rejecting unknown colors. */
|
|
538
|
+
static getColor(color: unknown): number;
|
|
539
|
+
/** Resolves the first 16 layers of a `banner_patterns` component, preserving their order. */
|
|
540
|
+
static getLayers(value: unknown, target: "banner" | "shield", root?: string): Promise<BannerPatternDraw[]>;
|
|
541
|
+
private static identifier;
|
|
542
|
+
}
|
|
543
|
+
|
|
504
544
|
declare const ITEM_GENERATED = "item/generated";
|
|
505
545
|
declare const BUILTIN_GENERATED = "builtin/generated";
|
|
506
546
|
declare const BUILTIN_ENTITY = "builtin/entity";
|
|
@@ -524,7 +564,7 @@ interface ItemModel extends Model {
|
|
|
524
564
|
gui_light?: GuiLight;
|
|
525
565
|
special?: SpecialItemRenderer;
|
|
526
566
|
tints?: ItemTintSource[];
|
|
527
|
-
/** Stack-component snapshot with namespaced IDs, used
|
|
567
|
+
/** Stack-component snapshot with namespaced IDs, used by tint sources and special renderers. */
|
|
528
568
|
components?: Record<string, unknown>;
|
|
529
569
|
/** Ordered composite children, each with its own textures, display pose, and tint sources. */
|
|
530
570
|
parts?: ItemModel[];
|
|
@@ -549,6 +589,13 @@ type ItemTintSource = {
|
|
|
549
589
|
};
|
|
550
590
|
/** Supported item definitions that draw entity geometry instead of ordinary model elements. */
|
|
551
591
|
type SpecialItemRenderer = {
|
|
592
|
+
type: "banner" | "minecraft:banner";
|
|
593
|
+
color: DyeColor;
|
|
594
|
+
} | {
|
|
595
|
+
type: "shield" | "minecraft:shield";
|
|
596
|
+
} | {
|
|
597
|
+
type: "trident" | "minecraft:trident" | "conduit" | "minecraft:conduit";
|
|
598
|
+
} | {
|
|
552
599
|
type: "chest" | "minecraft:chest";
|
|
553
600
|
texture: string;
|
|
554
601
|
openness?: number;
|
|
@@ -1292,11 +1339,13 @@ interface SpecialItemPart {
|
|
|
1292
1339
|
rotations: Record<string, TripleArray>;
|
|
1293
1340
|
/** Absolute named-part positions in the entity model's coordinate system. */
|
|
1294
1341
|
positions?: Record<string, TripleArray>;
|
|
1342
|
+
/** Colors for the entity model's named texture passes. */
|
|
1343
|
+
tints?: Record<string, number>;
|
|
1295
1344
|
}
|
|
1296
|
-
/** Loads
|
|
1345
|
+
/** Loads entity geometry and texture passes for supported special item previews. */
|
|
1297
1346
|
declare class SpecialItems {
|
|
1298
1347
|
/** Resolves the static entity parts drawn by a special item renderer, in model units. */
|
|
1299
|
-
static getParts(special: SpecialItemRenderer, root?: string): Promise<SpecialItemPart[]>;
|
|
1348
|
+
static getParts(special: SpecialItemRenderer, root?: string, components?: Record<string, unknown>): Promise<SpecialItemPart[]>;
|
|
1300
1349
|
/** An owned material with model-preview shading; its entity texture remains shared. */
|
|
1301
1350
|
static createMaterial(source: MeshBasicMaterial, shade: boolean): MeshBasicMaterial;
|
|
1302
1351
|
}
|
|
@@ -2328,6 +2377,7 @@ declare class Caching {
|
|
|
2328
2377
|
static readonly entityAnimationCache: AsyncLoadingCache<CacheKey, EntityAnimationFile>;
|
|
2329
2378
|
static readonly blockEntityIndexCache: AsyncLoadingCache<CacheKey, BlockEntityIndex>;
|
|
2330
2379
|
static readonly fontCache: AsyncLoadingCache<CacheKey, BitmapFont>;
|
|
2380
|
+
static readonly bannerPatternCache: AsyncLoadingCache<CacheKey, BannerPattern>;
|
|
2331
2381
|
private static createAssetCache;
|
|
2332
2382
|
/** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
|
|
2333
2383
|
private static get all();
|
|
@@ -3250,4 +3300,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
|
|
|
3250
3300
|
forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
|
|
3251
3301
|
}
|
|
3252
3302
|
|
|
3253
|
-
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, AnvilParser, type AnvilRegion, ArchiveAssetSource, type ArchiveAssetSourceOptions, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, 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, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, 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, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, 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, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
|
|
3303
|
+
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, AnvilParser, type AnvilRegion, 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, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, 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, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
|
package/dist/node/index.d.ts
CHANGED
|
@@ -269,7 +269,7 @@ interface EntityModelFile extends MinecraftAsset {
|
|
|
269
269
|
passes?: EntityModelPass[];
|
|
270
270
|
}
|
|
271
271
|
/** Vanilla render type of a draw; see the dataset README for the mode table. */
|
|
272
|
-
type EntityRenderMode = "cutout" | "cutout_cull" | "cutout_z_offset" | "solid" | "translucent" | "translucent_emissive" | "eyes" | "energy_swirl" | "breeze_wind" | "water_mask";
|
|
272
|
+
type EntityRenderMode = "cutout" | "cutout_cull" | "cutout_z_offset" | "solid" | "translucent" | "translucent_emissive" | "eyes" | "energy_swirl" | "breeze_wind" | "water_mask" | "no_outline";
|
|
273
273
|
/** An extra draw of a geometry layer, optionally enabled by an entity-state label. */
|
|
274
274
|
interface EntityModelPass {
|
|
275
275
|
/** Geometry layer of the same file; a pass on `main` draws that geometry again. */
|
|
@@ -501,6 +501,46 @@ declare class ImageLoader {
|
|
|
501
501
|
static getWrapped(src: string): Promise<WrappedImage>;
|
|
502
502
|
}
|
|
503
503
|
|
|
504
|
+
/** Vanilla dye colors used by banner and shield textures, as sRGB packed values. */
|
|
505
|
+
declare const DYE_COLORS: Readonly<{
|
|
506
|
+
readonly white: 16383998;
|
|
507
|
+
readonly orange: 16351261;
|
|
508
|
+
readonly magenta: 13061821;
|
|
509
|
+
readonly light_blue: 3847130;
|
|
510
|
+
readonly yellow: 16701501;
|
|
511
|
+
readonly lime: 8439583;
|
|
512
|
+
readonly pink: 15961002;
|
|
513
|
+
readonly gray: 4673362;
|
|
514
|
+
readonly light_gray: 10329495;
|
|
515
|
+
readonly cyan: 1481884;
|
|
516
|
+
readonly purple: 8991416;
|
|
517
|
+
readonly blue: 3949738;
|
|
518
|
+
readonly brown: 8606770;
|
|
519
|
+
readonly green: 6192150;
|
|
520
|
+
readonly red: 11546150;
|
|
521
|
+
readonly black: 1908001;
|
|
522
|
+
}>;
|
|
523
|
+
type DyeColor = keyof typeof DYE_COLORS;
|
|
524
|
+
/** A registry banner pattern or an inline value in a `banner_patterns` component. */
|
|
525
|
+
interface BannerPattern extends MinecraftAsset {
|
|
526
|
+
asset_id: string;
|
|
527
|
+
translation_key: string;
|
|
528
|
+
}
|
|
529
|
+
interface BannerPatternDraw {
|
|
530
|
+
texture: AssetKey;
|
|
531
|
+
color: number;
|
|
532
|
+
}
|
|
533
|
+
/** Loads banner-pattern registry entries and resolves their banner or shield textures. */
|
|
534
|
+
declare class BannerPatterns {
|
|
535
|
+
/** Lists namespaced pattern IDs from the selected namespace's data directory. */
|
|
536
|
+
static getList(namespace?: string, root?: string): Promise<string[]>;
|
|
537
|
+
/** Returns the named dye's sRGB value, rejecting unknown colors. */
|
|
538
|
+
static getColor(color: unknown): number;
|
|
539
|
+
/** Resolves the first 16 layers of a `banner_patterns` component, preserving their order. */
|
|
540
|
+
static getLayers(value: unknown, target: "banner" | "shield", root?: string): Promise<BannerPatternDraw[]>;
|
|
541
|
+
private static identifier;
|
|
542
|
+
}
|
|
543
|
+
|
|
504
544
|
declare const ITEM_GENERATED = "item/generated";
|
|
505
545
|
declare const BUILTIN_GENERATED = "builtin/generated";
|
|
506
546
|
declare const BUILTIN_ENTITY = "builtin/entity";
|
|
@@ -524,7 +564,7 @@ interface ItemModel extends Model {
|
|
|
524
564
|
gui_light?: GuiLight;
|
|
525
565
|
special?: SpecialItemRenderer;
|
|
526
566
|
tints?: ItemTintSource[];
|
|
527
|
-
/** Stack-component snapshot with namespaced IDs, used
|
|
567
|
+
/** Stack-component snapshot with namespaced IDs, used by tint sources and special renderers. */
|
|
528
568
|
components?: Record<string, unknown>;
|
|
529
569
|
/** Ordered composite children, each with its own textures, display pose, and tint sources. */
|
|
530
570
|
parts?: ItemModel[];
|
|
@@ -549,6 +589,13 @@ type ItemTintSource = {
|
|
|
549
589
|
};
|
|
550
590
|
/** Supported item definitions that draw entity geometry instead of ordinary model elements. */
|
|
551
591
|
type SpecialItemRenderer = {
|
|
592
|
+
type: "banner" | "minecraft:banner";
|
|
593
|
+
color: DyeColor;
|
|
594
|
+
} | {
|
|
595
|
+
type: "shield" | "minecraft:shield";
|
|
596
|
+
} | {
|
|
597
|
+
type: "trident" | "minecraft:trident" | "conduit" | "minecraft:conduit";
|
|
598
|
+
} | {
|
|
552
599
|
type: "chest" | "minecraft:chest";
|
|
553
600
|
texture: string;
|
|
554
601
|
openness?: number;
|
|
@@ -1292,11 +1339,13 @@ interface SpecialItemPart {
|
|
|
1292
1339
|
rotations: Record<string, TripleArray>;
|
|
1293
1340
|
/** Absolute named-part positions in the entity model's coordinate system. */
|
|
1294
1341
|
positions?: Record<string, TripleArray>;
|
|
1342
|
+
/** Colors for the entity model's named texture passes. */
|
|
1343
|
+
tints?: Record<string, number>;
|
|
1295
1344
|
}
|
|
1296
|
-
/** Loads
|
|
1345
|
+
/** Loads entity geometry and texture passes for supported special item previews. */
|
|
1297
1346
|
declare class SpecialItems {
|
|
1298
1347
|
/** Resolves the static entity parts drawn by a special item renderer, in model units. */
|
|
1299
|
-
static getParts(special: SpecialItemRenderer, root?: string): Promise<SpecialItemPart[]>;
|
|
1348
|
+
static getParts(special: SpecialItemRenderer, root?: string, components?: Record<string, unknown>): Promise<SpecialItemPart[]>;
|
|
1300
1349
|
/** An owned material with model-preview shading; its entity texture remains shared. */
|
|
1301
1350
|
static createMaterial(source: MeshBasicMaterial, shade: boolean): MeshBasicMaterial;
|
|
1302
1351
|
}
|
|
@@ -2328,6 +2377,7 @@ declare class Caching {
|
|
|
2328
2377
|
static readonly entityAnimationCache: AsyncLoadingCache<CacheKey, EntityAnimationFile>;
|
|
2329
2378
|
static readonly blockEntityIndexCache: AsyncLoadingCache<CacheKey, BlockEntityIndex>;
|
|
2330
2379
|
static readonly fontCache: AsyncLoadingCache<CacheKey, BitmapFont>;
|
|
2380
|
+
static readonly bannerPatternCache: AsyncLoadingCache<CacheKey, BannerPattern>;
|
|
2331
2381
|
private static createAssetCache;
|
|
2332
2382
|
/** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
|
|
2333
2383
|
private static get all();
|
|
@@ -3250,4 +3300,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
|
|
|
3250
3300
|
forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
|
|
3251
3301
|
}
|
|
3252
3302
|
|
|
3253
|
-
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, AnvilParser, type AnvilRegion, ArchiveAssetSource, type ArchiveAssetSourceOptions, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, 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, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, 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, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, 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, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
|
|
3303
|
+
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, AnvilParser, type AnvilRegion, 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, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, 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, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
|
package/dist/node/index.js
CHANGED
|
@@ -301,6 +301,9 @@ var init_Caching = __esm({
|
|
|
301
301
|
static {
|
|
302
302
|
this.fontCache = _Caching.createAssetCache();
|
|
303
303
|
}
|
|
304
|
+
static {
|
|
305
|
+
this.bannerPatternCache = _Caching.createAssetCache();
|
|
306
|
+
}
|
|
304
307
|
static createAssetCache() {
|
|
305
308
|
return import_loading_cache.Caches.builder().expireAfterWrite(import_time.Time.minutes(10)).expireAfterAccess(import_time.Time.minutes(5)).expirationInterval(import_time.Time.seconds(30)).buildAsync();
|
|
306
309
|
}
|
|
@@ -328,7 +331,8 @@ var init_Caching = __esm({
|
|
|
328
331
|
this.entityTextureCache,
|
|
329
332
|
this.entityAnimationCache,
|
|
330
333
|
this.blockEntityIndexCache,
|
|
331
|
-
this.fontCache
|
|
334
|
+
this.fontCache,
|
|
335
|
+
this.bannerPatternCache
|
|
332
336
|
];
|
|
333
337
|
}
|
|
334
338
|
/** Invalidates in-memory entries so later lookups reload them. Persisted entries are retained. */
|
|
@@ -992,6 +996,7 @@ var init_Materials = __esm({
|
|
|
992
996
|
material.depthWrite = false;
|
|
993
997
|
break;
|
|
994
998
|
case "eyes":
|
|
999
|
+
case "no_outline":
|
|
995
1000
|
material.transparent = true;
|
|
996
1001
|
material.alphaTest = 0;
|
|
997
1002
|
material.depthWrite = false;
|
|
@@ -1580,6 +1585,79 @@ var init_AssetParsers = __esm({
|
|
|
1580
1585
|
}
|
|
1581
1586
|
});
|
|
1582
1587
|
|
|
1588
|
+
// src/assets/BannerPatterns.ts
|
|
1589
|
+
var DYE_COLORS, BannerPatterns;
|
|
1590
|
+
var init_BannerPatterns = __esm({
|
|
1591
|
+
"src/assets/BannerPatterns.ts"() {
|
|
1592
|
+
init_AssetKey();
|
|
1593
|
+
init_AssetLoader();
|
|
1594
|
+
init_AssetParsers();
|
|
1595
|
+
init_Caching();
|
|
1596
|
+
DYE_COLORS = Object.freeze({
|
|
1597
|
+
white: 16383998,
|
|
1598
|
+
orange: 16351261,
|
|
1599
|
+
magenta: 13061821,
|
|
1600
|
+
light_blue: 3847130,
|
|
1601
|
+
yellow: 16701501,
|
|
1602
|
+
lime: 8439583,
|
|
1603
|
+
pink: 15961002,
|
|
1604
|
+
gray: 4673362,
|
|
1605
|
+
light_gray: 10329495,
|
|
1606
|
+
cyan: 1481884,
|
|
1607
|
+
purple: 8991416,
|
|
1608
|
+
blue: 3949738,
|
|
1609
|
+
brown: 8606770,
|
|
1610
|
+
green: 6192150,
|
|
1611
|
+
red: 11546150,
|
|
1612
|
+
black: 1908001
|
|
1613
|
+
});
|
|
1614
|
+
BannerPatterns = class {
|
|
1615
|
+
/** Lists namespaced pattern IDs from the selected namespace's data directory. */
|
|
1616
|
+
static async getList(namespace = "minecraft", root) {
|
|
1617
|
+
const collect = async (path) => {
|
|
1618
|
+
const prefix2 = path ? `${path}/` : "";
|
|
1619
|
+
const key = new AssetKey(namespace, `${prefix2}_list`, "banner_pattern", void 0, "data", ".json", root);
|
|
1620
|
+
const list2 = await Caching.listAssetCache.get(key.serialize(), () => AssetLoader.get(key, "list" /* LIST */));
|
|
1621
|
+
if (!list2) return [];
|
|
1622
|
+
const files = list2.files.filter((file) => file.endsWith(".json") && file !== "_list.json").map((file) => `${namespace}:${prefix2}${file.slice(0, -5)}`);
|
|
1623
|
+
const children = await Promise.all(list2.directories.map((directory) => collect(`${prefix2}${directory}`)));
|
|
1624
|
+
return [...files, ...children.flat()];
|
|
1625
|
+
};
|
|
1626
|
+
return collect("");
|
|
1627
|
+
}
|
|
1628
|
+
/** Returns the named dye's sRGB value, rejecting unknown colors. */
|
|
1629
|
+
static getColor(color2) {
|
|
1630
|
+
if (typeof color2 !== "string" || !Object.prototype.hasOwnProperty.call(DYE_COLORS, color2)) throw new Error(`Unsupported dye color ${color2}`);
|
|
1631
|
+
return DYE_COLORS[color2];
|
|
1632
|
+
}
|
|
1633
|
+
/** Resolves the first 16 layers of a `banner_patterns` component, preserving their order. */
|
|
1634
|
+
static async getLayers(value, target, root) {
|
|
1635
|
+
if (value === void 0) return [];
|
|
1636
|
+
if (!Array.isArray(value)) throw new Error("banner_patterns must be an array");
|
|
1637
|
+
return Promise.all(value.slice(0, 16).map(async (layer) => {
|
|
1638
|
+
if (!layer || typeof layer !== "object" || Array.isArray(layer)) throw new Error("Each banner pattern requires a pattern and dye color");
|
|
1639
|
+
const color2 = this.getColor(layer.color);
|
|
1640
|
+
let pattern2 = layer.pattern;
|
|
1641
|
+
if (typeof pattern2 === "string") {
|
|
1642
|
+
const id = this.identifier(pattern2);
|
|
1643
|
+
const key = new AssetKey(id.namespace, id.getFullPath(), "banner_pattern", void 0, "data", ".json", root);
|
|
1644
|
+
pattern2 = await Caching.bannerPatternCache.get(key.serialize(), () => AssetLoader.get(key, "json" /* JSON */));
|
|
1645
|
+
if (!pattern2) throw new Error(`Missing banner pattern ${layer.pattern}`);
|
|
1646
|
+
}
|
|
1647
|
+
if (!pattern2 || typeof pattern2 !== "object" || Array.isArray(pattern2) || typeof pattern2.translation_key !== "string") throw new Error("Banner patterns require asset_id and translation_key");
|
|
1648
|
+
const asset2 = this.identifier(pattern2.asset_id);
|
|
1649
|
+
return { color: color2, texture: new AssetKey(asset2.namespace, `${target}/${asset2.getFullPath()}`, "textures", "entity", "assets", ".png", root) };
|
|
1650
|
+
}));
|
|
1651
|
+
}
|
|
1652
|
+
static identifier(value) {
|
|
1653
|
+
if (typeof value !== "string" || !/^(?:[a-z0-9_.-]+:)?[a-z0-9_./-]+$/.test(value)) throw new Error(`Invalid banner-pattern identifier ${value}`);
|
|
1654
|
+
const [namespace, path] = value.includes(":") ? value.split(":") : ["minecraft", value];
|
|
1655
|
+
return new AssetKey(namespace, path);
|
|
1656
|
+
}
|
|
1657
|
+
};
|
|
1658
|
+
}
|
|
1659
|
+
});
|
|
1660
|
+
|
|
1583
1661
|
// src/assets/Models.ts
|
|
1584
1662
|
var Models;
|
|
1585
1663
|
var init_Models = __esm({
|
|
@@ -1592,6 +1670,7 @@ var init_Models = __esm({
|
|
|
1592
1670
|
init_AssetKey();
|
|
1593
1671
|
init_AssetParsers();
|
|
1594
1672
|
init_DisplayPosition();
|
|
1673
|
+
init_BannerPatterns();
|
|
1595
1674
|
Models = class _Models {
|
|
1596
1675
|
// opened lazily: touching the store at import time would hit IndexedDB/disk just for loading
|
|
1597
1676
|
// the library, and would require an EnvProvider before any entry has had a chance to register
|
|
@@ -1781,6 +1860,17 @@ var init_Models = __esm({
|
|
|
1781
1860
|
if (!node.base || !node.model || typeof node.model !== "object") break;
|
|
1782
1861
|
const special = node.model;
|
|
1783
1862
|
switch (special.type) {
|
|
1863
|
+
case "banner":
|
|
1864
|
+
case "minecraft:banner":
|
|
1865
|
+
if (typeof special.color === "string" && Object.prototype.hasOwnProperty.call(DYE_COLORS, special.color)) return { model: node.base, special };
|
|
1866
|
+
break;
|
|
1867
|
+
case "shield":
|
|
1868
|
+
case "minecraft:shield":
|
|
1869
|
+
case "trident":
|
|
1870
|
+
case "minecraft:trident":
|
|
1871
|
+
case "conduit":
|
|
1872
|
+
case "minecraft:conduit":
|
|
1873
|
+
return { model: node.base, special };
|
|
1784
1874
|
case "shulker_box":
|
|
1785
1875
|
case "minecraft:shulker_box":
|
|
1786
1876
|
if (typeof special.texture === "string" && special.texture && (special.openness === void 0 || typeof special.openness === "number" && Number.isFinite(special.openness)) && (special.orientation === void 0 || ["down", "up", "north", "south", "west", "east"].includes(special.orientation))) {
|
|
@@ -5524,9 +5614,11 @@ var init_SpecialItems = __esm({
|
|
|
5524
5614
|
import_three24 = require("three");
|
|
5525
5615
|
init_AssetKey();
|
|
5526
5616
|
init_Entities();
|
|
5617
|
+
init_BannerPatterns();
|
|
5618
|
+
init_ModelTextures();
|
|
5527
5619
|
SpecialItems = class {
|
|
5528
5620
|
/** Resolves the static entity parts drawn by a special item renderer, in model units. */
|
|
5529
|
-
static async getParts(special, root) {
|
|
5621
|
+
static async getParts(special, root, components = {}) {
|
|
5530
5622
|
const texture = (id, directory) => {
|
|
5531
5623
|
const key = AssetKey.parse("textures", id);
|
|
5532
5624
|
return new AssetKey(
|
|
@@ -5539,13 +5631,77 @@ var init_SpecialItems = __esm({
|
|
|
5539
5631
|
root
|
|
5540
5632
|
);
|
|
5541
5633
|
};
|
|
5542
|
-
const load = async (id, textureKey, transform, rotations = {}) => {
|
|
5634
|
+
const load = async (id, textureKey, transform, rotations = {}, layers = ["main"]) => {
|
|
5543
5635
|
const key = new AssetKey("minecraft", id, void 0, void 0, "entity-models", ".json", root);
|
|
5544
|
-
const model = await Entities.getEntity(key, textureKey, { layer:
|
|
5636
|
+
const model = await Entities.getEntity(key, textureKey, layers.length === 1 ? { layer: layers[0] } : {
|
|
5637
|
+
layers,
|
|
5638
|
+
textures: textureKey ? Object.fromEntries(layers.map((name) => [name, textureKey])) : void 0
|
|
5639
|
+
});
|
|
5545
5640
|
if (!model) throw new Error(`Missing entity model minecraft:${id} for special item ${special.type}`);
|
|
5546
5641
|
return { model, transform, rotations };
|
|
5547
5642
|
};
|
|
5548
5643
|
switch (special.type) {
|
|
5644
|
+
case "minecraft:trident":
|
|
5645
|
+
case "trident":
|
|
5646
|
+
case "minecraft:conduit":
|
|
5647
|
+
case "conduit": {
|
|
5648
|
+
const trident = special.type === "trident" || special.type === "minecraft:trident";
|
|
5649
|
+
const part = await load(
|
|
5650
|
+
trident ? "trident" : "conduit",
|
|
5651
|
+
texture(trident ? "trident" : "conduit/base", ""),
|
|
5652
|
+
trident ? new import_three24.Matrix4().makeScale(1, -1, -1) : new import_three24.Matrix4().makeTranslation(8, 8, 8),
|
|
5653
|
+
{},
|
|
5654
|
+
trident ? ["main"] : ["shell"]
|
|
5655
|
+
);
|
|
5656
|
+
part.model = { ...part.model, render: "solid", layers: part.model.layers && Object.fromEntries(
|
|
5657
|
+
Object.entries(part.model.layers).map(([name, layer]) => [name, { ...layer, render: "solid" }])
|
|
5658
|
+
) };
|
|
5659
|
+
return [part];
|
|
5660
|
+
}
|
|
5661
|
+
case "minecraft:banner":
|
|
5662
|
+
case "banner":
|
|
5663
|
+
case "minecraft:shield":
|
|
5664
|
+
case "shield": {
|
|
5665
|
+
const banner = special.type === "banner" || special.type === "minecraft:banner";
|
|
5666
|
+
const color2 = banner ? BannerPatterns.getColor(special.color) : components["minecraft:base_color"] === void 0 ? void 0 : BannerPatterns.getColor(components["minecraft:base_color"]);
|
|
5667
|
+
const patterns = await BannerPatterns.getLayers(components["minecraft:banner_patterns"], banner ? "banner" : "shield", root);
|
|
5668
|
+
const patterned = banner || color2 !== void 0 || patterns.length > 0;
|
|
5669
|
+
const baseTexture = texture(banner ? "banner_base" : patterned ? "shield_base" : "shield_base_nopattern", "");
|
|
5670
|
+
const transform = banner ? new import_three24.Matrix4().makeTranslation(8, 0, 8).multiply(new import_three24.Matrix4().makeScale(2 / 3, -2 / 3, -2 / 3)) : new import_three24.Matrix4().makeScale(1, -1, -1);
|
|
5671
|
+
const part = await load(banner ? "standing_banner" : "shield", baseTexture, transform, {}, banner ? ["main", "flag"] : ["main"]);
|
|
5672
|
+
const layers = Object.fromEntries(Object.entries(part.model.layers ?? { main: part.model }).map(([name, layer]) => [name, { ...layer, render: "solid" }]));
|
|
5673
|
+
let overlay2;
|
|
5674
|
+
if (banner) {
|
|
5675
|
+
const flagLayer = layers.flag;
|
|
5676
|
+
const flag = flagLayer?.layer.root.children.flag;
|
|
5677
|
+
if (!flag) throw new Error("Banner entity model is missing its flag layer");
|
|
5678
|
+
overlay2 = { ...flagLayer.layer, root: { ...flagLayer.layer.root, children: {
|
|
5679
|
+
...flagLayer.layer.root.children,
|
|
5680
|
+
flag: { ...flag, pose: { ...flag.pose, rotation: [-25e-4 * Math.PI, flag.pose.rotation[1], flag.pose.rotation[2]] } }
|
|
5681
|
+
} } };
|
|
5682
|
+
layers.flag = { ...flagLayer, layer: overlay2 };
|
|
5683
|
+
} else {
|
|
5684
|
+
const main = layers.main.layer;
|
|
5685
|
+
const plate = main.root.children.plate;
|
|
5686
|
+
if (!plate) throw new Error("Shield entity model is missing its plate");
|
|
5687
|
+
overlay2 = { ...main, root: { ...main.root, cubes: [], children: { plate } } };
|
|
5688
|
+
}
|
|
5689
|
+
const tints = {};
|
|
5690
|
+
if (patterned) {
|
|
5691
|
+
const draws = [{ texture: texture(`${banner ? "banner" : "shield"}/base`, ""), color: color2 ?? DYE_COLORS.white }, ...patterns];
|
|
5692
|
+
draws.forEach((draw, index) => {
|
|
5693
|
+
const name = index === 0 ? "pattern_base" : `pattern_${index - 1}`;
|
|
5694
|
+
layers[name] = { key: draw.texture, texture: draw.texture, layer: overlay2, render: "no_outline", tint: name };
|
|
5695
|
+
tints[name] = draw.color;
|
|
5696
|
+
});
|
|
5697
|
+
}
|
|
5698
|
+
await Promise.all([...new Map(Object.values(layers).map((layer) => [layer.texture.serialize(), layer.texture])).values()].map(async (key) => {
|
|
5699
|
+
if (!await ModelTextures.preload(key)) throw new Error(`Missing special item texture ${key.toNamespacedString()}`);
|
|
5700
|
+
}));
|
|
5701
|
+
part.model = { ...part.model, ...layers.main, layers };
|
|
5702
|
+
part.tints = tints;
|
|
5703
|
+
return [part];
|
|
5704
|
+
}
|
|
5549
5705
|
case "minecraft:chest":
|
|
5550
5706
|
case "chest": {
|
|
5551
5707
|
const angle = -(special.openness ?? 0) * Math.PI / 2;
|
|
@@ -5843,12 +5999,12 @@ var init_ModelObject = __esm({
|
|
|
5843
5999
|
this.options.tints = await ItemTints.get(this.originalModel, this.options.tints);
|
|
5844
6000
|
const special = this.originalModel.special;
|
|
5845
6001
|
if (special) {
|
|
5846
|
-
const parts2 = await SpecialItems.getParts(special, this.originalModel.key?.root);
|
|
6002
|
+
const parts2 = await SpecialItems.getParts(special, this.originalModel.key?.root, this.originalModel.components);
|
|
5847
6003
|
const transform = this.options.displayPosition ? DisplayTransforms.getMatrix(this.originalModel.display, this.options.displayPosition) : new import_three25.Matrix4();
|
|
5848
6004
|
transform.multiply(new import_three25.Matrix4().makeTranslation(-8, -8, -8));
|
|
5849
6005
|
try {
|
|
5850
6006
|
for (const part of parts2) {
|
|
5851
|
-
const object3 = new EntityObject(part.model, { flip: false, wireframe: this.options.wireframe });
|
|
6007
|
+
const object3 = new EntityObject(part.model, { flip: false, wireframe: this.options.wireframe, tints: part.tints });
|
|
5852
6008
|
object3.matrix.copy(transform).multiply(part.transform);
|
|
5853
6009
|
object3.matrixWorldNeedsUpdate = true;
|
|
5854
6010
|
object3.matrixAutoUpdate = false;
|
|
@@ -6299,6 +6455,7 @@ __export(index_node_exports, {
|
|
|
6299
6455
|
Axis: () => Axis,
|
|
6300
6456
|
BUILTIN_ENTITY: () => BUILTIN_ENTITY,
|
|
6301
6457
|
BUILTIN_GENERATED: () => BUILTIN_GENERATED,
|
|
6458
|
+
BannerPatterns: () => BannerPatterns,
|
|
6302
6459
|
BasicAssetKey: () => BasicAssetKey,
|
|
6303
6460
|
BatchedExecutor: () => BatchedExecutor,
|
|
6304
6461
|
BlockEntities: () => BlockEntities,
|
|
@@ -6321,6 +6478,7 @@ __export(index_node_exports, {
|
|
|
6321
6478
|
DEFAULT_ROOT: () => DEFAULT_ROOT,
|
|
6322
6479
|
DEFAULT_UV: () => DEFAULT_UV,
|
|
6323
6480
|
DISPLAY_POSITIONS: () => DISPLAY_POSITIONS,
|
|
6481
|
+
DYE_COLORS: () => DYE_COLORS,
|
|
6324
6482
|
DefaultBlockStates: () => DefaultBlockStates,
|
|
6325
6483
|
DisplayPosition: () => DisplayPosition,
|
|
6326
6484
|
DisplayTransforms: () => DisplayTransforms,
|
|
@@ -6618,6 +6776,7 @@ function shutdown() {
|
|
|
6618
6776
|
init_AssetKey();
|
|
6619
6777
|
init_AssetLoader();
|
|
6620
6778
|
init_Assets();
|
|
6779
|
+
init_BannerPatterns();
|
|
6621
6780
|
|
|
6622
6781
|
// src/assets/BlockEntities.ts
|
|
6623
6782
|
var import_three10 = require("three");
|
|
@@ -16985,6 +17144,7 @@ var Chunk = class _Chunk {
|
|
|
16985
17144
|
Axis,
|
|
16986
17145
|
BUILTIN_ENTITY,
|
|
16987
17146
|
BUILTIN_GENERATED,
|
|
17147
|
+
BannerPatterns,
|
|
16988
17148
|
BasicAssetKey,
|
|
16989
17149
|
BatchedExecutor,
|
|
16990
17150
|
BlockEntities,
|
|
@@ -17007,6 +17167,7 @@ var Chunk = class _Chunk {
|
|
|
17007
17167
|
DEFAULT_ROOT,
|
|
17008
17168
|
DEFAULT_UV,
|
|
17009
17169
|
DISPLAY_POSITIONS,
|
|
17170
|
+
DYE_COLORS,
|
|
17010
17171
|
DefaultBlockStates,
|
|
17011
17172
|
DisplayPosition,
|
|
17012
17173
|
DisplayTransforms,
|