minerender 2.1.0-alpha.68 → 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.
- package/dist/browser/index.d.mts +80 -3
- package/dist/browser/index.d.ts +80 -3
- package/dist/browser/index.js +440 -171
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +298 -29
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +277 -2
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +80 -3
- package/dist/node/index.d.ts +80 -3
- package/dist/node/index.js +445 -171
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +300 -29
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.d.mts
CHANGED
|
@@ -993,6 +993,27 @@ interface EntityModelOptions {
|
|
|
993
993
|
textures?: Record<string, BasicAssetKey>;
|
|
994
994
|
}
|
|
995
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
|
+
|
|
996
1017
|
declare class Models {
|
|
997
1018
|
private static _persistentCache;
|
|
998
1019
|
private static get PERSISTENT_CACHE();
|
|
@@ -1312,13 +1333,56 @@ interface EntityObjectOptions extends SceneObjectOptions {
|
|
|
1312
1333
|
}
|
|
1313
1334
|
declare function isEntityObject(obj: any): obj is EntityObject;
|
|
1314
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
|
+
|
|
1315
1379
|
/** GUI layers use pixel coordinates. Later layers draw above earlier layers. */
|
|
1316
|
-
type GuiLayer = GuiTextureLayer | GuiItemLayer;
|
|
1380
|
+
type GuiLayer = GuiTextureLayer | GuiItemLayer | GuiTextLayer;
|
|
1317
1381
|
interface GuiLayerLayout {
|
|
1318
1382
|
name?: string;
|
|
1319
1383
|
/** Top-left position; x grows right and y grows down. Defaults to [0, 0]. */
|
|
1320
1384
|
position?: [number, number];
|
|
1321
|
-
/** Output size; defaults to
|
|
1385
|
+
/** Output size; defaults to native texture/text dimensions, and [16, 16] for items. */
|
|
1322
1386
|
size?: [number, number];
|
|
1323
1387
|
}
|
|
1324
1388
|
interface GuiTextureLayer extends GuiLayerLayout {
|
|
@@ -1332,6 +1396,9 @@ interface GuiItemLayer extends GuiLayerLayout {
|
|
|
1332
1396
|
/** sRGB 0xRRGGBB colors by face tint index; omitted indices stay white. */
|
|
1333
1397
|
tints?: Record<number, number>;
|
|
1334
1398
|
}
|
|
1399
|
+
interface GuiTextLayer extends GuiLayerLayout, GuiTextOptions {
|
|
1400
|
+
text: GuiText;
|
|
1401
|
+
}
|
|
1335
1402
|
|
|
1336
1403
|
declare class GuiObject extends SceneObject {
|
|
1337
1404
|
readonly textureLayers: readonly GuiLayer[];
|
|
@@ -1340,6 +1407,7 @@ declare class GuiObject extends SceneObject {
|
|
|
1340
1407
|
readonly bounds: Box2;
|
|
1341
1408
|
private readonly geometries;
|
|
1342
1409
|
private readonly ownedMaterials;
|
|
1410
|
+
private readonly textMaterials;
|
|
1343
1411
|
private initialized;
|
|
1344
1412
|
constructor(textureLayers: readonly GuiLayer[], options?: Partial<GuiObjectOptions>);
|
|
1345
1413
|
init(): Promise<void>;
|
|
@@ -1835,6 +1903,7 @@ declare class Caching {
|
|
|
1835
1903
|
static readonly entityTextureCache: AsyncLoadingCache<CacheKey, AssetKey>;
|
|
1836
1904
|
static readonly entityAnimationCache: AsyncLoadingCache<CacheKey, EntityAnimationFile>;
|
|
1837
1905
|
static readonly blockEntityIndexCache: AsyncLoadingCache<CacheKey, BlockEntityIndex>;
|
|
1906
|
+
static readonly fontCache: AsyncLoadingCache<CacheKey, BitmapFont>;
|
|
1838
1907
|
private static createAssetCache;
|
|
1839
1908
|
/** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
|
|
1840
1909
|
private static get all();
|
|
@@ -1877,10 +1946,18 @@ declare class SceneExporter {
|
|
|
1877
1946
|
}
|
|
1878
1947
|
|
|
1879
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[]>;
|
|
1880
1951
|
static inventorySlot(slot: number | [number, number], origin?: [number, number], offset?: [number, number], rowSize?: number): [number, number];
|
|
1881
1952
|
/** Creates crafting-table layers for ingredients and the result; stack counts are not drawn. */
|
|
1882
1953
|
static recipe(recipe: GuiRecipe, options?: GuiRecipeOptions): GuiLayer[];
|
|
1883
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
|
+
}
|
|
1884
1961
|
type GuiRecipeIngredientValue = string | {
|
|
1885
1962
|
item: string;
|
|
1886
1963
|
} | {
|
|
@@ -2452,4 +2529,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
|
|
|
2452
2529
|
forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
|
|
2453
2530
|
}
|
|
2454
2531
|
|
|
2455
|
-
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 GuiSpriteScaling, 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, 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, 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 };
|
package/dist/node/index.d.ts
CHANGED
|
@@ -993,6 +993,27 @@ interface EntityModelOptions {
|
|
|
993
993
|
textures?: Record<string, BasicAssetKey>;
|
|
994
994
|
}
|
|
995
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
|
+
|
|
996
1017
|
declare class Models {
|
|
997
1018
|
private static _persistentCache;
|
|
998
1019
|
private static get PERSISTENT_CACHE();
|
|
@@ -1312,13 +1333,56 @@ interface EntityObjectOptions extends SceneObjectOptions {
|
|
|
1312
1333
|
}
|
|
1313
1334
|
declare function isEntityObject(obj: any): obj is EntityObject;
|
|
1314
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
|
+
|
|
1315
1379
|
/** GUI layers use pixel coordinates. Later layers draw above earlier layers. */
|
|
1316
|
-
type GuiLayer = GuiTextureLayer | GuiItemLayer;
|
|
1380
|
+
type GuiLayer = GuiTextureLayer | GuiItemLayer | GuiTextLayer;
|
|
1317
1381
|
interface GuiLayerLayout {
|
|
1318
1382
|
name?: string;
|
|
1319
1383
|
/** Top-left position; x grows right and y grows down. Defaults to [0, 0]. */
|
|
1320
1384
|
position?: [number, number];
|
|
1321
|
-
/** Output size; defaults to
|
|
1385
|
+
/** Output size; defaults to native texture/text dimensions, and [16, 16] for items. */
|
|
1322
1386
|
size?: [number, number];
|
|
1323
1387
|
}
|
|
1324
1388
|
interface GuiTextureLayer extends GuiLayerLayout {
|
|
@@ -1332,6 +1396,9 @@ interface GuiItemLayer extends GuiLayerLayout {
|
|
|
1332
1396
|
/** sRGB 0xRRGGBB colors by face tint index; omitted indices stay white. */
|
|
1333
1397
|
tints?: Record<number, number>;
|
|
1334
1398
|
}
|
|
1399
|
+
interface GuiTextLayer extends GuiLayerLayout, GuiTextOptions {
|
|
1400
|
+
text: GuiText;
|
|
1401
|
+
}
|
|
1335
1402
|
|
|
1336
1403
|
declare class GuiObject extends SceneObject {
|
|
1337
1404
|
readonly textureLayers: readonly GuiLayer[];
|
|
@@ -1340,6 +1407,7 @@ declare class GuiObject extends SceneObject {
|
|
|
1340
1407
|
readonly bounds: Box2;
|
|
1341
1408
|
private readonly geometries;
|
|
1342
1409
|
private readonly ownedMaterials;
|
|
1410
|
+
private readonly textMaterials;
|
|
1343
1411
|
private initialized;
|
|
1344
1412
|
constructor(textureLayers: readonly GuiLayer[], options?: Partial<GuiObjectOptions>);
|
|
1345
1413
|
init(): Promise<void>;
|
|
@@ -1835,6 +1903,7 @@ declare class Caching {
|
|
|
1835
1903
|
static readonly entityTextureCache: AsyncLoadingCache<CacheKey, AssetKey>;
|
|
1836
1904
|
static readonly entityAnimationCache: AsyncLoadingCache<CacheKey, EntityAnimationFile>;
|
|
1837
1905
|
static readonly blockEntityIndexCache: AsyncLoadingCache<CacheKey, BlockEntityIndex>;
|
|
1906
|
+
static readonly fontCache: AsyncLoadingCache<CacheKey, BitmapFont>;
|
|
1838
1907
|
private static createAssetCache;
|
|
1839
1908
|
/** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
|
|
1840
1909
|
private static get all();
|
|
@@ -1877,10 +1946,18 @@ declare class SceneExporter {
|
|
|
1877
1946
|
}
|
|
1878
1947
|
|
|
1879
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[]>;
|
|
1880
1951
|
static inventorySlot(slot: number | [number, number], origin?: [number, number], offset?: [number, number], rowSize?: number): [number, number];
|
|
1881
1952
|
/** Creates crafting-table layers for ingredients and the result; stack counts are not drawn. */
|
|
1882
1953
|
static recipe(recipe: GuiRecipe, options?: GuiRecipeOptions): GuiLayer[];
|
|
1883
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
|
+
}
|
|
1884
1961
|
type GuiRecipeIngredientValue = string | {
|
|
1885
1962
|
item: string;
|
|
1886
1963
|
} | {
|
|
@@ -2452,4 +2529,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
|
|
|
2452
2529
|
forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
|
|
2453
2530
|
}
|
|
2454
2531
|
|
|
2455
|
-
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 GuiSpriteScaling, 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, 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, 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 };
|