minerender 2.1.0-alpha.67 → 2.1.0-alpha.69

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.
@@ -522,8 +522,29 @@ declare class MinecraftCubeTexture {
522
522
  }
523
523
 
524
524
  interface MinecraftTextureMeta extends MinecraftAsset {
525
- animation: AnimationMeta;
525
+ animation?: AnimationMeta;
526
+ gui?: {
527
+ scaling?: GuiSpriteScaling;
528
+ };
526
529
  }
530
+ type GuiSpriteScaling = {
531
+ type: "stretch";
532
+ } | {
533
+ type: "tile";
534
+ width: number;
535
+ height: number;
536
+ } | {
537
+ type: "nine_slice";
538
+ width: number;
539
+ height: number;
540
+ border: number | {
541
+ left: number;
542
+ top: number;
543
+ right: number;
544
+ bottom: number;
545
+ };
546
+ stretch_inner?: boolean;
547
+ };
527
548
  interface AnimationMeta {
528
549
  interpolate: boolean;
529
550
  width: number;
@@ -972,6 +993,27 @@ interface EntityModelOptions {
972
993
  textures?: Record<string, BasicAssetKey>;
973
994
  }
974
995
 
996
+ interface BitmapGlyph {
997
+ image?: CompatCanvas;
998
+ /** Source rectangle in the bitmap sheet, before applying scale. */
999
+ x: number;
1000
+ y: number;
1001
+ width: number;
1002
+ height: number;
1003
+ scale: number;
1004
+ ascent: number;
1005
+ advance: number;
1006
+ }
1007
+ interface BitmapFont {
1008
+ glyphs: Map<string, BitmapGlyph>;
1009
+ }
1010
+ declare class Fonts {
1011
+ static get(key?: AssetKey | string): Promise<BitmapFont>;
1012
+ private static relatedKey;
1013
+ private static load;
1014
+ private static bitmap;
1015
+ }
1016
+
975
1017
  declare class Models {
976
1018
  private static _persistentCache;
977
1019
  private static get PERSISTENT_CACHE();
@@ -1291,18 +1333,61 @@ interface EntityObjectOptions extends SceneObjectOptions {
1291
1333
  }
1292
1334
  declare function isEntityObject(obj: any): obj is EntityObject;
1293
1335
 
1336
+ interface GuiTextStyle {
1337
+ /** sRGB 0xRRGGBB; defaults to white. */
1338
+ color?: number;
1339
+ bold?: boolean;
1340
+ italic?: boolean;
1341
+ }
1342
+ interface GuiTextRun extends GuiTextStyle {
1343
+ text: string;
1344
+ }
1345
+ /** Literal text, or styled runs. Newlines are preserved. */
1346
+ type GuiText = string | readonly GuiTextRun[];
1347
+ interface GuiTextOptions extends GuiTextStyle {
1348
+ /** Font resource ID; defaults to minecraft:default. */
1349
+ font?: AssetKey | string;
1350
+ /** Draws a one-pixel shadow; defaults to true. */
1351
+ shadow?: boolean;
1352
+ /** Wrap width in GUI pixels. Long words break at glyph boundaries. */
1353
+ maxWidth?: number;
1354
+ /** Distance between line origins; defaults to 9 GUI pixels. */
1355
+ lineHeight?: number;
1356
+ }
1357
+ interface PositionedGuiGlyph {
1358
+ character: string;
1359
+ glyph?: BitmapGlyph;
1360
+ x: number;
1361
+ y: number;
1362
+ advance: number;
1363
+ style: Required<GuiTextStyle>;
1364
+ }
1365
+ interface GuiTextLayout {
1366
+ glyphs: PositionedGuiGlyph[];
1367
+ lineWidths: number[];
1368
+ width: number;
1369
+ height: number;
1370
+ }
1371
+ /** Measures and wraps text using the same glyph advances used for rendering. */
1372
+ declare function layoutGuiText(text: GuiText, options?: GuiTextOptions): Promise<GuiTextLayout>;
1373
+ /** Creates glyph batches in painter order. Unsupported characters use an outlined missing glyph. */
1374
+ declare function createGuiTextGeometry(layout: GuiTextLayout, shadow?: boolean): {
1375
+ image?: CompatCanvas;
1376
+ geometry: BufferGeometry;
1377
+ }[];
1378
+
1294
1379
  /** GUI layers use pixel coordinates. Later layers draw above earlier layers. */
1295
- type GuiLayer = GuiTextureLayer | GuiItemLayer;
1380
+ type GuiLayer = GuiTextureLayer | GuiItemLayer | GuiTextLayer;
1296
1381
  interface GuiLayerLayout {
1297
1382
  name?: string;
1298
1383
  /** Top-left position; x grows right and y grows down. Defaults to [0, 0]. */
1299
1384
  position?: [number, number];
1300
- /** Output width and height; defaults to the texture crop size or [16, 16] for items. */
1385
+ /** Output size; defaults to native texture/text dimensions, and [16, 16] for items. */
1301
1386
  size?: [number, number];
1302
1387
  }
1303
1388
  interface GuiTextureLayer extends GuiLayerLayout {
1304
1389
  texture: AssetKey | string;
1305
- /** Source-image pixels: [x, y, width, height], measured from the top left. */
1390
+ /** Source-image pixels: [x, y, width, height], measured from the top left. Crops ignore sprite scaling. */
1306
1391
  crop?: [number, number, number, number];
1307
1392
  }
1308
1393
  interface GuiItemLayer extends GuiLayerLayout {
@@ -1311,6 +1396,9 @@ interface GuiItemLayer extends GuiLayerLayout {
1311
1396
  /** sRGB 0xRRGGBB colors by face tint index; omitted indices stay white. */
1312
1397
  tints?: Record<number, number>;
1313
1398
  }
1399
+ interface GuiTextLayer extends GuiLayerLayout, GuiTextOptions {
1400
+ text: GuiText;
1401
+ }
1314
1402
 
1315
1403
  declare class GuiObject extends SceneObject {
1316
1404
  readonly textureLayers: readonly GuiLayer[];
@@ -1319,6 +1407,7 @@ declare class GuiObject extends SceneObject {
1319
1407
  readonly bounds: Box2;
1320
1408
  private readonly geometries;
1321
1409
  private readonly ownedMaterials;
1410
+ private readonly textMaterials;
1322
1411
  private initialized;
1323
1412
  constructor(textureLayers: readonly GuiLayer[], options?: Partial<GuiObjectOptions>);
1324
1413
  init(): Promise<void>;
@@ -1814,6 +1903,7 @@ declare class Caching {
1814
1903
  static readonly entityTextureCache: AsyncLoadingCache<CacheKey, AssetKey>;
1815
1904
  static readonly entityAnimationCache: AsyncLoadingCache<CacheKey, EntityAnimationFile>;
1816
1905
  static readonly blockEntityIndexCache: AsyncLoadingCache<CacheKey, BlockEntityIndex>;
1906
+ static readonly fontCache: AsyncLoadingCache<CacheKey, BitmapFont>;
1817
1907
  private static createAssetCache;
1818
1908
  /** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
1819
1909
  private static get all();
@@ -1856,10 +1946,18 @@ declare class SceneExporter {
1856
1946
  }
1857
1947
 
1858
1948
  declare class GuiHelper {
1949
+ /** Sizes a tooltip around supplied text; the first entry is its title. */
1950
+ static tooltip(lines: readonly GuiText[], options?: GuiTooltipOptions): Promise<GuiLayer[]>;
1859
1951
  static inventorySlot(slot: number | [number, number], origin?: [number, number], offset?: [number, number], rowSize?: number): [number, number];
1860
1952
  /** Creates crafting-table layers for ingredients and the result; stack counts are not drawn. */
1861
1953
  static recipe(recipe: GuiRecipe, options?: GuiRecipeOptions): GuiLayer[];
1862
1954
  }
1955
+ interface GuiTooltipOptions extends GuiTextOptions {
1956
+ /** Top-left text position, inside the tooltip's padding. */
1957
+ position?: [number, number];
1958
+ /** Extra space after the title, in pixels. Defaults to 2. */
1959
+ titleGap?: number;
1960
+ }
1863
1961
  type GuiRecipeIngredientValue = string | {
1864
1962
  item: string;
1865
1963
  } | {
@@ -1887,6 +1985,9 @@ interface GuiRecipeOptions {
1887
1985
  resolveIngredient?: (ingredient: GuiRecipeIngredient) => string | AssetKey;
1888
1986
  }
1889
1987
 
1988
+ /** Builds one centered mesh; explicit source-pixel crops always stretch. */
1989
+ declare function createGuiTextureGeometry(width: number, height: number, imageWidth: number, imageHeight: number, crop?: [number, number, number, number], scaling?: GuiSpriteScaling): BufferGeometry;
1990
+
1890
1991
  declare class OrbitControls {
1891
1992
  constructor(object: Camera, domElement?: HTMLElement);
1892
1993
 
@@ -2428,4 +2529,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
2428
2529
  forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
2429
2530
  }
2430
2531
 
2431
- export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, AnvilParser, type AnvilRegion, ArchiveAssetSource, 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 Block, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, type FrameCallback, type FromTo, Geometries, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiTextureLayer, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, NodeCache, NodeEnv, OrbitControls, PersistentCache, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererFrame, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResponseParser, SKIN_PARTS, SceneExporter, type SceneGLTFExportOptions, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, 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, 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, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, registerNodeEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
2532
+ export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, AnvilParser, type AnvilRegion, ArchiveAssetSource, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type BitmapFont, type BitmapGlyph, type Block, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, Fonts, type FrameCallback, type FromTo, Geometries, 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 ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, NodeCache, NodeEnv, OrbitControls, 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, SceneExporter, type SceneGLTFExportOptions, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, 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, prefix, registerNodeEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
@@ -522,8 +522,29 @@ declare class MinecraftCubeTexture {
522
522
  }
523
523
 
524
524
  interface MinecraftTextureMeta extends MinecraftAsset {
525
- animation: AnimationMeta;
525
+ animation?: AnimationMeta;
526
+ gui?: {
527
+ scaling?: GuiSpriteScaling;
528
+ };
526
529
  }
530
+ type GuiSpriteScaling = {
531
+ type: "stretch";
532
+ } | {
533
+ type: "tile";
534
+ width: number;
535
+ height: number;
536
+ } | {
537
+ type: "nine_slice";
538
+ width: number;
539
+ height: number;
540
+ border: number | {
541
+ left: number;
542
+ top: number;
543
+ right: number;
544
+ bottom: number;
545
+ };
546
+ stretch_inner?: boolean;
547
+ };
527
548
  interface AnimationMeta {
528
549
  interpolate: boolean;
529
550
  width: number;
@@ -972,6 +993,27 @@ interface EntityModelOptions {
972
993
  textures?: Record<string, BasicAssetKey>;
973
994
  }
974
995
 
996
+ interface BitmapGlyph {
997
+ image?: CompatCanvas;
998
+ /** Source rectangle in the bitmap sheet, before applying scale. */
999
+ x: number;
1000
+ y: number;
1001
+ width: number;
1002
+ height: number;
1003
+ scale: number;
1004
+ ascent: number;
1005
+ advance: number;
1006
+ }
1007
+ interface BitmapFont {
1008
+ glyphs: Map<string, BitmapGlyph>;
1009
+ }
1010
+ declare class Fonts {
1011
+ static get(key?: AssetKey | string): Promise<BitmapFont>;
1012
+ private static relatedKey;
1013
+ private static load;
1014
+ private static bitmap;
1015
+ }
1016
+
975
1017
  declare class Models {
976
1018
  private static _persistentCache;
977
1019
  private static get PERSISTENT_CACHE();
@@ -1291,18 +1333,61 @@ interface EntityObjectOptions extends SceneObjectOptions {
1291
1333
  }
1292
1334
  declare function isEntityObject(obj: any): obj is EntityObject;
1293
1335
 
1336
+ interface GuiTextStyle {
1337
+ /** sRGB 0xRRGGBB; defaults to white. */
1338
+ color?: number;
1339
+ bold?: boolean;
1340
+ italic?: boolean;
1341
+ }
1342
+ interface GuiTextRun extends GuiTextStyle {
1343
+ text: string;
1344
+ }
1345
+ /** Literal text, or styled runs. Newlines are preserved. */
1346
+ type GuiText = string | readonly GuiTextRun[];
1347
+ interface GuiTextOptions extends GuiTextStyle {
1348
+ /** Font resource ID; defaults to minecraft:default. */
1349
+ font?: AssetKey | string;
1350
+ /** Draws a one-pixel shadow; defaults to true. */
1351
+ shadow?: boolean;
1352
+ /** Wrap width in GUI pixels. Long words break at glyph boundaries. */
1353
+ maxWidth?: number;
1354
+ /** Distance between line origins; defaults to 9 GUI pixels. */
1355
+ lineHeight?: number;
1356
+ }
1357
+ interface PositionedGuiGlyph {
1358
+ character: string;
1359
+ glyph?: BitmapGlyph;
1360
+ x: number;
1361
+ y: number;
1362
+ advance: number;
1363
+ style: Required<GuiTextStyle>;
1364
+ }
1365
+ interface GuiTextLayout {
1366
+ glyphs: PositionedGuiGlyph[];
1367
+ lineWidths: number[];
1368
+ width: number;
1369
+ height: number;
1370
+ }
1371
+ /** Measures and wraps text using the same glyph advances used for rendering. */
1372
+ declare function layoutGuiText(text: GuiText, options?: GuiTextOptions): Promise<GuiTextLayout>;
1373
+ /** Creates glyph batches in painter order. Unsupported characters use an outlined missing glyph. */
1374
+ declare function createGuiTextGeometry(layout: GuiTextLayout, shadow?: boolean): {
1375
+ image?: CompatCanvas;
1376
+ geometry: BufferGeometry;
1377
+ }[];
1378
+
1294
1379
  /** GUI layers use pixel coordinates. Later layers draw above earlier layers. */
1295
- type GuiLayer = GuiTextureLayer | GuiItemLayer;
1380
+ type GuiLayer = GuiTextureLayer | GuiItemLayer | GuiTextLayer;
1296
1381
  interface GuiLayerLayout {
1297
1382
  name?: string;
1298
1383
  /** Top-left position; x grows right and y grows down. Defaults to [0, 0]. */
1299
1384
  position?: [number, number];
1300
- /** Output width and height; defaults to the texture crop size or [16, 16] for items. */
1385
+ /** Output size; defaults to native texture/text dimensions, and [16, 16] for items. */
1301
1386
  size?: [number, number];
1302
1387
  }
1303
1388
  interface GuiTextureLayer extends GuiLayerLayout {
1304
1389
  texture: AssetKey | string;
1305
- /** Source-image pixels: [x, y, width, height], measured from the top left. */
1390
+ /** Source-image pixels: [x, y, width, height], measured from the top left. Crops ignore sprite scaling. */
1306
1391
  crop?: [number, number, number, number];
1307
1392
  }
1308
1393
  interface GuiItemLayer extends GuiLayerLayout {
@@ -1311,6 +1396,9 @@ interface GuiItemLayer extends GuiLayerLayout {
1311
1396
  /** sRGB 0xRRGGBB colors by face tint index; omitted indices stay white. */
1312
1397
  tints?: Record<number, number>;
1313
1398
  }
1399
+ interface GuiTextLayer extends GuiLayerLayout, GuiTextOptions {
1400
+ text: GuiText;
1401
+ }
1314
1402
 
1315
1403
  declare class GuiObject extends SceneObject {
1316
1404
  readonly textureLayers: readonly GuiLayer[];
@@ -1319,6 +1407,7 @@ declare class GuiObject extends SceneObject {
1319
1407
  readonly bounds: Box2;
1320
1408
  private readonly geometries;
1321
1409
  private readonly ownedMaterials;
1410
+ private readonly textMaterials;
1322
1411
  private initialized;
1323
1412
  constructor(textureLayers: readonly GuiLayer[], options?: Partial<GuiObjectOptions>);
1324
1413
  init(): Promise<void>;
@@ -1814,6 +1903,7 @@ declare class Caching {
1814
1903
  static readonly entityTextureCache: AsyncLoadingCache<CacheKey, AssetKey>;
1815
1904
  static readonly entityAnimationCache: AsyncLoadingCache<CacheKey, EntityAnimationFile>;
1816
1905
  static readonly blockEntityIndexCache: AsyncLoadingCache<CacheKey, BlockEntityIndex>;
1906
+ static readonly fontCache: AsyncLoadingCache<CacheKey, BitmapFont>;
1817
1907
  private static createAssetCache;
1818
1908
  /** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
1819
1909
  private static get all();
@@ -1856,10 +1946,18 @@ declare class SceneExporter {
1856
1946
  }
1857
1947
 
1858
1948
  declare class GuiHelper {
1949
+ /** Sizes a tooltip around supplied text; the first entry is its title. */
1950
+ static tooltip(lines: readonly GuiText[], options?: GuiTooltipOptions): Promise<GuiLayer[]>;
1859
1951
  static inventorySlot(slot: number | [number, number], origin?: [number, number], offset?: [number, number], rowSize?: number): [number, number];
1860
1952
  /** Creates crafting-table layers for ingredients and the result; stack counts are not drawn. */
1861
1953
  static recipe(recipe: GuiRecipe, options?: GuiRecipeOptions): GuiLayer[];
1862
1954
  }
1955
+ interface GuiTooltipOptions extends GuiTextOptions {
1956
+ /** Top-left text position, inside the tooltip's padding. */
1957
+ position?: [number, number];
1958
+ /** Extra space after the title, in pixels. Defaults to 2. */
1959
+ titleGap?: number;
1960
+ }
1863
1961
  type GuiRecipeIngredientValue = string | {
1864
1962
  item: string;
1865
1963
  } | {
@@ -1887,6 +1985,9 @@ interface GuiRecipeOptions {
1887
1985
  resolveIngredient?: (ingredient: GuiRecipeIngredient) => string | AssetKey;
1888
1986
  }
1889
1987
 
1988
+ /** Builds one centered mesh; explicit source-pixel crops always stretch. */
1989
+ declare function createGuiTextureGeometry(width: number, height: number, imageWidth: number, imageHeight: number, crop?: [number, number, number, number], scaling?: GuiSpriteScaling): BufferGeometry;
1990
+
1890
1991
  declare class OrbitControls {
1891
1992
  constructor(object: Camera, domElement?: HTMLElement);
1892
1993
 
@@ -2428,4 +2529,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
2428
2529
  forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
2429
2530
  }
2430
2531
 
2431
- export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, AnvilParser, type AnvilRegion, ArchiveAssetSource, 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 Block, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, type FrameCallback, type FromTo, Geometries, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiTextureLayer, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, NodeCache, NodeEnv, OrbitControls, PersistentCache, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererFrame, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResponseParser, SKIN_PARTS, SceneExporter, type SceneGLTFExportOptions, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, 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, 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, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, registerNodeEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
2532
+ export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, AnvilParser, type AnvilRegion, ArchiveAssetSource, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type BitmapFont, type BitmapGlyph, type Block, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, Fonts, type FrameCallback, type FromTo, Geometries, 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 ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, NodeCache, NodeEnv, OrbitControls, 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, SceneExporter, type SceneGLTFExportOptions, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, 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, prefix, registerNodeEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };