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/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,6 +588,13 @@ 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
|
+
} | {
|
|
596
|
+
type: "trident" | "minecraft:trident" | "conduit" | "minecraft:conduit";
|
|
597
|
+
} | {
|
|
551
598
|
type: "chest" | "minecraft:chest";
|
|
552
599
|
texture: string;
|
|
553
600
|
openness?: number;
|
|
@@ -1291,11 +1338,13 @@ interface SpecialItemPart {
|
|
|
1291
1338
|
rotations: Record<string, TripleArray>;
|
|
1292
1339
|
/** Absolute named-part positions in the entity model's coordinate system. */
|
|
1293
1340
|
positions?: Record<string, TripleArray>;
|
|
1341
|
+
/** Colors for the entity model's named texture passes. */
|
|
1342
|
+
tints?: Record<string, number>;
|
|
1294
1343
|
}
|
|
1295
|
-
/** Loads
|
|
1344
|
+
/** Loads entity geometry and texture passes for supported special item previews. */
|
|
1296
1345
|
declare class SpecialItems {
|
|
1297
1346
|
/** Resolves the static entity parts drawn by a special item renderer, in model units. */
|
|
1298
|
-
static getParts(special: SpecialItemRenderer, root?: string): Promise<SpecialItemPart[]>;
|
|
1347
|
+
static getParts(special: SpecialItemRenderer, root?: string, components?: Record<string, unknown>): Promise<SpecialItemPart[]>;
|
|
1299
1348
|
/** An owned material with model-preview shading; its entity texture remains shared. */
|
|
1300
1349
|
static createMaterial(source: MeshBasicMaterial, shade: boolean): MeshBasicMaterial;
|
|
1301
1350
|
}
|
|
@@ -2327,6 +2376,7 @@ declare class Caching {
|
|
|
2327
2376
|
static readonly entityAnimationCache: AsyncLoadingCache<CacheKey, EntityAnimationFile>;
|
|
2328
2377
|
static readonly blockEntityIndexCache: AsyncLoadingCache<CacheKey, BlockEntityIndex>;
|
|
2329
2378
|
static readonly fontCache: AsyncLoadingCache<CacheKey, BitmapFont>;
|
|
2379
|
+
static readonly bannerPatternCache: AsyncLoadingCache<CacheKey, BannerPattern>;
|
|
2330
2380
|
private static createAssetCache;
|
|
2331
2381
|
/** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
|
|
2332
2382
|
private static get all();
|
|
@@ -3247,4 +3297,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
|
|
|
3247
3297
|
*/
|
|
3248
3298
|
declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
|
|
3249
3299
|
|
|
3250
|
-
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 };
|
|
3300
|
+
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,6 +588,13 @@ 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
|
+
} | {
|
|
596
|
+
type: "trident" | "minecraft:trident" | "conduit" | "minecraft:conduit";
|
|
597
|
+
} | {
|
|
551
598
|
type: "chest" | "minecraft:chest";
|
|
552
599
|
texture: string;
|
|
553
600
|
openness?: number;
|
|
@@ -1291,11 +1338,13 @@ interface SpecialItemPart {
|
|
|
1291
1338
|
rotations: Record<string, TripleArray>;
|
|
1292
1339
|
/** Absolute named-part positions in the entity model's coordinate system. */
|
|
1293
1340
|
positions?: Record<string, TripleArray>;
|
|
1341
|
+
/** Colors for the entity model's named texture passes. */
|
|
1342
|
+
tints?: Record<string, number>;
|
|
1294
1343
|
}
|
|
1295
|
-
/** Loads
|
|
1344
|
+
/** Loads entity geometry and texture passes for supported special item previews. */
|
|
1296
1345
|
declare class SpecialItems {
|
|
1297
1346
|
/** Resolves the static entity parts drawn by a special item renderer, in model units. */
|
|
1298
|
-
static getParts(special: SpecialItemRenderer, root?: string): Promise<SpecialItemPart[]>;
|
|
1347
|
+
static getParts(special: SpecialItemRenderer, root?: string, components?: Record<string, unknown>): Promise<SpecialItemPart[]>;
|
|
1299
1348
|
/** An owned material with model-preview shading; its entity texture remains shared. */
|
|
1300
1349
|
static createMaterial(source: MeshBasicMaterial, shade: boolean): MeshBasicMaterial;
|
|
1301
1350
|
}
|
|
@@ -2327,6 +2376,7 @@ declare class Caching {
|
|
|
2327
2376
|
static readonly entityAnimationCache: AsyncLoadingCache<CacheKey, EntityAnimationFile>;
|
|
2328
2377
|
static readonly blockEntityIndexCache: AsyncLoadingCache<CacheKey, BlockEntityIndex>;
|
|
2329
2378
|
static readonly fontCache: AsyncLoadingCache<CacheKey, BitmapFont>;
|
|
2379
|
+
static readonly bannerPatternCache: AsyncLoadingCache<CacheKey, BannerPattern>;
|
|
2330
2380
|
private static createAssetCache;
|
|
2331
2381
|
/** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
|
|
2332
2382
|
private static get all();
|
|
@@ -3247,4 +3297,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
|
|
|
3247
3297
|
*/
|
|
3248
3298
|
declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
|
|
3249
3299
|
|
|
3250
|
-
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 };
|
|
3300
|
+
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,17 @@ 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
|
+
case "trident":
|
|
1818
|
+
case "minecraft:trident":
|
|
1819
|
+
case "conduit":
|
|
1820
|
+
case "minecraft:conduit":
|
|
1821
|
+
return { model: node.base, special };
|
|
1734
1822
|
case "shulker_box":
|
|
1735
1823
|
case "minecraft:shulker_box":
|
|
1736
1824
|
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))) {
|
|
@@ -5433,9 +5521,11 @@ var init_SpecialItems = __esm({
|
|
|
5433
5521
|
import_three24 = require("three");
|
|
5434
5522
|
init_AssetKey();
|
|
5435
5523
|
init_Entities();
|
|
5524
|
+
init_BannerPatterns();
|
|
5525
|
+
init_ModelTextures();
|
|
5436
5526
|
SpecialItems = class {
|
|
5437
5527
|
/** Resolves the static entity parts drawn by a special item renderer, in model units. */
|
|
5438
|
-
static async getParts(special, root) {
|
|
5528
|
+
static async getParts(special, root, components = {}) {
|
|
5439
5529
|
const texture = (id, directory) => {
|
|
5440
5530
|
const key = AssetKey.parse("textures", id);
|
|
5441
5531
|
return new AssetKey(
|
|
@@ -5448,13 +5538,77 @@ var init_SpecialItems = __esm({
|
|
|
5448
5538
|
root
|
|
5449
5539
|
);
|
|
5450
5540
|
};
|
|
5451
|
-
const load = async (id, textureKey, transform, rotations = {}) => {
|
|
5541
|
+
const load = async (id, textureKey, transform, rotations = {}, layers = ["main"]) => {
|
|
5452
5542
|
const key = new AssetKey("minecraft", id, void 0, void 0, "entity-models", ".json", root);
|
|
5453
|
-
const model = await Entities.getEntity(key, textureKey, { layer:
|
|
5543
|
+
const model = await Entities.getEntity(key, textureKey, layers.length === 1 ? { layer: layers[0] } : {
|
|
5544
|
+
layers,
|
|
5545
|
+
textures: textureKey ? Object.fromEntries(layers.map((name) => [name, textureKey])) : void 0
|
|
5546
|
+
});
|
|
5454
5547
|
if (!model) throw new Error(`Missing entity model minecraft:${id} for special item ${special.type}`);
|
|
5455
5548
|
return { model, transform, rotations };
|
|
5456
5549
|
};
|
|
5457
5550
|
switch (special.type) {
|
|
5551
|
+
case "minecraft:trident":
|
|
5552
|
+
case "trident":
|
|
5553
|
+
case "minecraft:conduit":
|
|
5554
|
+
case "conduit": {
|
|
5555
|
+
const trident = special.type === "trident" || special.type === "minecraft:trident";
|
|
5556
|
+
const part = await load(
|
|
5557
|
+
trident ? "trident" : "conduit",
|
|
5558
|
+
texture(trident ? "trident" : "conduit/base", ""),
|
|
5559
|
+
trident ? new import_three24.Matrix4().makeScale(1, -1, -1) : new import_three24.Matrix4().makeTranslation(8, 8, 8),
|
|
5560
|
+
{},
|
|
5561
|
+
trident ? ["main"] : ["shell"]
|
|
5562
|
+
);
|
|
5563
|
+
part.model = { ...part.model, render: "solid", layers: part.model.layers && Object.fromEntries(
|
|
5564
|
+
Object.entries(part.model.layers).map(([name, layer]) => [name, { ...layer, render: "solid" }])
|
|
5565
|
+
) };
|
|
5566
|
+
return [part];
|
|
5567
|
+
}
|
|
5568
|
+
case "minecraft:banner":
|
|
5569
|
+
case "banner":
|
|
5570
|
+
case "minecraft:shield":
|
|
5571
|
+
case "shield": {
|
|
5572
|
+
const banner = special.type === "banner" || special.type === "minecraft:banner";
|
|
5573
|
+
const color2 = banner ? BannerPatterns.getColor(special.color) : components["minecraft:base_color"] === void 0 ? void 0 : BannerPatterns.getColor(components["minecraft:base_color"]);
|
|
5574
|
+
const patterns = await BannerPatterns.getLayers(components["minecraft:banner_patterns"], banner ? "banner" : "shield", root);
|
|
5575
|
+
const patterned = banner || color2 !== void 0 || patterns.length > 0;
|
|
5576
|
+
const baseTexture = texture(banner ? "banner_base" : patterned ? "shield_base" : "shield_base_nopattern", "");
|
|
5577
|
+
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);
|
|
5578
|
+
const part = await load(banner ? "standing_banner" : "shield", baseTexture, transform, {}, banner ? ["main", "flag"] : ["main"]);
|
|
5579
|
+
const layers = Object.fromEntries(Object.entries(part.model.layers ?? { main: part.model }).map(([name, layer]) => [name, { ...layer, render: "solid" }]));
|
|
5580
|
+
let overlay2;
|
|
5581
|
+
if (banner) {
|
|
5582
|
+
const flagLayer = layers.flag;
|
|
5583
|
+
const flag = flagLayer?.layer.root.children.flag;
|
|
5584
|
+
if (!flag) throw new Error("Banner entity model is missing its flag layer");
|
|
5585
|
+
overlay2 = { ...flagLayer.layer, root: { ...flagLayer.layer.root, children: {
|
|
5586
|
+
...flagLayer.layer.root.children,
|
|
5587
|
+
flag: { ...flag, pose: { ...flag.pose, rotation: [-25e-4 * Math.PI, flag.pose.rotation[1], flag.pose.rotation[2]] } }
|
|
5588
|
+
} } };
|
|
5589
|
+
layers.flag = { ...flagLayer, layer: overlay2 };
|
|
5590
|
+
} else {
|
|
5591
|
+
const main = layers.main.layer;
|
|
5592
|
+
const plate = main.root.children.plate;
|
|
5593
|
+
if (!plate) throw new Error("Shield entity model is missing its plate");
|
|
5594
|
+
overlay2 = { ...main, root: { ...main.root, cubes: [], children: { plate } } };
|
|
5595
|
+
}
|
|
5596
|
+
const tints = {};
|
|
5597
|
+
if (patterned) {
|
|
5598
|
+
const draws = [{ texture: texture(`${banner ? "banner" : "shield"}/base`, ""), color: color2 ?? DYE_COLORS.white }, ...patterns];
|
|
5599
|
+
draws.forEach((draw, index) => {
|
|
5600
|
+
const name = index === 0 ? "pattern_base" : `pattern_${index - 1}`;
|
|
5601
|
+
layers[name] = { key: draw.texture, texture: draw.texture, layer: overlay2, render: "no_outline", tint: name };
|
|
5602
|
+
tints[name] = draw.color;
|
|
5603
|
+
});
|
|
5604
|
+
}
|
|
5605
|
+
await Promise.all([...new Map(Object.values(layers).map((layer) => [layer.texture.serialize(), layer.texture])).values()].map(async (key) => {
|
|
5606
|
+
if (!await ModelTextures.preload(key)) throw new Error(`Missing special item texture ${key.toNamespacedString()}`);
|
|
5607
|
+
}));
|
|
5608
|
+
part.model = { ...part.model, ...layers.main, layers };
|
|
5609
|
+
part.tints = tints;
|
|
5610
|
+
return [part];
|
|
5611
|
+
}
|
|
5458
5612
|
case "minecraft:chest":
|
|
5459
5613
|
case "chest": {
|
|
5460
5614
|
const angle = -(special.openness ?? 0) * Math.PI / 2;
|
|
@@ -5749,12 +5903,12 @@ var init_ModelObject = __esm({
|
|
|
5749
5903
|
this.options.tints = await ItemTints.get(this.originalModel, this.options.tints);
|
|
5750
5904
|
const special = this.originalModel.special;
|
|
5751
5905
|
if (special) {
|
|
5752
|
-
const parts2 = await SpecialItems.getParts(special, this.originalModel.key?.root);
|
|
5906
|
+
const parts2 = await SpecialItems.getParts(special, this.originalModel.key?.root, this.originalModel.components);
|
|
5753
5907
|
const transform = this.options.displayPosition ? DisplayTransforms.getMatrix(this.originalModel.display, this.options.displayPosition) : new import_three25.Matrix4();
|
|
5754
5908
|
transform.multiply(new import_three25.Matrix4().makeTranslation(-8, -8, -8));
|
|
5755
5909
|
try {
|
|
5756
5910
|
for (const part of parts2) {
|
|
5757
|
-
const object3 = new EntityObject(part.model, { flip: false, wireframe: this.options.wireframe });
|
|
5911
|
+
const object3 = new EntityObject(part.model, { flip: false, wireframe: this.options.wireframe, tints: part.tints });
|
|
5758
5912
|
object3.matrix.copy(transform).multiply(part.transform);
|
|
5759
5913
|
object3.matrixWorldNeedsUpdate = true;
|
|
5760
5914
|
object3.matrixAutoUpdate = false;
|
|
@@ -6207,6 +6361,7 @@ __export(index_browser_exports, {
|
|
|
6207
6361
|
Axis: () => Axis,
|
|
6208
6362
|
BUILTIN_ENTITY: () => BUILTIN_ENTITY,
|
|
6209
6363
|
BUILTIN_GENERATED: () => BUILTIN_GENERATED,
|
|
6364
|
+
BannerPatterns: () => BannerPatterns,
|
|
6210
6365
|
BasicAssetKey: () => BasicAssetKey,
|
|
6211
6366
|
BatchedExecutor: () => BatchedExecutor,
|
|
6212
6367
|
BlockEntities: () => BlockEntities,
|
|
@@ -6231,6 +6386,7 @@ __export(index_browser_exports, {
|
|
|
6231
6386
|
DEFAULT_ROOT: () => DEFAULT_ROOT,
|
|
6232
6387
|
DEFAULT_UV: () => DEFAULT_UV,
|
|
6233
6388
|
DISPLAY_POSITIONS: () => DISPLAY_POSITIONS,
|
|
6389
|
+
DYE_COLORS: () => DYE_COLORS,
|
|
6234
6390
|
DefaultBlockStates: () => DefaultBlockStates,
|
|
6235
6391
|
DisplayPosition: () => DisplayPosition,
|
|
6236
6392
|
DisplayTransforms: () => DisplayTransforms,
|
|
@@ -6565,6 +6721,7 @@ function shutdown() {
|
|
|
6565
6721
|
init_AssetKey();
|
|
6566
6722
|
init_AssetLoader();
|
|
6567
6723
|
init_Assets();
|
|
6724
|
+
init_BannerPatterns();
|
|
6568
6725
|
|
|
6569
6726
|
// src/assets/BlockEntities.ts
|
|
6570
6727
|
var import_three10 = require("three");
|