minerender 2.1.0-beta.1 → 2.1.0-beta.2
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/README.md +95 -0
- package/dist/browser/index.d.mts +795 -25
- package/dist/browser/index.d.ts +795 -25
- package/dist/browser/index.js +1905 -401
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +1881 -377
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +2729 -1205
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +795 -25
- package/dist/node/index.d.ts +795 -25
- package/dist/node/index.js +1915 -400
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +1884 -376
- package/dist/node/index.mjs.map +1 -1
- package/package.json +12 -4
package/dist/browser/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as three from 'three';
|
|
2
|
-
import { Vector3, PixelFormat, BoxGeometry, Material, ColorRepresentation, MeshBasicMaterial, Mesh, Euler, Vector2, BufferAttribute, Float32BufferAttribute, BufferGeometry, Object3D, Box3, InstancedMesh, PerspectiveCamera, OrthographicCamera, Matrix4, Box2, Scene, Object3DEventMap, Texture, Camera, MOUSE, TOUCH, WebGLRenderer, EventDispatcher, Raycaster, Intersection, DataTexture, CanvasTexture, InterleavedBufferAttribute, TrianglesDrawModes, Line, Points
|
|
2
|
+
import { Vector3, PixelFormat, BoxGeometry, Material, ColorRepresentation, MeshBasicMaterial, Mesh, Euler, Vector2, BufferAttribute, Float32BufferAttribute, BufferGeometry, Object3D, Box3, InstancedMesh, PerspectiveCamera, OrthographicCamera, Matrix4, Box2, Scene, Object3DEventMap, Texture, Camera, MOUSE, TOUCH, WebGLRenderer, EventDispatcher, Raycaster, Intersection, Group, DataTexture, CanvasTexture, InterleavedBufferAttribute, TrianglesDrawModes, Line, Points } from 'three';
|
|
3
3
|
import * as nodeCanvas from 'canvas';
|
|
4
4
|
import { ImageData as ImageData$1, CanvasRenderingContext2D } from 'canvas';
|
|
5
5
|
import { Buffer } from 'buffer';
|
|
@@ -11,6 +11,7 @@ export { PLYExporterOptions } from 'three/examples/jsm/exporters/PLYExporter.js'
|
|
|
11
11
|
import Stats from 'stats.js';
|
|
12
12
|
import { EffectComposer } from 'postprocessing';
|
|
13
13
|
|
|
14
|
+
/** Advances a texture animation by one tick. Return `false` when its pixels have not changed. */
|
|
14
15
|
interface AnimatorFunction {
|
|
15
16
|
(): boolean | void;
|
|
16
17
|
}
|
|
@@ -42,6 +43,7 @@ declare enum CubeFaceIndex {
|
|
|
42
43
|
declare const CUBE_FACES: CubeFace[];
|
|
43
44
|
declare const CUBE_FACE_OFFSETS: readonly [readonly [1, 0, 0], readonly [-1, 0, 0], readonly [0, 1, 0], readonly [0, -1, 0], readonly [0, 0, 1], readonly [0, 0, -1]];
|
|
44
45
|
|
|
46
|
+
/** An object that can release the resources it owns. */
|
|
45
47
|
interface Disposable {
|
|
46
48
|
dispose(): void;
|
|
47
49
|
}
|
|
@@ -49,7 +51,9 @@ declare function isDisposable(obj: any): obj is Disposable;
|
|
|
49
51
|
|
|
50
52
|
type CompatImage = HTMLImageElement | nodeCanvas.Image;
|
|
51
53
|
type CompatCanvas = HTMLCanvasElement | nodeCanvas.Canvas;
|
|
54
|
+
/** Creates an image through the active environment provider. Dimensions are in pixels. */
|
|
52
55
|
declare function createImage(width?: number, height?: number): CompatImage;
|
|
56
|
+
/** Creates a browser or Node canvas through the active environment provider, sized in pixels. */
|
|
53
57
|
declare function createCanvas(width: number, height: number): CompatCanvas;
|
|
54
58
|
|
|
55
59
|
/**
|
|
@@ -63,6 +67,7 @@ declare abstract class PersistentCache<B = unknown> {
|
|
|
63
67
|
readonly backing: B;
|
|
64
68
|
/** Bump to invalidate every persisted entry. */
|
|
65
69
|
static readonly VERSION = 2;
|
|
70
|
+
/** Opens a named store in the active environment using the current cache schema version. */
|
|
66
71
|
static open(name: string): PersistentCache;
|
|
67
72
|
protected constructor(backing: B);
|
|
68
73
|
abstract get<T>(key: string): Promise<T>;
|
|
@@ -115,6 +120,7 @@ declare class Env {
|
|
|
115
120
|
static get provider(): EnvProvider;
|
|
116
121
|
}
|
|
117
122
|
|
|
123
|
+
/** A canvas-backed image with dimensions and a context for reading pixel regions. */
|
|
118
124
|
interface ExtractableImageData {
|
|
119
125
|
readonly data: CanvasImageData;
|
|
120
126
|
readonly width: number;
|
|
@@ -122,10 +128,12 @@ interface ExtractableImageData {
|
|
|
122
128
|
}
|
|
123
129
|
|
|
124
130
|
type CacheKey = string;
|
|
131
|
+
/** Source URL used to identify cached image bytes and pixels. */
|
|
125
132
|
interface RawImageKey {
|
|
126
133
|
src: string;
|
|
127
134
|
}
|
|
128
135
|
declare function serializeImageKey(key: RawImageKey): string;
|
|
136
|
+
/** Box dimensions in scene units and optional normalized UVs in Three.js face order. */
|
|
129
137
|
interface BoxGeometryKey {
|
|
130
138
|
width: number;
|
|
131
139
|
height: number;
|
|
@@ -133,32 +141,39 @@ interface BoxGeometryKey {
|
|
|
133
141
|
uv?: number[];
|
|
134
142
|
}
|
|
135
143
|
declare function serializeBoxGeometryKey(key: BoxGeometryKey): string;
|
|
144
|
+
/** Settings passed to {@link Textures.getImage}. Texture rotation uses radians. */
|
|
136
145
|
interface TextureKey extends RawImageKey {
|
|
137
146
|
format?: PixelFormat;
|
|
138
147
|
rotation?: number;
|
|
139
148
|
}
|
|
140
149
|
declare function serializeTextureKey(key: TextureKey): string;
|
|
150
|
+
/** Texture and transparency settings passed to {@link Materials.getImage}. */
|
|
141
151
|
interface MaterialKey {
|
|
142
152
|
texture: TextureKey;
|
|
143
153
|
transparent?: boolean;
|
|
144
154
|
}
|
|
145
155
|
declare function serializeMaterialKey(key: MaterialKey): string;
|
|
156
|
+
/** Geometry and material settings passed to {@link Meshes.createBox} or {@link Meshes.getBox}. */
|
|
146
157
|
interface MeshKey {
|
|
147
158
|
geometry: BoxGeometryKey;
|
|
148
159
|
material: MaterialKey;
|
|
149
160
|
}
|
|
150
161
|
declare function serializeMeshKey(key: MeshKey): string;
|
|
151
162
|
|
|
163
|
+
/** Creates box geometry with optional face UVs and caches it by dimensions and UV values. */
|
|
152
164
|
declare class Geometries {
|
|
153
165
|
static createBox(key: BoxGeometryKey): BoxGeometry;
|
|
166
|
+
/** Returns shared geometry. Use {@link createBox} when the caller needs to modify or dispose it independently. */
|
|
154
167
|
static getBox(key: BoxGeometryKey): BoxGeometry;
|
|
155
168
|
}
|
|
156
169
|
|
|
170
|
+
/** Produces a string representation, such as an asset cache key. */
|
|
157
171
|
interface Serializable {
|
|
158
172
|
serialize(): string;
|
|
159
173
|
}
|
|
160
174
|
|
|
161
175
|
type AssetType = "models" | "textures" | "blockstates" | string;
|
|
176
|
+
/** A Minecraft namespace and path, such as `minecraft` and `zombie`. */
|
|
162
177
|
declare class BasicAssetKey implements Serializable {
|
|
163
178
|
readonly namespace: string;
|
|
164
179
|
readonly path: string;
|
|
@@ -168,6 +183,7 @@ declare class BasicAssetKey implements Serializable {
|
|
|
168
183
|
toString(): string;
|
|
169
184
|
serialize(): string;
|
|
170
185
|
}
|
|
186
|
+
/** Locates an asset by namespace, directory, extension, and optional asset root. */
|
|
171
187
|
declare class AssetKey extends BasicAssetKey {
|
|
172
188
|
readonly namespace: string;
|
|
173
189
|
readonly path: string;
|
|
@@ -177,28 +193,52 @@ declare class AssetKey extends BasicAssetKey {
|
|
|
177
193
|
extension: ".json" | ".png" | string;
|
|
178
194
|
root?: string | undefined;
|
|
179
195
|
readonly isAssetKey: true;
|
|
196
|
+
/**
|
|
197
|
+
* Creates a key from separate path components. Use {@link parse} for a combined reference.
|
|
198
|
+
*
|
|
199
|
+
* @param assetType - Asset directory, such as `models`, `textures`, or `blockstates`.
|
|
200
|
+
* @param type - Subdirectory, such as `block` or `item`.
|
|
201
|
+
* @param rootType - Top-level directory, usually `assets` or `data`.
|
|
202
|
+
* @param root - Base URL override for hosted asset sources.
|
|
203
|
+
*/
|
|
180
204
|
constructor(namespace: string, path: string, assetType?: AssetType | undefined, type?: string | undefined, rootType?: "assets" | "data" | string, extension?: ".json" | ".png" | string, root?: string | undefined);
|
|
205
|
+
/**
|
|
206
|
+
* Parses an asset reference such as `minecraft:block/stone`.
|
|
207
|
+
* A missing namespace defaults to the origin's namespace or `minecraft`.
|
|
208
|
+
*
|
|
209
|
+
* @param assetType - Asset category, such as `models` or `textures`.
|
|
210
|
+
* @param str - Path with an optional namespace and file extension.
|
|
211
|
+
* @param origin - Supplies the asset root, default namespace, and non-texture extension.
|
|
212
|
+
* @returns A key with the matching extension removed from its path. Textures use `.png`;
|
|
213
|
+
* other assets use the origin's extension or `.json`.
|
|
214
|
+
*/
|
|
181
215
|
static parse(assetType: AssetType, str: string, origin?: AssetKey): AssetKey;
|
|
182
216
|
toString(): string;
|
|
217
|
+
/** Joins the type subdirectory and path without adding a namespace or file extension. */
|
|
183
218
|
getFullPath(): string;
|
|
184
219
|
toNamespacedString(): string;
|
|
220
|
+
/** Returns a cache identifier that includes the explicit root or {@link AssetLoader.ROOT}. */
|
|
185
221
|
serialize(): string;
|
|
186
222
|
}
|
|
187
223
|
declare function isBasicAssetKey(obj: any): obj is BasicAssetKey;
|
|
188
224
|
declare function isAssetKey(obj: any): obj is AssetKey;
|
|
189
225
|
|
|
226
|
+
/** Loaded data with an optional namespace-and-path identity. */
|
|
190
227
|
interface BasicMinecraftAsset {
|
|
191
228
|
key?: BasicAssetKey;
|
|
192
229
|
}
|
|
230
|
+
/** Loaded data that can retain its full source key for related asset lookups. */
|
|
193
231
|
interface MinecraftAsset extends BasicMinecraftAsset {
|
|
194
232
|
key?: AssetKey;
|
|
195
233
|
}
|
|
196
234
|
|
|
235
|
+
/** A hosted `_list.json` directory index used by asset-listing APIs. */
|
|
197
236
|
interface ListAsset extends MinecraftAsset {
|
|
198
237
|
directories: string[];
|
|
199
238
|
files: string[];
|
|
200
239
|
}
|
|
201
240
|
|
|
241
|
+
/** One selected draw, combining geometry, texture, and material settings. */
|
|
202
242
|
interface EntityLayer {
|
|
203
243
|
key: BasicAssetKey;
|
|
204
244
|
texture?: AssetKey;
|
|
@@ -208,6 +248,7 @@ interface EntityLayer {
|
|
|
208
248
|
/** Label of the state colour that multiplies the texture, from the pass that selected this draw. */
|
|
209
249
|
tint?: string;
|
|
210
250
|
}
|
|
251
|
+
/** Selected entity data returned by {@link Entities.getEntity} for rendering. */
|
|
211
252
|
interface EntityModel extends EntityLayer {
|
|
212
253
|
id: string;
|
|
213
254
|
/** Root transform from the dataset; see {@link EntityTransformOp}. */
|
|
@@ -218,6 +259,7 @@ interface EntityModel extends EntityLayer {
|
|
|
218
259
|
*/
|
|
219
260
|
layers?: Record<string, EntityLayer>;
|
|
220
261
|
}
|
|
262
|
+
/** Dataset file containing all geometry layers and optional extra render passes. */
|
|
221
263
|
interface EntityModelFile extends MinecraftAsset {
|
|
222
264
|
id: string;
|
|
223
265
|
transform?: EntityTransformOp[];
|
|
@@ -226,7 +268,8 @@ interface EntityModelFile extends MinecraftAsset {
|
|
|
226
268
|
passes?: EntityModelPass[];
|
|
227
269
|
}
|
|
228
270
|
/** Vanilla render type of a draw; see the dataset README for the mode table. */
|
|
229
|
-
type EntityRenderMode = "cutout" | "cutout_cull" | "cutout_z_offset" | "solid" | "translucent" | "translucent_emissive" | "eyes" | "energy_swirl" | "breeze_wind" | "water_mask";
|
|
271
|
+
type EntityRenderMode = "cutout" | "cutout_cull" | "cutout_z_offset" | "solid" | "translucent" | "translucent_emissive" | "eyes" | "energy_swirl" | "breeze_wind" | "water_mask" | "no_outline";
|
|
272
|
+
/** An extra draw of a geometry layer, optionally enabled by an entity-state label. */
|
|
230
273
|
interface EntityModelPass {
|
|
231
274
|
/** Geometry layer of the same file; a pass on `main` draws that geometry again. */
|
|
232
275
|
layer: string;
|
|
@@ -251,6 +294,7 @@ type EntityTransformOp = {
|
|
|
251
294
|
} | {
|
|
252
295
|
rotate: [number, number, number];
|
|
253
296
|
};
|
|
297
|
+
/** A named geometry tree with texture dimensions in pixels and an optional default texture path. */
|
|
254
298
|
interface EntityModelLayer {
|
|
255
299
|
texture: [number, number];
|
|
256
300
|
textureLocation?: string;
|
|
@@ -258,6 +302,7 @@ interface EntityModelLayer {
|
|
|
258
302
|
render?: EntityRenderMode;
|
|
259
303
|
root: EntityModelPart;
|
|
260
304
|
}
|
|
305
|
+
/** A named part's baked pose and children. Offsets use model units and rotations use radians. */
|
|
261
306
|
interface EntityModelPart {
|
|
262
307
|
pose: {
|
|
263
308
|
offset: [number, number, number];
|
|
@@ -268,6 +313,7 @@ interface EntityModelPart {
|
|
|
268
313
|
cubes: EntityModelCube[];
|
|
269
314
|
children: Record<string, EntityModelPart>;
|
|
270
315
|
}
|
|
316
|
+
/** A part's cuboid in model units, with a texture origin in pixels and optional per-axis growth. */
|
|
271
317
|
interface EntityModelCube {
|
|
272
318
|
origin: [number, number, number];
|
|
273
319
|
size: [number, number, number];
|
|
@@ -276,7 +322,9 @@ interface EntityModelCube {
|
|
|
276
322
|
mirror?: boolean;
|
|
277
323
|
}
|
|
278
324
|
|
|
325
|
+
/** Creates Minecraft model, entity, and GUI materials, with shared caches for image materials. */
|
|
279
326
|
declare class Materials {
|
|
327
|
+
/** Shared checkerboard material, created on first access. */
|
|
280
328
|
static get MISSING_TEXTURE(): Material;
|
|
281
329
|
static createImage(key: MaterialKey): Material;
|
|
282
330
|
static createBasicCanvasMaterial(canvas: HTMLCanvasElement, transparent?: boolean, shade?: boolean): Material;
|
|
@@ -290,17 +338,22 @@ declare class Materials {
|
|
|
290
338
|
* whether the geometry gets inward faces.
|
|
291
339
|
*/
|
|
292
340
|
static createEntityCanvasMaterial(canvas: HTMLCanvasElement, mode?: EntityRenderMode, tint?: ColorRepresentation): MeshBasicMaterial;
|
|
341
|
+
/** Creates an unlit, transparent GUI material without depth writes or tone mapping. */
|
|
293
342
|
static createGuiCanvasMaterial(canvas: HTMLCanvasElement): MeshBasicMaterial;
|
|
294
|
-
static createShadedCanvasMaterial(canvas: HTMLCanvasElement, transparent?: boolean, shade?: boolean): Material;
|
|
343
|
+
static createShadedCanvasMaterial(canvas: HTMLCanvasElement, transparent?: boolean, shade?: boolean, boundUvs?: boolean): Material;
|
|
344
|
+
/** Returns a shared image material. Use {@link createImage} for a separate material instance. */
|
|
295
345
|
static getImage(key: MaterialKey): Material;
|
|
296
346
|
static needsUpdate(mat: Material): void;
|
|
297
347
|
}
|
|
298
348
|
|
|
349
|
+
/** Creates box meshes from shared geometry and image materials. */
|
|
299
350
|
declare class Meshes {
|
|
300
351
|
static createBox(key: MeshKey): Mesh;
|
|
352
|
+
/** Returns a shared Mesh object. Use {@link createBox} for a mesh with its own transform and parent. */
|
|
301
353
|
static getBox(key: MeshKey): Mesh;
|
|
302
354
|
}
|
|
303
355
|
|
|
356
|
+
/** Texture and culling settings for one cuboid face. Java model UVs use Minecraft's 0–16 texture space. */
|
|
304
357
|
interface ElementFace {
|
|
305
358
|
uv: QuadArray;
|
|
306
359
|
mappedUv?: QuadArray;
|
|
@@ -314,6 +367,7 @@ interface FromTo {
|
|
|
314
367
|
from: TripleArray;
|
|
315
368
|
to: TripleArray;
|
|
316
369
|
}
|
|
370
|
+
/** A cuboid in model units, where 16 units equal one block. */
|
|
317
371
|
interface ModelElement extends FromTo {
|
|
318
372
|
rotation?: ElementRotation;
|
|
319
373
|
shade?: boolean;
|
|
@@ -321,6 +375,7 @@ interface ModelElement extends FromTo {
|
|
|
321
375
|
mappedUv?: number[];
|
|
322
376
|
}
|
|
323
377
|
type ModelFaces = Partial<Record<CubeFace, Partial<ElementFace>>>;
|
|
378
|
+
/** Rotates one cuboid around an origin in model units, using an angle in degrees. */
|
|
324
379
|
interface ElementRotation {
|
|
325
380
|
origin: TripleArray;
|
|
326
381
|
axis: Axis;
|
|
@@ -346,14 +401,17 @@ declare enum GuiLight {
|
|
|
346
401
|
SIDE = "side"
|
|
347
402
|
}
|
|
348
403
|
|
|
404
|
+
/** Fetch settings passed to {@link Requests.genericRequest} or {@link Requests.mcAssetRequest}. */
|
|
349
405
|
interface RequestConfig extends RequestInit {
|
|
350
406
|
url: string;
|
|
351
407
|
/** Prepended to relative URLs, preserving any path in the base URL. */
|
|
352
408
|
baseURL?: string;
|
|
353
409
|
/** Timeout per attempt in milliseconds, including body reading. Defaults to 5000; 0 disables it. */
|
|
354
410
|
timeout?: number;
|
|
411
|
+
/** Response-body decoding. Defaults to `json`. */
|
|
355
412
|
responseType?: "json" | "arraybuffer";
|
|
356
413
|
}
|
|
414
|
+
/** A decoded response body with the HTTP status, native headers, and final URL. */
|
|
357
415
|
interface RequestResponse<T = any> {
|
|
358
416
|
data: T;
|
|
359
417
|
status: number;
|
|
@@ -362,16 +420,21 @@ interface RequestResponse<T = any> {
|
|
|
362
420
|
/** Final URL after redirects. */
|
|
363
421
|
url: string;
|
|
364
422
|
}
|
|
423
|
+
/** An HTTP or network failure, with response details or an underlying cause when available. */
|
|
365
424
|
declare class RequestError extends Error {
|
|
366
425
|
readonly response?: RequestResponse<undefined> | undefined;
|
|
367
426
|
readonly cause?: unknown;
|
|
368
427
|
constructor(message: string, response?: RequestResponse<undefined> | undefined, cause?: unknown);
|
|
369
428
|
}
|
|
429
|
+
/** Shared Fetch queues with concurrency limits, cancellation, timeouts, and bounded retries for GET requests. */
|
|
370
430
|
declare class Requests {
|
|
371
431
|
private static genericQueue;
|
|
372
432
|
private static mcAssetRequestQueue;
|
|
433
|
+
/** Queues a general request. Set `request.signal` to cancel it and `request.timeout` to limit each attempt. */
|
|
373
434
|
static genericRequest(request: RequestConfig): Promise<RequestResponse>;
|
|
435
|
+
/** Queues a request separately from general traffic, using the configured asset base URL for relative paths. */
|
|
374
436
|
static mcAssetRequest(request: RequestConfig): Promise<RequestResponse>;
|
|
437
|
+
/** Sets the base URL for relative asset requests. Use {@link AssetLoader.setVersion} to change Minecraft versions. */
|
|
375
438
|
static setMcAssetRoot(root: string): void;
|
|
376
439
|
/** Counts unsettled calls, including retry delays and requests still running after shutdown. */
|
|
377
440
|
static get queueSizes(): {
|
|
@@ -386,6 +449,7 @@ declare class Requests {
|
|
|
386
449
|
static end(): void;
|
|
387
450
|
}
|
|
388
451
|
|
|
452
|
+
/** Provides pixel and frame access to a canvas-backed image. Simple frame helpers assume a vertical strip of squares. */
|
|
389
453
|
declare class WrappedImage {
|
|
390
454
|
readonly dta: ExtractableImageData;
|
|
391
455
|
constructor(dta: ExtractableImageData);
|
|
@@ -394,6 +458,7 @@ declare class WrappedImage {
|
|
|
394
458
|
get width(): number;
|
|
395
459
|
get height(): number;
|
|
396
460
|
get hasTransparency(): boolean;
|
|
461
|
+
/** Whether the dimensions form a vertical strip of square frames, without consulting `.mcmeta`. */
|
|
397
462
|
get animated(): boolean;
|
|
398
463
|
get frameWidth(): number;
|
|
399
464
|
get frameHeight(): number;
|
|
@@ -404,6 +469,7 @@ declare class WrappedImage {
|
|
|
404
469
|
getFrameSectionData(frame: number): ImageData$1;
|
|
405
470
|
}
|
|
406
471
|
|
|
472
|
+
/** Encoded image bytes with dimensions and format detected from the file header. */
|
|
407
473
|
interface ImageInfo {
|
|
408
474
|
src?: string;
|
|
409
475
|
width: number;
|
|
@@ -411,15 +477,21 @@ interface ImageInfo {
|
|
|
411
477
|
type?: string;
|
|
412
478
|
data: Buffer;
|
|
413
479
|
}
|
|
480
|
+
/** Fetches and decodes images through the active browser or Node environment provider. */
|
|
414
481
|
declare class ImageLoader {
|
|
415
482
|
protected static _createImage(): CompatImage;
|
|
483
|
+
/** Resolves when an image URL has decoded, or rejects if decoding fails. */
|
|
416
484
|
static loadAsync(src: string): Promise<CompatImage>;
|
|
485
|
+
/** Returns an image immediately. Use the callbacks to observe loading, or await {@link loadAsync}. */
|
|
417
486
|
static loadElement(src: string, onload?: () => void, onerr?: (err: Error) => void): CompatImage;
|
|
418
487
|
static loadData(src: string): Promise<ImageData>;
|
|
419
488
|
static loadCanvasData(src: string): Promise<ExtractableImageData>;
|
|
489
|
+
/** Decodes the supplied bytes into a canvas without fetching the source URL again. */
|
|
420
490
|
static infoToCanvasData(info: ImageInfo): Promise<ExtractableImageData>;
|
|
421
491
|
static infoToData(info: ImageInfo): Promise<ImageData>;
|
|
492
|
+
/** Returns cached RGBA pixels for an image URL or data URL. Failed loads can be retried. */
|
|
422
493
|
static getData(src: string): Promise<ImageData>;
|
|
494
|
+
/** Returns a cached canvas context and dimensions for an image URL or data URL. */
|
|
423
495
|
static getCanvasData(src: string): Promise<ExtractableImageData>;
|
|
424
496
|
static processResponse(response: Pick<RequestResponse<ArrayBuffer>, "data" | "url">): Promise<ImageInfo>;
|
|
425
497
|
static loadInfo(src: string): Promise<ImageInfo>;
|
|
@@ -428,10 +500,51 @@ declare class ImageLoader {
|
|
|
428
500
|
static getWrapped(src: string): Promise<WrappedImage>;
|
|
429
501
|
}
|
|
430
502
|
|
|
503
|
+
/** Vanilla dye colors used by banner and shield textures, as sRGB packed values. */
|
|
504
|
+
declare const DYE_COLORS: Readonly<{
|
|
505
|
+
readonly white: 16383998;
|
|
506
|
+
readonly orange: 16351261;
|
|
507
|
+
readonly magenta: 13061821;
|
|
508
|
+
readonly light_blue: 3847130;
|
|
509
|
+
readonly yellow: 16701501;
|
|
510
|
+
readonly lime: 8439583;
|
|
511
|
+
readonly pink: 15961002;
|
|
512
|
+
readonly gray: 4673362;
|
|
513
|
+
readonly light_gray: 10329495;
|
|
514
|
+
readonly cyan: 1481884;
|
|
515
|
+
readonly purple: 8991416;
|
|
516
|
+
readonly blue: 3949738;
|
|
517
|
+
readonly brown: 8606770;
|
|
518
|
+
readonly green: 6192150;
|
|
519
|
+
readonly red: 11546150;
|
|
520
|
+
readonly black: 1908001;
|
|
521
|
+
}>;
|
|
522
|
+
type DyeColor = keyof typeof DYE_COLORS;
|
|
523
|
+
/** A registry banner pattern or an inline value in a `banner_patterns` component. */
|
|
524
|
+
interface BannerPattern extends MinecraftAsset {
|
|
525
|
+
asset_id: string;
|
|
526
|
+
translation_key: string;
|
|
527
|
+
}
|
|
528
|
+
interface BannerPatternDraw {
|
|
529
|
+
texture: AssetKey;
|
|
530
|
+
color: number;
|
|
531
|
+
}
|
|
532
|
+
/** Loads banner-pattern registry entries and resolves their banner or shield textures. */
|
|
533
|
+
declare class BannerPatterns {
|
|
534
|
+
/** Lists namespaced pattern IDs from the selected namespace's data directory. */
|
|
535
|
+
static getList(namespace?: string, root?: string): Promise<string[]>;
|
|
536
|
+
/** Returns the named dye's sRGB value, rejecting unknown colors. */
|
|
537
|
+
static getColor(color: unknown): number;
|
|
538
|
+
/** Resolves the first 16 layers of a `banner_patterns` component, preserving their order. */
|
|
539
|
+
static getLayers(value: unknown, target: "banner" | "shield", root?: string): Promise<BannerPatternDraw[]>;
|
|
540
|
+
private static identifier;
|
|
541
|
+
}
|
|
542
|
+
|
|
431
543
|
declare const ITEM_GENERATED = "item/generated";
|
|
432
544
|
declare const BUILTIN_GENERATED = "builtin/generated";
|
|
433
545
|
declare const BUILTIN_ENTITY = "builtin/entity";
|
|
434
546
|
declare const DEFAULT_ELEMENTS: ModelElement[];
|
|
547
|
+
/** A Java model definition. {@link Models.getMerged} resolves its parent, textures, and elements. */
|
|
435
548
|
interface Model extends MinecraftAsset {
|
|
436
549
|
textures?: IModelTextures;
|
|
437
550
|
parent?: string;
|
|
@@ -439,17 +552,25 @@ interface Model extends MinecraftAsset {
|
|
|
439
552
|
elements?: ModelElement[];
|
|
440
553
|
hierarchy?: string[];
|
|
441
554
|
}
|
|
555
|
+
/** Java block-model data, including the ambient-occlusion flag. */
|
|
442
556
|
interface BlockModel extends Model {
|
|
443
557
|
textures?: BlockModelTextures;
|
|
444
558
|
ambientocclusion?: boolean;
|
|
445
559
|
}
|
|
560
|
+
/** Item preview data, including GUI lighting, tint sources, and supported special renderers. */
|
|
446
561
|
interface ItemModel extends Model {
|
|
447
562
|
textures?: ItemModelTextures;
|
|
448
563
|
gui_light?: GuiLight;
|
|
449
564
|
special?: SpecialItemRenderer;
|
|
450
565
|
tints?: ItemTintSource[];
|
|
566
|
+
/** Stack-component snapshot with namespaced IDs, used by tint sources and special renderers. */
|
|
567
|
+
components?: Record<string, unknown>;
|
|
568
|
+
/** Ordered composite children, each with its own textures, display pose, and tint sources. */
|
|
569
|
+
parts?: ItemModel[];
|
|
451
570
|
}
|
|
571
|
+
/** An sRGB packed `0xRRGGBB` value or an RGB triple with components from 0 to 1. */
|
|
452
572
|
type ItemTintColor = number | TripleArray;
|
|
573
|
+
/** A vanilla item color source. Missing component values and unsupported gameplay state use the declared default. */
|
|
453
574
|
type ItemTintSource = {
|
|
454
575
|
type: "constant" | "minecraft:constant";
|
|
455
576
|
value: ItemTintColor;
|
|
@@ -465,10 +586,23 @@ type ItemTintSource = {
|
|
|
465
586
|
index?: number;
|
|
466
587
|
default: ItemTintColor;
|
|
467
588
|
};
|
|
589
|
+
/** Supported item definitions that draw entity geometry instead of ordinary model elements. */
|
|
468
590
|
type SpecialItemRenderer = {
|
|
591
|
+
type: "banner" | "minecraft:banner";
|
|
592
|
+
color: DyeColor;
|
|
593
|
+
} | {
|
|
594
|
+
type: "shield" | "minecraft:shield";
|
|
595
|
+
} | {
|
|
596
|
+
type: "trident" | "minecraft:trident" | "conduit" | "minecraft:conduit";
|
|
597
|
+
} | {
|
|
469
598
|
type: "chest" | "minecraft:chest";
|
|
470
599
|
texture: string;
|
|
471
600
|
openness?: number;
|
|
601
|
+
} | {
|
|
602
|
+
type: "shulker_box" | "minecraft:shulker_box";
|
|
603
|
+
texture: string;
|
|
604
|
+
openness?: number;
|
|
605
|
+
orientation?: "down" | "up" | "north" | "south" | "west" | "east";
|
|
472
606
|
} | {
|
|
473
607
|
type: "bed" | "minecraft:bed";
|
|
474
608
|
texture: string;
|
|
@@ -480,6 +614,7 @@ type SpecialItemRenderer = {
|
|
|
480
614
|
};
|
|
481
615
|
interface TextureAsset extends MinecraftAsset, ImageInfo {
|
|
482
616
|
}
|
|
617
|
+
/** A model display pose: translation in model units, rotation in degrees, and scale factors. */
|
|
483
618
|
interface ModelDisplay {
|
|
484
619
|
translation?: TripleArray;
|
|
485
620
|
rotation?: TripleArray;
|
|
@@ -519,12 +654,14 @@ declare class MinecraftCubeTexture {
|
|
|
519
654
|
toUvArray(w: number, h: number, l: number, mirror?: boolean): number[];
|
|
520
655
|
}
|
|
521
656
|
|
|
657
|
+
/** Texture animation and GUI scaling metadata read from a `.png.mcmeta` file. */
|
|
522
658
|
interface MinecraftTextureMeta extends MinecraftAsset {
|
|
523
659
|
animation?: AnimationMeta;
|
|
524
660
|
gui?: {
|
|
525
661
|
scaling?: GuiSpriteScaling;
|
|
526
662
|
};
|
|
527
663
|
}
|
|
664
|
+
/** GUI sprite scaling rules. Dimensions and borders use logical GUI pixels, independent of PNG resolution. */
|
|
528
665
|
type GuiSpriteScaling = {
|
|
529
666
|
type: "stretch";
|
|
530
667
|
} | {
|
|
@@ -543,6 +680,7 @@ type GuiSpriteScaling = {
|
|
|
543
680
|
};
|
|
544
681
|
stretch_inner?: boolean;
|
|
545
682
|
};
|
|
683
|
+
/** Texture frame-grid and playback settings. Frame durations use ticks at 20 ticks per second. */
|
|
546
684
|
interface AnimationMeta {
|
|
547
685
|
interpolate: boolean;
|
|
548
686
|
width: number;
|
|
@@ -550,17 +688,20 @@ interface AnimationMeta {
|
|
|
550
688
|
frametime: number;
|
|
551
689
|
frames: Array<number | AnimationFrame>;
|
|
552
690
|
}
|
|
691
|
+
/** A zero-based frame index and its duration in ticks, overriding the animation's default frame time. */
|
|
553
692
|
interface AnimationFrame {
|
|
554
693
|
index: number;
|
|
555
694
|
time: number;
|
|
556
695
|
}
|
|
557
696
|
|
|
697
|
+
/** Counts direct scene children, Minecraft scene objects, and live instance placements. */
|
|
558
698
|
declare class SceneStats {
|
|
559
699
|
objectCount: number;
|
|
560
700
|
sceneObjectCount: number;
|
|
561
701
|
instanceCount: number;
|
|
562
702
|
}
|
|
563
703
|
|
|
704
|
+
/** A synchronous callback registered with {@link Ticker.add}. */
|
|
564
705
|
interface TickerFunction {
|
|
565
706
|
(): void;
|
|
566
707
|
}
|
|
@@ -582,18 +723,24 @@ declare class Ticker {
|
|
|
582
723
|
private static fiveSecondTps;
|
|
583
724
|
private static fiveSecondTicks;
|
|
584
725
|
private static schedule;
|
|
726
|
+
/** Starts or resumes the shared tick loop. Repeated calls have no effect. */
|
|
585
727
|
static start(): void;
|
|
728
|
+
/** Pauses the loop while retaining callbacks for a later {@link start}. */
|
|
586
729
|
static stop(): void;
|
|
730
|
+
/** Registers a callback, starts the loop if needed, and returns an ID for {@link remove}. */
|
|
587
731
|
static add(tick: TickerFunction): number;
|
|
732
|
+
/** Removes a callback by ID and stops the timers when no callbacks remain. */
|
|
588
733
|
static remove(c?: number): void;
|
|
589
734
|
static get tickers(): Map<number, TickerFunction>;
|
|
590
735
|
static get tpsOneSecond(): number;
|
|
591
736
|
static get tpsFiveSeconds(): number;
|
|
737
|
+
/** Stops the loop and removes all registered callbacks. */
|
|
592
738
|
static dispose(): void;
|
|
593
739
|
}
|
|
594
740
|
|
|
595
741
|
declare const TintColors: never[];
|
|
596
742
|
|
|
743
|
+
/** Transform access shared by scene objects and instance references. Positions use scene units and rotations use radians. */
|
|
597
744
|
interface Transformable {
|
|
598
745
|
setPositionRotationScale(position?: Vector3, rotation?: Euler, scale?: Vector3): void;
|
|
599
746
|
setPosition(position: Vector3): void;
|
|
@@ -617,22 +764,30 @@ declare function base64encode(str: string): string;
|
|
|
617
764
|
declare function base64decode(str: string): string;
|
|
618
765
|
declare function toRadians(degrees: number): number;
|
|
619
766
|
declare function toDegrees(radians: number): number;
|
|
767
|
+
/** Resolves after a delay in milliseconds. */
|
|
620
768
|
declare function sleep(timeout: number): Promise<void>;
|
|
769
|
+
/** Reduces an angle modulo 360, retaining a negative sign for negative inputs. */
|
|
621
770
|
declare function clampRotationDegrees(deg: number): number;
|
|
622
771
|
declare function isVector3(obj: any): obj is Vector3;
|
|
623
772
|
type DeepPartial<T> = {
|
|
624
773
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
625
774
|
};
|
|
626
775
|
|
|
776
|
+
/** Loads texture pixels and `.mcmeta` files through the active asset sources. */
|
|
627
777
|
declare class ModelTextures {
|
|
628
778
|
private static _persistentMetaCache;
|
|
629
779
|
private static get PERSISTENT_META_CACHE();
|
|
780
|
+
/** Loads and decodes a texture into a readable canvas, or returns `undefined` when missing. */
|
|
630
781
|
static get(key: AssetKey): Promise<Maybe<ExtractableImageData>>;
|
|
782
|
+
/** Fetches and caches encoded texture bytes without decoding the pixels. */
|
|
631
783
|
static preload(key: AssetKey): Promise<Maybe<TextureAsset>>;
|
|
784
|
+
/** Loads a texture's `.mcmeta` file, or returns `undefined` when no metadata file exists. */
|
|
632
785
|
static getMeta(key: AssetKey): Promise<Maybe<MinecraftTextureMeta>>;
|
|
786
|
+
/** Clears persisted texture metadata. Use {@link Caching.clear} to discard in-memory textures and metadata. */
|
|
633
787
|
static clearCache(): Promise<void>;
|
|
634
788
|
}
|
|
635
789
|
|
|
790
|
+
/** Wraps a browser or Node canvas for pixel reads and writes. All coordinates and dimensions use pixels. */
|
|
636
791
|
declare class CanvasImage implements Disposable {
|
|
637
792
|
readonly canvas: CompatCanvas;
|
|
638
793
|
readonly context: CanvasRenderingContext2D;
|
|
@@ -650,6 +805,7 @@ declare class CanvasImage implements Disposable {
|
|
|
650
805
|
dispose(): void;
|
|
651
806
|
}
|
|
652
807
|
|
|
808
|
+
/** A model's combined texture canvas, per-texture rectangles, and shared animation subscriptions. */
|
|
653
809
|
declare class TextureAtlas implements Disposable {
|
|
654
810
|
readonly model: Model;
|
|
655
811
|
readonly image: CanvasImage;
|
|
@@ -675,11 +831,13 @@ declare class TextureAtlas implements Disposable {
|
|
|
675
831
|
}, hasTransparency: boolean);
|
|
676
832
|
/** Calls subscribers when an animation frame changes; unused atlases do not tick. */
|
|
677
833
|
subscribe(callback: () => void): () => void;
|
|
834
|
+
/** Copies pixels for a texture variable from its current atlas rectangle. */
|
|
678
835
|
getData(texture: string): ImageData$1;
|
|
679
836
|
dispose(): void;
|
|
680
837
|
}
|
|
681
838
|
|
|
682
839
|
declare const DEFAULT_UV: QuadArray;
|
|
840
|
+
/** Maps Minecraft face coordinates to Three.js UVs and builds per-model texture atlases. */
|
|
683
841
|
declare class UVMapper {
|
|
684
842
|
protected static makeUv(uvCoord: number, originalTextureSize: number, actualTextureSize: number): number;
|
|
685
843
|
protected static makeUvCoords([originalTextureWidth, originalTextureHeight]: DoubleArray, [actualTextureWidth, actualTextureHeight]: DoubleArray, [x1, y1, x2, y2]: QuadArray): QuadArray;
|
|
@@ -693,7 +851,10 @@ declare class UVMapper {
|
|
|
693
851
|
static setCubeUvs(geometry: BoxGeometry, originalTextureSize: DoubleArray, actualTextureSize: DoubleArray, faces: ModelFaces): void;
|
|
694
852
|
static facesToUvArray(faces: ModelFaces, originalTextureSize: DoubleArray, actualTextureSize: DoubleArray): number[];
|
|
695
853
|
static facesToUv(faces: ModelFaces, originalTextureSize: DoubleArray, actualTextureSize: DoubleArray): Float32BufferAttribute;
|
|
854
|
+
/** Bounds texture sampling to texel centres without changing cropped face UVs. */
|
|
855
|
+
static setAtlasUvBounds(geometry: BoxGeometry, faces: ModelFaces, atlas: TextureAtlas): void;
|
|
696
856
|
static lockUvs(geometry: BoxGeometry, faces: ModelFaces, atlas: TextureAtlas, rotation: Euler): void;
|
|
857
|
+
/** Returns the shared atlas for a keyed, merged model, creating it on first use. */
|
|
697
858
|
static getAtlas(model: Model): Promise<Maybe<TextureAtlas>>;
|
|
698
859
|
static fillMissingTextureKeys<T>(textures: ModelTextures, target: {
|
|
699
860
|
[k: string]: T;
|
|
@@ -702,8 +863,14 @@ declare class UVMapper {
|
|
|
702
863
|
};
|
|
703
864
|
protected static getFallbackUv(element: ModelElement, faceName: CubeFace): QuadArray;
|
|
704
865
|
protected static expandAndRotateMcUvs([u1, v1, u2, v2]: QuadArray, rotation: number | undefined, actualWidth: number, actualHeight: number): QuadArray<Vector2>;
|
|
866
|
+
/**
|
|
867
|
+
* Combines model textures and animation metadata into an atlas.
|
|
868
|
+
* Mapped UVs are stored on copies of the model's elements, available through the returned atlas.
|
|
869
|
+
* Returns `undefined` for models without a texture map.
|
|
870
|
+
*/
|
|
705
871
|
static createAtlas(originalModel: Model): Promise<Maybe<TextureAtlas>>;
|
|
706
872
|
}
|
|
873
|
+
/** Stores a Minecraft face's UV rectangle and its rotation in degrees. */
|
|
707
874
|
declare class MinecraftFaceUV {
|
|
708
875
|
readonly uv: QuadArray;
|
|
709
876
|
readonly rotation: number;
|
|
@@ -725,22 +892,32 @@ declare class MinecraftFaceUV {
|
|
|
725
892
|
*/
|
|
726
893
|
declare function shutdown(): void;
|
|
727
894
|
|
|
895
|
+
/** Runs queued tasks in bounded batches. Idle executors do not keep a timer running. */
|
|
728
896
|
declare class BatchedExecutor {
|
|
729
897
|
readonly interval: number;
|
|
730
898
|
readonly batch: number;
|
|
731
899
|
private readonly queue;
|
|
900
|
+
/**
|
|
901
|
+
* @param interval - Delay between queue runs, in milliseconds.
|
|
902
|
+
* @param batch - Maximum tasks started per run and maximum tasks active at once.
|
|
903
|
+
*/
|
|
732
904
|
constructor(interval?: number, batch?: number);
|
|
905
|
+
/** Queues a task and resolves with its result, or rejects with its error. */
|
|
733
906
|
submit<T>(task: Task<T>): Promise<T>;
|
|
907
|
+
/** Rejects queued and future tasks. Tasks already running are allowed to finish. */
|
|
734
908
|
stop(): void;
|
|
735
909
|
}
|
|
736
910
|
type Task<T = unknown> = () => T | Promise<T>;
|
|
737
911
|
|
|
738
912
|
declare function prefix(prefix?: string): string;
|
|
739
913
|
|
|
914
|
+
/** Rotates geometry in place around the element's origin. The supplied angle is in degrees. */
|
|
740
915
|
declare function applyElementRotation(rotation: ElementRotation, geometry: BufferGeometry): void;
|
|
916
|
+
/** Rotates an object around a local axis by an angle in degrees. */
|
|
741
917
|
declare function applyGenericRotation(axis: Axis, rotation: number, obj: Object3D): void;
|
|
742
918
|
declare function addBox3WireframeToObject(box: Box3, obj: Object3D, color?: number, w?: number): void;
|
|
743
919
|
declare function addWireframeToObject(obj: Object3D, color?: number, w?: number): void;
|
|
920
|
+
/** Adds edge and axis helpers to a mesh and returns a function that disposes their resources. */
|
|
744
921
|
declare function addWireframeToMesh(geo: BufferGeometry, mesh: Mesh, color?: number, w?: number): () => void;
|
|
745
922
|
|
|
746
923
|
declare function captureException(e: any, ...extra: any[]): void;
|
|
@@ -763,9 +940,13 @@ declare enum AssetParser {
|
|
|
763
940
|
JSON = "json"
|
|
764
941
|
}
|
|
765
942
|
|
|
943
|
+
/** An asset provider registered with {@link AssetLoader.addSource}. */
|
|
766
944
|
declare abstract class AssetSource {
|
|
767
945
|
protected constructor();
|
|
946
|
+
/** Returns a parsed asset, or `undefined` to allow fallback. Load and parse failures should reject. */
|
|
768
947
|
abstract get<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<Maybe<T>>;
|
|
948
|
+
/** Whether this source prevents lower-priority sources from supplying the key. Its own assets remain available. */
|
|
949
|
+
blocks(key: AssetKey): boolean | Promise<boolean>;
|
|
769
950
|
/**
|
|
770
951
|
* Identifies this source's content across sessions for persistent caching. Sources that
|
|
771
952
|
* cannot tell whether their content changed (an unnamed archive, for example) return
|
|
@@ -782,12 +963,15 @@ declare class AssetLoadError extends Error {
|
|
|
782
963
|
constructor(source: AssetSource, key: AssetKey, path: string, cause: unknown);
|
|
783
964
|
}
|
|
784
965
|
|
|
966
|
+
/** Loads assets from a shared, ordered registry of hosted sources and resource packs. */
|
|
785
967
|
declare class AssetLoader {
|
|
968
|
+
/** Default asset base URL. Use {@link setVersion} to select a Minecraft version. */
|
|
786
969
|
static ROOT: string;
|
|
787
970
|
private static _SOURCES;
|
|
788
971
|
/** Used when a registered source cannot identify its content, so nothing persists past this session. */
|
|
789
972
|
private static readonly SESSION_SCOPE;
|
|
790
973
|
static get version(): string;
|
|
974
|
+
/** Selects an mcasset.cloud version, updates the vanilla source, and clears in-memory caches. */
|
|
791
975
|
static setVersion(version: string): void;
|
|
792
976
|
/**
|
|
793
977
|
* Scope for persistent cache keys. Empty with only the default vanilla sources, so their
|
|
@@ -797,8 +981,17 @@ declare class AssetLoader {
|
|
|
797
981
|
static get persistentScope(): string;
|
|
798
982
|
/** Prefixes a persistent cache key with the current source scope. */
|
|
799
983
|
static persistentKey(key: string): string;
|
|
984
|
+
/**
|
|
985
|
+
* Registers a source at the highest priority.
|
|
986
|
+
* Call {@link Caching.clear} after changing sources to discard previously loaded assets.
|
|
987
|
+
*
|
|
988
|
+
* @param key - Name used to replace or remove this source.
|
|
989
|
+
* @param override - Removes the first source with this name before adding the new one.
|
|
990
|
+
*/
|
|
800
991
|
static addSource(key: string, source: AssetSource, override?: boolean): void;
|
|
992
|
+
/** Removes and returns the first source with this name. Call {@link Caching.clear} to reload assets. */
|
|
801
993
|
static removeSource(key: string): Maybe<AssetSource>;
|
|
994
|
+
/** Loads from all sources and returns defined results in priority order. Any source failure rejects the call. */
|
|
802
995
|
static getAll<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<T[]>;
|
|
803
996
|
/** Returns the first defined result in source-priority order, without merging assets. */
|
|
804
997
|
static get<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<Maybe<T>>;
|
|
@@ -809,6 +1002,7 @@ declare class AssetLoader {
|
|
|
809
1002
|
}>>;
|
|
810
1003
|
}
|
|
811
1004
|
|
|
1005
|
+
/** A Java blockstate file that selects models through variants or multipart conditions. */
|
|
812
1006
|
interface BlockState extends MinecraftAsset {
|
|
813
1007
|
variants?: BlockStateVariants;
|
|
814
1008
|
multipart?: BlockStateMultipart[];
|
|
@@ -816,6 +1010,7 @@ interface BlockState extends MinecraftAsset {
|
|
|
816
1010
|
type BlockStateVariants = {
|
|
817
1011
|
[key: string]: BlockStateVariant | BlockStateVariant[];
|
|
818
1012
|
};
|
|
1013
|
+
/** A model selection with optional x/y rotations in degrees, UV locking, and random-selection weight. */
|
|
819
1014
|
interface BlockStateVariant {
|
|
820
1015
|
model?: string;
|
|
821
1016
|
y?: number;
|
|
@@ -827,6 +1022,7 @@ interface BlockStateMultipart {
|
|
|
827
1022
|
when?: MultipartCondition;
|
|
828
1023
|
apply?: BlockStateVariant | BlockStateVariant[];
|
|
829
1024
|
}
|
|
1025
|
+
/** Property tests combined with AND or OR. A property value such as `north|south` accepts either value. */
|
|
830
1026
|
type MultipartCondition = Record<string, string> | {
|
|
831
1027
|
OR: MultipartCondition[];
|
|
832
1028
|
} | {
|
|
@@ -835,16 +1031,20 @@ type MultipartCondition = Record<string, string> | {
|
|
|
835
1031
|
|
|
836
1032
|
declare const DEFAULT_ROOT = "https://assets.mcasset.cloud/1.21.11";
|
|
837
1033
|
declare const DEFAULT_NAMESPACE = "minecraft";
|
|
1034
|
+
/** Convenience accessors for model and blockstate loading. */
|
|
838
1035
|
declare class Assets {
|
|
839
1036
|
/**
|
|
840
1037
|
* @deprecated
|
|
841
1038
|
*/
|
|
842
1039
|
static parseAssetKey(assetType: AssetType, str: string, origin?: AssetKey): AssetKey;
|
|
1040
|
+
/** Loads a model with its parent chain resolved. See {@link Models.getMerged}. */
|
|
843
1041
|
static getModel(key: AssetKey): Promise<Maybe<Model>>;
|
|
1042
|
+
/** Loads a blockstate definition. See {@link BlockStates.get}. */
|
|
844
1043
|
static getBlockState(key: AssetKey): Promise<Maybe<BlockState>>;
|
|
845
1044
|
}
|
|
846
1045
|
|
|
847
1046
|
type BlockStatePropertyValue = string | boolean | number;
|
|
1047
|
+
/** A vanilla block property's default and allowed values, loaded through {@link BlockStates.getDefaultState}. */
|
|
848
1048
|
interface BlockStateProperty {
|
|
849
1049
|
default: BlockStatePropertyValue;
|
|
850
1050
|
type: "boolean" | "int" | "enum";
|
|
@@ -854,6 +1054,7 @@ interface BlockStateProperty {
|
|
|
854
1054
|
type BlockStatePropertyDefaults = {
|
|
855
1055
|
[key: string]: BlockStateProperty;
|
|
856
1056
|
};
|
|
1057
|
+
/** Block property values, such as `{ facing: "north", waterlogged: "false" }`. */
|
|
857
1058
|
type BlockStateProperties = {
|
|
858
1059
|
[key: string]: string;
|
|
859
1060
|
};
|
|
@@ -876,6 +1077,7 @@ type BlockEntityRotation = {
|
|
|
876
1077
|
property: string;
|
|
877
1078
|
step: number;
|
|
878
1079
|
};
|
|
1080
|
+
/** Models and state-dependent placement for one block ID in the block-entity index. */
|
|
879
1081
|
interface BlockEntityEntry {
|
|
880
1082
|
parts: BlockEntityPart[];
|
|
881
1083
|
rotation?: BlockEntityRotation;
|
|
@@ -886,12 +1088,14 @@ interface BlockEntityEntry {
|
|
|
886
1088
|
type BlockEntityIndex = MinecraftAsset & {
|
|
887
1089
|
[block: string]: BlockEntityEntry;
|
|
888
1090
|
};
|
|
1091
|
+
/** Parts and placement selected by {@link BlockEntities.resolve} for a block's properties. */
|
|
889
1092
|
interface ResolvedBlockEntity {
|
|
890
1093
|
parts: BlockEntityPart[];
|
|
891
1094
|
/** Degrees counter-clockwise seen from above, about the block's vertical centre axis. */
|
|
892
1095
|
rotation: number;
|
|
893
1096
|
translation: TripleArray;
|
|
894
1097
|
}
|
|
1098
|
+
/** Resolves blockstate properties into the entity models used to draw chests, beds, and other block entities. */
|
|
895
1099
|
declare class BlockEntities {
|
|
896
1100
|
/**
|
|
897
1101
|
* Loads the block index of a version. Versions and sources without one yield an empty index, and so does
|
|
@@ -907,14 +1111,19 @@ declare class BlockEntities {
|
|
|
907
1111
|
static matrix(resolved: ResolvedBlockEntity, matrix?: Matrix4): Matrix4;
|
|
908
1112
|
}
|
|
909
1113
|
|
|
1114
|
+
/** Loads blockstate definitions and the property defaults used to select block models. */
|
|
910
1115
|
declare class BlockStates {
|
|
911
1116
|
private static _persistentCache;
|
|
912
1117
|
private static get PERSISTENT_CACHE();
|
|
1118
|
+
/** Returns blockstate filenames from the selected version's `_list.json`, or an empty list. */
|
|
913
1119
|
static getList(): Promise<string[]>;
|
|
914
1120
|
static getDefaultStates(): Promise<Maybe<DefaultBlockStates>>;
|
|
1121
|
+
/** Looks up vanilla property definitions for the key's block path, or returns `undefined`. */
|
|
915
1122
|
static getDefaultState(key: AssetKey): Promise<Maybe<BlockStatePropertyDefaults>>;
|
|
1123
|
+
/** Loads a cached blockstate definition for {@link MineRenderScene.addBlock}, or returns `undefined`. */
|
|
916
1124
|
static get(key: AssetKey): Promise<Maybe<BlockState>>;
|
|
917
1125
|
static getAll(keys: AssetKey[] | Iterable<AssetKey>): Promise<Maybe<BlockState>[]>;
|
|
1126
|
+
/** Clears persisted blockstates. Use {@link Caching.clear} to also discard in-memory assets. */
|
|
918
1127
|
static clearCache(): Promise<void>;
|
|
919
1128
|
}
|
|
920
1129
|
declare class DefaultBlockStates implements MinecraftAsset {
|
|
@@ -926,6 +1135,7 @@ interface EntityAnimationFile extends MinecraftAsset {
|
|
|
926
1135
|
id: string;
|
|
927
1136
|
animations: Record<string, EntityAnimation>;
|
|
928
1137
|
}
|
|
1138
|
+
/** A clip of pose offsets, played with {@link EntityObject.playAnimation} or sampled directly. */
|
|
929
1139
|
interface EntityAnimation {
|
|
930
1140
|
/** Seconds. */
|
|
931
1141
|
length: number;
|
|
@@ -938,6 +1148,7 @@ interface EntityAnimation {
|
|
|
938
1148
|
type EntityAnimationChannel = "position" | "rotation" | "scale";
|
|
939
1149
|
/** Keyframes in time order per channel. */
|
|
940
1150
|
type EntityAnimationBone = Partial<Record<EntityAnimationChannel, EntityAnimationKeyframe[]>>;
|
|
1151
|
+
/** One timed offset for a part's position, rotation, or scale channel. */
|
|
941
1152
|
interface EntityAnimationKeyframe {
|
|
942
1153
|
/** Seconds. */
|
|
943
1154
|
time: number;
|
|
@@ -961,24 +1172,39 @@ declare function entityAnimationTime(animation: EntityAnimation, time: number, l
|
|
|
961
1172
|
/** Samples every bone and channel of an animation at `time` seconds. */
|
|
962
1173
|
declare function sampleEntityAnimation(animation: EntityAnimation, time: number, loop?: boolean): EntityAnimationPose;
|
|
963
1174
|
|
|
1175
|
+
/** Loads entity and block-entity geometry, texture selections, and animation clips from the dataset. */
|
|
964
1176
|
declare class Entities {
|
|
1177
|
+
/** Lists model paths in the `minecraft` namespace, including subdirectories and excluding `.json`. */
|
|
965
1178
|
static getEntityList(): Promise<string[]>;
|
|
966
1179
|
private static getModelFile;
|
|
1180
|
+
/** Returns selectable geometry-layer names, or an empty list when the model is missing. */
|
|
967
1181
|
static getLayerList(modelKey: BasicAssetKey): Promise<string[]>;
|
|
968
1182
|
/** The dataset's extra draws on top of `main`; their `when` labels are the states `EntityModelOptions.when` can enable. */
|
|
969
1183
|
static getPassList(modelKey: BasicAssetKey): Promise<EntityModelPass[]>;
|
|
1184
|
+
/**
|
|
1185
|
+
* Loads the layers and textures to pass to {@link MineRenderScene.addEntity}.
|
|
1186
|
+
* By default, selects `main`, unconditional passes, and passes enabled by `options.when`.
|
|
1187
|
+
*
|
|
1188
|
+
* @param modelKey - Dataset model, such as `new BasicAssetKey("minecraft", "zombie")`.
|
|
1189
|
+
* @param textureKey - Texture override for the first selected layer.
|
|
1190
|
+
* @param options - Layer selection, conditional passes, and per-layer texture overrides.
|
|
1191
|
+
* @returns The selected model, or `undefined` when its dataset file is missing.
|
|
1192
|
+
*/
|
|
970
1193
|
static getEntity(modelKey: BasicAssetKey, textureKey?: BasicAssetKey, options?: EntityModelOptions): Promise<Maybe<EntityModel>>;
|
|
971
1194
|
/**
|
|
972
1195
|
* Native and sampled vanilla clips by name, or undefined when the model or selected version has none.
|
|
973
1196
|
*/
|
|
974
1197
|
static getAnimations(modelKey: BasicAssetKey): Promise<Maybe<Record<string, EntityAnimation>>>;
|
|
1198
|
+
/** Finds a fallback texture using the model path, its directory, and vanilla variant data. */
|
|
975
1199
|
static resolveTexture(modelKey: BasicAssetKey): Promise<Maybe<AssetKey>>;
|
|
976
1200
|
/** @deprecated Use getEntityList(); block entities share the entity dataset. */
|
|
977
1201
|
static getBlockList(): Promise<string[]>;
|
|
978
1202
|
/** @deprecated Use getEntity(); block entities share the entity dataset. */
|
|
979
1203
|
static getBlock(modelKey: BasicAssetKey, textureKey?: BasicAssetKey, options?: EntityModelOptions): Promise<Maybe<EntityModel>>;
|
|
980
1204
|
}
|
|
1205
|
+
/** Selection settings passed as the third argument to {@link Entities.getEntity}. */
|
|
981
1206
|
interface EntityModelOptions {
|
|
1207
|
+
/** Selects one geometry layer without dataset passes. `layers` takes precedence when supplied. */
|
|
982
1208
|
layer?: string;
|
|
983
1209
|
/** Layer names in draw order; an explicit selection draws exactly these layers and no dataset passes. */
|
|
984
1210
|
layers?: string[];
|
|
@@ -991,6 +1217,7 @@ interface EntityModelOptions {
|
|
|
991
1217
|
textures?: Record<string, BasicAssetKey>;
|
|
992
1218
|
}
|
|
993
1219
|
|
|
1220
|
+
/** A glyph's source pixels and layout metrics. Glyphs without an image contribute spacing only. */
|
|
994
1221
|
interface BitmapGlyph {
|
|
995
1222
|
image?: CompatCanvas;
|
|
996
1223
|
/** Source rectangle in the bitmap sheet, before applying scale. */
|
|
@@ -1002,48 +1229,92 @@ interface BitmapGlyph {
|
|
|
1002
1229
|
ascent: number;
|
|
1003
1230
|
advance: number;
|
|
1004
1231
|
}
|
|
1232
|
+
/** Character-to-glyph lookup assembled from the active resource-pack fonts. */
|
|
1005
1233
|
interface BitmapFont {
|
|
1006
1234
|
glyphs: Map<string, BitmapGlyph>;
|
|
1007
1235
|
}
|
|
1236
|
+
/** Loads Minecraft bitmap, space, and reference font providers for GUI text. */
|
|
1008
1237
|
declare class Fonts {
|
|
1238
|
+
/** Combines font definitions in source-priority order. Unsupported Unihex and TrueType providers are skipped. */
|
|
1009
1239
|
static get(key?: AssetKey | string): Promise<BitmapFont>;
|
|
1010
1240
|
private static relatedKey;
|
|
1011
1241
|
private static load;
|
|
1012
1242
|
private static bitmap;
|
|
1013
1243
|
}
|
|
1014
1244
|
|
|
1245
|
+
/** Caller-supplied item-preview state passed to {@link Models.getMerged}. */
|
|
1246
|
+
interface ItemModelContext {
|
|
1247
|
+
/** Context used by display-context selectors, overriding `properties`. Defaults to GUI. */
|
|
1248
|
+
displayContext?: DisplayPosition | "none";
|
|
1249
|
+
/** Explicit property overrides. Nodes with the same ID share one override, regardless of their parameters. */
|
|
1250
|
+
properties?: Record<string, boolean | string | number>;
|
|
1251
|
+
/** Supplied component JSON by ID. Item-registry defaults are not added; component selectors compare structural JSON values. */
|
|
1252
|
+
components?: Record<string, unknown>;
|
|
1253
|
+
/** Stack count, as a nonnegative integer. Defaults to 1; absent `max_stack_size` also defaults to 1. */
|
|
1254
|
+
count?: number;
|
|
1255
|
+
/** Item-model keys by reference-node ID, such as `minecraft:bundle/selected_item`. Unset references draw nothing. */
|
|
1256
|
+
itemReferences?: Record<string, AssetKey>;
|
|
1257
|
+
}
|
|
1258
|
+
/** Loads and caches Java block/item models, including inherited geometry and textures. */
|
|
1015
1259
|
declare class Models {
|
|
1016
1260
|
private static _persistentCache;
|
|
1017
1261
|
private static get PERSISTENT_CACHE();
|
|
1262
|
+
/** Lists item filenames from the asset source's `_list.json`, with a legacy model-directory fallback. */
|
|
1018
1263
|
static getItemList(): Promise<string[]>;
|
|
1019
|
-
static loadAndMerge(key: AssetKey): Promise<Maybe<Model>>;
|
|
1264
|
+
static loadAndMerge(key: AssetKey, context?: ItemModelContext): Promise<Maybe<Model>>;
|
|
1020
1265
|
private static getItemModel;
|
|
1021
|
-
private static
|
|
1266
|
+
private static contextIdentifier;
|
|
1267
|
+
private static snapshotContext;
|
|
1268
|
+
private static contextKey;
|
|
1269
|
+
private static snapshotJson;
|
|
1270
|
+
private static propertyValue;
|
|
1271
|
+
private static selectItemModel;
|
|
1272
|
+
/** Loads one model file without resolving its parents. Returns `undefined` when the file is missing. */
|
|
1022
1273
|
static getRaw(key: AssetKey): Promise<Maybe<Model>>;
|
|
1023
|
-
|
|
1024
|
-
|
|
1274
|
+
/**
|
|
1275
|
+
* Loads a model and resolves its parent chain. Returns `undefined` when the model is missing.
|
|
1276
|
+
* Item keys default to GUI context and a stack count of 1. Unresolved conditions are false and numeric properties are zero.
|
|
1277
|
+
* Pass `context` to supply component values, property overrides, and item references for a preview.
|
|
1278
|
+
* Composite items retain independently merged children in `ItemModel.parts`.
|
|
1279
|
+
*
|
|
1280
|
+
* @param key - Model key, for example `AssetKey.parse("models", "minecraft:item/diamond_sword")`.
|
|
1281
|
+
*/
|
|
1282
|
+
static getMerged(key: AssetKey, context?: ItemModelContext): Promise<Maybe<Model>>;
|
|
1283
|
+
/** Alias for {@link getMerged}. */
|
|
1284
|
+
static get(key: AssetKey, context?: ItemModelContext): Promise<Maybe<Model>>;
|
|
1285
|
+
/** Clears persisted models. Use {@link Caching.clear} to also discard in-memory assets. */
|
|
1025
1286
|
static clearCache(): Promise<void>;
|
|
1026
1287
|
}
|
|
1027
1288
|
|
|
1289
|
+
/** Resolves Minecraft display poses and applies them to model geometry. */
|
|
1028
1290
|
declare class DisplayTransforms {
|
|
1029
1291
|
/** Resolve hand fallbacks within one model, before inheriting parent display entries. */
|
|
1030
1292
|
static withHandFallbacks(display: Model["display"]): Model["display"];
|
|
1031
1293
|
/** Build a display pose for geometry already centered at the model's [8, 8, 8] pivot. */
|
|
1032
1294
|
static getMatrix(display: Model["display"], position: DisplayPosition): Matrix4;
|
|
1295
|
+
/** Transforms geometry in place and reverses triangle winding when the matrix reflects it. */
|
|
1033
1296
|
static apply(geometry: BufferGeometry, matrix: Matrix4): void;
|
|
1034
1297
|
}
|
|
1035
1298
|
|
|
1299
|
+
/** Resolves item-preview colors from vanilla tint definitions, stack components, and caller overrides. */
|
|
1036
1300
|
declare class ItemTints {
|
|
1037
1301
|
/** Resolves preview colors from item definitions; explicit per-index colors take precedence. */
|
|
1038
1302
|
static get(model: Model, tints?: Record<number, number>): Promise<Record<number, number> | undefined>;
|
|
1303
|
+
private static componentField;
|
|
1304
|
+
private static colorOrDefault;
|
|
1305
|
+
private static componentColor;
|
|
1039
1306
|
private static rgb;
|
|
1040
1307
|
}
|
|
1041
1308
|
|
|
1309
|
+
/** Identifies fully opaque cubes and maps neighbor visibility to model-local face masks. */
|
|
1042
1310
|
declare class ModelCulling {
|
|
1311
|
+
/** Rotates a world-direction bit mask into model space. Bits follow {@link CUBE_FACES}. */
|
|
1043
1312
|
static toLocalMask(worldMask: number, rotation: Euler): number;
|
|
1313
|
+
/** Whether a model fills one block with opaque faces and can hide adjacent block faces. */
|
|
1044
1314
|
static isOpaqueFullCube(atlas: Maybe<TextureAtlas>): boolean;
|
|
1045
1315
|
}
|
|
1046
1316
|
|
|
1317
|
+
/** Builds extruded item-model elements from sprite pixels, including edges around transparent regions. */
|
|
1047
1318
|
declare class ModelGenerator {
|
|
1048
1319
|
static readonly ITEM_LAYERS: string[];
|
|
1049
1320
|
/**
|
|
@@ -1053,42 +1324,59 @@ declare class ModelGenerator {
|
|
|
1053
1324
|
static generateItemModel(imageData: Pick<ImageData$1, "width" | "height" | "data">, layer: string): ModelElement[];
|
|
1054
1325
|
}
|
|
1055
1326
|
|
|
1327
|
+
/** Resolves Java model inheritance, with child elements and display poses overriding their parents. */
|
|
1056
1328
|
declare class ModelMerger {
|
|
1329
|
+
/** Loads the parent chain and returns a merged model without modifying the supplied definition. */
|
|
1057
1330
|
static mergeWithParents(model: Model): Promise<Model>;
|
|
1058
1331
|
protected static collectAllParents(model: Model): Promise<Model[]>;
|
|
1059
1332
|
}
|
|
1060
1333
|
|
|
1334
|
+
/** Entity geometry and placement for a special item preview. Named part rotations use radians. */
|
|
1061
1335
|
interface SpecialItemPart {
|
|
1062
1336
|
model: EntityModel;
|
|
1063
1337
|
transform: Matrix4;
|
|
1064
1338
|
rotations: Record<string, TripleArray>;
|
|
1339
|
+
/** Absolute named-part positions in the entity model's coordinate system. */
|
|
1340
|
+
positions?: Record<string, TripleArray>;
|
|
1341
|
+
/** Colors for the entity model's named texture passes. */
|
|
1342
|
+
tints?: Record<string, number>;
|
|
1065
1343
|
}
|
|
1344
|
+
/** Loads entity geometry and texture passes for supported special item previews. */
|
|
1066
1345
|
declare class SpecialItems {
|
|
1067
1346
|
/** Resolves the static entity parts drawn by a special item renderer, in model units. */
|
|
1068
|
-
static getParts(special: SpecialItemRenderer, root?: string): Promise<SpecialItemPart[]>;
|
|
1347
|
+
static getParts(special: SpecialItemRenderer, root?: string, components?: Record<string, unknown>): Promise<SpecialItemPart[]>;
|
|
1069
1348
|
/** An owned material with model-preview shading; its entity texture remains shared. */
|
|
1070
1349
|
static createMaterial(source: MeshBasicMaterial, shade: boolean): MeshBasicMaterial;
|
|
1071
1350
|
}
|
|
1072
1351
|
|
|
1352
|
+
/** Block data passed to world setters. `type` is a namespaced ID such as `minecraft:oak_log`. */
|
|
1073
1353
|
interface Block {
|
|
1074
1354
|
type: string;
|
|
1075
1355
|
properties?: BlockStateProperties;
|
|
1076
1356
|
nbt?: any;
|
|
1077
1357
|
}
|
|
1078
1358
|
|
|
1359
|
+
/** Selects block models from property values, including multipart conditions and weighted alternatives. */
|
|
1079
1360
|
declare class BlockStateResolver {
|
|
1361
|
+
/** Loads vanilla property defaults, falling back to preview values inferred from the blockstate file. */
|
|
1080
1362
|
static defaults(blockState: BlockState): Promise<BlockStateProperties>;
|
|
1363
|
+
/** Selects matching models. Supply `choose` to control selection within each alternatives array. */
|
|
1081
1364
|
static select(blockState: BlockState, state: BlockStateProperties, choose?: (variants: BlockStateVariant | BlockStateVariant[]) => BlockStateVariant): BlockStateVariant[];
|
|
1365
|
+
/** Returns matching model groups before choosing weighted alternatives. */
|
|
1082
1366
|
static matching(blockState: BlockState, state: BlockStateProperties): (BlockStateVariant | BlockStateVariant[])[];
|
|
1367
|
+
/** Selects a random alternative using positive integer weights, each defaulting to 1. */
|
|
1083
1368
|
static choose(variants: BlockStateVariant | BlockStateVariant[]): BlockStateVariant;
|
|
1369
|
+
/** Converts blockstate rotations in degrees into the Euler rotation used by model rendering. */
|
|
1084
1370
|
static rotation(variant: BlockStateVariant): Euler;
|
|
1085
1371
|
}
|
|
1086
1372
|
|
|
1373
|
+
/** Supplies block-preview tint colors from block properties and the active resource pack. */
|
|
1087
1374
|
declare class BlockTints {
|
|
1088
1375
|
/** Resolves block preview colors without biome context; explicit tints take precedence. */
|
|
1089
1376
|
static get(key: AssetKey | undefined, state: BlockStateProperties, model: Model, tints?: Record<number, number>): Promise<Record<number, number> | undefined>;
|
|
1090
1377
|
}
|
|
1091
1378
|
|
|
1379
|
+
/** A model that owns reusable instance slots and exposes per-slot transforms to {@link InstanceReference}. */
|
|
1092
1380
|
interface Instanceable {
|
|
1093
1381
|
nextInstance(): InstanceReference<SceneObject>;
|
|
1094
1382
|
removeInstanceAt(index: number): void;
|
|
@@ -1106,6 +1394,10 @@ interface Instanceable {
|
|
|
1106
1394
|
}
|
|
1107
1395
|
declare function isInstanceable(obj: any): obj is Instanceable;
|
|
1108
1396
|
|
|
1397
|
+
/**
|
|
1398
|
+
* Controls one placement of a shared model. Transform methods affect only this instance.
|
|
1399
|
+
* After {@link removeFromScene} or {@link dispose}, accessing its transforms throws.
|
|
1400
|
+
*/
|
|
1109
1401
|
declare class InstanceReference<T extends Instanceable> implements Transformable, Disposable {
|
|
1110
1402
|
readonly instanceable: T;
|
|
1111
1403
|
readonly index: number;
|
|
@@ -1113,11 +1405,14 @@ declare class InstanceReference<T extends Instanceable> implements Transformable
|
|
|
1113
1405
|
constructor(instanceable: T, index: number);
|
|
1114
1406
|
nextInstance(): InstanceReference<SceneObject>;
|
|
1115
1407
|
private get activeInstanceable();
|
|
1408
|
+
/** Releases this placement's slot for reuse. Repeated calls have no effect. */
|
|
1116
1409
|
removeFromScene(): void;
|
|
1117
1410
|
dispose(): void;
|
|
1118
1411
|
getMatrix(matrix?: Matrix4): Matrix4;
|
|
1119
1412
|
setMatrix(matrix: Matrix4): void;
|
|
1413
|
+
/** Hides or restores this placement while preserving its transform and allocated slot. */
|
|
1120
1414
|
setVisible(visible: boolean): void;
|
|
1415
|
+
/** Updates the supplied transform components. Positions use scene units and rotations use radians. */
|
|
1121
1416
|
setPositionRotationScale(position?: Vector3, rotation?: Euler, scale?: Vector3): void;
|
|
1122
1417
|
setPosition(position: Vector3): void;
|
|
1123
1418
|
getPosition(): Vector3;
|
|
@@ -1128,13 +1423,18 @@ declare class InstanceReference<T extends Instanceable> implements Transformable
|
|
|
1128
1423
|
}
|
|
1129
1424
|
declare function isInstanceReference(obj: any): obj is InstanceReference<any>;
|
|
1130
1425
|
|
|
1426
|
+
/** Shared settings passed to scene-object constructors or the scene's `addModel` and `addBlock` methods. */
|
|
1131
1427
|
interface SceneObjectOptions {
|
|
1132
1428
|
wireframe: boolean;
|
|
1429
|
+
/** Combines compatible model elements into one geometry. */
|
|
1133
1430
|
mergeMeshes: boolean;
|
|
1431
|
+
/** Allows compatible models to share geometry through instance references. */
|
|
1134
1432
|
instanceMeshes: boolean;
|
|
1433
|
+
/** Initial instance capacity. Buffers grow when more placements are added. */
|
|
1135
1434
|
maxInstanceCount: number;
|
|
1136
1435
|
}
|
|
1137
1436
|
|
|
1437
|
+
/** Builds render geometry from a merged Java model. Create it through {@link MineRenderScene.addModel}. */
|
|
1138
1438
|
declare class ModelObject extends SceneObject {
|
|
1139
1439
|
readonly originalModel: Model;
|
|
1140
1440
|
readonly isModelObject: true;
|
|
@@ -1145,6 +1445,7 @@ declare class ModelObject extends SceneObject {
|
|
|
1145
1445
|
private atlasTexture?;
|
|
1146
1446
|
private unsubscribeAtlas?;
|
|
1147
1447
|
private readonly specialMaterials;
|
|
1448
|
+
private readonly geometries;
|
|
1148
1449
|
blockParent: Maybe<BlockObject>;
|
|
1149
1450
|
private meshesCreated;
|
|
1150
1451
|
constructor(originalModel: Model, options?: Partial<ModelObjectOptions>);
|
|
@@ -1159,26 +1460,31 @@ declare class ModelObject extends SceneObject {
|
|
|
1159
1460
|
removeInstanceAt(index: number): void;
|
|
1160
1461
|
disposeAndRemoveAllChildren(): void;
|
|
1161
1462
|
}
|
|
1463
|
+
/** Model settings passed to `scene.addModel(model, options)` or the ModelObject constructor. */
|
|
1162
1464
|
interface ModelObjectOptions extends SceneObjectOptions {
|
|
1163
1465
|
/** Minecraft display pose applied around the model center, before scene transforms. */
|
|
1164
1466
|
displayPosition?: DisplayPosition;
|
|
1165
1467
|
/** Quarter-turn block rotation in radians to compensate when locking UVs. */
|
|
1166
1468
|
uvLockRotation?: TripleArray;
|
|
1167
|
-
/** sRGB 0xRRGGBB colors by face tint index
|
|
1469
|
+
/** sRGB 0xRRGGBB colors by face tint index, overriding automatic item or block preview colors. */
|
|
1168
1470
|
tints?: Record<number, number>;
|
|
1169
1471
|
/** Hidden neighbor directions in CUBE_FACES order, before the model's block rotation. */
|
|
1170
1472
|
cullMask?: number;
|
|
1171
1473
|
}
|
|
1172
1474
|
declare function isModelObject(obj: any): obj is ModelObject;
|
|
1173
1475
|
|
|
1476
|
+
/** Shares initialized model objects by cache key and allocates references to their placements. */
|
|
1174
1477
|
declare class InstanceManager {
|
|
1175
1478
|
readonly isInstanceManager: true;
|
|
1176
1479
|
protected readonly instanceCache: {
|
|
1177
1480
|
[key: string]: Promise<InstanceReference<SceneObject>>;
|
|
1178
1481
|
};
|
|
1179
1482
|
constructor();
|
|
1483
|
+
/** Allocates a new placement of a cached model, or returns `undefined` if the key is unknown. */
|
|
1180
1484
|
get<T extends SceneObject>(key: string): Promise<Maybe<InstanceReference<T>>>;
|
|
1485
|
+
/** Allocates a placement, calling the supplier once when the shared model is first needed. */
|
|
1181
1486
|
getOrCreate<T extends SceneObject>(key: string, supplier: () => T | Promise<T>): Promise<InstanceReference<T>>;
|
|
1487
|
+
/** Forgets cached models without disposing them or releasing their existing placements. */
|
|
1182
1488
|
reset(): void;
|
|
1183
1489
|
}
|
|
1184
1490
|
declare function isInstanceManager(obj: any): obj is InstanceManager;
|
|
@@ -1216,6 +1522,14 @@ declare class SkinObject extends SceneObject {
|
|
|
1216
1522
|
init(): Promise<void>;
|
|
1217
1523
|
protected removeMeshes(): void;
|
|
1218
1524
|
protected createMeshes(): void;
|
|
1525
|
+
/**
|
|
1526
|
+
* Loads a skin texture, detecting slim arms and legacy layouts by default.
|
|
1527
|
+
* To override detection, set `slim` or `legacy` in the options passed to
|
|
1528
|
+
* `new SkinObject(options)` or `scene.addSkin(src, options)`.
|
|
1529
|
+
* Use {@link setSlim} or {@link setLegacy} to change these settings later.
|
|
1530
|
+
*
|
|
1531
|
+
* @param src - URL of the skin texture.
|
|
1532
|
+
*/
|
|
1219
1533
|
setSkinTexture(src: string): Promise<void>;
|
|
1220
1534
|
/** Load a cape texture in the selected layout, or pass undefined to remove the cape. */
|
|
1221
1535
|
setCapeTexture(src?: string, layout?: CapeLayout): Promise<void>;
|
|
@@ -1227,11 +1541,15 @@ declare class SkinObject extends SceneObject {
|
|
|
1227
1541
|
dispose(): void;
|
|
1228
1542
|
protected getBoxGeometry(part: SkinPart): BoxGeometry;
|
|
1229
1543
|
}
|
|
1544
|
+
/** Player settings passed to `new SkinObject(options)` or `scene.addSkin(src, options)`. */
|
|
1230
1545
|
interface SkinObjectOptions extends SceneObjectOptions {
|
|
1546
|
+
/** Forces slim (`true`) or classic (`false`) arms. Omit it to detect the model from the texture. */
|
|
1231
1547
|
slim?: boolean;
|
|
1548
|
+
/** Forces the legacy (`true`) or modern (`false`) texture layout. Omit it to detect the layout. */
|
|
1232
1549
|
legacy?: boolean;
|
|
1233
1550
|
}
|
|
1234
1551
|
|
|
1552
|
+
/** Playback settings passed to {@link EntityObject.playAnimation}, {@link EntityObject.playAnimations}, or {@link EntityAnimationPlayer.play}. */
|
|
1235
1553
|
interface EntityAnimationOptions {
|
|
1236
1554
|
/** Overrides the animation's own `loop` flag. */
|
|
1237
1555
|
loop?: boolean;
|
|
@@ -1262,11 +1580,14 @@ declare class EntityAnimationPlayer {
|
|
|
1262
1580
|
stop(): boolean;
|
|
1263
1581
|
/** Forgets the animation without touching the parts, for parts that no longer exist. */
|
|
1264
1582
|
clear(): void;
|
|
1583
|
+
/** Applies the pose at an absolute playback time. Returns `false` when no clip is active. */
|
|
1265
1584
|
setTime(seconds: number): boolean;
|
|
1585
|
+
/** Advances playback by elapsed seconds multiplied by the speed passed to {@link play}. */
|
|
1266
1586
|
advance(deltaSeconds: number): boolean;
|
|
1267
1587
|
private apply;
|
|
1268
1588
|
}
|
|
1269
1589
|
|
|
1590
|
+
/** Renders selected entity layers as named part groups. Create it through {@link MineRenderScene.addEntity}. */
|
|
1270
1591
|
declare class EntityObject extends SceneObject {
|
|
1271
1592
|
readonly entity: EntityModel;
|
|
1272
1593
|
readonly isEntityObject: true;
|
|
@@ -1310,8 +1631,11 @@ declare class EntityObject extends SceneObject {
|
|
|
1310
1631
|
setAnimationTime(seconds: number): void;
|
|
1311
1632
|
/** Advances the animation by a frame delta in seconds, scaled by its speed. Has no effect without an animation. */
|
|
1312
1633
|
advanceAnimation(deltaSeconds: number): void;
|
|
1634
|
+
/** Finds a selected draw by its layer key, such as `main` or `main#2`, or returns `undefined`. */
|
|
1313
1635
|
getLayerGroup(name: string): Maybe<Object3D>;
|
|
1636
|
+
/** Finds a part name without `group:`. Supply `layerName` to restrict the search to one draw. */
|
|
1314
1637
|
getGroupByName(name: string, layerName?: string): Maybe<Object3D>;
|
|
1638
|
+
/** Finds a mesh name without `mesh:`. Supply `layerName` to restrict the search to one draw. */
|
|
1315
1639
|
getMeshByName(name: string, layerName?: string): Maybe<Mesh>;
|
|
1316
1640
|
private get entityLayers();
|
|
1317
1641
|
private getTextureKey;
|
|
@@ -1320,6 +1644,7 @@ declare class EntityObject extends SceneObject {
|
|
|
1320
1644
|
private createPart;
|
|
1321
1645
|
protected applyTextures(): Promise<void>;
|
|
1322
1646
|
}
|
|
1647
|
+
/** Render settings passed to `scene.addEntity(entity, options)` or the EntityObject constructor. */
|
|
1323
1648
|
interface EntityObjectOptions extends SceneObjectOptions {
|
|
1324
1649
|
/**
|
|
1325
1650
|
* `true` applies only vanilla's entity flip, scale (-1, -1, 1); `false` keeps raw model space.
|
|
@@ -1331,17 +1656,20 @@ interface EntityObjectOptions extends SceneObjectOptions {
|
|
|
1331
1656
|
}
|
|
1332
1657
|
declare function isEntityObject(obj: any): obj is EntityObject;
|
|
1333
1658
|
|
|
1659
|
+
/** Text appearance set on a GUI text layer or overridden by an individual text run. */
|
|
1334
1660
|
interface GuiTextStyle {
|
|
1335
1661
|
/** sRGB 0xRRGGBB; defaults to white. */
|
|
1336
1662
|
color?: number;
|
|
1337
1663
|
bold?: boolean;
|
|
1338
1664
|
italic?: boolean;
|
|
1339
1665
|
}
|
|
1666
|
+
/** A text segment with optional style overrides within {@link GuiText}. */
|
|
1340
1667
|
interface GuiTextRun extends GuiTextStyle {
|
|
1341
1668
|
text: string;
|
|
1342
1669
|
}
|
|
1343
1670
|
/** Literal text, or styled runs. Newlines are preserved. */
|
|
1344
1671
|
type GuiText = string | readonly GuiTextRun[];
|
|
1672
|
+
/** Text layout settings set on a GUI text layer or passed to {@link layoutGuiText}. */
|
|
1345
1673
|
interface GuiTextOptions extends GuiTextStyle {
|
|
1346
1674
|
/** Font resource ID; defaults to minecraft:default. */
|
|
1347
1675
|
font?: AssetKey | string;
|
|
@@ -1352,6 +1680,7 @@ interface GuiTextOptions extends GuiTextStyle {
|
|
|
1352
1680
|
/** Distance between line origins; defaults to 9 GUI pixels. */
|
|
1353
1681
|
lineHeight?: number;
|
|
1354
1682
|
}
|
|
1683
|
+
/** One measured glyph and its position in GUI pixels, produced by {@link layoutGuiText}. */
|
|
1355
1684
|
interface PositionedGuiGlyph {
|
|
1356
1685
|
character: string;
|
|
1357
1686
|
glyph?: BitmapGlyph;
|
|
@@ -1360,6 +1689,7 @@ interface PositionedGuiGlyph {
|
|
|
1360
1689
|
advance: number;
|
|
1361
1690
|
style: Required<GuiTextStyle>;
|
|
1362
1691
|
}
|
|
1692
|
+
/** Measured glyphs, line widths, and overall dimensions in GUI pixels. */
|
|
1363
1693
|
interface GuiTextLayout {
|
|
1364
1694
|
glyphs: PositionedGuiGlyph[];
|
|
1365
1695
|
lineWidths: number[];
|
|
@@ -1383,21 +1713,30 @@ interface GuiLayerLayout {
|
|
|
1383
1713
|
/** Output size; defaults to native texture/text dimensions, and [16, 16] for items. */
|
|
1384
1714
|
size?: [number, number];
|
|
1385
1715
|
}
|
|
1716
|
+
/** A texture layer for {@link MineRenderScene.addGui}. Uncropped textures use their `.mcmeta` scaling rules. */
|
|
1386
1717
|
interface GuiTextureLayer extends GuiLayerLayout {
|
|
1387
1718
|
texture: AssetKey | string;
|
|
1388
1719
|
/** Source-image pixels: [x, y, width, height], measured from the top left. Crops ignore sprite scaling. */
|
|
1389
1720
|
crop?: [number, number, number, number];
|
|
1390
1721
|
}
|
|
1722
|
+
/** An item preview in a 16×16 GUI slot by default, with optional tint overrides. */
|
|
1391
1723
|
interface GuiItemLayer extends GuiLayerLayout {
|
|
1392
1724
|
/** Model key, such as minecraft:item/stone; uses the model's GUI display pose. */
|
|
1393
1725
|
item: AssetKey | string;
|
|
1394
|
-
/**
|
|
1726
|
+
/** Supplied item state. GUI layers always select models in the GUI display context. */
|
|
1727
|
+
context?: Omit<ItemModelContext, "displayContext">;
|
|
1728
|
+
/** sRGB 0xRRGGBB colors by face tint index, overriding the item's automatic preview colors. */
|
|
1395
1729
|
tints?: Record<number, number>;
|
|
1396
1730
|
}
|
|
1731
|
+
/** A bitmap-text layer. Set font, wrapping, and style directly on the layer object. */
|
|
1397
1732
|
interface GuiTextLayer extends GuiLayerLayout, GuiTextOptions {
|
|
1398
1733
|
text: GuiText;
|
|
1399
1734
|
}
|
|
1400
1735
|
|
|
1736
|
+
/**
|
|
1737
|
+
* Renders ordered texture, item, and text layers. Create it through {@link MineRenderScene.addGui}.
|
|
1738
|
+
* GUI coordinates grow right and down, with one pixel equal to one scene unit.
|
|
1739
|
+
*/
|
|
1401
1740
|
declare class GuiObject extends SceneObject {
|
|
1402
1741
|
readonly textureLayers: readonly GuiLayer[];
|
|
1403
1742
|
readonly isGuiObject: true;
|
|
@@ -1413,10 +1752,12 @@ declare class GuiObject extends SceneObject {
|
|
|
1413
1752
|
private loadMaterial;
|
|
1414
1753
|
disposeAndRemoveAllChildren(): void;
|
|
1415
1754
|
}
|
|
1755
|
+
/** Scene-object settings for `scene.addGui(layers, options)`. GUI objects disable instancing and mesh merging. */
|
|
1416
1756
|
interface GuiObjectOptions extends SceneObjectOptions {
|
|
1417
1757
|
}
|
|
1418
1758
|
declare function isGuiObject(obj: any): obj is GuiObject;
|
|
1419
1759
|
|
|
1760
|
+
/** A Three.js scene that initializes Minecraft objects and tracks changes that need a redraw. */
|
|
1420
1761
|
declare class MineRenderScene extends Scene {
|
|
1421
1762
|
readonly isMineRenderScene: true;
|
|
1422
1763
|
static readonly DEFAULT_OPTIONS: MineRenderSceneOptions;
|
|
@@ -1430,18 +1771,48 @@ declare class MineRenderScene extends Scene {
|
|
|
1430
1771
|
add(...objects: Object3D[]): this;
|
|
1431
1772
|
remove(...objects: Object3D[]): this;
|
|
1432
1773
|
private updateObjectRegistration;
|
|
1774
|
+
/** Initializes each object before attaching it to the scene. */
|
|
1433
1775
|
initAndAdd(...object: SceneObject[]): Promise<this>;
|
|
1434
1776
|
addSceneObject<A extends BasicMinecraftAsset, T extends SceneObject, O extends SceneObjectOptions>(asset: A, objectSupplier: () => T | Promise<T>, _options?: Partial<O>, parent?: Object3D): Promise<T | InstanceReference<T>>;
|
|
1777
|
+
/**
|
|
1778
|
+
* Adds a model loaded with {@link Models.getMerged}.
|
|
1779
|
+
* Set `options.instanceMeshes` to `false` to create a separate ModelObject.
|
|
1780
|
+
*
|
|
1781
|
+
* @param parent - Object to attach the model to. Defaults to this scene.
|
|
1782
|
+
* @returns The model, or a reference to one placement of a shared model.
|
|
1783
|
+
*/
|
|
1435
1784
|
addModel(model: Model, options?: Partial<ModelObjectOptions>, parent?: Object3D): Promise<ModelObject | InstanceReference<ModelObject>>;
|
|
1785
|
+
/**
|
|
1786
|
+
* Adds the models selected by a blockstate loaded with {@link BlockStates.get}.
|
|
1787
|
+
* Set `options.initialState` to choose block properties such as `facing` or `axis`.
|
|
1788
|
+
* Use the returned object's `setPosition` method to move all of its model parts.
|
|
1789
|
+
*/
|
|
1436
1790
|
addBlock(blockState: BlockState, options?: Partial<BlockObjectOptions>, parent?: Object3D): Promise<BlockObject | InstanceReference<BlockObject>>;
|
|
1791
|
+
/**
|
|
1792
|
+
* Loads a skin and adds an initialized player model.
|
|
1793
|
+
*
|
|
1794
|
+
* @param skin - Texture URL, such as one returned by {@link Skins.fromUuidOrUsername}.
|
|
1795
|
+
* Omit it to assign a texture later with {@link SkinObject.setSkinTexture}.
|
|
1796
|
+
* @param options - Player settings, including `slim` and `legacy` detection overrides.
|
|
1797
|
+
* @param parent - Object to attach the player to. Defaults to this scene.
|
|
1798
|
+
*/
|
|
1437
1799
|
addSkin(skin?: string, options?: Partial<SkinObjectOptions>, parent?: Object3D): Promise<SkinObject>;
|
|
1800
|
+
/** Adds an entity loaded with {@link Entities.getEntity}, using its selected layers and textures. */
|
|
1438
1801
|
addEntity(entity: EntityModel, options?: Partial<EntityObjectOptions>, parent?: Object3D): Promise<EntityObject | InstanceReference<EntityObject>>;
|
|
1802
|
+
/**
|
|
1803
|
+
* Adds GUI layers in draw order. One GUI pixel equals one scene unit.
|
|
1804
|
+
* Layer positions start at the top left, with positive GUI y pointing down.
|
|
1805
|
+
*/
|
|
1439
1806
|
addGui(layers: readonly GuiLayer[], options?: Partial<GuiObjectOptions>, parent?: Object3D): Promise<GuiObject>;
|
|
1440
1807
|
}
|
|
1441
1808
|
interface MineRenderSceneOptions {
|
|
1442
1809
|
}
|
|
1443
1810
|
declare function isMineRenderScene(obj: any): obj is MineRenderScene;
|
|
1444
1811
|
|
|
1812
|
+
/**
|
|
1813
|
+
* Base for renderable Minecraft objects, with named parts and optional shared instances.
|
|
1814
|
+
* Use {@link notifyDirty} after changing a part directly so the renderer redraws it.
|
|
1815
|
+
*/
|
|
1445
1816
|
declare class SceneObject extends Object3D<Object3DEventMap & {
|
|
1446
1817
|
change: {};
|
|
1447
1818
|
}> implements Disposable, Instanceable, Transformable {
|
|
@@ -1460,17 +1831,20 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
|
|
|
1460
1831
|
set scene(scene: MineRenderScene);
|
|
1461
1832
|
get scene(): MineRenderScene;
|
|
1462
1833
|
init(): Promise<void>;
|
|
1834
|
+
/** Marks ancestor scenes for redraw and emits a `change` event. */
|
|
1463
1835
|
notifyDirty(): void;
|
|
1464
1836
|
protected createAndAddGroup(name?: string, x?: number, y?: number, z?: number, offsetAxis?: Axis, offset?: number): Object3D;
|
|
1465
1837
|
protected createGroup(name?: string, x?: number, y?: number, z?: number, offsetAxis?: Axis, offset?: number): Object3D;
|
|
1466
1838
|
/**
|
|
1467
|
-
*
|
|
1839
|
+
* Finds a named part, such as `head`, without the internal `group:` prefix.
|
|
1840
|
+
* Returns `undefined` when the group does not exist.
|
|
1468
1841
|
*/
|
|
1469
1842
|
getGroupByName(name: string): Maybe<Object3D>;
|
|
1470
1843
|
/**
|
|
1471
|
-
*
|
|
1472
|
-
* @param name name
|
|
1473
|
-
* @param visible
|
|
1844
|
+
* Changes a named group's visibility and requests a redraw.
|
|
1845
|
+
* @param name - Part name without the `group:` prefix.
|
|
1846
|
+
* @param visible - Visibility to assign. Omit it to toggle the current value.
|
|
1847
|
+
* @returns The resulting visibility, or `false` if the group does not exist.
|
|
1474
1848
|
*/
|
|
1475
1849
|
toggleGroupVisibility(name: string, visible?: boolean): boolean;
|
|
1476
1850
|
protected addOrReplaceMesh(mesh: Mesh, parent: Object3D, name?: string): void;
|
|
@@ -1478,13 +1852,14 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
|
|
|
1478
1852
|
protected createMesh(name?: string, geometry?: BufferGeometry, material?: Material | Material[], offsetAxis?: Axis, offset?: number): Mesh;
|
|
1479
1853
|
protected createInstancedMesh(name: Maybe<string>, geometry: BufferGeometry, material: Material | Material[], count: number): InstancedMesh;
|
|
1480
1854
|
/**
|
|
1481
|
-
*
|
|
1855
|
+
* Finds a named mesh without the internal `mesh:` prefix, or returns `undefined`.
|
|
1482
1856
|
*/
|
|
1483
1857
|
getMeshByName(name: string): Maybe<Mesh>;
|
|
1484
1858
|
/**
|
|
1485
|
-
*
|
|
1486
|
-
* @param name name
|
|
1487
|
-
* @param visible
|
|
1859
|
+
* Changes a named mesh's visibility and requests a redraw.
|
|
1860
|
+
* @param name - Mesh name without the `mesh:` prefix.
|
|
1861
|
+
* @param visible - Visibility to assign. Omit it to toggle the current value.
|
|
1862
|
+
* @returns The resulting visibility, or `false` if the mesh does not exist.
|
|
1488
1863
|
*/
|
|
1489
1864
|
toggleMeshVisibility(name: string, visible?: boolean): boolean;
|
|
1490
1865
|
iterateAllMeshes(cb: (mesh: Mesh) => void): void;
|
|
@@ -1492,8 +1867,10 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
|
|
|
1492
1867
|
protected _getBoxGeometryFromElement(element: ModelElement): BoxGeometry;
|
|
1493
1868
|
protected _getBoxGeometryForDimensionsAndUv(width: number, height: number, depth: number, uv: number[]): BoxGeometry;
|
|
1494
1869
|
get isInstanced(): boolean;
|
|
1870
|
+
/** Number of live placements, excluding released instance slots. */
|
|
1495
1871
|
get instanceCounter(): number;
|
|
1496
1872
|
protected constructInstanceReference(i: number): InstanceReference<SceneObject>;
|
|
1873
|
+
/** Allocates a placement of this instanced object, reusing a released slot when available. */
|
|
1497
1874
|
nextInstance(): InstanceReference<SceneObject>;
|
|
1498
1875
|
/** Returns the live reference for a raycast hit on this object's instance mesh. */
|
|
1499
1876
|
getInstanceReference(mesh: Object3D, index: number): Maybe<InstanceReference<SceneObject>>;
|
|
@@ -1511,37 +1888,48 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
|
|
|
1511
1888
|
getRotationAt(index: number, euler?: Euler): Euler;
|
|
1512
1889
|
setScaleAt(index: number, scale: Vector3): void;
|
|
1513
1890
|
getScaleAt(index: number, vector?: Vector3): Vector3;
|
|
1891
|
+
/** Updates supplied transform components. For a shared model, affects every live instance. */
|
|
1514
1892
|
setPositionRotationScale(position?: Vector3, rotation?: Euler, scale?: Vector3): void;
|
|
1893
|
+
/** Sets position in scene units. For a shared model, updates every live instance. */
|
|
1515
1894
|
setPosition(position: Vector3): void;
|
|
1516
1895
|
getPosition(): Vector3;
|
|
1896
|
+
/** Sets rotation in radians. For a shared model, updates every live instance. */
|
|
1517
1897
|
setRotation(rotation: Euler): void;
|
|
1518
1898
|
getRotation(): Euler;
|
|
1899
|
+
/** Sets scale factors. For a shared model, updates every live instance. */
|
|
1519
1900
|
setScale(scale: Vector3): void;
|
|
1520
1901
|
getScale(): Vector3;
|
|
1521
1902
|
protected toggleObjectVisibility(object?: Object3D, visible?: boolean): boolean;
|
|
1522
1903
|
dispose(): void;
|
|
1904
|
+
/** Releases instance slots and removes children, disposing children that implement Disposable. */
|
|
1523
1905
|
disposeAndRemoveAllChildren(): void;
|
|
1906
|
+
/** Detaches the object from its parent and requests a redraw. */
|
|
1524
1907
|
removeFromScene(): void;
|
|
1525
1908
|
}
|
|
1526
1909
|
declare function isSceneObject(obj: any): obj is SceneObject;
|
|
1527
1910
|
|
|
1528
1911
|
type FluidKind = "water" | "lava";
|
|
1912
|
+
/** Fluid contained in a block and whether the block's ordinary model is also drawn. */
|
|
1529
1913
|
interface BlockFluidState {
|
|
1530
1914
|
kind: FluidKind;
|
|
1531
1915
|
level: number;
|
|
1532
1916
|
renderModel: boolean;
|
|
1533
1917
|
}
|
|
1918
|
+
/** Finds water or lava from the block ID and properties, including waterlogged blocks and aquatic plants. */
|
|
1534
1919
|
declare function getBlockFluidState(key?: AssetKey, state?: BlockStateProperties): BlockFluidState | undefined;
|
|
1535
1920
|
declare function getFluidKind(key?: AssetKey, state?: BlockStateProperties): FluidKind | undefined;
|
|
1921
|
+
/** A neighboring cell's fluid level and full-cube occlusion state. */
|
|
1536
1922
|
interface FluidSample {
|
|
1537
1923
|
fluid?: FluidKind;
|
|
1538
1924
|
level?: number;
|
|
1539
1925
|
solid?: boolean;
|
|
1540
1926
|
}
|
|
1927
|
+
/** Reads cells at integer block offsets relative to the fluid being rendered, with `(0, 0, 0)` as the center. */
|
|
1541
1928
|
type FluidSampler = (x: number, y: number, z: number) => FluidSample;
|
|
1542
1929
|
/** Builds centered fluid faces with material groups 0 (still) and 1 (flowing). */
|
|
1543
1930
|
declare function createFluidGeometry(kind: FluidKind, sample: FluidSampler): BufferGeometry;
|
|
1544
1931
|
|
|
1932
|
+
/** Controls the model parts selected by a blockstate. Create it through {@link MineRenderScene.addBlock}. */
|
|
1545
1933
|
declare class BlockObject extends SceneObject {
|
|
1546
1934
|
readonly blockState: BlockState;
|
|
1547
1935
|
readonly isBlockObject: true;
|
|
@@ -1583,6 +1971,7 @@ declare class BlockObject extends SceneObject {
|
|
|
1583
1971
|
private getModelMatrix;
|
|
1584
1972
|
private getModelCullMask;
|
|
1585
1973
|
setCullMask(worldMask: number): Promise<void>;
|
|
1974
|
+
/** Selected property values. Use {@link setState} to change properties and rebuild the rendered models. */
|
|
1586
1975
|
get state(): {
|
|
1587
1976
|
[key: string]: string;
|
|
1588
1977
|
};
|
|
@@ -1597,7 +1986,13 @@ declare class BlockObject extends SceneObject {
|
|
|
1597
1986
|
protected getSingleVariant(variants: BlockStateVariant | BlockStateVariant[]): BlockStateVariant;
|
|
1598
1987
|
protected createAVariant(variants: BlockStateVariant | BlockStateVariant[], instanceInfo: Matrix4[]): Promise<void>;
|
|
1599
1988
|
protected createVariant(variant: BlockStateVariant): Promise<ModelObject | InstanceReference<ModelObject>>;
|
|
1989
|
+
/** Clears selected properties and rebuilds models without reapplying property defaults. */
|
|
1600
1990
|
resetState(): Promise<void>;
|
|
1991
|
+
/**
|
|
1992
|
+
* Updates properties and rebuilds the selected models.
|
|
1993
|
+
* Accepts `"facing=north,open=true"`, a property object, or a key and value.
|
|
1994
|
+
* Properties omitted from the call keep their current values.
|
|
1995
|
+
*/
|
|
1601
1996
|
setState(string: string): any;
|
|
1602
1997
|
setState(state: BlockStateProperties): any;
|
|
1603
1998
|
setState(key: string, value: string): any;
|
|
@@ -1607,7 +2002,9 @@ declare class BlockObject extends SceneObject {
|
|
|
1607
2002
|
setMatrixAt(index: number, matrix: Matrix4): void;
|
|
1608
2003
|
setPosition(position: Vector3): void;
|
|
1609
2004
|
}
|
|
2005
|
+
/** Block settings passed to `scene.addBlock(blockState, options)` or the BlockObject constructor. */
|
|
1610
2006
|
interface BlockObjectOptions extends ModelObjectOptions {
|
|
2007
|
+
/** Loads vanilla property defaults before applying `initialState`. Defaults to `true`. */
|
|
1611
2008
|
applyDefaultState: boolean;
|
|
1612
2009
|
/** Properties applied before model creation, overriding defaults when applyDefaultState is enabled. */
|
|
1613
2010
|
initialState?: BlockStateProperties;
|
|
@@ -1619,6 +2016,7 @@ declare function sampleFluid(kind: FluidKind, sample: FluidSampler): {
|
|
|
1619
2016
|
key: string;
|
|
1620
2017
|
sample: FluidSampler;
|
|
1621
2018
|
};
|
|
2019
|
+
/** Renders water or lava with neighbor-dependent surfaces and animated still/flow textures. */
|
|
1622
2020
|
declare class FluidModelObject extends ModelObject {
|
|
1623
2021
|
readonly kind: FluidKind;
|
|
1624
2022
|
private readonly sample;
|
|
@@ -1629,32 +2027,50 @@ declare class FluidModelObject extends ModelObject {
|
|
|
1629
2027
|
disposeAndRemoveAllChildren(): void;
|
|
1630
2028
|
}
|
|
1631
2029
|
|
|
2030
|
+
/** Parsed blocks and entity data for {@link MineRenderWorld.placeMultiBlock}. Dimensions and positions use blocks. */
|
|
1632
2031
|
interface MultiBlockStructure {
|
|
1633
2032
|
readonly size: TripleArray;
|
|
1634
2033
|
readonly blocks: MultiBlockBlock[];
|
|
1635
2034
|
readonly dataVersion?: number;
|
|
1636
2035
|
readonly entities?: MultiBlockEntity[];
|
|
1637
2036
|
}
|
|
2037
|
+
/** Preserved entity position and NBT. World placement does not create a render object for it. */
|
|
1638
2038
|
interface MultiBlockEntity {
|
|
1639
2039
|
position: TripleArray;
|
|
1640
2040
|
blockPosition?: TripleArray;
|
|
1641
2041
|
nbt: unknown;
|
|
1642
2042
|
}
|
|
2043
|
+
/** Block data and its position within a parsed structure. */
|
|
1643
2044
|
interface MultiBlockBlock extends Block {
|
|
1644
2045
|
position: TripleArray;
|
|
1645
2046
|
}
|
|
1646
2047
|
|
|
2048
|
+
/** Converts legacy Alpha `.schematic` NBT with numeric block IDs into modern block names and properties. */
|
|
1647
2049
|
declare class SchematicParser {
|
|
1648
2050
|
/**
|
|
1649
2051
|
* Parses a legacy schematic using custom mappings before the bundled defaults.
|
|
1650
2052
|
* Keys are `id:metadata`; values are block states such as `minecraft:oak_log[axis=x]`.
|
|
1651
2053
|
*/
|
|
1652
|
-
static parse(nbt: NBT, customMappings?: Readonly<Record<string, string
|
|
2054
|
+
static parse(nbt: NBT, customMappings?: Readonly<Record<string, string>>, options?: SchematicParserOptions): Promise<MultiBlockStructure>;
|
|
2055
|
+
}
|
|
2056
|
+
interface SchematicParserOptions {
|
|
2057
|
+
/**
|
|
2058
|
+
* Ignores Materials, tries metadata 0 for unmapped states, and skips unknown IDs. Defaults to false.
|
|
2059
|
+
* Dimensions, arrays, and entity data remain validated.
|
|
2060
|
+
*/
|
|
2061
|
+
lenient?: boolean;
|
|
1653
2062
|
}
|
|
1654
2063
|
|
|
2064
|
+
/** Converts Java structure NBT into blocks and preserved entity data for world placement. */
|
|
1655
2065
|
declare class StructureParser {
|
|
2066
|
+
/**
|
|
2067
|
+
* Parses decoded NBT, omitting air blocks.
|
|
2068
|
+
* @param _nbt - Structure data decoded by {@link NBTHelper.fromBuffer}.
|
|
2069
|
+
* @param paletteIndex - Palette to select when the structure has several. Defaults to 0.
|
|
2070
|
+
*/
|
|
1656
2071
|
static parse(_nbt: NBT, paletteIndex?: number): Promise<MultiBlockStructure>;
|
|
1657
2072
|
}
|
|
2073
|
+
/** Tagged NBT fields used by Java structure files. */
|
|
1658
2074
|
interface StructureNBT {
|
|
1659
2075
|
DataVersion?: {
|
|
1660
2076
|
type: "int";
|
|
@@ -1750,20 +2166,27 @@ interface BlockEntry {
|
|
|
1750
2166
|
};
|
|
1751
2167
|
}
|
|
1752
2168
|
|
|
2169
|
+
/** Decodes Named Binary Tag (NBT) data for structure and world parsers. */
|
|
1753
2170
|
declare class NBTHelper {
|
|
2171
|
+
/** Parses NBT bytes and preserves format and compression metadata. Omit `format` for automatic detection. */
|
|
1754
2172
|
static fromBuffer(data: Uint8Array | ArrayBuffer, format?: NBTFormat): Promise<NBTAsset>;
|
|
1755
2173
|
}
|
|
2174
|
+
/** Decoded NBT with the source format and parser metadata attached. */
|
|
1756
2175
|
interface NBTAsset extends MinecraftAsset, NBT {
|
|
1757
2176
|
format?: NBTFormat;
|
|
1758
2177
|
metadata?: Metadata;
|
|
1759
2178
|
compression?: "gzip" | "none";
|
|
1760
2179
|
}
|
|
1761
2180
|
|
|
2181
|
+
/** Configures a hosted asset request and converts its response into an asset. */
|
|
1762
2182
|
interface ResponseParser<T extends MinecraftAsset> {
|
|
2183
|
+
/** Sets response decoding or other request options before the request starts. */
|
|
1763
2184
|
config(request: RequestConfig): any;
|
|
2185
|
+
/** Returns `undefined` to permit source fallback, or throws to report a parse failure. */
|
|
1764
2186
|
parse(response: RequestResponse): Maybe<T> | Promise<Maybe<T>>;
|
|
1765
2187
|
}
|
|
1766
2188
|
|
|
2189
|
+
/** Loads assets over HTTP from a Minecraft directory tree rooted at the constructor's URL. */
|
|
1767
2190
|
declare class HostedAssetSource extends AssetSource {
|
|
1768
2191
|
static readonly MODEL: ResponseParser<Model>;
|
|
1769
2192
|
static readonly BLOCKSTATE: ResponseParser<BlockState>;
|
|
@@ -1773,11 +2196,16 @@ declare class HostedAssetSource extends AssetSource {
|
|
|
1773
2196
|
static readonly LIST: ResponseParser<ListAsset>;
|
|
1774
2197
|
static readonly JSON: ResponseParser<any>;
|
|
1775
2198
|
static readonly PARSER_MAP: Map<AssetParser, ResponseParser<any>>;
|
|
2199
|
+
/** Retries missing assets with the `minecraft` namespace and default root. Other failures reject. */
|
|
1776
2200
|
loadOrRetryWithDefaults<T extends MinecraftAsset>(key: AssetKey, parser: ResponseParser<T>): Promise<Maybe<T>>;
|
|
1777
2201
|
protected load<T extends MinecraftAsset>(key: AssetKey, parser: ResponseParser<T>): Promise<Maybe<T>>;
|
|
1778
2202
|
assetBasePath(key: AssetKey): string;
|
|
1779
2203
|
private readonly _root;
|
|
1780
2204
|
private readonly _options;
|
|
2205
|
+
/**
|
|
2206
|
+
* Creates a hosted source for {@link AssetLoader.addSource}.
|
|
2207
|
+
* Set `options.retryDefaults` to `false` to restrict lookups to the requested namespace and root.
|
|
2208
|
+
*/
|
|
1781
2209
|
constructor(root: string, options?: Partial<HostedAssetSourceOptions>);
|
|
1782
2210
|
get root(): string;
|
|
1783
2211
|
get cacheId(): string;
|
|
@@ -1788,38 +2216,80 @@ interface HostedAssetSourceOptions {
|
|
|
1788
2216
|
retryDefaults: boolean;
|
|
1789
2217
|
}
|
|
1790
2218
|
|
|
2219
|
+
/** A resource-pack ZIP entry, with its archive-relative path and lazily extracted bytes. */
|
|
1791
2220
|
interface ArchiveEntry {
|
|
1792
2221
|
filename: string;
|
|
1793
2222
|
directory: boolean;
|
|
1794
2223
|
getData(): Promise<Blob>;
|
|
1795
2224
|
}
|
|
1796
2225
|
|
|
2226
|
+
/** Supplies resource-pack entries to {@link ArchiveAssetSource}. */
|
|
1797
2227
|
interface ArchiveProxy {
|
|
1798
2228
|
/** Identifies the archive's content across sessions; undefined when it cannot be identified. */
|
|
1799
2229
|
readonly id?: string;
|
|
1800
2230
|
getEntries(): Promise<ArchiveEntry[]>;
|
|
1801
2231
|
}
|
|
1802
2232
|
|
|
2233
|
+
/** A resource-pack format; a number selects minor version zero. */
|
|
2234
|
+
type PackFormat = number | readonly [number, number];
|
|
2235
|
+
declare class PackMetadata {
|
|
2236
|
+
private readonly overlays;
|
|
2237
|
+
private readonly filters;
|
|
2238
|
+
readonly hasOverlays: boolean;
|
|
2239
|
+
private constructor();
|
|
2240
|
+
static parse(value: unknown): PackMetadata;
|
|
2241
|
+
/** Returns applicable directories in lookup order, with the last declared overlay first. */
|
|
2242
|
+
overlayDirectories(target: PackFormat): string[];
|
|
2243
|
+
blocks(namespace: string, path: string): boolean;
|
|
2244
|
+
}
|
|
2245
|
+
|
|
2246
|
+
interface ArchiveAssetSourceOptions {
|
|
2247
|
+
/** Target resource-pack format. Omit to look up the version selected by AssetLoader.setVersion. */
|
|
2248
|
+
resourcePackFormat?: PackFormat;
|
|
2249
|
+
/** Target data-pack format, used for assets under data/. Omit to look up the selected version. */
|
|
2250
|
+
dataPackFormat?: PackFormat;
|
|
2251
|
+
}
|
|
2252
|
+
/** Loads assets from resource-pack ZIP entries. Register it with {@link AssetLoader.addSource}. */
|
|
1803
2253
|
declare class ArchiveAssetSource extends AssetSource implements ArchiveProxy {
|
|
1804
2254
|
readonly _archiveProxy: ArchiveProxy;
|
|
1805
|
-
|
|
1806
|
-
|
|
2255
|
+
private readonly options;
|
|
2256
|
+
private entries?;
|
|
2257
|
+
private metadata?;
|
|
2258
|
+
constructor(archiveProxy: ArchiveProxy, options?: ArchiveAssetSourceOptions);
|
|
2259
|
+
/** Creates a browser ZIP source from a Blob or File. */
|
|
2260
|
+
static blob(blob: Blob, options?: ArchiveAssetSourceOptions): ArchiveAssetSource;
|
|
1807
2261
|
get cacheId(): Maybe<string>;
|
|
1808
2262
|
getEntries(): Promise<ArchiveEntry[]>;
|
|
1809
2263
|
getEntry(path: string): Promise<Maybe<ArchiveEntry>>;
|
|
2264
|
+
private getMetadata;
|
|
2265
|
+
blocks(key: AssetKey): Promise<boolean>;
|
|
1810
2266
|
get<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<Maybe<T>>;
|
|
1811
2267
|
protected load<T extends MinecraftAsset>(key: AssetKey, parser: ResponseParser<T>): Promise<Maybe<T>>;
|
|
1812
2268
|
assetBasePath(key: AssetKey): string;
|
|
1813
2269
|
}
|
|
1814
2270
|
|
|
2271
|
+
/** Reads a resource-pack ZIP from a browser Blob or File for {@link ArchiveAssetSource}. */
|
|
1815
2272
|
declare class BrowserArchiveProxy implements ArchiveProxy {
|
|
1816
2273
|
readonly _blob: Blob;
|
|
1817
2274
|
readonly _reader: ZipReader<Blob>;
|
|
1818
2275
|
readonly id?: string;
|
|
2276
|
+
/**
|
|
2277
|
+
* Opens a ZIP for asset lookup.
|
|
2278
|
+
* @param id - Cache identity for this content. Change it when the pack changes.
|
|
2279
|
+
* A File supplies an identity from its name, size, and modification time when omitted.
|
|
2280
|
+
*/
|
|
1819
2281
|
constructor(blob: Blob, id?: string);
|
|
1820
2282
|
getEntries(): Promise<ArchiveEntry[]>;
|
|
1821
2283
|
}
|
|
1822
2284
|
|
|
2285
|
+
declare class PackFormats {
|
|
2286
|
+
private static readonly versions;
|
|
2287
|
+
/** Resolves pack formats from Mojang's client metadata hosted on assets.mcasset.cloud. */
|
|
2288
|
+
static get(version: string, type: "assets" | "data"): Promise<PackFormat>;
|
|
2289
|
+
private static load;
|
|
2290
|
+
}
|
|
2291
|
+
|
|
2292
|
+
/** Bedrock client-entity resource references. This schema does not provide a Bedrock renderer. */
|
|
1823
2293
|
interface BedrockEntityDescription {
|
|
1824
2294
|
identifier: string;
|
|
1825
2295
|
materials: {
|
|
@@ -1840,6 +2310,7 @@ interface BedrockEntityDescription {
|
|
|
1840
2310
|
enable_attachables?: boolean;
|
|
1841
2311
|
}
|
|
1842
2312
|
|
|
2313
|
+
/** Bedrock client-entity JSON schema, provided for typing only. */
|
|
1843
2314
|
interface BedrockEntityFile {
|
|
1844
2315
|
format_version: string;
|
|
1845
2316
|
"minecraft:client_entity": {
|
|
@@ -1847,6 +2318,7 @@ interface BedrockEntityFile {
|
|
|
1847
2318
|
};
|
|
1848
2319
|
}
|
|
1849
2320
|
|
|
2321
|
+
/** Bedrock bone-and-cube geometry schema, provided for typing only. */
|
|
1850
2322
|
interface BedrockGeometry {
|
|
1851
2323
|
visible_bounds_width: number;
|
|
1852
2324
|
visible_bounds_height: number;
|
|
@@ -1874,11 +2346,13 @@ interface BedrockCube {
|
|
|
1874
2346
|
inflate?: number;
|
|
1875
2347
|
}
|
|
1876
2348
|
|
|
2349
|
+
/** A versioned Bedrock JSON container for named geometry definitions. */
|
|
1877
2350
|
interface BedrockGeometryFile {
|
|
1878
2351
|
format_version: string;
|
|
1879
2352
|
[key: string]: BedrockGeometry | any;
|
|
1880
2353
|
}
|
|
1881
2354
|
|
|
2355
|
+
/** Shared in-memory caches for loaded assets and render resources. Persistent stores are managed separately. */
|
|
1882
2356
|
declare class Caching {
|
|
1883
2357
|
static readonly rawImageCache: AsyncLoadingCache<CacheKey, ImageInfo>;
|
|
1884
2358
|
static readonly imageDataCache: AsyncLoadingCache<CacheKey, ImageData>;
|
|
@@ -1902,9 +2376,11 @@ declare class Caching {
|
|
|
1902
2376
|
static readonly entityAnimationCache: AsyncLoadingCache<CacheKey, EntityAnimationFile>;
|
|
1903
2377
|
static readonly blockEntityIndexCache: AsyncLoadingCache<CacheKey, BlockEntityIndex>;
|
|
1904
2378
|
static readonly fontCache: AsyncLoadingCache<CacheKey, BitmapFont>;
|
|
2379
|
+
static readonly bannerPatternCache: AsyncLoadingCache<CacheKey, BannerPattern>;
|
|
1905
2380
|
private static createAssetCache;
|
|
1906
2381
|
/** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
|
|
1907
2382
|
private static get all();
|
|
2383
|
+
/** Invalidates in-memory entries so later lookups reload them. Persisted entries are retained. */
|
|
1908
2384
|
static clear(): void;
|
|
1909
2385
|
/**
|
|
1910
2386
|
* Clears every cache and stops its expiry timer.
|
|
@@ -1919,11 +2395,13 @@ declare class Caching {
|
|
|
1919
2395
|
/** Copies the nontransparent bounds without resizing the source; empty images become one transparent pixel. */
|
|
1920
2396
|
declare function trimCanvas(source: CompatCanvas): CompatCanvas;
|
|
1921
2397
|
|
|
2398
|
+
/** Reports invalid Minecraft data or an unsupported rendering operation. */
|
|
1922
2399
|
declare class MineRenderError extends Error {
|
|
1923
2400
|
constructor(msg: any);
|
|
1924
2401
|
get name(): string;
|
|
1925
2402
|
}
|
|
1926
2403
|
|
|
2404
|
+
/** Settings passed to {@link Renderer.toGLTF} or {@link SceneExporter.toGLTF}. */
|
|
1927
2405
|
interface SceneGLTFExportOptions {
|
|
1928
2406
|
/** Returns a GLB ArrayBuffer instead of a glTF object. */
|
|
1929
2407
|
binary?: boolean;
|
|
@@ -1943,13 +2421,77 @@ declare class SceneExporter {
|
|
|
1943
2421
|
static toGLTF(root: Object3D, options?: SceneGLTFExportOptions): Promise<Record<string, any> | ArrayBuffer>;
|
|
1944
2422
|
}
|
|
1945
2423
|
|
|
2424
|
+
/** Container coordinates in GUI pixels. Crops refer to vanilla's 256×256 sheets; {@link GuiHelper.container} scales them for resource packs. */
|
|
2425
|
+
declare const GUI_CONTAINER_LAYOUTS: {
|
|
2426
|
+
readonly generic_54: {
|
|
2427
|
+
readonly texture: "minecraft:gui/container/generic_54";
|
|
2428
|
+
readonly crop: readonly [0, 0, 176, 222];
|
|
2429
|
+
readonly slotOrigin: readonly [8, 18];
|
|
2430
|
+
readonly slotOffset: readonly [18, 18];
|
|
2431
|
+
readonly rowSize: 9;
|
|
2432
|
+
readonly slotCount: 54;
|
|
2433
|
+
};
|
|
2434
|
+
readonly crafting_table: {
|
|
2435
|
+
readonly texture: "minecraft:gui/container/crafting_table";
|
|
2436
|
+
readonly crop: readonly [0, 0, 176, 166];
|
|
2437
|
+
readonly slotOrigin: readonly [30, 17];
|
|
2438
|
+
readonly slotOffset: readonly [18, 18];
|
|
2439
|
+
readonly rowSize: 3;
|
|
2440
|
+
readonly slotCount: 9;
|
|
2441
|
+
readonly resultPosition: readonly [124, 35];
|
|
2442
|
+
};
|
|
2443
|
+
};
|
|
2444
|
+
type GuiContainerType = keyof typeof GUI_CONTAINER_LAYOUTS;
|
|
2445
|
+
type GuiBossBarColor = "pink" | "blue" | "red" | "green" | "yellow" | "purple" | "white";
|
|
2446
|
+
type GuiBookButtonState = "hidden" | "normal" | "hover";
|
|
2447
|
+
/** Creates GUI positions and layer lists for {@link MineRenderScene.addGui}. */
|
|
1946
2448
|
declare class GuiHelper {
|
|
2449
|
+
/**
|
|
2450
|
+
* Creates a 182×5 boss bar using the active resource pack. Finite progress is clamped to 0–1.
|
|
2451
|
+
* The fill crops the source image; explicit crops do not apply `.mcmeta` sprite scaling.
|
|
2452
|
+
*/
|
|
2453
|
+
static bossBar(options?: GuiBossBarOptions): Promise<GuiLayer[]>;
|
|
2454
|
+
/**
|
|
2455
|
+
* Creates a 192×192 book page with optional arrows and supplied text. Buttons are hidden by default.
|
|
2456
|
+
* Callers choose the page content and button states; this helper does not paginate or handle clicks.
|
|
2457
|
+
*/
|
|
2458
|
+
static book(options?: GuiBookOptions): Promise<GuiLayer[]>;
|
|
2459
|
+
/** Creates a container background. Use {@link GUI_CONTAINER_LAYOUTS} with {@link inventorySlot} to place its items. */
|
|
2460
|
+
static container(type: GuiContainerType, position?: [number, number]): Promise<GuiLayer[]>;
|
|
2461
|
+
private static validatePosition;
|
|
2462
|
+
private static cropTexture;
|
|
1947
2463
|
/** Sizes a tooltip around supplied text; the first entry is its title. */
|
|
1948
2464
|
static tooltip(lines: readonly GuiText[], options?: GuiTooltipOptions): Promise<GuiLayer[]>;
|
|
1949
|
-
|
|
2465
|
+
/**
|
|
2466
|
+
* Calculates a slot's top-left position in GUI pixels.
|
|
2467
|
+
* @param slot - Zero-based slot index, or `[column, row]`.
|
|
2468
|
+
* @param origin - Position of the first slot.
|
|
2469
|
+
* @param offset - Horizontal and vertical spacing between slot origins, in pixels.
|
|
2470
|
+
* @param rowSize - Slots per row when `slot` is an index.
|
|
2471
|
+
*/
|
|
2472
|
+
static inventorySlot(slot: number | readonly [number, number], origin?: readonly [number, number], offset?: readonly [number, number], rowSize?: number): [number, number];
|
|
1950
2473
|
/** Creates crafting-table layers for ingredients and the result; stack counts are not drawn. */
|
|
1951
2474
|
static recipe(recipe: GuiRecipe, options?: GuiRecipeOptions): GuiLayer[];
|
|
1952
2475
|
}
|
|
2476
|
+
/** Settings passed to {@link GuiHelper.bossBar}. */
|
|
2477
|
+
interface GuiBossBarOptions {
|
|
2478
|
+
/** Vanilla sprite color. Defaults to `pink`. */
|
|
2479
|
+
color?: GuiBossBarColor;
|
|
2480
|
+
/** Fill from 0 to 1, rounded to vanilla's discrete pixel width. Defaults to 1. */
|
|
2481
|
+
progress?: number;
|
|
2482
|
+
/** Top-left position in GUI pixels. Defaults to `[0, 0]`. */
|
|
2483
|
+
position?: [number, number];
|
|
2484
|
+
}
|
|
2485
|
+
/** Settings passed to {@link GuiHelper.book}. Text defaults to black, unshadowed, and wrapped at 114 pixels. */
|
|
2486
|
+
interface GuiBookOptions extends GuiTextOptions {
|
|
2487
|
+
/** Top-left position of the book background in GUI pixels. Defaults to `[0, 0]`. */
|
|
2488
|
+
position?: [number, number];
|
|
2489
|
+
previous?: GuiBookButtonState;
|
|
2490
|
+
next?: GuiBookButtonState;
|
|
2491
|
+
/** Content for one page. The caller keeps it within the 128-pixel text height. */
|
|
2492
|
+
text?: GuiText;
|
|
2493
|
+
}
|
|
2494
|
+
/** Settings passed to {@link GuiHelper.tooltip}. Its default `lineHeight` is 10 GUI pixels. */
|
|
1953
2495
|
interface GuiTooltipOptions extends GuiTextOptions {
|
|
1954
2496
|
/** Top-left text position, inside the tooltip's padding. */
|
|
1955
2497
|
position?: [number, number];
|
|
@@ -1961,7 +2503,9 @@ type GuiRecipeIngredientValue = string | {
|
|
|
1961
2503
|
} | {
|
|
1962
2504
|
tag: string;
|
|
1963
2505
|
};
|
|
2506
|
+
/** An item, tag, or alternatives list. Tags and alternatives need `GuiRecipeOptions.resolveIngredient`. */
|
|
1964
2507
|
type GuiRecipeIngredient = GuiRecipeIngredientValue | readonly GuiRecipeIngredientValue[];
|
|
2508
|
+
/** Shaped or shapeless crafting data accepted by {@link GuiHelper.recipe}. */
|
|
1965
2509
|
type GuiRecipe = ({
|
|
1966
2510
|
type: "minecraft:crafting_shaped" | "crafting_shaped";
|
|
1967
2511
|
pattern: readonly string[];
|
|
@@ -1978,6 +2522,7 @@ type GuiRecipe = ({
|
|
|
1978
2522
|
count?: number;
|
|
1979
2523
|
};
|
|
1980
2524
|
};
|
|
2525
|
+
/** Settings passed as the second argument to {@link GuiHelper.recipe}. */
|
|
1981
2526
|
interface GuiRecipeOptions {
|
|
1982
2527
|
/** Selects a concrete item ID or model AssetKey for a tag or alternatives array. */
|
|
1983
2528
|
resolveIngredient?: (ingredient: GuiRecipeIngredient) => string | AssetKey;
|
|
@@ -2063,6 +2608,11 @@ declare class MapControls extends OrbitControls {
|
|
|
2063
2608
|
constructor(object: Camera, domElement?: HTMLElement);
|
|
2064
2609
|
}
|
|
2065
2610
|
|
|
2611
|
+
/**
|
|
2612
|
+
* Renders a Minecraft scene with a camera and an optional effects composer.
|
|
2613
|
+
* Requires a browser DOM and WebGL. Call {@link appendTo} to attach the canvas,
|
|
2614
|
+
* then {@link start} to render scene changes.
|
|
2615
|
+
*/
|
|
2066
2616
|
declare class Renderer implements Disposable {
|
|
2067
2617
|
static readonly DEFAULT_OPTIONS: RendererOptions;
|
|
2068
2618
|
readonly options: RendererOptions;
|
|
@@ -2093,12 +2643,14 @@ declare class Renderer implements Disposable {
|
|
|
2093
2643
|
protected createControls(): Maybe<OrbitControls>;
|
|
2094
2644
|
init(): void;
|
|
2095
2645
|
get element(): Maybe<HTMLElement>;
|
|
2646
|
+
/** Attaches the canvas to an element and sizes it to that element's dimensions. */
|
|
2096
2647
|
appendTo(element: HTMLElement): void;
|
|
2097
2648
|
/**
|
|
2098
2649
|
* Redraws when the dispatcher emits the selected event. Registering the same pair twice has no effect.
|
|
2099
2650
|
* The renderer removes its listener on disposal; the caller retains ownership of the dispatcher.
|
|
2100
2651
|
*/
|
|
2101
2652
|
registerEventDispatcher(dispatcher: EventDispatcher<any>, changeEvent?: string): void;
|
|
2653
|
+
/** Updates the camera and canvas size. Width and height are in CSS pixels. */
|
|
2102
2654
|
resize(width: number, height: number): void;
|
|
2103
2655
|
get dirty(): boolean;
|
|
2104
2656
|
set dirty(dirty: boolean);
|
|
@@ -2108,7 +2660,9 @@ declare class Renderer implements Disposable {
|
|
|
2108
2660
|
* Registering the same callback twice has no effect. Image exports do not invoke callbacks.
|
|
2109
2661
|
*/
|
|
2110
2662
|
onFrame(callback: FrameCallback): () => void;
|
|
2663
|
+
/** Starts or resumes the animation loop and registered frame callbacks. */
|
|
2111
2664
|
start(): void;
|
|
2665
|
+
/** Pauses rendering and frame callbacks. Call {@link start} to resume. */
|
|
2112
2666
|
stop(): void;
|
|
2113
2667
|
/**
|
|
2114
2668
|
* Stops rendering and releases owned resources. Repeated calls have no effect, and a disposed
|
|
@@ -2124,8 +2678,11 @@ declare class Renderer implements Disposable {
|
|
|
2124
2678
|
* MIME type support and lossy quality (0–1) follow the canvas encoder.
|
|
2125
2679
|
*/
|
|
2126
2680
|
toImage(trim?: boolean, mime?: string, quality?: number): string;
|
|
2681
|
+
/** Exports visible scene meshes as OBJ text, without texture images. */
|
|
2127
2682
|
toObj(): string;
|
|
2683
|
+
/** Exports visible scene meshes as PLY. Set `options.binary` for an ArrayBuffer. */
|
|
2128
2684
|
toPLY(options?: PLYExporterOptions): string | ArrayBuffer;
|
|
2685
|
+
/** Exports a static textured scene in the browser. Set `options.binary` for GLB output. */
|
|
2129
2686
|
toGLTF(options?: SceneGLTFExportOptions): Promise<Record<string, any> | ArrayBuffer>;
|
|
2130
2687
|
protected get attachedToBody(): boolean;
|
|
2131
2688
|
protected get viewWidth(): number;
|
|
@@ -2137,13 +2694,16 @@ declare class Renderer implements Disposable {
|
|
|
2137
2694
|
/** Renderer-owned controls, or undefined when disabled at construction or after disposal. */
|
|
2138
2695
|
get controls(): Maybe<OrbitControls>;
|
|
2139
2696
|
}
|
|
2697
|
+
/** Timing passed to callbacks registered with {@link Renderer.onFrame}. */
|
|
2140
2698
|
interface RendererFrame {
|
|
2141
2699
|
/** Animation-loop timestamp in seconds, relative to the browser's performance time origin. */
|
|
2142
2700
|
readonly time: number;
|
|
2143
2701
|
/** Seconds since this callback's previous update; zero on its first update after subscribing or starting. */
|
|
2144
2702
|
readonly delta: number;
|
|
2145
2703
|
}
|
|
2704
|
+
/** A synchronous scene update registered with {@link Renderer.onFrame}. */
|
|
2146
2705
|
type FrameCallback = (frame: RendererFrame) => void;
|
|
2706
|
+
/** Settings for `new Renderer(options)`. Omitted values use {@link Renderer.DEFAULT_OPTIONS}. */
|
|
2147
2707
|
interface RendererOptions {
|
|
2148
2708
|
camera: CameraOptions;
|
|
2149
2709
|
render: RenderOptions;
|
|
@@ -2151,12 +2711,14 @@ interface RendererOptions {
|
|
|
2151
2711
|
controls?: ControlsOptions;
|
|
2152
2712
|
debug: DebugOptions;
|
|
2153
2713
|
}
|
|
2714
|
+
/** Camera settings passed as `camera` in the Renderer constructor options. Positions use scene units. */
|
|
2154
2715
|
interface CameraOptions {
|
|
2155
2716
|
type: "perspective" | "orthographic";
|
|
2156
2717
|
near: number;
|
|
2157
2718
|
far: number;
|
|
2158
2719
|
perspective: {
|
|
2159
2720
|
aspect: undefined | number;
|
|
2721
|
+
/** Vertical field of view in degrees. */
|
|
2160
2722
|
fov: number;
|
|
2161
2723
|
};
|
|
2162
2724
|
orthographic: {
|
|
@@ -2168,6 +2730,7 @@ interface CameraOptions {
|
|
|
2168
2730
|
position: Vector3 | TripleArray;
|
|
2169
2731
|
lookingAt: Vector3 | TripleArray;
|
|
2170
2732
|
}
|
|
2733
|
+
/** Canvas and draw-loop settings passed as `render` in the Renderer constructor options. */
|
|
2171
2734
|
interface RenderOptions {
|
|
2172
2735
|
/** Maximum draw rate (60 by default); zero or a negative value disables the limit. */
|
|
2173
2736
|
fpsLimit: number;
|
|
@@ -2176,20 +2739,29 @@ interface RenderOptions {
|
|
|
2176
2739
|
stats: boolean;
|
|
2177
2740
|
antialias: boolean;
|
|
2178
2741
|
shade: boolean;
|
|
2742
|
+
/** Resizes to the attached element when the browser window resizes. */
|
|
2179
2743
|
autoResize: boolean;
|
|
2744
|
+
/** Draws even when the scene is unchanged, while still respecting `fpsLimit`. */
|
|
2180
2745
|
renderAlways: boolean;
|
|
2181
2746
|
}
|
|
2747
|
+
/** Effects settings passed as `composer` in the Renderer constructor options. */
|
|
2182
2748
|
interface ComposerOptions {
|
|
2183
2749
|
enabled: boolean;
|
|
2184
2750
|
}
|
|
2751
|
+
/** Set `controls: { enabled: true }` in the Renderer constructor to create owned OrbitControls. */
|
|
2185
2752
|
interface ControlsOptions {
|
|
2186
2753
|
enabled: boolean;
|
|
2187
2754
|
}
|
|
2755
|
+
/** Scene helpers enabled through `debug` in the Renderer constructor options. */
|
|
2188
2756
|
interface DebugOptions {
|
|
2189
2757
|
grid: boolean;
|
|
2190
2758
|
axes: boolean;
|
|
2191
2759
|
}
|
|
2192
2760
|
|
|
2761
|
+
/**
|
|
2762
|
+
* Browser controls for inspecting and editing scene objects with Ctrl/Cmd-click selection.
|
|
2763
|
+
* Construct it with a renderer, attach its panels with {@link appendTo}, and call {@link dispose} when finished.
|
|
2764
|
+
*/
|
|
2193
2765
|
declare class SceneInspector {
|
|
2194
2766
|
readonly renderer: Renderer;
|
|
2195
2767
|
readonly objectInfoContainer: HTMLDivElement;
|
|
@@ -2219,6 +2791,7 @@ declare class SceneInspector {
|
|
|
2219
2791
|
protected separator(name?: string): HTMLElement;
|
|
2220
2792
|
}
|
|
2221
2793
|
|
|
2794
|
+
/** A browser statistics panel refreshed once per second. Dispose it separately from its renderer. */
|
|
2222
2795
|
declare class SceneStatsDisplay implements Disposable {
|
|
2223
2796
|
readonly renderer: Renderer;
|
|
2224
2797
|
readonly statsContainer: HTMLDivElement;
|
|
@@ -2227,6 +2800,7 @@ declare class SceneStatsDisplay implements Disposable {
|
|
|
2227
2800
|
constructor(renderer: Renderer);
|
|
2228
2801
|
protected init(): void;
|
|
2229
2802
|
appendTo(el: HTMLElement): void;
|
|
2803
|
+
/** Stops the refresh timer and removes the panel from the page. */
|
|
2230
2804
|
dispose(): void;
|
|
2231
2805
|
add(line?: StatLine): void;
|
|
2232
2806
|
}
|
|
@@ -2242,10 +2816,130 @@ declare class StatLine {
|
|
|
2242
2816
|
update(): void;
|
|
2243
2817
|
}
|
|
2244
2818
|
|
|
2819
|
+
/** Portable scene setup. Positions use model units (16 per block); rotations use radians. */
|
|
2820
|
+
interface SceneDocument {
|
|
2821
|
+
format: "minerender-scene";
|
|
2822
|
+
version: 1;
|
|
2823
|
+
minecraftVersion?: string;
|
|
2824
|
+
camera?: {
|
|
2825
|
+
position: TripleArray;
|
|
2826
|
+
target: TripleArray;
|
|
2827
|
+
};
|
|
2828
|
+
objects: SceneObjectDefinition[];
|
|
2829
|
+
}
|
|
2830
|
+
interface SceneObjectDefinitionBase {
|
|
2831
|
+
id: string;
|
|
2832
|
+
name?: string;
|
|
2833
|
+
position?: TripleArray;
|
|
2834
|
+
rotation?: TripleArray;
|
|
2835
|
+
scale?: TripleArray;
|
|
2836
|
+
visible?: boolean;
|
|
2837
|
+
}
|
|
2838
|
+
type SceneSkinPosePart = "head" | "body" | "rightArm" | "leftArm" | "rightLeg" | "leftLeg" | "cape";
|
|
2839
|
+
interface SceneSkinDefinition extends SceneObjectDefinitionBase {
|
|
2840
|
+
type: "skin";
|
|
2841
|
+
/** Texture URL, Minecraft username, or UUID. Omit for Steve, or Alex with slim: true, from the active asset version. */
|
|
2842
|
+
skin?: string;
|
|
2843
|
+
cape?: {
|
|
2844
|
+
texture: string;
|
|
2845
|
+
layout?: CapeLayout;
|
|
2846
|
+
};
|
|
2847
|
+
options?: {
|
|
2848
|
+
slim?: boolean;
|
|
2849
|
+
legacy?: boolean;
|
|
2850
|
+
};
|
|
2851
|
+
/** Mesh names from SkinPart; hiding a base part does not hide its overlay. */
|
|
2852
|
+
hiddenParts?: string[];
|
|
2853
|
+
/** Absolute local XYZ joint rotations in radians; omitted joints keep their default pose. */
|
|
2854
|
+
pose?: Partial<Record<SceneSkinPosePart, TripleArray>>;
|
|
2855
|
+
}
|
|
2856
|
+
interface SceneBlockDefinition extends SceneObjectDefinitionBase {
|
|
2857
|
+
type: "block";
|
|
2858
|
+
asset: string;
|
|
2859
|
+
state?: Record<string, string>;
|
|
2860
|
+
options?: {
|
|
2861
|
+
wireframe?: boolean;
|
|
2862
|
+
tints?: Record<number, number>;
|
|
2863
|
+
};
|
|
2864
|
+
}
|
|
2865
|
+
interface SceneModelDefinition extends SceneObjectDefinitionBase {
|
|
2866
|
+
type: "item" | "model";
|
|
2867
|
+
asset: string;
|
|
2868
|
+
options?: {
|
|
2869
|
+
wireframe?: boolean;
|
|
2870
|
+
displayPosition?: DisplayPosition;
|
|
2871
|
+
tints?: Record<number, number>;
|
|
2872
|
+
};
|
|
2873
|
+
}
|
|
2874
|
+
interface SceneEntityDefinition extends SceneObjectDefinitionBase {
|
|
2875
|
+
type: "entity";
|
|
2876
|
+
asset: string;
|
|
2877
|
+
texture?: string;
|
|
2878
|
+
layers?: string[];
|
|
2879
|
+
when?: string[];
|
|
2880
|
+
textures?: Record<string, string>;
|
|
2881
|
+
options?: {
|
|
2882
|
+
flip?: boolean;
|
|
2883
|
+
wireframe?: boolean;
|
|
2884
|
+
tints?: Record<string, string | number>;
|
|
2885
|
+
};
|
|
2886
|
+
animation?: {
|
|
2887
|
+
name: string;
|
|
2888
|
+
loop?: boolean;
|
|
2889
|
+
speed?: number;
|
|
2890
|
+
time?: number;
|
|
2891
|
+
paused?: boolean;
|
|
2892
|
+
};
|
|
2893
|
+
}
|
|
2894
|
+
type SceneGuiLayer = (Omit<GuiTextureLayer, "texture"> & {
|
|
2895
|
+
texture: string;
|
|
2896
|
+
}) | (Omit<GuiItemLayer, "item"> & {
|
|
2897
|
+
item: string;
|
|
2898
|
+
}) | (Omit<GuiTextLayer, "font"> & {
|
|
2899
|
+
font?: string;
|
|
2900
|
+
});
|
|
2901
|
+
interface SceneGuiDefinition extends SceneObjectDefinitionBase {
|
|
2902
|
+
type: "gui";
|
|
2903
|
+
layers: SceneGuiLayer[];
|
|
2904
|
+
}
|
|
2905
|
+
type SceneObjectDefinition = SceneSkinDefinition | SceneBlockDefinition | SceneModelDefinition | SceneEntityDefinition | SceneGuiDefinition;
|
|
2906
|
+
/** Validates and copies a scene document without requesting assets or changing the active asset version. */
|
|
2907
|
+
declare function parseSceneDocument(value: unknown): SceneDocument;
|
|
2908
|
+
|
|
2909
|
+
interface LoadedSceneObject {
|
|
2910
|
+
readonly root: Group;
|
|
2911
|
+
readonly object: SceneObject;
|
|
2912
|
+
readonly definition: SceneObjectDefinition;
|
|
2913
|
+
/** Advances entity playback in seconds unless the definition has paused it. */
|
|
2914
|
+
advanceAnimation(delta: number): void;
|
|
2915
|
+
/** Removes this object and releases its owned resources. Safe to call more than once. */
|
|
2916
|
+
dispose(): void;
|
|
2917
|
+
}
|
|
2918
|
+
interface LoadedSceneDocument {
|
|
2919
|
+
readonly root: Group;
|
|
2920
|
+
readonly objects: LoadedSceneObject[];
|
|
2921
|
+
readonly definition: SceneDocument;
|
|
2922
|
+
advanceAnimations(delta: number): void;
|
|
2923
|
+
dispose(): void;
|
|
2924
|
+
}
|
|
2925
|
+
/** Loads portable scene documents using the asset sources already configured by the caller. */
|
|
2926
|
+
declare class SceneDocumentLoader {
|
|
2927
|
+
static parse(value: unknown): SceneDocument;
|
|
2928
|
+
/**
|
|
2929
|
+
* Loads objects concurrently and attaches them in document order after every load succeeds.
|
|
2930
|
+
* A failure waits for all loads, disposes staged objects, and reports the first error in document order.
|
|
2931
|
+
*/
|
|
2932
|
+
static load(scene: MineRenderScene, value: unknown, parent?: Object3D): Promise<LoadedSceneDocument>;
|
|
2933
|
+
/** Loads an independently editable object. Its root owns the document's position, rotation, and scale. */
|
|
2934
|
+
static loadObject(scene: MineRenderScene, value: SceneObjectDefinition, parent?: Object3D): Promise<LoadedSceneObject>;
|
|
2935
|
+
private static loadValidatedObject;
|
|
2936
|
+
}
|
|
2937
|
+
|
|
2245
2938
|
type SkinGeometries = Record<SkinPart, TripleArray>;
|
|
2246
2939
|
declare const classicSkinGeometries: SkinGeometries;
|
|
2247
2940
|
declare const slimSkinGeometries: SkinGeometries;
|
|
2248
2941
|
|
|
2942
|
+
/** Decodes skin pixels while preserving hidden RGB values in transparent PNG pixels. */
|
|
2249
2943
|
declare class SkinImage {
|
|
2250
2944
|
static getData(src: string): Promise<ImageData>;
|
|
2251
2945
|
private static decodePng;
|
|
@@ -2255,12 +2949,15 @@ type SkinTextureCoordinates = Record<SkinPart, ModelFaces>;
|
|
|
2255
2949
|
declare const classicSkinTextureCoordinates: Readonly<SkinTextureCoordinates>;
|
|
2256
2950
|
declare const slimSkinTextureCoordinates: Readonly<SkinTextureCoordinates>;
|
|
2257
2951
|
|
|
2952
|
+
/** A prepared shared skin material with detected arm-model and texture-layout flags. */
|
|
2258
2953
|
interface SkinTexture {
|
|
2259
2954
|
material: MeshBasicMaterial;
|
|
2260
2955
|
slim: boolean;
|
|
2261
2956
|
legacy: boolean;
|
|
2262
2957
|
}
|
|
2958
|
+
/** Prepares shared skin and cape materials, including legacy layout conversion and base-layer opacity. */
|
|
2263
2959
|
declare class SkinTextures {
|
|
2960
|
+
/** Loads a skin URL. Pass `legacy` to override layout detection from the image dimensions. */
|
|
2264
2961
|
static get(src: string, legacy?: boolean): Promise<SkinTexture>;
|
|
2265
2962
|
static getCape(src: string, layout?: CapeLayout): Promise<MeshBasicMaterial>;
|
|
2266
2963
|
private static createMaterial;
|
|
@@ -2269,12 +2966,18 @@ declare class SkinTextures {
|
|
|
2269
2966
|
private static makeBaseOpaque;
|
|
2270
2967
|
}
|
|
2271
2968
|
|
|
2969
|
+
/** Resolves player names, UUIDs, and service IDs to skin or cape texture URLs. */
|
|
2272
2970
|
declare class Skins {
|
|
2971
|
+
/** Returns a skin URL for {@link MineRenderScene.addSkin}, or `undefined` if name lookup fails. */
|
|
2273
2972
|
static fromUuidOrUsername(uuidOrUsername: string): Promise<Maybe<string>>;
|
|
2973
|
+
/** Builds a proxy URL for a UUID without downloading or checking the skin. */
|
|
2274
2974
|
static fromUuid(uuid: string): Promise<Maybe<string>>;
|
|
2275
2975
|
static fromUsername(username: string): Promise<Maybe<string>>;
|
|
2976
|
+
/** Looks up a saved MineSkin skin and returns its texture URL, or `undefined` on lookup failure. */
|
|
2276
2977
|
static fromMineSkin(mineskinId: string): Promise<Maybe<string>>;
|
|
2978
|
+
/** Resolves a player's Minecraft cape URL for {@link SkinObject.setCapeTexture}. */
|
|
2277
2979
|
static capeFromUuidOrUsername(uuidOrUsername: string): Promise<Maybe<string>>;
|
|
2980
|
+
/** Builds a proxy URL without checking whether the player has a cape. */
|
|
2278
2981
|
static capeFromUuid(uuid: string): Promise<Maybe<string>>;
|
|
2279
2982
|
static capeFromUsername(username: string): Promise<Maybe<string>>;
|
|
2280
2983
|
/** Returns a full static cape texture for a username or UUID. */
|
|
@@ -2299,27 +3002,34 @@ declare class Skins {
|
|
|
2299
3002
|
private static getMcProxyCapeUrl;
|
|
2300
3003
|
}
|
|
2301
3004
|
|
|
3005
|
+
/** Samples resource-pack colormaps to produce packed sRGB tint colors. */
|
|
2302
3006
|
declare class Colormaps {
|
|
2303
3007
|
/** Samples the selected resource pack's grass colormap using Minecraft's climate coordinates. */
|
|
2304
3008
|
static grassColor(origin?: AssetKey, temperature?: number, downfall?: number): Promise<number>;
|
|
2305
3009
|
}
|
|
2306
3010
|
|
|
3011
|
+
/** Creates sRGB textures immediately and fills their pixels after asynchronous image loading. */
|
|
2307
3012
|
declare class TextureLoader {
|
|
2308
3013
|
private static readonly failedTextures;
|
|
2309
3014
|
/** Reports whether image loading failed, so cached textures can be retried. */
|
|
2310
3015
|
static hasFailed(texture: Texture): boolean;
|
|
2311
3016
|
protected static createTexture(): Texture;
|
|
2312
3017
|
static loadInBackground(src: string, format?: PixelFormat, rotation?: number): Texture;
|
|
3018
|
+
/** Loads image pixels in the background. `rotation` is in radians. Check {@link hasFailed} for load failures. */
|
|
2313
3019
|
static load(src: string, format?: PixelFormat, rotation?: number): Texture;
|
|
2314
3020
|
}
|
|
2315
3021
|
|
|
3022
|
+
/** Creates and caches Three.js textures with nearest-neighbor sampling for Minecraft artwork. */
|
|
2316
3023
|
declare class Textures {
|
|
2317
3024
|
/** Creates the shared checkerboard from pixels without fetching or decoding an image. */
|
|
2318
3025
|
static getMissing(): DataTexture;
|
|
3026
|
+
/** Sets nearest-neighbor filters without changing the texture's color space. Returns the same texture. */
|
|
2319
3027
|
static initTextureProps<T extends Texture>(texture: T): T;
|
|
2320
3028
|
static createImage(key: TextureKey): Texture;
|
|
2321
3029
|
static createAsset(key: AssetKey): Texture;
|
|
3030
|
+
/** Creates an sRGB color texture from a canvas. */
|
|
2322
3031
|
static createCanvasTexture(canvas: HTMLCanvasElement): CanvasTexture;
|
|
3032
|
+
/** Returns a shared texture immediately and loads its image asynchronously. Failed cached loads are retried. */
|
|
2323
3033
|
static getImage(key: TextureKey): Texture;
|
|
2324
3034
|
}
|
|
2325
3035
|
|
|
@@ -2331,14 +3041,18 @@ declare function mergeVertices(geometry: BufferGeometry, tolerance?: number): Bu
|
|
|
2331
3041
|
declare function toTrianglesDrawMode(geometry: BufferGeometry, drawMode: TrianglesDrawModes): BufferGeometry;
|
|
2332
3042
|
declare function computeMorphedAttributes(object: Mesh | Line | Points): object;
|
|
2333
3043
|
|
|
3044
|
+
/** Stores 4,096 block cells in a shared state palette, with separate NBT for each cell. */
|
|
2334
3045
|
declare class ChunkData {
|
|
2335
3046
|
private readonly indices;
|
|
2336
3047
|
private readonly palette;
|
|
2337
3048
|
private readonly paletteIds;
|
|
2338
3049
|
private readonly freeIds;
|
|
2339
3050
|
private readonly nbt;
|
|
3051
|
+
/** Returns a detached copy of a cell, or `undefined` for air. Indices range from 0 to 4095. */
|
|
2340
3052
|
get(index: number): Maybe<Block>;
|
|
3053
|
+
/** Captures a cell's data and returns a copy-producing reader that survives later cell changes. */
|
|
2341
3054
|
snapshot(index: number): Maybe<() => Block>;
|
|
3055
|
+
/** Copies block data into a cell. An omitted block or an air block clears the cell. */
|
|
2342
3056
|
set(index: number, block?: Block): void;
|
|
2343
3057
|
clear(): void;
|
|
2344
3058
|
static isAir(block: Maybe<Block>): boolean;
|
|
@@ -2347,9 +3061,11 @@ declare class ChunkData {
|
|
|
2347
3061
|
}
|
|
2348
3062
|
|
|
2349
3063
|
type RegionInput = Uint8Array | ArrayBuffer;
|
|
3064
|
+
/** Chunk columns decoded from an Anvil region file. */
|
|
2350
3065
|
interface AnvilRegion {
|
|
2351
3066
|
chunks: AnvilChunk[];
|
|
2352
3067
|
}
|
|
3068
|
+
/** A decoded chunk column. `x` and `z` are absolute chunk coordinates, and section `y` is a section coordinate. */
|
|
2353
3069
|
interface AnvilChunk {
|
|
2354
3070
|
x: number;
|
|
2355
3071
|
z: number;
|
|
@@ -2360,12 +3076,21 @@ interface AnvilChunk {
|
|
|
2360
3076
|
}[];
|
|
2361
3077
|
entities?: MultiBlockEntity[];
|
|
2362
3078
|
}
|
|
3079
|
+
/** Reads Java 1.13+ paletted `.mca` regions. Entity NBT is preserved without data-version migration. */
|
|
2363
3080
|
declare class AnvilParser {
|
|
3081
|
+
/** Lists occupied chunk positions within the region, using local coordinates from 0 to 31. */
|
|
2364
3082
|
static getChunkList(data: RegionInput): {
|
|
2365
3083
|
x: number;
|
|
2366
3084
|
z: number;
|
|
2367
3085
|
}[];
|
|
3086
|
+
/** Decodes all stored chunks. Gzip, zlib, and uncompressed payloads are supported. */
|
|
2368
3087
|
static parse(data: RegionInput): Promise<AnvilRegion>;
|
|
3088
|
+
/**
|
|
3089
|
+
* Decodes one chunk for {@link MineRenderWorld.placeChunk}.
|
|
3090
|
+
* @param localX - Chunk x within the region, from 0 to 31.
|
|
3091
|
+
* @param localZ - Chunk z within the region, from 0 to 31.
|
|
3092
|
+
* @returns The chunk with absolute coordinates, or `undefined` if the region has no chunk there.
|
|
3093
|
+
*/
|
|
2369
3094
|
static parseChunk(data: RegionInput, localX: number, localZ: number): Promise<AnvilChunk | undefined>;
|
|
2370
3095
|
private static bytes;
|
|
2371
3096
|
private static locations;
|
|
@@ -2376,6 +3101,7 @@ declare class AnvilParser {
|
|
|
2376
3101
|
private static unpack;
|
|
2377
3102
|
}
|
|
2378
3103
|
|
|
3104
|
+
/** A placed block's data snapshot and optional render object, returned by world and chunk accessors. */
|
|
2379
3105
|
interface BlockInfo<SectionMeshing extends boolean = false> {
|
|
2380
3106
|
/** Detached block data; use world or chunk setters to update stored blocks. */
|
|
2381
3107
|
readonly block: Block;
|
|
@@ -2383,33 +3109,45 @@ interface BlockInfo<SectionMeshing extends boolean = false> {
|
|
|
2383
3109
|
object: SectionMeshing extends false ? BlockObject : BlockObject | undefined;
|
|
2384
3110
|
}
|
|
2385
3111
|
|
|
3112
|
+
/** Shared cube geometry and atlas data prepared for section merging. */
|
|
2386
3113
|
interface SectionMeshTemplate {
|
|
2387
3114
|
geometry: BufferGeometry;
|
|
2388
3115
|
atlas: TextureAtlas;
|
|
2389
3116
|
cullFaces: readonly number[];
|
|
2390
3117
|
}
|
|
3118
|
+
/** One block placement in a section, with its storage index and hidden-face mask. */
|
|
2391
3119
|
interface SectionMeshEntry {
|
|
2392
3120
|
index: number;
|
|
2393
3121
|
template: SectionMeshTemplate;
|
|
2394
3122
|
cullMask: number;
|
|
2395
3123
|
}
|
|
3124
|
+
/** Merged terrain geometry and atlas pages for one 16×16×16 section. Owns its generated render resources. */
|
|
2396
3125
|
declare class SectionMesh extends Group {
|
|
2397
3126
|
private readonly ownedMeshes;
|
|
3127
|
+
/** Builds section-local meshes from visible cube faces. `maxAtlasSize` limits each atlas dimension in pixels. */
|
|
2398
3128
|
static build(entries: readonly SectionMeshEntry[], maxAtlasSize?: number): SectionMesh;
|
|
2399
3129
|
dispose(): void;
|
|
2400
3130
|
}
|
|
2401
3131
|
|
|
3132
|
+
/** Prepares and caches static opaque cube geometry for merged world sections. */
|
|
2402
3133
|
declare class SectionModels {
|
|
2403
3134
|
readonly maxAtlasSize: number;
|
|
2404
3135
|
private states;
|
|
2405
3136
|
private models;
|
|
2406
3137
|
private readonly templates;
|
|
2407
3138
|
constructor(maxAtlasSize?: number);
|
|
3139
|
+
/** Returns a cube template, or `undefined` when the block requires an individual render object. */
|
|
2408
3140
|
get(blockState: BlockState, properties?: BlockStateProperties): Promise<SectionMeshTemplate | undefined>;
|
|
2409
3141
|
private prepare;
|
|
3142
|
+
/** Disposes prepared geometry and clears this world's template caches. */
|
|
2410
3143
|
clear(): void;
|
|
2411
3144
|
}
|
|
2412
3145
|
|
|
3146
|
+
/**
|
|
3147
|
+
* A 16×16×16 block section and its render objects.
|
|
3148
|
+
* Constructor coordinates identify the section. Block accessors use world block coordinates
|
|
3149
|
+
* unless their name explicitly refers to positions within the chunk.
|
|
3150
|
+
*/
|
|
2413
3151
|
declare class Chunk<SectionMeshing extends boolean = false> {
|
|
2414
3152
|
private readonly onBlocksChanged?;
|
|
2415
3153
|
private readonly sectionModels?;
|
|
@@ -2428,28 +3166,36 @@ declare class Chunk<SectionMeshing extends boolean = false> {
|
|
|
2428
3166
|
getBlockAt(pos: Vector3): Maybe<BlockInfo<SectionMeshing>>;
|
|
2429
3167
|
getBlockAt(pos: TripleArray): Maybe<BlockInfo<SectionMeshing>>;
|
|
2430
3168
|
/**
|
|
2431
|
-
*
|
|
3169
|
+
* Places a block at integer world block coordinates. Pass `undefined` to remove it.
|
|
2432
3170
|
*/
|
|
2433
3171
|
setBlockAt(x: number, y: number, z: number, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
|
|
2434
3172
|
setBlockAt(pos: Vector3, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
|
|
2435
3173
|
setBlockAt(pos: TripleArray, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
|
|
2436
3174
|
/**
|
|
2437
|
-
*
|
|
3175
|
+
* Places a block at integer chunk-local coordinates from 0 to 15.
|
|
2438
3176
|
*/
|
|
2439
3177
|
setBlockInChunkAt(pos: Vector3, block?: Block, worldPos?: Vector3, onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined): Promise<Maybe<BlockInfo<SectionMeshing>>>;
|
|
3178
|
+
/** Changes visibility at world block coordinates while preserving the block's data. */
|
|
2440
3179
|
setBlockVisibleAt(pos: Vector3, visible: boolean): Promise<void>;
|
|
2441
3180
|
isBlockVisibleAt(pos: Vector3): boolean;
|
|
2442
3181
|
isOccludingAt(pos: Vector3): boolean;
|
|
2443
3182
|
setCullMaskAt(pos: Vector3, mask: number): Promise<void>;
|
|
2444
3183
|
rebuildSectionMesh(): void;
|
|
3184
|
+
/** Removes stored blocks and their render objects, then notifies the owning world of changed positions. */
|
|
2445
3185
|
clear(onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined): Promise<void>;
|
|
2446
3186
|
dispose(): Promise<void>;
|
|
2447
3187
|
static isAir(block: Maybe<Block>): boolean;
|
|
3188
|
+
/** Maps chunk-local coordinates from 0 to 15 to a storage index, with x varying fastest, then z, then y. */
|
|
2448
3189
|
static chunkPosToBlockIndex(pos: Vector3): number;
|
|
2449
3190
|
worldPosToChunkPos(pos: Vector3): Vector3;
|
|
2450
3191
|
chunkPosToWorldPos(pos: Vector3): Vector3;
|
|
2451
3192
|
}
|
|
2452
3193
|
|
|
3194
|
+
/**
|
|
3195
|
+
* Stores and renders blocks in sparse 16×16×16 chunks.
|
|
3196
|
+
* Positions use integer block coordinates, including negatives. One block is 16 scene units.
|
|
3197
|
+
* Set `options.sectionMeshing` in `new MineRenderWorld(scene, options)` to merge compatible terrain.
|
|
3198
|
+
*/
|
|
2453
3199
|
declare class MineRenderWorld<SectionMeshing extends boolean = false> {
|
|
2454
3200
|
readonly scene: MineRenderScene;
|
|
2455
3201
|
private readonly _chunks;
|
|
@@ -2457,9 +3203,14 @@ declare class MineRenderWorld<SectionMeshing extends boolean = false> {
|
|
|
2457
3203
|
private readonly pendingCulling;
|
|
2458
3204
|
private culling?;
|
|
2459
3205
|
constructor(scene: MineRenderScene, options?: MineRenderWorldOptions<SectionMeshing>);
|
|
3206
|
+
/** Returns a placed block at world block coordinates, or `undefined` for an empty position. */
|
|
2460
3207
|
getBlockAt(x: number, y: number, z: number): Maybe<BlockInfo<SectionMeshing>>;
|
|
2461
3208
|
getBlockAt(pos: Vector3): Maybe<BlockInfo<SectionMeshing>>;
|
|
2462
3209
|
getBlockAt(pos: TripleArray): Maybe<BlockInfo<SectionMeshing>>;
|
|
3210
|
+
/**
|
|
3211
|
+
* Places or replaces a block and refreshes neighboring faces.
|
|
3212
|
+
* Pass `undefined` or an air block to remove the block at these world block coordinates.
|
|
3213
|
+
*/
|
|
2463
3214
|
setBlockAt(x: number, y: number, z: number, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
|
|
2464
3215
|
setBlockAt(pos: Vector3, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
|
|
2465
3216
|
setBlockAt(pos: TripleArray, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
|
|
@@ -2471,19 +3222,37 @@ declare class MineRenderWorld<SectionMeshing extends boolean = false> {
|
|
|
2471
3222
|
setBlockVisibleAt(x: number, y: number, z: number, visible: boolean): Promise<void>;
|
|
2472
3223
|
setBlockVisibleAt(pos: Vector3, visible: boolean): Promise<void>;
|
|
2473
3224
|
setBlockVisibleAt(pos: TripleArray, visible: boolean): Promise<void>;
|
|
3225
|
+
/**
|
|
3226
|
+
* Places a structure's blocks at their stored positions, then refreshes neighboring faces.
|
|
3227
|
+
* Entity NBT is retained by the structure but is not rendered.
|
|
3228
|
+
*
|
|
3229
|
+
* @param useBatches - Uses bounded batches by default. Set to `false` for sequential placement.
|
|
3230
|
+
* @param executor - Optional queue for batched placement. The caller remains responsible for stopping it.
|
|
3231
|
+
*/
|
|
2474
3232
|
placeMultiBlock(multiblock: MultiBlockStructure, useBatches?: boolean, executor?: BatchedExecutor): Promise<void>;
|
|
2475
3233
|
private placeBlocks;
|
|
2476
3234
|
/** Replaces one chunk column's blocks. Entity NBT remains available on the parsed chunk. */
|
|
2477
3235
|
placeChunk(chunk: AnvilChunk, executor?: BatchedExecutor): Promise<void>;
|
|
3236
|
+
/**
|
|
3237
|
+
* Removes all sections at integer chunk-column coordinates, then refreshes neighboring faces and fluids.
|
|
3238
|
+
* Coordinates match AnvilChunk.x/z, not block positions. Missing columns are ignored.
|
|
3239
|
+
*/
|
|
3240
|
+
unloadChunkColumn(x: number, z: number): Promise<void>;
|
|
3241
|
+
private clearChunkColumn;
|
|
3242
|
+
/** Removes all chunks and releases their block placements and section meshes. */
|
|
2478
3243
|
clear(): Promise<void>;
|
|
2479
3244
|
private updateCulling;
|
|
2480
3245
|
private getOrCreateChunkAt;
|
|
3246
|
+
/** Returns the loaded chunk containing a world block position, without creating a chunk. */
|
|
2481
3247
|
getChunkAt(pos: Vector3): Maybe<Chunk<SectionMeshing>>;
|
|
3248
|
+
/** Converts block coordinates to scene units by multiplying each component by 16. */
|
|
2482
3249
|
static worldToScenePosition(pos: Vector3): Vector3;
|
|
3250
|
+
/** Converts scene units to block coordinates without rounding to an integer block. */
|
|
2483
3251
|
static sceneToWorldPosition(pos: Vector3): Vector3;
|
|
2484
3252
|
worldPosToChunkKey(pos: Vector3): string;
|
|
2485
3253
|
validatePosBounds(pos: Vector3): void;
|
|
2486
3254
|
}
|
|
3255
|
+
/** Settings passed as the second argument to `new MineRenderWorld(scene, options)`. */
|
|
2487
3256
|
interface MineRenderWorldOptions<SectionMeshing extends boolean = boolean> {
|
|
2488
3257
|
/** Merge static opaque cubes into section meshes. Merged blocks have no individual object. */
|
|
2489
3258
|
sectionMeshing?: SectionMeshing;
|
|
@@ -2502,6 +3271,7 @@ declare class BrowserEnv implements EnvProvider {
|
|
|
2502
3271
|
imageSize(data: Uint8Array): ImageSizeInfo;
|
|
2503
3272
|
openCache(name: string, version: number): PersistentCache;
|
|
2504
3273
|
}
|
|
3274
|
+
/** Installs the browser provider. The browser package entry calls this automatically. */
|
|
2505
3275
|
declare function registerBrowserEnv(): BrowserEnv;
|
|
2506
3276
|
|
|
2507
3277
|
/**
|
|
@@ -2527,4 +3297,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
|
|
|
2527
3297
|
*/
|
|
2528
3298
|
declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
|
|
2529
3299
|
|
|
2530
|
-
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 };
|
|
3300
|
+
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, AnvilParser, type AnvilRegion, ArchiveAssetSource, type ArchiveAssetSourceOptions, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, type BannerPattern, type BannerPatternDraw, BannerPatterns, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type BitmapFont, type BitmapGlyph, type Block, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, BrowserCache, BrowserEnv, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, DYE_COLORS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type DyeColor, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, Fonts, type FrameCallback, type FromTo, GUI_CONTAINER_LAYOUTS, Geometries, type GuiBookButtonState, type GuiBookOptions, type GuiBossBarColor, type GuiBossBarOptions, type GuiContainerType, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiSpriteScaling, type GuiText, type GuiTextLayer, type GuiTextLayout, type GuiTextOptions, type GuiTextRun, type GuiTextStyle, type GuiTextureLayer, type GuiTooltipOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelContext, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, type LoadedSceneDocument, type LoadedSceneObject, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, OrbitControls, type PackFormat, PackFormats, PackMetadata, PersistentCache, type PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererFrame, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResponseParser, SKIN_PARTS, type SceneBlockDefinition, type SceneDocument, SceneDocumentLoader, type SceneEntityDefinition, SceneExporter, type SceneGLTFExportOptions, type SceneGuiDefinition, type SceneGuiLayer, SceneInspector, type SceneModelDefinition, SceneObject, type SceneObjectDefinition, type SceneObjectDefinitionBase, type SceneObjectOptions, type SceneSkinDefinition, type SceneSkinPosePart, SceneStats, SceneStatsDisplay, SchematicParser, type SchematicParserOptions, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createFluidGeometry, createGuiTextGeometry, createGuiTextureGeometry, createImage, entityAnimationTime, estimateBytesUsed, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, layoutGuiText, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, parseSceneDocument, prefix, probeImageSize, registerBrowserEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
|