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.
- package/dist/browser/index.d.mts +106 -5
- package/dist/browser/index.d.ts +106 -5
- package/dist/browser/index.js +520 -179
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +379 -38
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +363 -13
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +106 -5
- package/dist/node/index.d.ts +106 -5
- package/dist/node/index.js +526 -179
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +381 -38
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.d.mts
CHANGED
|
@@ -521,8 +521,29 @@ declare class MinecraftCubeTexture {
|
|
|
521
521
|
}
|
|
522
522
|
|
|
523
523
|
interface MinecraftTextureMeta extends MinecraftAsset {
|
|
524
|
-
animation
|
|
524
|
+
animation?: AnimationMeta;
|
|
525
|
+
gui?: {
|
|
526
|
+
scaling?: GuiSpriteScaling;
|
|
527
|
+
};
|
|
525
528
|
}
|
|
529
|
+
type GuiSpriteScaling = {
|
|
530
|
+
type: "stretch";
|
|
531
|
+
} | {
|
|
532
|
+
type: "tile";
|
|
533
|
+
width: number;
|
|
534
|
+
height: number;
|
|
535
|
+
} | {
|
|
536
|
+
type: "nine_slice";
|
|
537
|
+
width: number;
|
|
538
|
+
height: number;
|
|
539
|
+
border: number | {
|
|
540
|
+
left: number;
|
|
541
|
+
top: number;
|
|
542
|
+
right: number;
|
|
543
|
+
bottom: number;
|
|
544
|
+
};
|
|
545
|
+
stretch_inner?: boolean;
|
|
546
|
+
};
|
|
526
547
|
interface AnimationMeta {
|
|
527
548
|
interpolate: boolean;
|
|
528
549
|
width: number;
|
|
@@ -971,6 +992,27 @@ interface EntityModelOptions {
|
|
|
971
992
|
textures?: Record<string, BasicAssetKey>;
|
|
972
993
|
}
|
|
973
994
|
|
|
995
|
+
interface BitmapGlyph {
|
|
996
|
+
image?: CompatCanvas;
|
|
997
|
+
/** Source rectangle in the bitmap sheet, before applying scale. */
|
|
998
|
+
x: number;
|
|
999
|
+
y: number;
|
|
1000
|
+
width: number;
|
|
1001
|
+
height: number;
|
|
1002
|
+
scale: number;
|
|
1003
|
+
ascent: number;
|
|
1004
|
+
advance: number;
|
|
1005
|
+
}
|
|
1006
|
+
interface BitmapFont {
|
|
1007
|
+
glyphs: Map<string, BitmapGlyph>;
|
|
1008
|
+
}
|
|
1009
|
+
declare class Fonts {
|
|
1010
|
+
static get(key?: AssetKey | string): Promise<BitmapFont>;
|
|
1011
|
+
private static relatedKey;
|
|
1012
|
+
private static load;
|
|
1013
|
+
private static bitmap;
|
|
1014
|
+
}
|
|
1015
|
+
|
|
974
1016
|
declare class Models {
|
|
975
1017
|
private static _persistentCache;
|
|
976
1018
|
private static get PERSISTENT_CACHE();
|
|
@@ -1290,18 +1332,61 @@ interface EntityObjectOptions extends SceneObjectOptions {
|
|
|
1290
1332
|
}
|
|
1291
1333
|
declare function isEntityObject(obj: any): obj is EntityObject;
|
|
1292
1334
|
|
|
1335
|
+
interface GuiTextStyle {
|
|
1336
|
+
/** sRGB 0xRRGGBB; defaults to white. */
|
|
1337
|
+
color?: number;
|
|
1338
|
+
bold?: boolean;
|
|
1339
|
+
italic?: boolean;
|
|
1340
|
+
}
|
|
1341
|
+
interface GuiTextRun extends GuiTextStyle {
|
|
1342
|
+
text: string;
|
|
1343
|
+
}
|
|
1344
|
+
/** Literal text, or styled runs. Newlines are preserved. */
|
|
1345
|
+
type GuiText = string | readonly GuiTextRun[];
|
|
1346
|
+
interface GuiTextOptions extends GuiTextStyle {
|
|
1347
|
+
/** Font resource ID; defaults to minecraft:default. */
|
|
1348
|
+
font?: AssetKey | string;
|
|
1349
|
+
/** Draws a one-pixel shadow; defaults to true. */
|
|
1350
|
+
shadow?: boolean;
|
|
1351
|
+
/** Wrap width in GUI pixels. Long words break at glyph boundaries. */
|
|
1352
|
+
maxWidth?: number;
|
|
1353
|
+
/** Distance between line origins; defaults to 9 GUI pixels. */
|
|
1354
|
+
lineHeight?: number;
|
|
1355
|
+
}
|
|
1356
|
+
interface PositionedGuiGlyph {
|
|
1357
|
+
character: string;
|
|
1358
|
+
glyph?: BitmapGlyph;
|
|
1359
|
+
x: number;
|
|
1360
|
+
y: number;
|
|
1361
|
+
advance: number;
|
|
1362
|
+
style: Required<GuiTextStyle>;
|
|
1363
|
+
}
|
|
1364
|
+
interface GuiTextLayout {
|
|
1365
|
+
glyphs: PositionedGuiGlyph[];
|
|
1366
|
+
lineWidths: number[];
|
|
1367
|
+
width: number;
|
|
1368
|
+
height: number;
|
|
1369
|
+
}
|
|
1370
|
+
/** Measures and wraps text using the same glyph advances used for rendering. */
|
|
1371
|
+
declare function layoutGuiText(text: GuiText, options?: GuiTextOptions): Promise<GuiTextLayout>;
|
|
1372
|
+
/** Creates glyph batches in painter order. Unsupported characters use an outlined missing glyph. */
|
|
1373
|
+
declare function createGuiTextGeometry(layout: GuiTextLayout, shadow?: boolean): {
|
|
1374
|
+
image?: CompatCanvas;
|
|
1375
|
+
geometry: BufferGeometry;
|
|
1376
|
+
}[];
|
|
1377
|
+
|
|
1293
1378
|
/** GUI layers use pixel coordinates. Later layers draw above earlier layers. */
|
|
1294
|
-
type GuiLayer = GuiTextureLayer | GuiItemLayer;
|
|
1379
|
+
type GuiLayer = GuiTextureLayer | GuiItemLayer | GuiTextLayer;
|
|
1295
1380
|
interface GuiLayerLayout {
|
|
1296
1381
|
name?: string;
|
|
1297
1382
|
/** Top-left position; x grows right and y grows down. Defaults to [0, 0]. */
|
|
1298
1383
|
position?: [number, number];
|
|
1299
|
-
/** Output
|
|
1384
|
+
/** Output size; defaults to native texture/text dimensions, and [16, 16] for items. */
|
|
1300
1385
|
size?: [number, number];
|
|
1301
1386
|
}
|
|
1302
1387
|
interface GuiTextureLayer extends GuiLayerLayout {
|
|
1303
1388
|
texture: AssetKey | string;
|
|
1304
|
-
/** Source-image pixels: [x, y, width, height], measured from the top left. */
|
|
1389
|
+
/** Source-image pixels: [x, y, width, height], measured from the top left. Crops ignore sprite scaling. */
|
|
1305
1390
|
crop?: [number, number, number, number];
|
|
1306
1391
|
}
|
|
1307
1392
|
interface GuiItemLayer extends GuiLayerLayout {
|
|
@@ -1310,6 +1395,9 @@ interface GuiItemLayer extends GuiLayerLayout {
|
|
|
1310
1395
|
/** sRGB 0xRRGGBB colors by face tint index; omitted indices stay white. */
|
|
1311
1396
|
tints?: Record<number, number>;
|
|
1312
1397
|
}
|
|
1398
|
+
interface GuiTextLayer extends GuiLayerLayout, GuiTextOptions {
|
|
1399
|
+
text: GuiText;
|
|
1400
|
+
}
|
|
1313
1401
|
|
|
1314
1402
|
declare class GuiObject extends SceneObject {
|
|
1315
1403
|
readonly textureLayers: readonly GuiLayer[];
|
|
@@ -1318,6 +1406,7 @@ declare class GuiObject extends SceneObject {
|
|
|
1318
1406
|
readonly bounds: Box2;
|
|
1319
1407
|
private readonly geometries;
|
|
1320
1408
|
private readonly ownedMaterials;
|
|
1409
|
+
private readonly textMaterials;
|
|
1321
1410
|
private initialized;
|
|
1322
1411
|
constructor(textureLayers: readonly GuiLayer[], options?: Partial<GuiObjectOptions>);
|
|
1323
1412
|
init(): Promise<void>;
|
|
@@ -1813,6 +1902,7 @@ declare class Caching {
|
|
|
1813
1902
|
static readonly entityTextureCache: AsyncLoadingCache<CacheKey, AssetKey>;
|
|
1814
1903
|
static readonly entityAnimationCache: AsyncLoadingCache<CacheKey, EntityAnimationFile>;
|
|
1815
1904
|
static readonly blockEntityIndexCache: AsyncLoadingCache<CacheKey, BlockEntityIndex>;
|
|
1905
|
+
static readonly fontCache: AsyncLoadingCache<CacheKey, BitmapFont>;
|
|
1816
1906
|
private static createAssetCache;
|
|
1817
1907
|
/** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
|
|
1818
1908
|
private static get all();
|
|
@@ -1855,10 +1945,18 @@ declare class SceneExporter {
|
|
|
1855
1945
|
}
|
|
1856
1946
|
|
|
1857
1947
|
declare class GuiHelper {
|
|
1948
|
+
/** Sizes a tooltip around supplied text; the first entry is its title. */
|
|
1949
|
+
static tooltip(lines: readonly GuiText[], options?: GuiTooltipOptions): Promise<GuiLayer[]>;
|
|
1858
1950
|
static inventorySlot(slot: number | [number, number], origin?: [number, number], offset?: [number, number], rowSize?: number): [number, number];
|
|
1859
1951
|
/** Creates crafting-table layers for ingredients and the result; stack counts are not drawn. */
|
|
1860
1952
|
static recipe(recipe: GuiRecipe, options?: GuiRecipeOptions): GuiLayer[];
|
|
1861
1953
|
}
|
|
1954
|
+
interface GuiTooltipOptions extends GuiTextOptions {
|
|
1955
|
+
/** Top-left text position, inside the tooltip's padding. */
|
|
1956
|
+
position?: [number, number];
|
|
1957
|
+
/** Extra space after the title, in pixels. Defaults to 2. */
|
|
1958
|
+
titleGap?: number;
|
|
1959
|
+
}
|
|
1862
1960
|
type GuiRecipeIngredientValue = string | {
|
|
1863
1961
|
item: string;
|
|
1864
1962
|
} | {
|
|
@@ -1886,6 +1984,9 @@ interface GuiRecipeOptions {
|
|
|
1886
1984
|
resolveIngredient?: (ingredient: GuiRecipeIngredient) => string | AssetKey;
|
|
1887
1985
|
}
|
|
1888
1986
|
|
|
1987
|
+
/** Builds one centered mesh; explicit source-pixel crops always stretch. */
|
|
1988
|
+
declare function createGuiTextureGeometry(width: number, height: number, imageWidth: number, imageHeight: number, crop?: [number, number, number, number], scaling?: GuiSpriteScaling): BufferGeometry;
|
|
1989
|
+
|
|
1889
1990
|
declare class OrbitControls {
|
|
1890
1991
|
constructor(object: Camera, domElement?: HTMLElement);
|
|
1891
1992
|
|
|
@@ -2425,4 +2526,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
|
|
|
2425
2526
|
*/
|
|
2426
2527
|
declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
|
|
2427
2528
|
|
|
2428
|
-
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, 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, 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, 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, probeImageSize, registerBrowserEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
|
|
2529
|
+
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, 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, 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, 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, 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
|
@@ -521,8 +521,29 @@ declare class MinecraftCubeTexture {
|
|
|
521
521
|
}
|
|
522
522
|
|
|
523
523
|
interface MinecraftTextureMeta extends MinecraftAsset {
|
|
524
|
-
animation
|
|
524
|
+
animation?: AnimationMeta;
|
|
525
|
+
gui?: {
|
|
526
|
+
scaling?: GuiSpriteScaling;
|
|
527
|
+
};
|
|
525
528
|
}
|
|
529
|
+
type GuiSpriteScaling = {
|
|
530
|
+
type: "stretch";
|
|
531
|
+
} | {
|
|
532
|
+
type: "tile";
|
|
533
|
+
width: number;
|
|
534
|
+
height: number;
|
|
535
|
+
} | {
|
|
536
|
+
type: "nine_slice";
|
|
537
|
+
width: number;
|
|
538
|
+
height: number;
|
|
539
|
+
border: number | {
|
|
540
|
+
left: number;
|
|
541
|
+
top: number;
|
|
542
|
+
right: number;
|
|
543
|
+
bottom: number;
|
|
544
|
+
};
|
|
545
|
+
stretch_inner?: boolean;
|
|
546
|
+
};
|
|
526
547
|
interface AnimationMeta {
|
|
527
548
|
interpolate: boolean;
|
|
528
549
|
width: number;
|
|
@@ -971,6 +992,27 @@ interface EntityModelOptions {
|
|
|
971
992
|
textures?: Record<string, BasicAssetKey>;
|
|
972
993
|
}
|
|
973
994
|
|
|
995
|
+
interface BitmapGlyph {
|
|
996
|
+
image?: CompatCanvas;
|
|
997
|
+
/** Source rectangle in the bitmap sheet, before applying scale. */
|
|
998
|
+
x: number;
|
|
999
|
+
y: number;
|
|
1000
|
+
width: number;
|
|
1001
|
+
height: number;
|
|
1002
|
+
scale: number;
|
|
1003
|
+
ascent: number;
|
|
1004
|
+
advance: number;
|
|
1005
|
+
}
|
|
1006
|
+
interface BitmapFont {
|
|
1007
|
+
glyphs: Map<string, BitmapGlyph>;
|
|
1008
|
+
}
|
|
1009
|
+
declare class Fonts {
|
|
1010
|
+
static get(key?: AssetKey | string): Promise<BitmapFont>;
|
|
1011
|
+
private static relatedKey;
|
|
1012
|
+
private static load;
|
|
1013
|
+
private static bitmap;
|
|
1014
|
+
}
|
|
1015
|
+
|
|
974
1016
|
declare class Models {
|
|
975
1017
|
private static _persistentCache;
|
|
976
1018
|
private static get PERSISTENT_CACHE();
|
|
@@ -1290,18 +1332,61 @@ interface EntityObjectOptions extends SceneObjectOptions {
|
|
|
1290
1332
|
}
|
|
1291
1333
|
declare function isEntityObject(obj: any): obj is EntityObject;
|
|
1292
1334
|
|
|
1335
|
+
interface GuiTextStyle {
|
|
1336
|
+
/** sRGB 0xRRGGBB; defaults to white. */
|
|
1337
|
+
color?: number;
|
|
1338
|
+
bold?: boolean;
|
|
1339
|
+
italic?: boolean;
|
|
1340
|
+
}
|
|
1341
|
+
interface GuiTextRun extends GuiTextStyle {
|
|
1342
|
+
text: string;
|
|
1343
|
+
}
|
|
1344
|
+
/** Literal text, or styled runs. Newlines are preserved. */
|
|
1345
|
+
type GuiText = string | readonly GuiTextRun[];
|
|
1346
|
+
interface GuiTextOptions extends GuiTextStyle {
|
|
1347
|
+
/** Font resource ID; defaults to minecraft:default. */
|
|
1348
|
+
font?: AssetKey | string;
|
|
1349
|
+
/** Draws a one-pixel shadow; defaults to true. */
|
|
1350
|
+
shadow?: boolean;
|
|
1351
|
+
/** Wrap width in GUI pixels. Long words break at glyph boundaries. */
|
|
1352
|
+
maxWidth?: number;
|
|
1353
|
+
/** Distance between line origins; defaults to 9 GUI pixels. */
|
|
1354
|
+
lineHeight?: number;
|
|
1355
|
+
}
|
|
1356
|
+
interface PositionedGuiGlyph {
|
|
1357
|
+
character: string;
|
|
1358
|
+
glyph?: BitmapGlyph;
|
|
1359
|
+
x: number;
|
|
1360
|
+
y: number;
|
|
1361
|
+
advance: number;
|
|
1362
|
+
style: Required<GuiTextStyle>;
|
|
1363
|
+
}
|
|
1364
|
+
interface GuiTextLayout {
|
|
1365
|
+
glyphs: PositionedGuiGlyph[];
|
|
1366
|
+
lineWidths: number[];
|
|
1367
|
+
width: number;
|
|
1368
|
+
height: number;
|
|
1369
|
+
}
|
|
1370
|
+
/** Measures and wraps text using the same glyph advances used for rendering. */
|
|
1371
|
+
declare function layoutGuiText(text: GuiText, options?: GuiTextOptions): Promise<GuiTextLayout>;
|
|
1372
|
+
/** Creates glyph batches in painter order. Unsupported characters use an outlined missing glyph. */
|
|
1373
|
+
declare function createGuiTextGeometry(layout: GuiTextLayout, shadow?: boolean): {
|
|
1374
|
+
image?: CompatCanvas;
|
|
1375
|
+
geometry: BufferGeometry;
|
|
1376
|
+
}[];
|
|
1377
|
+
|
|
1293
1378
|
/** GUI layers use pixel coordinates. Later layers draw above earlier layers. */
|
|
1294
|
-
type GuiLayer = GuiTextureLayer | GuiItemLayer;
|
|
1379
|
+
type GuiLayer = GuiTextureLayer | GuiItemLayer | GuiTextLayer;
|
|
1295
1380
|
interface GuiLayerLayout {
|
|
1296
1381
|
name?: string;
|
|
1297
1382
|
/** Top-left position; x grows right and y grows down. Defaults to [0, 0]. */
|
|
1298
1383
|
position?: [number, number];
|
|
1299
|
-
/** Output
|
|
1384
|
+
/** Output size; defaults to native texture/text dimensions, and [16, 16] for items. */
|
|
1300
1385
|
size?: [number, number];
|
|
1301
1386
|
}
|
|
1302
1387
|
interface GuiTextureLayer extends GuiLayerLayout {
|
|
1303
1388
|
texture: AssetKey | string;
|
|
1304
|
-
/** Source-image pixels: [x, y, width, height], measured from the top left. */
|
|
1389
|
+
/** Source-image pixels: [x, y, width, height], measured from the top left. Crops ignore sprite scaling. */
|
|
1305
1390
|
crop?: [number, number, number, number];
|
|
1306
1391
|
}
|
|
1307
1392
|
interface GuiItemLayer extends GuiLayerLayout {
|
|
@@ -1310,6 +1395,9 @@ interface GuiItemLayer extends GuiLayerLayout {
|
|
|
1310
1395
|
/** sRGB 0xRRGGBB colors by face tint index; omitted indices stay white. */
|
|
1311
1396
|
tints?: Record<number, number>;
|
|
1312
1397
|
}
|
|
1398
|
+
interface GuiTextLayer extends GuiLayerLayout, GuiTextOptions {
|
|
1399
|
+
text: GuiText;
|
|
1400
|
+
}
|
|
1313
1401
|
|
|
1314
1402
|
declare class GuiObject extends SceneObject {
|
|
1315
1403
|
readonly textureLayers: readonly GuiLayer[];
|
|
@@ -1318,6 +1406,7 @@ declare class GuiObject extends SceneObject {
|
|
|
1318
1406
|
readonly bounds: Box2;
|
|
1319
1407
|
private readonly geometries;
|
|
1320
1408
|
private readonly ownedMaterials;
|
|
1409
|
+
private readonly textMaterials;
|
|
1321
1410
|
private initialized;
|
|
1322
1411
|
constructor(textureLayers: readonly GuiLayer[], options?: Partial<GuiObjectOptions>);
|
|
1323
1412
|
init(): Promise<void>;
|
|
@@ -1813,6 +1902,7 @@ declare class Caching {
|
|
|
1813
1902
|
static readonly entityTextureCache: AsyncLoadingCache<CacheKey, AssetKey>;
|
|
1814
1903
|
static readonly entityAnimationCache: AsyncLoadingCache<CacheKey, EntityAnimationFile>;
|
|
1815
1904
|
static readonly blockEntityIndexCache: AsyncLoadingCache<CacheKey, BlockEntityIndex>;
|
|
1905
|
+
static readonly fontCache: AsyncLoadingCache<CacheKey, BitmapFont>;
|
|
1816
1906
|
private static createAssetCache;
|
|
1817
1907
|
/** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
|
|
1818
1908
|
private static get all();
|
|
@@ -1855,10 +1945,18 @@ declare class SceneExporter {
|
|
|
1855
1945
|
}
|
|
1856
1946
|
|
|
1857
1947
|
declare class GuiHelper {
|
|
1948
|
+
/** Sizes a tooltip around supplied text; the first entry is its title. */
|
|
1949
|
+
static tooltip(lines: readonly GuiText[], options?: GuiTooltipOptions): Promise<GuiLayer[]>;
|
|
1858
1950
|
static inventorySlot(slot: number | [number, number], origin?: [number, number], offset?: [number, number], rowSize?: number): [number, number];
|
|
1859
1951
|
/** Creates crafting-table layers for ingredients and the result; stack counts are not drawn. */
|
|
1860
1952
|
static recipe(recipe: GuiRecipe, options?: GuiRecipeOptions): GuiLayer[];
|
|
1861
1953
|
}
|
|
1954
|
+
interface GuiTooltipOptions extends GuiTextOptions {
|
|
1955
|
+
/** Top-left text position, inside the tooltip's padding. */
|
|
1956
|
+
position?: [number, number];
|
|
1957
|
+
/** Extra space after the title, in pixels. Defaults to 2. */
|
|
1958
|
+
titleGap?: number;
|
|
1959
|
+
}
|
|
1862
1960
|
type GuiRecipeIngredientValue = string | {
|
|
1863
1961
|
item: string;
|
|
1864
1962
|
} | {
|
|
@@ -1886,6 +1984,9 @@ interface GuiRecipeOptions {
|
|
|
1886
1984
|
resolveIngredient?: (ingredient: GuiRecipeIngredient) => string | AssetKey;
|
|
1887
1985
|
}
|
|
1888
1986
|
|
|
1987
|
+
/** Builds one centered mesh; explicit source-pixel crops always stretch. */
|
|
1988
|
+
declare function createGuiTextureGeometry(width: number, height: number, imageWidth: number, imageHeight: number, crop?: [number, number, number, number], scaling?: GuiSpriteScaling): BufferGeometry;
|
|
1989
|
+
|
|
1889
1990
|
declare class OrbitControls {
|
|
1890
1991
|
constructor(object: Camera, domElement?: HTMLElement);
|
|
1891
1992
|
|
|
@@ -2425,4 +2526,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
|
|
|
2425
2526
|
*/
|
|
2426
2527
|
declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
|
|
2427
2528
|
|
|
2428
|
-
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, 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, 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, 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, probeImageSize, registerBrowserEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
|
|
2529
|
+
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, 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, 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, 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, probeImageSize, registerBrowserEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
|