minerender 2.1.0-alpha.80 → 2.1.0-alpha.83
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 +60 -5
- package/dist/browser/index.d.ts +60 -5
- package/dist/browser/index.js +171 -6
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +178 -13
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +174 -6
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +60 -5
- package/dist/node/index.d.ts +60 -5
- package/dist/node/index.js +175 -6
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +180 -13
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.d.mts
CHANGED
|
@@ -268,7 +268,7 @@ interface EntityModelFile extends MinecraftAsset {
|
|
|
268
268
|
passes?: EntityModelPass[];
|
|
269
269
|
}
|
|
270
270
|
/** Vanilla render type of a draw; see the dataset README for the mode table. */
|
|
271
|
-
type EntityRenderMode = "cutout" | "cutout_cull" | "cutout_z_offset" | "solid" | "translucent" | "translucent_emissive" | "eyes" | "energy_swirl" | "breeze_wind" | "water_mask";
|
|
271
|
+
type EntityRenderMode = "cutout" | "cutout_cull" | "cutout_z_offset" | "solid" | "translucent" | "translucent_emissive" | "eyes" | "energy_swirl" | "breeze_wind" | "water_mask" | "no_outline";
|
|
272
272
|
/** An extra draw of a geometry layer, optionally enabled by an entity-state label. */
|
|
273
273
|
interface EntityModelPass {
|
|
274
274
|
/** Geometry layer of the same file; a pass on `main` draws that geometry again. */
|
|
@@ -500,6 +500,46 @@ declare class ImageLoader {
|
|
|
500
500
|
static getWrapped(src: string): Promise<WrappedImage>;
|
|
501
501
|
}
|
|
502
502
|
|
|
503
|
+
/** Vanilla dye colors used by banner and shield textures, as sRGB packed values. */
|
|
504
|
+
declare const DYE_COLORS: Readonly<{
|
|
505
|
+
readonly white: 16383998;
|
|
506
|
+
readonly orange: 16351261;
|
|
507
|
+
readonly magenta: 13061821;
|
|
508
|
+
readonly light_blue: 3847130;
|
|
509
|
+
readonly yellow: 16701501;
|
|
510
|
+
readonly lime: 8439583;
|
|
511
|
+
readonly pink: 15961002;
|
|
512
|
+
readonly gray: 4673362;
|
|
513
|
+
readonly light_gray: 10329495;
|
|
514
|
+
readonly cyan: 1481884;
|
|
515
|
+
readonly purple: 8991416;
|
|
516
|
+
readonly blue: 3949738;
|
|
517
|
+
readonly brown: 8606770;
|
|
518
|
+
readonly green: 6192150;
|
|
519
|
+
readonly red: 11546150;
|
|
520
|
+
readonly black: 1908001;
|
|
521
|
+
}>;
|
|
522
|
+
type DyeColor = keyof typeof DYE_COLORS;
|
|
523
|
+
/** A registry banner pattern or an inline value in a `banner_patterns` component. */
|
|
524
|
+
interface BannerPattern extends MinecraftAsset {
|
|
525
|
+
asset_id: string;
|
|
526
|
+
translation_key: string;
|
|
527
|
+
}
|
|
528
|
+
interface BannerPatternDraw {
|
|
529
|
+
texture: AssetKey;
|
|
530
|
+
color: number;
|
|
531
|
+
}
|
|
532
|
+
/** Loads banner-pattern registry entries and resolves their banner or shield textures. */
|
|
533
|
+
declare class BannerPatterns {
|
|
534
|
+
/** Lists namespaced pattern IDs from the selected namespace's data directory. */
|
|
535
|
+
static getList(namespace?: string, root?: string): Promise<string[]>;
|
|
536
|
+
/** Returns the named dye's sRGB value, rejecting unknown colors. */
|
|
537
|
+
static getColor(color: unknown): number;
|
|
538
|
+
/** Resolves the first 16 layers of a `banner_patterns` component, preserving their order. */
|
|
539
|
+
static getLayers(value: unknown, target: "banner" | "shield", root?: string): Promise<BannerPatternDraw[]>;
|
|
540
|
+
private static identifier;
|
|
541
|
+
}
|
|
542
|
+
|
|
503
543
|
declare const ITEM_GENERATED = "item/generated";
|
|
504
544
|
declare const BUILTIN_GENERATED = "builtin/generated";
|
|
505
545
|
declare const BUILTIN_ENTITY = "builtin/entity";
|
|
@@ -523,7 +563,7 @@ interface ItemModel extends Model {
|
|
|
523
563
|
gui_light?: GuiLight;
|
|
524
564
|
special?: SpecialItemRenderer;
|
|
525
565
|
tints?: ItemTintSource[];
|
|
526
|
-
/** Stack-component snapshot with namespaced IDs, used
|
|
566
|
+
/** Stack-component snapshot with namespaced IDs, used by tint sources and special renderers. */
|
|
527
567
|
components?: Record<string, unknown>;
|
|
528
568
|
/** Ordered composite children, each with its own textures, display pose, and tint sources. */
|
|
529
569
|
parts?: ItemModel[];
|
|
@@ -548,9 +588,19 @@ type ItemTintSource = {
|
|
|
548
588
|
};
|
|
549
589
|
/** Supported item definitions that draw entity geometry instead of ordinary model elements. */
|
|
550
590
|
type SpecialItemRenderer = {
|
|
591
|
+
type: "banner" | "minecraft:banner";
|
|
592
|
+
color: DyeColor;
|
|
593
|
+
} | {
|
|
594
|
+
type: "shield" | "minecraft:shield";
|
|
595
|
+
} | {
|
|
551
596
|
type: "chest" | "minecraft:chest";
|
|
552
597
|
texture: string;
|
|
553
598
|
openness?: number;
|
|
599
|
+
} | {
|
|
600
|
+
type: "shulker_box" | "minecraft:shulker_box";
|
|
601
|
+
texture: string;
|
|
602
|
+
openness?: number;
|
|
603
|
+
orientation?: "down" | "up" | "north" | "south" | "west" | "east";
|
|
554
604
|
} | {
|
|
555
605
|
type: "bed" | "minecraft:bed";
|
|
556
606
|
texture: string;
|
|
@@ -1284,11 +1334,15 @@ interface SpecialItemPart {
|
|
|
1284
1334
|
model: EntityModel;
|
|
1285
1335
|
transform: Matrix4;
|
|
1286
1336
|
rotations: Record<string, TripleArray>;
|
|
1337
|
+
/** Absolute named-part positions in the entity model's coordinate system. */
|
|
1338
|
+
positions?: Record<string, TripleArray>;
|
|
1339
|
+
/** Colors for the entity model's named texture passes. */
|
|
1340
|
+
tints?: Record<string, number>;
|
|
1287
1341
|
}
|
|
1288
|
-
/** Loads
|
|
1342
|
+
/** Loads entity geometry and texture passes for supported special item previews. */
|
|
1289
1343
|
declare class SpecialItems {
|
|
1290
1344
|
/** Resolves the static entity parts drawn by a special item renderer, in model units. */
|
|
1291
|
-
static getParts(special: SpecialItemRenderer, root?: string): Promise<SpecialItemPart[]>;
|
|
1345
|
+
static getParts(special: SpecialItemRenderer, root?: string, components?: Record<string, unknown>): Promise<SpecialItemPart[]>;
|
|
1292
1346
|
/** An owned material with model-preview shading; its entity texture remains shared. */
|
|
1293
1347
|
static createMaterial(source: MeshBasicMaterial, shade: boolean): MeshBasicMaterial;
|
|
1294
1348
|
}
|
|
@@ -2320,6 +2374,7 @@ declare class Caching {
|
|
|
2320
2374
|
static readonly entityAnimationCache: AsyncLoadingCache<CacheKey, EntityAnimationFile>;
|
|
2321
2375
|
static readonly blockEntityIndexCache: AsyncLoadingCache<CacheKey, BlockEntityIndex>;
|
|
2322
2376
|
static readonly fontCache: AsyncLoadingCache<CacheKey, BitmapFont>;
|
|
2377
|
+
static readonly bannerPatternCache: AsyncLoadingCache<CacheKey, BannerPattern>;
|
|
2323
2378
|
private static createAssetCache;
|
|
2324
2379
|
/** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
|
|
2325
2380
|
private static get all();
|
|
@@ -3240,4 +3295,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
|
|
|
3240
3295
|
*/
|
|
3241
3296
|
declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
|
|
3242
3297
|
|
|
3243
|
-
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, BrowserCache, BrowserEnv, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, 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, 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, probeImageSize, registerBrowserEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
|
|
3298
|
+
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, BrowserCache, BrowserEnv, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, DYE_COLORS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type DyeColor, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, Fonts, type FrameCallback, type FromTo, GUI_CONTAINER_LAYOUTS, Geometries, type GuiBookButtonState, type GuiBookOptions, type GuiBossBarColor, type GuiBossBarOptions, type GuiContainerType, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiSpriteScaling, type GuiText, type GuiTextLayer, type GuiTextLayout, type GuiTextOptions, type GuiTextRun, type GuiTextStyle, type GuiTextureLayer, type GuiTooltipOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelContext, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, type LoadedSceneDocument, type LoadedSceneObject, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, OrbitControls, type PackFormat, PackFormats, PackMetadata, PersistentCache, type PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererFrame, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResponseParser, SKIN_PARTS, type SceneBlockDefinition, type SceneDocument, SceneDocumentLoader, type SceneEntityDefinition, SceneExporter, type SceneGLTFExportOptions, type SceneGuiDefinition, type SceneGuiLayer, SceneInspector, type SceneModelDefinition, SceneObject, type SceneObjectDefinition, type SceneObjectDefinitionBase, type SceneObjectOptions, type SceneSkinDefinition, type SceneSkinPosePart, SceneStats, SceneStatsDisplay, SchematicParser, type SchematicParserOptions, 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, probeImageSize, registerBrowserEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -268,7 +268,7 @@ interface EntityModelFile extends MinecraftAsset {
|
|
|
268
268
|
passes?: EntityModelPass[];
|
|
269
269
|
}
|
|
270
270
|
/** Vanilla render type of a draw; see the dataset README for the mode table. */
|
|
271
|
-
type EntityRenderMode = "cutout" | "cutout_cull" | "cutout_z_offset" | "solid" | "translucent" | "translucent_emissive" | "eyes" | "energy_swirl" | "breeze_wind" | "water_mask";
|
|
271
|
+
type EntityRenderMode = "cutout" | "cutout_cull" | "cutout_z_offset" | "solid" | "translucent" | "translucent_emissive" | "eyes" | "energy_swirl" | "breeze_wind" | "water_mask" | "no_outline";
|
|
272
272
|
/** An extra draw of a geometry layer, optionally enabled by an entity-state label. */
|
|
273
273
|
interface EntityModelPass {
|
|
274
274
|
/** Geometry layer of the same file; a pass on `main` draws that geometry again. */
|
|
@@ -500,6 +500,46 @@ declare class ImageLoader {
|
|
|
500
500
|
static getWrapped(src: string): Promise<WrappedImage>;
|
|
501
501
|
}
|
|
502
502
|
|
|
503
|
+
/** Vanilla dye colors used by banner and shield textures, as sRGB packed values. */
|
|
504
|
+
declare const DYE_COLORS: Readonly<{
|
|
505
|
+
readonly white: 16383998;
|
|
506
|
+
readonly orange: 16351261;
|
|
507
|
+
readonly magenta: 13061821;
|
|
508
|
+
readonly light_blue: 3847130;
|
|
509
|
+
readonly yellow: 16701501;
|
|
510
|
+
readonly lime: 8439583;
|
|
511
|
+
readonly pink: 15961002;
|
|
512
|
+
readonly gray: 4673362;
|
|
513
|
+
readonly light_gray: 10329495;
|
|
514
|
+
readonly cyan: 1481884;
|
|
515
|
+
readonly purple: 8991416;
|
|
516
|
+
readonly blue: 3949738;
|
|
517
|
+
readonly brown: 8606770;
|
|
518
|
+
readonly green: 6192150;
|
|
519
|
+
readonly red: 11546150;
|
|
520
|
+
readonly black: 1908001;
|
|
521
|
+
}>;
|
|
522
|
+
type DyeColor = keyof typeof DYE_COLORS;
|
|
523
|
+
/** A registry banner pattern or an inline value in a `banner_patterns` component. */
|
|
524
|
+
interface BannerPattern extends MinecraftAsset {
|
|
525
|
+
asset_id: string;
|
|
526
|
+
translation_key: string;
|
|
527
|
+
}
|
|
528
|
+
interface BannerPatternDraw {
|
|
529
|
+
texture: AssetKey;
|
|
530
|
+
color: number;
|
|
531
|
+
}
|
|
532
|
+
/** Loads banner-pattern registry entries and resolves their banner or shield textures. */
|
|
533
|
+
declare class BannerPatterns {
|
|
534
|
+
/** Lists namespaced pattern IDs from the selected namespace's data directory. */
|
|
535
|
+
static getList(namespace?: string, root?: string): Promise<string[]>;
|
|
536
|
+
/** Returns the named dye's sRGB value, rejecting unknown colors. */
|
|
537
|
+
static getColor(color: unknown): number;
|
|
538
|
+
/** Resolves the first 16 layers of a `banner_patterns` component, preserving their order. */
|
|
539
|
+
static getLayers(value: unknown, target: "banner" | "shield", root?: string): Promise<BannerPatternDraw[]>;
|
|
540
|
+
private static identifier;
|
|
541
|
+
}
|
|
542
|
+
|
|
503
543
|
declare const ITEM_GENERATED = "item/generated";
|
|
504
544
|
declare const BUILTIN_GENERATED = "builtin/generated";
|
|
505
545
|
declare const BUILTIN_ENTITY = "builtin/entity";
|
|
@@ -523,7 +563,7 @@ interface ItemModel extends Model {
|
|
|
523
563
|
gui_light?: GuiLight;
|
|
524
564
|
special?: SpecialItemRenderer;
|
|
525
565
|
tints?: ItemTintSource[];
|
|
526
|
-
/** Stack-component snapshot with namespaced IDs, used
|
|
566
|
+
/** Stack-component snapshot with namespaced IDs, used by tint sources and special renderers. */
|
|
527
567
|
components?: Record<string, unknown>;
|
|
528
568
|
/** Ordered composite children, each with its own textures, display pose, and tint sources. */
|
|
529
569
|
parts?: ItemModel[];
|
|
@@ -548,9 +588,19 @@ type ItemTintSource = {
|
|
|
548
588
|
};
|
|
549
589
|
/** Supported item definitions that draw entity geometry instead of ordinary model elements. */
|
|
550
590
|
type SpecialItemRenderer = {
|
|
591
|
+
type: "banner" | "minecraft:banner";
|
|
592
|
+
color: DyeColor;
|
|
593
|
+
} | {
|
|
594
|
+
type: "shield" | "minecraft:shield";
|
|
595
|
+
} | {
|
|
551
596
|
type: "chest" | "minecraft:chest";
|
|
552
597
|
texture: string;
|
|
553
598
|
openness?: number;
|
|
599
|
+
} | {
|
|
600
|
+
type: "shulker_box" | "minecraft:shulker_box";
|
|
601
|
+
texture: string;
|
|
602
|
+
openness?: number;
|
|
603
|
+
orientation?: "down" | "up" | "north" | "south" | "west" | "east";
|
|
554
604
|
} | {
|
|
555
605
|
type: "bed" | "minecraft:bed";
|
|
556
606
|
texture: string;
|
|
@@ -1284,11 +1334,15 @@ interface SpecialItemPart {
|
|
|
1284
1334
|
model: EntityModel;
|
|
1285
1335
|
transform: Matrix4;
|
|
1286
1336
|
rotations: Record<string, TripleArray>;
|
|
1337
|
+
/** Absolute named-part positions in the entity model's coordinate system. */
|
|
1338
|
+
positions?: Record<string, TripleArray>;
|
|
1339
|
+
/** Colors for the entity model's named texture passes. */
|
|
1340
|
+
tints?: Record<string, number>;
|
|
1287
1341
|
}
|
|
1288
|
-
/** Loads
|
|
1342
|
+
/** Loads entity geometry and texture passes for supported special item previews. */
|
|
1289
1343
|
declare class SpecialItems {
|
|
1290
1344
|
/** Resolves the static entity parts drawn by a special item renderer, in model units. */
|
|
1291
|
-
static getParts(special: SpecialItemRenderer, root?: string): Promise<SpecialItemPart[]>;
|
|
1345
|
+
static getParts(special: SpecialItemRenderer, root?: string, components?: Record<string, unknown>): Promise<SpecialItemPart[]>;
|
|
1292
1346
|
/** An owned material with model-preview shading; its entity texture remains shared. */
|
|
1293
1347
|
static createMaterial(source: MeshBasicMaterial, shade: boolean): MeshBasicMaterial;
|
|
1294
1348
|
}
|
|
@@ -2320,6 +2374,7 @@ declare class Caching {
|
|
|
2320
2374
|
static readonly entityAnimationCache: AsyncLoadingCache<CacheKey, EntityAnimationFile>;
|
|
2321
2375
|
static readonly blockEntityIndexCache: AsyncLoadingCache<CacheKey, BlockEntityIndex>;
|
|
2322
2376
|
static readonly fontCache: AsyncLoadingCache<CacheKey, BitmapFont>;
|
|
2377
|
+
static readonly bannerPatternCache: AsyncLoadingCache<CacheKey, BannerPattern>;
|
|
2323
2378
|
private static createAssetCache;
|
|
2324
2379
|
/** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
|
|
2325
2380
|
private static get all();
|
|
@@ -3240,4 +3295,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
|
|
|
3240
3295
|
*/
|
|
3241
3296
|
declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
|
|
3242
3297
|
|
|
3243
|
-
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, BrowserCache, BrowserEnv, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, 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, 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, probeImageSize, registerBrowserEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
|
|
3298
|
+
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, BrowserCache, BrowserEnv, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, DYE_COLORS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type DyeColor, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, Fonts, type FrameCallback, type FromTo, GUI_CONTAINER_LAYOUTS, Geometries, type GuiBookButtonState, type GuiBookOptions, type GuiBossBarColor, type GuiBossBarOptions, type GuiContainerType, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiSpriteScaling, type GuiText, type GuiTextLayer, type GuiTextLayout, type GuiTextOptions, type GuiTextRun, type GuiTextStyle, type GuiTextureLayer, type GuiTooltipOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelContext, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, type LoadedSceneDocument, type LoadedSceneObject, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, OrbitControls, type PackFormat, PackFormats, PackMetadata, PersistentCache, type PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererFrame, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResponseParser, SKIN_PARTS, type SceneBlockDefinition, type SceneDocument, SceneDocumentLoader, type SceneEntityDefinition, SceneExporter, type SceneGLTFExportOptions, type SceneGuiDefinition, type SceneGuiLayer, SceneInspector, type SceneModelDefinition, SceneObject, type SceneObjectDefinition, type SceneObjectDefinitionBase, type SceneObjectOptions, type SceneSkinDefinition, type SceneSkinPosePart, SceneStats, SceneStatsDisplay, SchematicParser, type SchematicParserOptions, 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, probeImageSize, registerBrowserEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
|
package/dist/browser/index.js
CHANGED
|
@@ -261,7 +261,8 @@ var init_Caching = __esm({
|
|
|
261
261
|
this.entityTextureCache,
|
|
262
262
|
this.entityAnimationCache,
|
|
263
263
|
this.blockEntityIndexCache,
|
|
264
|
-
this.fontCache
|
|
264
|
+
this.fontCache,
|
|
265
|
+
this.bannerPatternCache
|
|
265
266
|
];
|
|
266
267
|
}
|
|
267
268
|
/** Invalidates in-memory entries so later lookups reload them. Persisted entries are retained. */
|
|
@@ -310,6 +311,7 @@ var init_Caching = __esm({
|
|
|
310
311
|
_Caching.entityAnimationCache = _Caching.createAssetCache();
|
|
311
312
|
_Caching.blockEntityIndexCache = _Caching.createAssetCache();
|
|
312
313
|
_Caching.fontCache = _Caching.createAssetCache();
|
|
314
|
+
_Caching.bannerPatternCache = _Caching.createAssetCache();
|
|
313
315
|
Caching = _Caching;
|
|
314
316
|
}
|
|
315
317
|
});
|
|
@@ -942,6 +944,7 @@ var init_Materials = __esm({
|
|
|
942
944
|
material.depthWrite = false;
|
|
943
945
|
break;
|
|
944
946
|
case "eyes":
|
|
947
|
+
case "no_outline":
|
|
945
948
|
material.transparent = true;
|
|
946
949
|
material.alphaTest = 0;
|
|
947
950
|
material.depthWrite = false;
|
|
@@ -1530,6 +1533,79 @@ var init_AssetParsers = __esm({
|
|
|
1530
1533
|
}
|
|
1531
1534
|
});
|
|
1532
1535
|
|
|
1536
|
+
// src/assets/BannerPatterns.ts
|
|
1537
|
+
var DYE_COLORS, BannerPatterns;
|
|
1538
|
+
var init_BannerPatterns = __esm({
|
|
1539
|
+
"src/assets/BannerPatterns.ts"() {
|
|
1540
|
+
init_AssetKey();
|
|
1541
|
+
init_AssetLoader();
|
|
1542
|
+
init_AssetParsers();
|
|
1543
|
+
init_Caching();
|
|
1544
|
+
DYE_COLORS = Object.freeze({
|
|
1545
|
+
white: 16383998,
|
|
1546
|
+
orange: 16351261,
|
|
1547
|
+
magenta: 13061821,
|
|
1548
|
+
light_blue: 3847130,
|
|
1549
|
+
yellow: 16701501,
|
|
1550
|
+
lime: 8439583,
|
|
1551
|
+
pink: 15961002,
|
|
1552
|
+
gray: 4673362,
|
|
1553
|
+
light_gray: 10329495,
|
|
1554
|
+
cyan: 1481884,
|
|
1555
|
+
purple: 8991416,
|
|
1556
|
+
blue: 3949738,
|
|
1557
|
+
brown: 8606770,
|
|
1558
|
+
green: 6192150,
|
|
1559
|
+
red: 11546150,
|
|
1560
|
+
black: 1908001
|
|
1561
|
+
});
|
|
1562
|
+
BannerPatterns = class {
|
|
1563
|
+
/** Lists namespaced pattern IDs from the selected namespace's data directory. */
|
|
1564
|
+
static async getList(namespace = "minecraft", root) {
|
|
1565
|
+
const collect = async (path) => {
|
|
1566
|
+
const prefix2 = path ? `${path}/` : "";
|
|
1567
|
+
const key = new AssetKey(namespace, `${prefix2}_list`, "banner_pattern", void 0, "data", ".json", root);
|
|
1568
|
+
const list2 = await Caching.listAssetCache.get(key.serialize(), () => AssetLoader.get(key, "list" /* LIST */));
|
|
1569
|
+
if (!list2) return [];
|
|
1570
|
+
const files = list2.files.filter((file) => file.endsWith(".json") && file !== "_list.json").map((file) => `${namespace}:${prefix2}${file.slice(0, -5)}`);
|
|
1571
|
+
const children = await Promise.all(list2.directories.map((directory) => collect(`${prefix2}${directory}`)));
|
|
1572
|
+
return [...files, ...children.flat()];
|
|
1573
|
+
};
|
|
1574
|
+
return collect("");
|
|
1575
|
+
}
|
|
1576
|
+
/** Returns the named dye's sRGB value, rejecting unknown colors. */
|
|
1577
|
+
static getColor(color2) {
|
|
1578
|
+
if (typeof color2 !== "string" || !Object.prototype.hasOwnProperty.call(DYE_COLORS, color2)) throw new Error(`Unsupported dye color ${color2}`);
|
|
1579
|
+
return DYE_COLORS[color2];
|
|
1580
|
+
}
|
|
1581
|
+
/** Resolves the first 16 layers of a `banner_patterns` component, preserving their order. */
|
|
1582
|
+
static async getLayers(value, target, root) {
|
|
1583
|
+
if (value === void 0) return [];
|
|
1584
|
+
if (!Array.isArray(value)) throw new Error("banner_patterns must be an array");
|
|
1585
|
+
return Promise.all(value.slice(0, 16).map(async (layer) => {
|
|
1586
|
+
if (!layer || typeof layer !== "object" || Array.isArray(layer)) throw new Error("Each banner pattern requires a pattern and dye color");
|
|
1587
|
+
const color2 = this.getColor(layer.color);
|
|
1588
|
+
let pattern2 = layer.pattern;
|
|
1589
|
+
if (typeof pattern2 === "string") {
|
|
1590
|
+
const id = this.identifier(pattern2);
|
|
1591
|
+
const key = new AssetKey(id.namespace, id.getFullPath(), "banner_pattern", void 0, "data", ".json", root);
|
|
1592
|
+
pattern2 = await Caching.bannerPatternCache.get(key.serialize(), () => AssetLoader.get(key, "json" /* JSON */));
|
|
1593
|
+
if (!pattern2) throw new Error(`Missing banner pattern ${layer.pattern}`);
|
|
1594
|
+
}
|
|
1595
|
+
if (!pattern2 || typeof pattern2 !== "object" || Array.isArray(pattern2) || typeof pattern2.translation_key !== "string") throw new Error("Banner patterns require asset_id and translation_key");
|
|
1596
|
+
const asset2 = this.identifier(pattern2.asset_id);
|
|
1597
|
+
return { color: color2, texture: new AssetKey(asset2.namespace, `${target}/${asset2.getFullPath()}`, "textures", "entity", "assets", ".png", root) };
|
|
1598
|
+
}));
|
|
1599
|
+
}
|
|
1600
|
+
static identifier(value) {
|
|
1601
|
+
if (typeof value !== "string" || !/^(?:[a-z0-9_.-]+:)?[a-z0-9_./-]+$/.test(value)) throw new Error(`Invalid banner-pattern identifier ${value}`);
|
|
1602
|
+
const [namespace, path] = value.includes(":") ? value.split(":") : ["minecraft", value];
|
|
1603
|
+
return new AssetKey(namespace, path);
|
|
1604
|
+
}
|
|
1605
|
+
};
|
|
1606
|
+
}
|
|
1607
|
+
});
|
|
1608
|
+
|
|
1533
1609
|
// src/assets/Models.ts
|
|
1534
1610
|
var Models;
|
|
1535
1611
|
var init_Models = __esm({
|
|
@@ -1542,6 +1618,7 @@ var init_Models = __esm({
|
|
|
1542
1618
|
init_AssetKey();
|
|
1543
1619
|
init_AssetParsers();
|
|
1544
1620
|
init_DisplayPosition();
|
|
1621
|
+
init_BannerPatterns();
|
|
1545
1622
|
Models = class _Models {
|
|
1546
1623
|
// opened lazily: touching the store at import time would hit IndexedDB/disk just for loading
|
|
1547
1624
|
// the library, and would require an EnvProvider before any entry has had a chance to register
|
|
@@ -1731,6 +1808,19 @@ var init_Models = __esm({
|
|
|
1731
1808
|
if (!node.base || !node.model || typeof node.model !== "object") break;
|
|
1732
1809
|
const special = node.model;
|
|
1733
1810
|
switch (special.type) {
|
|
1811
|
+
case "banner":
|
|
1812
|
+
case "minecraft:banner":
|
|
1813
|
+
if (typeof special.color === "string" && Object.prototype.hasOwnProperty.call(DYE_COLORS, special.color)) return { model: node.base, special };
|
|
1814
|
+
break;
|
|
1815
|
+
case "shield":
|
|
1816
|
+
case "minecraft:shield":
|
|
1817
|
+
return { model: node.base, special };
|
|
1818
|
+
case "shulker_box":
|
|
1819
|
+
case "minecraft:shulker_box":
|
|
1820
|
+
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))) {
|
|
1821
|
+
return { model: node.base, special };
|
|
1822
|
+
}
|
|
1823
|
+
break;
|
|
1734
1824
|
case "chest":
|
|
1735
1825
|
case "minecraft:chest":
|
|
1736
1826
|
case "bed":
|
|
@@ -5427,9 +5517,11 @@ var init_SpecialItems = __esm({
|
|
|
5427
5517
|
import_three24 = require("three");
|
|
5428
5518
|
init_AssetKey();
|
|
5429
5519
|
init_Entities();
|
|
5520
|
+
init_BannerPatterns();
|
|
5521
|
+
init_ModelTextures();
|
|
5430
5522
|
SpecialItems = class {
|
|
5431
5523
|
/** Resolves the static entity parts drawn by a special item renderer, in model units. */
|
|
5432
|
-
static async getParts(special, root) {
|
|
5524
|
+
static async getParts(special, root, components = {}) {
|
|
5433
5525
|
const texture = (id, directory) => {
|
|
5434
5526
|
const key = AssetKey.parse("textures", id);
|
|
5435
5527
|
return new AssetKey(
|
|
@@ -5442,13 +5534,60 @@ var init_SpecialItems = __esm({
|
|
|
5442
5534
|
root
|
|
5443
5535
|
);
|
|
5444
5536
|
};
|
|
5445
|
-
const load = async (id, textureKey, transform, rotations = {}) => {
|
|
5537
|
+
const load = async (id, textureKey, transform, rotations = {}, layers = ["main"]) => {
|
|
5446
5538
|
const key = new AssetKey("minecraft", id, void 0, void 0, "entity-models", ".json", root);
|
|
5447
|
-
const model = await Entities.getEntity(key, textureKey, { layer:
|
|
5539
|
+
const model = await Entities.getEntity(key, textureKey, layers.length === 1 ? { layer: layers[0] } : {
|
|
5540
|
+
layers,
|
|
5541
|
+
textures: textureKey ? Object.fromEntries(layers.map((name) => [name, textureKey])) : void 0
|
|
5542
|
+
});
|
|
5448
5543
|
if (!model) throw new Error(`Missing entity model minecraft:${id} for special item ${special.type}`);
|
|
5449
5544
|
return { model, transform, rotations };
|
|
5450
5545
|
};
|
|
5451
5546
|
switch (special.type) {
|
|
5547
|
+
case "minecraft:banner":
|
|
5548
|
+
case "banner":
|
|
5549
|
+
case "minecraft:shield":
|
|
5550
|
+
case "shield": {
|
|
5551
|
+
const banner = special.type === "banner" || special.type === "minecraft:banner";
|
|
5552
|
+
const color2 = banner ? BannerPatterns.getColor(special.color) : components["minecraft:base_color"] === void 0 ? void 0 : BannerPatterns.getColor(components["minecraft:base_color"]);
|
|
5553
|
+
const patterns = await BannerPatterns.getLayers(components["minecraft:banner_patterns"], banner ? "banner" : "shield", root);
|
|
5554
|
+
const patterned = banner || color2 !== void 0 || patterns.length > 0;
|
|
5555
|
+
const baseTexture = texture(banner ? "banner_base" : patterned ? "shield_base" : "shield_base_nopattern", "");
|
|
5556
|
+
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);
|
|
5557
|
+
const part = await load(banner ? "standing_banner" : "shield", baseTexture, transform, {}, banner ? ["main", "flag"] : ["main"]);
|
|
5558
|
+
const layers = Object.fromEntries(Object.entries(part.model.layers ?? { main: part.model }).map(([name, layer]) => [name, { ...layer, render: "solid" }]));
|
|
5559
|
+
let overlay2;
|
|
5560
|
+
if (banner) {
|
|
5561
|
+
const flagLayer = layers.flag;
|
|
5562
|
+
const flag = flagLayer?.layer.root.children.flag;
|
|
5563
|
+
if (!flag) throw new Error("Banner entity model is missing its flag layer");
|
|
5564
|
+
overlay2 = { ...flagLayer.layer, root: { ...flagLayer.layer.root, children: {
|
|
5565
|
+
...flagLayer.layer.root.children,
|
|
5566
|
+
flag: { ...flag, pose: { ...flag.pose, rotation: [-25e-4 * Math.PI, flag.pose.rotation[1], flag.pose.rotation[2]] } }
|
|
5567
|
+
} } };
|
|
5568
|
+
layers.flag = { ...flagLayer, layer: overlay2 };
|
|
5569
|
+
} else {
|
|
5570
|
+
const main = layers.main.layer;
|
|
5571
|
+
const plate = main.root.children.plate;
|
|
5572
|
+
if (!plate) throw new Error("Shield entity model is missing its plate");
|
|
5573
|
+
overlay2 = { ...main, root: { ...main.root, cubes: [], children: { plate } } };
|
|
5574
|
+
}
|
|
5575
|
+
const tints = {};
|
|
5576
|
+
if (patterned) {
|
|
5577
|
+
const draws = [{ texture: texture(`${banner ? "banner" : "shield"}/base`, ""), color: color2 ?? DYE_COLORS.white }, ...patterns];
|
|
5578
|
+
draws.forEach((draw, index) => {
|
|
5579
|
+
const name = index === 0 ? "pattern_base" : `pattern_${index - 1}`;
|
|
5580
|
+
layers[name] = { key: draw.texture, texture: draw.texture, layer: overlay2, render: "no_outline", tint: name };
|
|
5581
|
+
tints[name] = draw.color;
|
|
5582
|
+
});
|
|
5583
|
+
}
|
|
5584
|
+
await Promise.all([...new Map(Object.values(layers).map((layer) => [layer.texture.serialize(), layer.texture])).values()].map(async (key) => {
|
|
5585
|
+
if (!await ModelTextures.preload(key)) throw new Error(`Missing special item texture ${key.toNamespacedString()}`);
|
|
5586
|
+
}));
|
|
5587
|
+
part.model = { ...part.model, ...layers.main, layers };
|
|
5588
|
+
part.tints = tints;
|
|
5589
|
+
return [part];
|
|
5590
|
+
}
|
|
5452
5591
|
case "minecraft:chest":
|
|
5453
5592
|
case "chest": {
|
|
5454
5593
|
const angle = -(special.openness ?? 0) * Math.PI / 2;
|
|
@@ -5459,6 +5598,26 @@ var init_SpecialItems = __esm({
|
|
|
5459
5598
|
chest.model = { ...chest.model, render: "solid", layers: void 0 };
|
|
5460
5599
|
return [chest];
|
|
5461
5600
|
}
|
|
5601
|
+
case "minecraft:shulker_box":
|
|
5602
|
+
case "shulker_box": {
|
|
5603
|
+
const openness = special.openness === void 0 ? 0 : special.openness;
|
|
5604
|
+
const orientation = special.orientation === void 0 ? "up" : special.orientation;
|
|
5605
|
+
const directions = {
|
|
5606
|
+
down: [Math.PI, 0, 0],
|
|
5607
|
+
up: [0, 0, 0],
|
|
5608
|
+
north: [Math.PI / 2, 0, Math.PI],
|
|
5609
|
+
south: [Math.PI / 2, 0, 0],
|
|
5610
|
+
west: [Math.PI / 2, 0, Math.PI / 2],
|
|
5611
|
+
east: [Math.PI / 2, 0, -Math.PI / 2]
|
|
5612
|
+
};
|
|
5613
|
+
if (!Object.prototype.hasOwnProperty.call(directions, orientation)) throw new Error(`Unsupported shulker-box orientation ${orientation}`);
|
|
5614
|
+
if (typeof openness !== "number" || !Number.isFinite(openness)) throw new Error("Shulker-box openness must be finite");
|
|
5615
|
+
if (typeof special.texture !== "string" || !special.texture) throw new Error("Shulker-box texture is required");
|
|
5616
|
+
const transform = new import_three24.Matrix4().makeTranslation(8, 8, 8).multiply(new import_three24.Matrix4().makeScale(0.9995, 0.9995, 0.9995)).multiply(new import_three24.Matrix4().makeRotationFromEuler(new import_three24.Euler(...directions[orientation], "XYZ"))).multiply(new import_three24.Matrix4().makeScale(1, -1, -1)).multiply(new import_three24.Matrix4().makeTranslation(0, -16, 0));
|
|
5617
|
+
const box = await load("shulker_box", texture(special.texture, "shulker"), transform, { lid: [0, openness * Math.PI * 1.5, 0] });
|
|
5618
|
+
box.positions = { lid: [0, 24 - openness * 8, 0] };
|
|
5619
|
+
return [box];
|
|
5620
|
+
}
|
|
5462
5621
|
case "minecraft:bed":
|
|
5463
5622
|
case "bed": {
|
|
5464
5623
|
const transform = new import_three24.Matrix4().makeTranslation(0, 9, 0).multiply(new import_three24.Matrix4().makeRotationX(Math.PI / 2)).multiply(new import_three24.Matrix4().makeTranslation(8, 8, 8)).multiply(new import_three24.Matrix4().makeRotationZ(Math.PI)).multiply(new import_three24.Matrix4().makeTranslation(-8, -8, -8));
|
|
@@ -5723,12 +5882,12 @@ var init_ModelObject = __esm({
|
|
|
5723
5882
|
this.options.tints = await ItemTints.get(this.originalModel, this.options.tints);
|
|
5724
5883
|
const special = this.originalModel.special;
|
|
5725
5884
|
if (special) {
|
|
5726
|
-
const parts2 = await SpecialItems.getParts(special, this.originalModel.key?.root);
|
|
5885
|
+
const parts2 = await SpecialItems.getParts(special, this.originalModel.key?.root, this.originalModel.components);
|
|
5727
5886
|
const transform = this.options.displayPosition ? DisplayTransforms.getMatrix(this.originalModel.display, this.options.displayPosition) : new import_three25.Matrix4();
|
|
5728
5887
|
transform.multiply(new import_three25.Matrix4().makeTranslation(-8, -8, -8));
|
|
5729
5888
|
try {
|
|
5730
5889
|
for (const part of parts2) {
|
|
5731
|
-
const object3 = new EntityObject(part.model, { flip: false, wireframe: this.options.wireframe });
|
|
5890
|
+
const object3 = new EntityObject(part.model, { flip: false, wireframe: this.options.wireframe, tints: part.tints });
|
|
5732
5891
|
object3.matrix.copy(transform).multiply(part.transform);
|
|
5733
5892
|
object3.matrixWorldNeedsUpdate = true;
|
|
5734
5893
|
object3.matrixAutoUpdate = false;
|
|
@@ -5747,6 +5906,9 @@ var init_ModelObject = __esm({
|
|
|
5747
5906
|
for (const [name, rotation] of Object.entries(part.rotations)) {
|
|
5748
5907
|
object3.getGroupByName(name)?.rotation.set(...rotation, "ZYX");
|
|
5749
5908
|
}
|
|
5909
|
+
for (const [name, position] of Object.entries(part.positions ?? {})) {
|
|
5910
|
+
object3.getGroupByName(name)?.position.set(...position);
|
|
5911
|
+
}
|
|
5750
5912
|
}
|
|
5751
5913
|
} catch (error) {
|
|
5752
5914
|
this.disposeAndRemoveAllChildren();
|
|
@@ -6178,6 +6340,7 @@ __export(index_browser_exports, {
|
|
|
6178
6340
|
Axis: () => Axis,
|
|
6179
6341
|
BUILTIN_ENTITY: () => BUILTIN_ENTITY,
|
|
6180
6342
|
BUILTIN_GENERATED: () => BUILTIN_GENERATED,
|
|
6343
|
+
BannerPatterns: () => BannerPatterns,
|
|
6181
6344
|
BasicAssetKey: () => BasicAssetKey,
|
|
6182
6345
|
BatchedExecutor: () => BatchedExecutor,
|
|
6183
6346
|
BlockEntities: () => BlockEntities,
|
|
@@ -6202,6 +6365,7 @@ __export(index_browser_exports, {
|
|
|
6202
6365
|
DEFAULT_ROOT: () => DEFAULT_ROOT,
|
|
6203
6366
|
DEFAULT_UV: () => DEFAULT_UV,
|
|
6204
6367
|
DISPLAY_POSITIONS: () => DISPLAY_POSITIONS,
|
|
6368
|
+
DYE_COLORS: () => DYE_COLORS,
|
|
6205
6369
|
DefaultBlockStates: () => DefaultBlockStates,
|
|
6206
6370
|
DisplayPosition: () => DisplayPosition,
|
|
6207
6371
|
DisplayTransforms: () => DisplayTransforms,
|
|
@@ -6536,6 +6700,7 @@ function shutdown() {
|
|
|
6536
6700
|
init_AssetKey();
|
|
6537
6701
|
init_AssetLoader();
|
|
6538
6702
|
init_Assets();
|
|
6703
|
+
init_BannerPatterns();
|
|
6539
6704
|
|
|
6540
6705
|
// src/assets/BlockEntities.ts
|
|
6541
6706
|
var import_three10 = require("three");
|