minerender 2.1.0-alpha.82 → 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 +53 -5
- package/dist/browser/index.d.ts +53 -5
- package/dist/browser/index.js +142 -6
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +142 -6
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +145 -6
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +53 -5
- package/dist/node/index.d.ts +53 -5
- package/dist/node/index.js +146 -6
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +144 -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,11 @@ 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;
|
|
@@ -1291,11 +1336,13 @@ interface SpecialItemPart {
|
|
|
1291
1336
|
rotations: Record<string, TripleArray>;
|
|
1292
1337
|
/** Absolute named-part positions in the entity model's coordinate system. */
|
|
1293
1338
|
positions?: Record<string, TripleArray>;
|
|
1339
|
+
/** Colors for the entity model's named texture passes. */
|
|
1340
|
+
tints?: Record<string, number>;
|
|
1294
1341
|
}
|
|
1295
|
-
/** Loads
|
|
1342
|
+
/** Loads entity geometry and texture passes for supported special item previews. */
|
|
1296
1343
|
declare class SpecialItems {
|
|
1297
1344
|
/** Resolves the static entity parts drawn by a special item renderer, in model units. */
|
|
1298
|
-
static getParts(special: SpecialItemRenderer, root?: string): Promise<SpecialItemPart[]>;
|
|
1345
|
+
static getParts(special: SpecialItemRenderer, root?: string, components?: Record<string, unknown>): Promise<SpecialItemPart[]>;
|
|
1299
1346
|
/** An owned material with model-preview shading; its entity texture remains shared. */
|
|
1300
1347
|
static createMaterial(source: MeshBasicMaterial, shade: boolean): MeshBasicMaterial;
|
|
1301
1348
|
}
|
|
@@ -2327,6 +2374,7 @@ declare class Caching {
|
|
|
2327
2374
|
static readonly entityAnimationCache: AsyncLoadingCache<CacheKey, EntityAnimationFile>;
|
|
2328
2375
|
static readonly blockEntityIndexCache: AsyncLoadingCache<CacheKey, BlockEntityIndex>;
|
|
2329
2376
|
static readonly fontCache: AsyncLoadingCache<CacheKey, BitmapFont>;
|
|
2377
|
+
static readonly bannerPatternCache: AsyncLoadingCache<CacheKey, BannerPattern>;
|
|
2330
2378
|
private static createAssetCache;
|
|
2331
2379
|
/** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
|
|
2332
2380
|
private static get all();
|
|
@@ -3247,4 +3295,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
|
|
|
3247
3295
|
*/
|
|
3248
3296
|
declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
|
|
3249
3297
|
|
|
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 };
|
|
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,6 +588,11 @@ 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;
|
|
@@ -1291,11 +1336,13 @@ interface SpecialItemPart {
|
|
|
1291
1336
|
rotations: Record<string, TripleArray>;
|
|
1292
1337
|
/** Absolute named-part positions in the entity model's coordinate system. */
|
|
1293
1338
|
positions?: Record<string, TripleArray>;
|
|
1339
|
+
/** Colors for the entity model's named texture passes. */
|
|
1340
|
+
tints?: Record<string, number>;
|
|
1294
1341
|
}
|
|
1295
|
-
/** Loads
|
|
1342
|
+
/** Loads entity geometry and texture passes for supported special item previews. */
|
|
1296
1343
|
declare class SpecialItems {
|
|
1297
1344
|
/** Resolves the static entity parts drawn by a special item renderer, in model units. */
|
|
1298
|
-
static getParts(special: SpecialItemRenderer, root?: string): Promise<SpecialItemPart[]>;
|
|
1345
|
+
static getParts(special: SpecialItemRenderer, root?: string, components?: Record<string, unknown>): Promise<SpecialItemPart[]>;
|
|
1299
1346
|
/** An owned material with model-preview shading; its entity texture remains shared. */
|
|
1300
1347
|
static createMaterial(source: MeshBasicMaterial, shade: boolean): MeshBasicMaterial;
|
|
1301
1348
|
}
|
|
@@ -2327,6 +2374,7 @@ declare class Caching {
|
|
|
2327
2374
|
static readonly entityAnimationCache: AsyncLoadingCache<CacheKey, EntityAnimationFile>;
|
|
2328
2375
|
static readonly blockEntityIndexCache: AsyncLoadingCache<CacheKey, BlockEntityIndex>;
|
|
2329
2376
|
static readonly fontCache: AsyncLoadingCache<CacheKey, BitmapFont>;
|
|
2377
|
+
static readonly bannerPatternCache: AsyncLoadingCache<CacheKey, BannerPattern>;
|
|
2330
2378
|
private static createAssetCache;
|
|
2331
2379
|
/** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
|
|
2332
2380
|
private static get all();
|
|
@@ -3247,4 +3295,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
|
|
|
3247
3295
|
*/
|
|
3248
3296
|
declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
|
|
3249
3297
|
|
|
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 };
|
|
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,13 @@ 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 };
|
|
1734
1818
|
case "shulker_box":
|
|
1735
1819
|
case "minecraft:shulker_box":
|
|
1736
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))) {
|
|
@@ -5433,9 +5517,11 @@ var init_SpecialItems = __esm({
|
|
|
5433
5517
|
import_three24 = require("three");
|
|
5434
5518
|
init_AssetKey();
|
|
5435
5519
|
init_Entities();
|
|
5520
|
+
init_BannerPatterns();
|
|
5521
|
+
init_ModelTextures();
|
|
5436
5522
|
SpecialItems = class {
|
|
5437
5523
|
/** Resolves the static entity parts drawn by a special item renderer, in model units. */
|
|
5438
|
-
static async getParts(special, root) {
|
|
5524
|
+
static async getParts(special, root, components = {}) {
|
|
5439
5525
|
const texture = (id, directory) => {
|
|
5440
5526
|
const key = AssetKey.parse("textures", id);
|
|
5441
5527
|
return new AssetKey(
|
|
@@ -5448,13 +5534,60 @@ var init_SpecialItems = __esm({
|
|
|
5448
5534
|
root
|
|
5449
5535
|
);
|
|
5450
5536
|
};
|
|
5451
|
-
const load = async (id, textureKey, transform, rotations = {}) => {
|
|
5537
|
+
const load = async (id, textureKey, transform, rotations = {}, layers = ["main"]) => {
|
|
5452
5538
|
const key = new AssetKey("minecraft", id, void 0, void 0, "entity-models", ".json", root);
|
|
5453
|
-
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
|
+
});
|
|
5454
5543
|
if (!model) throw new Error(`Missing entity model minecraft:${id} for special item ${special.type}`);
|
|
5455
5544
|
return { model, transform, rotations };
|
|
5456
5545
|
};
|
|
5457
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
|
+
}
|
|
5458
5591
|
case "minecraft:chest":
|
|
5459
5592
|
case "chest": {
|
|
5460
5593
|
const angle = -(special.openness ?? 0) * Math.PI / 2;
|
|
@@ -5749,12 +5882,12 @@ var init_ModelObject = __esm({
|
|
|
5749
5882
|
this.options.tints = await ItemTints.get(this.originalModel, this.options.tints);
|
|
5750
5883
|
const special = this.originalModel.special;
|
|
5751
5884
|
if (special) {
|
|
5752
|
-
const parts2 = await SpecialItems.getParts(special, this.originalModel.key?.root);
|
|
5885
|
+
const parts2 = await SpecialItems.getParts(special, this.originalModel.key?.root, this.originalModel.components);
|
|
5753
5886
|
const transform = this.options.displayPosition ? DisplayTransforms.getMatrix(this.originalModel.display, this.options.displayPosition) : new import_three25.Matrix4();
|
|
5754
5887
|
transform.multiply(new import_three25.Matrix4().makeTranslation(-8, -8, -8));
|
|
5755
5888
|
try {
|
|
5756
5889
|
for (const part of parts2) {
|
|
5757
|
-
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 });
|
|
5758
5891
|
object3.matrix.copy(transform).multiply(part.transform);
|
|
5759
5892
|
object3.matrixWorldNeedsUpdate = true;
|
|
5760
5893
|
object3.matrixAutoUpdate = false;
|
|
@@ -6207,6 +6340,7 @@ __export(index_browser_exports, {
|
|
|
6207
6340
|
Axis: () => Axis,
|
|
6208
6341
|
BUILTIN_ENTITY: () => BUILTIN_ENTITY,
|
|
6209
6342
|
BUILTIN_GENERATED: () => BUILTIN_GENERATED,
|
|
6343
|
+
BannerPatterns: () => BannerPatterns,
|
|
6210
6344
|
BasicAssetKey: () => BasicAssetKey,
|
|
6211
6345
|
BatchedExecutor: () => BatchedExecutor,
|
|
6212
6346
|
BlockEntities: () => BlockEntities,
|
|
@@ -6231,6 +6365,7 @@ __export(index_browser_exports, {
|
|
|
6231
6365
|
DEFAULT_ROOT: () => DEFAULT_ROOT,
|
|
6232
6366
|
DEFAULT_UV: () => DEFAULT_UV,
|
|
6233
6367
|
DISPLAY_POSITIONS: () => DISPLAY_POSITIONS,
|
|
6368
|
+
DYE_COLORS: () => DYE_COLORS,
|
|
6234
6369
|
DefaultBlockStates: () => DefaultBlockStates,
|
|
6235
6370
|
DisplayPosition: () => DisplayPosition,
|
|
6236
6371
|
DisplayTransforms: () => DisplayTransforms,
|
|
@@ -6565,6 +6700,7 @@ function shutdown() {
|
|
|
6565
6700
|
init_AssetKey();
|
|
6566
6701
|
init_AssetLoader();
|
|
6567
6702
|
init_Assets();
|
|
6703
|
+
init_BannerPatterns();
|
|
6568
6704
|
|
|
6569
6705
|
// src/assets/BlockEntities.ts
|
|
6570
6706
|
var import_three10 = require("three");
|