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