minerender 2.1.0-alpha.75 → 2.1.0-alpha.77

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.
@@ -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, Group } 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, Group, DataTexture, CanvasTexture, InterleavedBufferAttribute, TrianglesDrawModes, Line, Points } from 'three';
3
3
  import * as nodeCanvas from 'canvas';
4
4
  import { ImageData as ImageData$1, CanvasRenderingContext2D } from 'canvas';
5
5
  import { Buffer } from 'buffer';
@@ -11,6 +11,7 @@ export { PLYExporterOptions } from 'three/examples/jsm/exporters/PLYExporter.js'
11
11
  import Stats from 'stats.js';
12
12
  import { EffectComposer } from 'postprocessing';
13
13
 
14
+ /** Advances a texture animation by one tick. Return `false` when its pixels have not changed. */
14
15
  interface AnimatorFunction {
15
16
  (): boolean | void;
16
17
  }
@@ -42,6 +43,7 @@ declare enum CubeFaceIndex {
42
43
  declare const CUBE_FACES: CubeFace[];
43
44
  declare const CUBE_FACE_OFFSETS: readonly [readonly [1, 0, 0], readonly [-1, 0, 0], readonly [0, 1, 0], readonly [0, -1, 0], readonly [0, 0, 1], readonly [0, 0, -1]];
44
45
 
46
+ /** An object that can release the resources it owns. */
45
47
  interface Disposable {
46
48
  dispose(): void;
47
49
  }
@@ -49,7 +51,9 @@ declare function isDisposable(obj: any): obj is Disposable;
49
51
 
50
52
  type CompatImage = HTMLImageElement | nodeCanvas.Image;
51
53
  type CompatCanvas = HTMLCanvasElement | nodeCanvas.Canvas;
54
+ /** Creates an image through the active environment provider. Dimensions are in pixels. */
52
55
  declare function createImage(width?: number, height?: number): CompatImage;
56
+ /** Creates a browser or Node canvas through the active environment provider, sized in pixels. */
53
57
  declare function createCanvas(width: number, height: number): CompatCanvas;
54
58
 
55
59
  /**
@@ -63,6 +67,7 @@ declare abstract class PersistentCache<B = unknown> {
63
67
  readonly backing: B;
64
68
  /** Bump to invalidate every persisted entry. */
65
69
  static readonly VERSION = 2;
70
+ /** Opens a named store in the active environment using the current cache schema version. */
66
71
  static open(name: string): PersistentCache;
67
72
  protected constructor(backing: B);
68
73
  abstract get<T>(key: string): Promise<T>;
@@ -115,6 +120,7 @@ declare class Env {
115
120
  static get provider(): EnvProvider;
116
121
  }
117
122
 
123
+ /** A canvas-backed image with dimensions and a context for reading pixel regions. */
118
124
  interface ExtractableImageData {
119
125
  readonly data: CanvasImageData;
120
126
  readonly width: number;
@@ -122,10 +128,12 @@ interface ExtractableImageData {
122
128
  }
123
129
 
124
130
  type CacheKey = string;
131
+ /** Source URL used to identify cached image bytes and pixels. */
125
132
  interface RawImageKey {
126
133
  src: string;
127
134
  }
128
135
  declare function serializeImageKey(key: RawImageKey): string;
136
+ /** Box dimensions in scene units and optional normalized UVs in Three.js face order. */
129
137
  interface BoxGeometryKey {
130
138
  width: number;
131
139
  height: number;
@@ -133,32 +141,39 @@ interface BoxGeometryKey {
133
141
  uv?: number[];
134
142
  }
135
143
  declare function serializeBoxGeometryKey(key: BoxGeometryKey): string;
144
+ /** Settings passed to {@link Textures.getImage}. Texture rotation uses radians. */
136
145
  interface TextureKey extends RawImageKey {
137
146
  format?: PixelFormat;
138
147
  rotation?: number;
139
148
  }
140
149
  declare function serializeTextureKey(key: TextureKey): string;
150
+ /** Texture and transparency settings passed to {@link Materials.getImage}. */
141
151
  interface MaterialKey {
142
152
  texture: TextureKey;
143
153
  transparent?: boolean;
144
154
  }
145
155
  declare function serializeMaterialKey(key: MaterialKey): string;
156
+ /** Geometry and material settings passed to {@link Meshes.createBox} or {@link Meshes.getBox}. */
146
157
  interface MeshKey {
147
158
  geometry: BoxGeometryKey;
148
159
  material: MaterialKey;
149
160
  }
150
161
  declare function serializeMeshKey(key: MeshKey): string;
151
162
 
163
+ /** Creates box geometry with optional face UVs and caches it by dimensions and UV values. */
152
164
  declare class Geometries {
153
165
  static createBox(key: BoxGeometryKey): BoxGeometry;
166
+ /** Returns shared geometry. Use {@link createBox} when the caller needs to modify or dispose it independently. */
154
167
  static getBox(key: BoxGeometryKey): BoxGeometry;
155
168
  }
156
169
 
170
+ /** Produces a string representation, such as an asset cache key. */
157
171
  interface Serializable {
158
172
  serialize(): string;
159
173
  }
160
174
 
161
175
  type AssetType = "models" | "textures" | "blockstates" | string;
176
+ /** A Minecraft namespace and path, such as `minecraft` and `zombie`. */
162
177
  declare class BasicAssetKey implements Serializable {
163
178
  readonly namespace: string;
164
179
  readonly path: string;
@@ -168,6 +183,7 @@ declare class BasicAssetKey implements Serializable {
168
183
  toString(): string;
169
184
  serialize(): string;
170
185
  }
186
+ /** Locates an asset by namespace, directory, extension, and optional asset root. */
171
187
  declare class AssetKey extends BasicAssetKey {
172
188
  readonly namespace: string;
173
189
  readonly path: string;
@@ -177,28 +193,52 @@ declare class AssetKey extends BasicAssetKey {
177
193
  extension: ".json" | ".png" | string;
178
194
  root?: string | undefined;
179
195
  readonly isAssetKey: true;
196
+ /**
197
+ * Creates a key from separate path components. Use {@link parse} for a combined reference.
198
+ *
199
+ * @param assetType - Asset directory, such as `models`, `textures`, or `blockstates`.
200
+ * @param type - Subdirectory, such as `block` or `item`.
201
+ * @param rootType - Top-level directory, usually `assets` or `data`.
202
+ * @param root - Base URL override for hosted asset sources.
203
+ */
180
204
  constructor(namespace: string, path: string, assetType?: AssetType | undefined, type?: string | undefined, rootType?: "assets" | "data" | string, extension?: ".json" | ".png" | string, root?: string | undefined);
205
+ /**
206
+ * Parses an asset reference such as `minecraft:block/stone`.
207
+ * A missing namespace defaults to the origin's namespace or `minecraft`.
208
+ *
209
+ * @param assetType - Asset category, such as `models` or `textures`.
210
+ * @param str - Path with an optional namespace and file extension.
211
+ * @param origin - Supplies the asset root, default namespace, and non-texture extension.
212
+ * @returns A key with the matching extension removed from its path. Textures use `.png`;
213
+ * other assets use the origin's extension or `.json`.
214
+ */
181
215
  static parse(assetType: AssetType, str: string, origin?: AssetKey): AssetKey;
182
216
  toString(): string;
217
+ /** Joins the type subdirectory and path without adding a namespace or file extension. */
183
218
  getFullPath(): string;
184
219
  toNamespacedString(): string;
220
+ /** Returns a cache identifier that includes the explicit root or {@link AssetLoader.ROOT}. */
185
221
  serialize(): string;
186
222
  }
187
223
  declare function isBasicAssetKey(obj: any): obj is BasicAssetKey;
188
224
  declare function isAssetKey(obj: any): obj is AssetKey;
189
225
 
226
+ /** Loaded data with an optional namespace-and-path identity. */
190
227
  interface BasicMinecraftAsset {
191
228
  key?: BasicAssetKey;
192
229
  }
230
+ /** Loaded data that can retain its full source key for related asset lookups. */
193
231
  interface MinecraftAsset extends BasicMinecraftAsset {
194
232
  key?: AssetKey;
195
233
  }
196
234
 
235
+ /** A hosted `_list.json` directory index used by asset-listing APIs. */
197
236
  interface ListAsset extends MinecraftAsset {
198
237
  directories: string[];
199
238
  files: string[];
200
239
  }
201
240
 
241
+ /** One selected draw, combining geometry, texture, and material settings. */
202
242
  interface EntityLayer {
203
243
  key: BasicAssetKey;
204
244
  texture?: AssetKey;
@@ -208,6 +248,7 @@ interface EntityLayer {
208
248
  /** Label of the state colour that multiplies the texture, from the pass that selected this draw. */
209
249
  tint?: string;
210
250
  }
251
+ /** Selected entity data returned by {@link Entities.getEntity} for rendering. */
211
252
  interface EntityModel extends EntityLayer {
212
253
  id: string;
213
254
  /** Root transform from the dataset; see {@link EntityTransformOp}. */
@@ -218,6 +259,7 @@ interface EntityModel extends EntityLayer {
218
259
  */
219
260
  layers?: Record<string, EntityLayer>;
220
261
  }
262
+ /** Dataset file containing all geometry layers and optional extra render passes. */
221
263
  interface EntityModelFile extends MinecraftAsset {
222
264
  id: string;
223
265
  transform?: EntityTransformOp[];
@@ -227,6 +269,7 @@ interface EntityModelFile extends MinecraftAsset {
227
269
  }
228
270
  /** Vanilla render type of a draw; see the dataset README for the mode table. */
229
271
  type EntityRenderMode = "cutout" | "cutout_cull" | "cutout_z_offset" | "solid" | "translucent" | "translucent_emissive" | "eyes" | "energy_swirl" | "breeze_wind" | "water_mask";
272
+ /** An extra draw of a geometry layer, optionally enabled by an entity-state label. */
230
273
  interface EntityModelPass {
231
274
  /** Geometry layer of the same file; a pass on `main` draws that geometry again. */
232
275
  layer: string;
@@ -251,6 +294,7 @@ type EntityTransformOp = {
251
294
  } | {
252
295
  rotate: [number, number, number];
253
296
  };
297
+ /** A named geometry tree with texture dimensions in pixels and an optional default texture path. */
254
298
  interface EntityModelLayer {
255
299
  texture: [number, number];
256
300
  textureLocation?: string;
@@ -258,6 +302,7 @@ interface EntityModelLayer {
258
302
  render?: EntityRenderMode;
259
303
  root: EntityModelPart;
260
304
  }
305
+ /** A named part's baked pose and children. Offsets use model units and rotations use radians. */
261
306
  interface EntityModelPart {
262
307
  pose: {
263
308
  offset: [number, number, number];
@@ -268,6 +313,7 @@ interface EntityModelPart {
268
313
  cubes: EntityModelCube[];
269
314
  children: Record<string, EntityModelPart>;
270
315
  }
316
+ /** A part's cuboid in model units, with a texture origin in pixels and optional per-axis growth. */
271
317
  interface EntityModelCube {
272
318
  origin: [number, number, number];
273
319
  size: [number, number, number];
@@ -276,7 +322,9 @@ interface EntityModelCube {
276
322
  mirror?: boolean;
277
323
  }
278
324
 
325
+ /** Creates Minecraft model, entity, and GUI materials, with shared caches for image materials. */
279
326
  declare class Materials {
327
+ /** Shared checkerboard material, created on first access. */
280
328
  static get MISSING_TEXTURE(): Material;
281
329
  static createImage(key: MaterialKey): Material;
282
330
  static createBasicCanvasMaterial(canvas: HTMLCanvasElement, transparent?: boolean, shade?: boolean): Material;
@@ -290,17 +338,22 @@ declare class Materials {
290
338
  * whether the geometry gets inward faces.
291
339
  */
292
340
  static createEntityCanvasMaterial(canvas: HTMLCanvasElement, mode?: EntityRenderMode, tint?: ColorRepresentation): MeshBasicMaterial;
341
+ /** Creates an unlit, transparent GUI material without depth writes or tone mapping. */
293
342
  static createGuiCanvasMaterial(canvas: HTMLCanvasElement): MeshBasicMaterial;
294
343
  static createShadedCanvasMaterial(canvas: HTMLCanvasElement, transparent?: boolean, shade?: boolean, boundUvs?: boolean): Material;
344
+ /** Returns a shared image material. Use {@link createImage} for a separate material instance. */
295
345
  static getImage(key: MaterialKey): Material;
296
346
  static needsUpdate(mat: Material): void;
297
347
  }
298
348
 
349
+ /** Creates box meshes from shared geometry and image materials. */
299
350
  declare class Meshes {
300
351
  static createBox(key: MeshKey): Mesh;
352
+ /** Returns a shared Mesh object. Use {@link createBox} for a mesh with its own transform and parent. */
301
353
  static getBox(key: MeshKey): Mesh;
302
354
  }
303
355
 
356
+ /** Texture and culling settings for one cuboid face. Java model UVs use Minecraft's 0–16 texture space. */
304
357
  interface ElementFace {
305
358
  uv: QuadArray;
306
359
  mappedUv?: QuadArray;
@@ -314,6 +367,7 @@ interface FromTo {
314
367
  from: TripleArray;
315
368
  to: TripleArray;
316
369
  }
370
+ /** A cuboid in model units, where 16 units equal one block. */
317
371
  interface ModelElement extends FromTo {
318
372
  rotation?: ElementRotation;
319
373
  shade?: boolean;
@@ -321,6 +375,7 @@ interface ModelElement extends FromTo {
321
375
  mappedUv?: number[];
322
376
  }
323
377
  type ModelFaces = Partial<Record<CubeFace, Partial<ElementFace>>>;
378
+ /** Rotates one cuboid around an origin in model units, using an angle in degrees. */
324
379
  interface ElementRotation {
325
380
  origin: TripleArray;
326
381
  axis: Axis;
@@ -346,14 +401,17 @@ declare enum GuiLight {
346
401
  SIDE = "side"
347
402
  }
348
403
 
404
+ /** Fetch settings passed to {@link Requests.genericRequest} or {@link Requests.mcAssetRequest}. */
349
405
  interface RequestConfig extends RequestInit {
350
406
  url: string;
351
407
  /** Prepended to relative URLs, preserving any path in the base URL. */
352
408
  baseURL?: string;
353
409
  /** Timeout per attempt in milliseconds, including body reading. Defaults to 5000; 0 disables it. */
354
410
  timeout?: number;
411
+ /** Response-body decoding. Defaults to `json`. */
355
412
  responseType?: "json" | "arraybuffer";
356
413
  }
414
+ /** A decoded response body with the HTTP status, native headers, and final URL. */
357
415
  interface RequestResponse<T = any> {
358
416
  data: T;
359
417
  status: number;
@@ -362,16 +420,21 @@ interface RequestResponse<T = any> {
362
420
  /** Final URL after redirects. */
363
421
  url: string;
364
422
  }
423
+ /** An HTTP or network failure, with response details or an underlying cause when available. */
365
424
  declare class RequestError extends Error {
366
425
  readonly response?: RequestResponse<undefined> | undefined;
367
426
  readonly cause?: unknown;
368
427
  constructor(message: string, response?: RequestResponse<undefined> | undefined, cause?: unknown);
369
428
  }
429
+ /** Shared Fetch queues with concurrency limits, cancellation, timeouts, and bounded retries for GET requests. */
370
430
  declare class Requests {
371
431
  private static genericQueue;
372
432
  private static mcAssetRequestQueue;
433
+ /** Queues a general request. Set `request.signal` to cancel it and `request.timeout` to limit each attempt. */
373
434
  static genericRequest(request: RequestConfig): Promise<RequestResponse>;
435
+ /** Queues a request separately from general traffic, using the configured asset base URL for relative paths. */
374
436
  static mcAssetRequest(request: RequestConfig): Promise<RequestResponse>;
437
+ /** Sets the base URL for relative asset requests. Use {@link AssetLoader.setVersion} to change Minecraft versions. */
375
438
  static setMcAssetRoot(root: string): void;
376
439
  /** Counts unsettled calls, including retry delays and requests still running after shutdown. */
377
440
  static get queueSizes(): {
@@ -386,6 +449,7 @@ declare class Requests {
386
449
  static end(): void;
387
450
  }
388
451
 
452
+ /** Provides pixel and frame access to a canvas-backed image. Simple frame helpers assume a vertical strip of squares. */
389
453
  declare class WrappedImage {
390
454
  readonly dta: ExtractableImageData;
391
455
  constructor(dta: ExtractableImageData);
@@ -394,6 +458,7 @@ declare class WrappedImage {
394
458
  get width(): number;
395
459
  get height(): number;
396
460
  get hasTransparency(): boolean;
461
+ /** Whether the dimensions form a vertical strip of square frames, without consulting `.mcmeta`. */
397
462
  get animated(): boolean;
398
463
  get frameWidth(): number;
399
464
  get frameHeight(): number;
@@ -404,6 +469,7 @@ declare class WrappedImage {
404
469
  getFrameSectionData(frame: number): ImageData$1;
405
470
  }
406
471
 
472
+ /** Encoded image bytes with dimensions and format detected from the file header. */
407
473
  interface ImageInfo {
408
474
  src?: string;
409
475
  width: number;
@@ -411,15 +477,21 @@ interface ImageInfo {
411
477
  type?: string;
412
478
  data: Buffer;
413
479
  }
480
+ /** Fetches and decodes images through the active browser or Node environment provider. */
414
481
  declare class ImageLoader {
415
482
  protected static _createImage(): CompatImage;
483
+ /** Resolves when an image URL has decoded, or rejects if decoding fails. */
416
484
  static loadAsync(src: string): Promise<CompatImage>;
485
+ /** Returns an image immediately. Use the callbacks to observe loading, or await {@link loadAsync}. */
417
486
  static loadElement(src: string, onload?: () => void, onerr?: (err: Error) => void): CompatImage;
418
487
  static loadData(src: string): Promise<ImageData>;
419
488
  static loadCanvasData(src: string): Promise<ExtractableImageData>;
489
+ /** Decodes the supplied bytes into a canvas without fetching the source URL again. */
420
490
  static infoToCanvasData(info: ImageInfo): Promise<ExtractableImageData>;
421
491
  static infoToData(info: ImageInfo): Promise<ImageData>;
492
+ /** Returns cached RGBA pixels for an image URL or data URL. Failed loads can be retried. */
422
493
  static getData(src: string): Promise<ImageData>;
494
+ /** Returns a cached canvas context and dimensions for an image URL or data URL. */
423
495
  static getCanvasData(src: string): Promise<ExtractableImageData>;
424
496
  static processResponse(response: Pick<RequestResponse<ArrayBuffer>, "data" | "url">): Promise<ImageInfo>;
425
497
  static loadInfo(src: string): Promise<ImageInfo>;
@@ -432,6 +504,7 @@ declare const ITEM_GENERATED = "item/generated";
432
504
  declare const BUILTIN_GENERATED = "builtin/generated";
433
505
  declare const BUILTIN_ENTITY = "builtin/entity";
434
506
  declare const DEFAULT_ELEMENTS: ModelElement[];
507
+ /** A Java model definition. {@link Models.getMerged} resolves its parent, textures, and elements. */
435
508
  interface Model extends MinecraftAsset {
436
509
  textures?: IModelTextures;
437
510
  parent?: string;
@@ -439,17 +512,21 @@ interface Model extends MinecraftAsset {
439
512
  elements?: ModelElement[];
440
513
  hierarchy?: string[];
441
514
  }
515
+ /** Java block-model data, including the ambient-occlusion flag. */
442
516
  interface BlockModel extends Model {
443
517
  textures?: BlockModelTextures;
444
518
  ambientocclusion?: boolean;
445
519
  }
520
+ /** Item preview data, including GUI lighting, tint sources, and supported special renderers. */
446
521
  interface ItemModel extends Model {
447
522
  textures?: ItemModelTextures;
448
523
  gui_light?: GuiLight;
449
524
  special?: SpecialItemRenderer;
450
525
  tints?: ItemTintSource[];
451
526
  }
527
+ /** An sRGB packed `0xRRGGBB` value or an RGB triple with components from 0 to 1. */
452
528
  type ItemTintColor = number | TripleArray;
529
+ /** A vanilla item color source. Gameplay-dependent sources use their declared default color. */
453
530
  type ItemTintSource = {
454
531
  type: "constant" | "minecraft:constant";
455
532
  value: ItemTintColor;
@@ -465,6 +542,7 @@ type ItemTintSource = {
465
542
  index?: number;
466
543
  default: ItemTintColor;
467
544
  };
545
+ /** Supported item definitions that draw entity geometry instead of ordinary model elements. */
468
546
  type SpecialItemRenderer = {
469
547
  type: "chest" | "minecraft:chest";
470
548
  texture: string;
@@ -480,6 +558,7 @@ type SpecialItemRenderer = {
480
558
  };
481
559
  interface TextureAsset extends MinecraftAsset, ImageInfo {
482
560
  }
561
+ /** A model display pose: translation in model units, rotation in degrees, and scale factors. */
483
562
  interface ModelDisplay {
484
563
  translation?: TripleArray;
485
564
  rotation?: TripleArray;
@@ -519,12 +598,14 @@ declare class MinecraftCubeTexture {
519
598
  toUvArray(w: number, h: number, l: number, mirror?: boolean): number[];
520
599
  }
521
600
 
601
+ /** Texture animation and GUI scaling metadata read from a `.png.mcmeta` file. */
522
602
  interface MinecraftTextureMeta extends MinecraftAsset {
523
603
  animation?: AnimationMeta;
524
604
  gui?: {
525
605
  scaling?: GuiSpriteScaling;
526
606
  };
527
607
  }
608
+ /** GUI sprite scaling rules. Dimensions and borders use logical GUI pixels, independent of PNG resolution. */
528
609
  type GuiSpriteScaling = {
529
610
  type: "stretch";
530
611
  } | {
@@ -543,6 +624,7 @@ type GuiSpriteScaling = {
543
624
  };
544
625
  stretch_inner?: boolean;
545
626
  };
627
+ /** Texture frame-grid and playback settings. Frame durations use ticks at 20 ticks per second. */
546
628
  interface AnimationMeta {
547
629
  interpolate: boolean;
548
630
  width: number;
@@ -550,17 +632,20 @@ interface AnimationMeta {
550
632
  frametime: number;
551
633
  frames: Array<number | AnimationFrame>;
552
634
  }
635
+ /** A zero-based frame index and its duration in ticks, overriding the animation's default frame time. */
553
636
  interface AnimationFrame {
554
637
  index: number;
555
638
  time: number;
556
639
  }
557
640
 
641
+ /** Counts direct scene children, Minecraft scene objects, and live instance placements. */
558
642
  declare class SceneStats {
559
643
  objectCount: number;
560
644
  sceneObjectCount: number;
561
645
  instanceCount: number;
562
646
  }
563
647
 
648
+ /** A synchronous callback registered with {@link Ticker.add}. */
564
649
  interface TickerFunction {
565
650
  (): void;
566
651
  }
@@ -582,18 +667,24 @@ declare class Ticker {
582
667
  private static fiveSecondTps;
583
668
  private static fiveSecondTicks;
584
669
  private static schedule;
670
+ /** Starts or resumes the shared tick loop. Repeated calls have no effect. */
585
671
  static start(): void;
672
+ /** Pauses the loop while retaining callbacks for a later {@link start}. */
586
673
  static stop(): void;
674
+ /** Registers a callback, starts the loop if needed, and returns an ID for {@link remove}. */
587
675
  static add(tick: TickerFunction): number;
676
+ /** Removes a callback by ID and stops the timers when no callbacks remain. */
588
677
  static remove(c?: number): void;
589
678
  static get tickers(): Map<number, TickerFunction>;
590
679
  static get tpsOneSecond(): number;
591
680
  static get tpsFiveSeconds(): number;
681
+ /** Stops the loop and removes all registered callbacks. */
592
682
  static dispose(): void;
593
683
  }
594
684
 
595
685
  declare const TintColors: never[];
596
686
 
687
+ /** Transform access shared by scene objects and instance references. Positions use scene units and rotations use radians. */
597
688
  interface Transformable {
598
689
  setPositionRotationScale(position?: Vector3, rotation?: Euler, scale?: Vector3): void;
599
690
  setPosition(position: Vector3): void;
@@ -617,22 +708,30 @@ declare function base64encode(str: string): string;
617
708
  declare function base64decode(str: string): string;
618
709
  declare function toRadians(degrees: number): number;
619
710
  declare function toDegrees(radians: number): number;
711
+ /** Resolves after a delay in milliseconds. */
620
712
  declare function sleep(timeout: number): Promise<void>;
713
+ /** Reduces an angle modulo 360, retaining a negative sign for negative inputs. */
621
714
  declare function clampRotationDegrees(deg: number): number;
622
715
  declare function isVector3(obj: any): obj is Vector3;
623
716
  type DeepPartial<T> = {
624
717
  [P in keyof T]?: DeepPartial<T[P]>;
625
718
  };
626
719
 
720
+ /** Loads texture pixels and `.mcmeta` files through the active asset sources. */
627
721
  declare class ModelTextures {
628
722
  private static _persistentMetaCache;
629
723
  private static get PERSISTENT_META_CACHE();
724
+ /** Loads and decodes a texture into a readable canvas, or returns `undefined` when missing. */
630
725
  static get(key: AssetKey): Promise<Maybe<ExtractableImageData>>;
726
+ /** Fetches and caches encoded texture bytes without decoding the pixels. */
631
727
  static preload(key: AssetKey): Promise<Maybe<TextureAsset>>;
728
+ /** Loads a texture's `.mcmeta` file, or returns `undefined` when no metadata file exists. */
632
729
  static getMeta(key: AssetKey): Promise<Maybe<MinecraftTextureMeta>>;
730
+ /** Clears persisted texture metadata. Use {@link Caching.clear} to discard in-memory textures and metadata. */
633
731
  static clearCache(): Promise<void>;
634
732
  }
635
733
 
734
+ /** Wraps a browser or Node canvas for pixel reads and writes. All coordinates and dimensions use pixels. */
636
735
  declare class CanvasImage implements Disposable {
637
736
  readonly canvas: CompatCanvas;
638
737
  readonly context: CanvasRenderingContext2D;
@@ -650,6 +749,7 @@ declare class CanvasImage implements Disposable {
650
749
  dispose(): void;
651
750
  }
652
751
 
752
+ /** A model's combined texture canvas, per-texture rectangles, and shared animation subscriptions. */
653
753
  declare class TextureAtlas implements Disposable {
654
754
  readonly model: Model;
655
755
  readonly image: CanvasImage;
@@ -675,11 +775,13 @@ declare class TextureAtlas implements Disposable {
675
775
  }, hasTransparency: boolean);
676
776
  /** Calls subscribers when an animation frame changes; unused atlases do not tick. */
677
777
  subscribe(callback: () => void): () => void;
778
+ /** Copies pixels for a texture variable from its current atlas rectangle. */
678
779
  getData(texture: string): ImageData$1;
679
780
  dispose(): void;
680
781
  }
681
782
 
682
783
  declare const DEFAULT_UV: QuadArray;
784
+ /** Maps Minecraft face coordinates to Three.js UVs and builds per-model texture atlases. */
683
785
  declare class UVMapper {
684
786
  protected static makeUv(uvCoord: number, originalTextureSize: number, actualTextureSize: number): number;
685
787
  protected static makeUvCoords([originalTextureWidth, originalTextureHeight]: DoubleArray, [actualTextureWidth, actualTextureHeight]: DoubleArray, [x1, y1, x2, y2]: QuadArray): QuadArray;
@@ -696,6 +798,7 @@ declare class UVMapper {
696
798
  /** Bounds texture sampling to texel centres without changing cropped face UVs. */
697
799
  static setAtlasUvBounds(geometry: BoxGeometry, faces: ModelFaces, atlas: TextureAtlas): void;
698
800
  static lockUvs(geometry: BoxGeometry, faces: ModelFaces, atlas: TextureAtlas, rotation: Euler): void;
801
+ /** Returns the shared atlas for a keyed, merged model, creating it on first use. */
699
802
  static getAtlas(model: Model): Promise<Maybe<TextureAtlas>>;
700
803
  static fillMissingTextureKeys<T>(textures: ModelTextures, target: {
701
804
  [k: string]: T;
@@ -704,8 +807,14 @@ declare class UVMapper {
704
807
  };
705
808
  protected static getFallbackUv(element: ModelElement, faceName: CubeFace): QuadArray;
706
809
  protected static expandAndRotateMcUvs([u1, v1, u2, v2]: QuadArray, rotation: number | undefined, actualWidth: number, actualHeight: number): QuadArray<Vector2>;
810
+ /**
811
+ * Combines model textures and animation metadata into an atlas.
812
+ * Mapped UVs are stored on copies of the model's elements, available through the returned atlas.
813
+ * Returns `undefined` for models without a texture map.
814
+ */
707
815
  static createAtlas(originalModel: Model): Promise<Maybe<TextureAtlas>>;
708
816
  }
817
+ /** Stores a Minecraft face's UV rectangle and its rotation in degrees. */
709
818
  declare class MinecraftFaceUV {
710
819
  readonly uv: QuadArray;
711
820
  readonly rotation: number;
@@ -727,22 +836,32 @@ declare class MinecraftFaceUV {
727
836
  */
728
837
  declare function shutdown(): void;
729
838
 
839
+ /** Runs queued tasks in bounded batches. Idle executors do not keep a timer running. */
730
840
  declare class BatchedExecutor {
731
841
  readonly interval: number;
732
842
  readonly batch: number;
733
843
  private readonly queue;
844
+ /**
845
+ * @param interval - Delay between queue runs, in milliseconds.
846
+ * @param batch - Maximum tasks started per run and maximum tasks active at once.
847
+ */
734
848
  constructor(interval?: number, batch?: number);
849
+ /** Queues a task and resolves with its result, or rejects with its error. */
735
850
  submit<T>(task: Task<T>): Promise<T>;
851
+ /** Rejects queued and future tasks. Tasks already running are allowed to finish. */
736
852
  stop(): void;
737
853
  }
738
854
  type Task<T = unknown> = () => T | Promise<T>;
739
855
 
740
856
  declare function prefix(prefix?: string): string;
741
857
 
858
+ /** Rotates geometry in place around the element's origin. The supplied angle is in degrees. */
742
859
  declare function applyElementRotation(rotation: ElementRotation, geometry: BufferGeometry): void;
860
+ /** Rotates an object around a local axis by an angle in degrees. */
743
861
  declare function applyGenericRotation(axis: Axis, rotation: number, obj: Object3D): void;
744
862
  declare function addBox3WireframeToObject(box: Box3, obj: Object3D, color?: number, w?: number): void;
745
863
  declare function addWireframeToObject(obj: Object3D, color?: number, w?: number): void;
864
+ /** Adds edge and axis helpers to a mesh and returns a function that disposes their resources. */
746
865
  declare function addWireframeToMesh(geo: BufferGeometry, mesh: Mesh, color?: number, w?: number): () => void;
747
866
 
748
867
  declare function captureException(e: any, ...extra: any[]): void;
@@ -765,8 +884,10 @@ declare enum AssetParser {
765
884
  JSON = "json"
766
885
  }
767
886
 
887
+ /** An asset provider registered with {@link AssetLoader.addSource}. */
768
888
  declare abstract class AssetSource {
769
889
  protected constructor();
890
+ /** Returns a parsed asset, or `undefined` to allow fallback. Load and parse failures should reject. */
770
891
  abstract get<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<Maybe<T>>;
771
892
  /** Whether this source prevents lower-priority sources from supplying the key. Its own assets remain available. */
772
893
  blocks(key: AssetKey): boolean | Promise<boolean>;
@@ -786,12 +907,15 @@ declare class AssetLoadError extends Error {
786
907
  constructor(source: AssetSource, key: AssetKey, path: string, cause: unknown);
787
908
  }
788
909
 
910
+ /** Loads assets from a shared, ordered registry of hosted sources and resource packs. */
789
911
  declare class AssetLoader {
912
+ /** Default asset base URL. Use {@link setVersion} to select a Minecraft version. */
790
913
  static ROOT: string;
791
914
  private static _SOURCES;
792
915
  /** Used when a registered source cannot identify its content, so nothing persists past this session. */
793
916
  private static readonly SESSION_SCOPE;
794
917
  static get version(): string;
918
+ /** Selects an mcasset.cloud version, updates the vanilla source, and clears in-memory caches. */
795
919
  static setVersion(version: string): void;
796
920
  /**
797
921
  * Scope for persistent cache keys. Empty with only the default vanilla sources, so their
@@ -801,8 +925,17 @@ declare class AssetLoader {
801
925
  static get persistentScope(): string;
802
926
  /** Prefixes a persistent cache key with the current source scope. */
803
927
  static persistentKey(key: string): string;
928
+ /**
929
+ * Registers a source at the highest priority.
930
+ * Call {@link Caching.clear} after changing sources to discard previously loaded assets.
931
+ *
932
+ * @param key - Name used to replace or remove this source.
933
+ * @param override - Removes the first source with this name before adding the new one.
934
+ */
804
935
  static addSource(key: string, source: AssetSource, override?: boolean): void;
936
+ /** Removes and returns the first source with this name. Call {@link Caching.clear} to reload assets. */
805
937
  static removeSource(key: string): Maybe<AssetSource>;
938
+ /** Loads from all sources and returns defined results in priority order. Any source failure rejects the call. */
806
939
  static getAll<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<T[]>;
807
940
  /** Returns the first defined result in source-priority order, without merging assets. */
808
941
  static get<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<Maybe<T>>;
@@ -813,6 +946,7 @@ declare class AssetLoader {
813
946
  }>>;
814
947
  }
815
948
 
949
+ /** A Java blockstate file that selects models through variants or multipart conditions. */
816
950
  interface BlockState extends MinecraftAsset {
817
951
  variants?: BlockStateVariants;
818
952
  multipart?: BlockStateMultipart[];
@@ -820,6 +954,7 @@ interface BlockState extends MinecraftAsset {
820
954
  type BlockStateVariants = {
821
955
  [key: string]: BlockStateVariant | BlockStateVariant[];
822
956
  };
957
+ /** A model selection with optional x/y rotations in degrees, UV locking, and random-selection weight. */
823
958
  interface BlockStateVariant {
824
959
  model?: string;
825
960
  y?: number;
@@ -831,6 +966,7 @@ interface BlockStateMultipart {
831
966
  when?: MultipartCondition;
832
967
  apply?: BlockStateVariant | BlockStateVariant[];
833
968
  }
969
+ /** Property tests combined with AND or OR. A property value such as `north|south` accepts either value. */
834
970
  type MultipartCondition = Record<string, string> | {
835
971
  OR: MultipartCondition[];
836
972
  } | {
@@ -839,16 +975,20 @@ type MultipartCondition = Record<string, string> | {
839
975
 
840
976
  declare const DEFAULT_ROOT = "https://assets.mcasset.cloud/1.21.11";
841
977
  declare const DEFAULT_NAMESPACE = "minecraft";
978
+ /** Convenience accessors for model and blockstate loading. */
842
979
  declare class Assets {
843
980
  /**
844
981
  * @deprecated
845
982
  */
846
983
  static parseAssetKey(assetType: AssetType, str: string, origin?: AssetKey): AssetKey;
984
+ /** Loads a model with its parent chain resolved. See {@link Models.getMerged}. */
847
985
  static getModel(key: AssetKey): Promise<Maybe<Model>>;
986
+ /** Loads a blockstate definition. See {@link BlockStates.get}. */
848
987
  static getBlockState(key: AssetKey): Promise<Maybe<BlockState>>;
849
988
  }
850
989
 
851
990
  type BlockStatePropertyValue = string | boolean | number;
991
+ /** A vanilla block property's default and allowed values, loaded through {@link BlockStates.getDefaultState}. */
852
992
  interface BlockStateProperty {
853
993
  default: BlockStatePropertyValue;
854
994
  type: "boolean" | "int" | "enum";
@@ -858,6 +998,7 @@ interface BlockStateProperty {
858
998
  type BlockStatePropertyDefaults = {
859
999
  [key: string]: BlockStateProperty;
860
1000
  };
1001
+ /** Block property values, such as `{ facing: "north", waterlogged: "false" }`. */
861
1002
  type BlockStateProperties = {
862
1003
  [key: string]: string;
863
1004
  };
@@ -880,6 +1021,7 @@ type BlockEntityRotation = {
880
1021
  property: string;
881
1022
  step: number;
882
1023
  };
1024
+ /** Models and state-dependent placement for one block ID in the block-entity index. */
883
1025
  interface BlockEntityEntry {
884
1026
  parts: BlockEntityPart[];
885
1027
  rotation?: BlockEntityRotation;
@@ -890,12 +1032,14 @@ interface BlockEntityEntry {
890
1032
  type BlockEntityIndex = MinecraftAsset & {
891
1033
  [block: string]: BlockEntityEntry;
892
1034
  };
1035
+ /** Parts and placement selected by {@link BlockEntities.resolve} for a block's properties. */
893
1036
  interface ResolvedBlockEntity {
894
1037
  parts: BlockEntityPart[];
895
1038
  /** Degrees counter-clockwise seen from above, about the block's vertical centre axis. */
896
1039
  rotation: number;
897
1040
  translation: TripleArray;
898
1041
  }
1042
+ /** Resolves blockstate properties into the entity models used to draw chests, beds, and other block entities. */
899
1043
  declare class BlockEntities {
900
1044
  /**
901
1045
  * Loads the block index of a version. Versions and sources without one yield an empty index, and so does
@@ -911,14 +1055,19 @@ declare class BlockEntities {
911
1055
  static matrix(resolved: ResolvedBlockEntity, matrix?: Matrix4): Matrix4;
912
1056
  }
913
1057
 
1058
+ /** Loads blockstate definitions and the property defaults used to select block models. */
914
1059
  declare class BlockStates {
915
1060
  private static _persistentCache;
916
1061
  private static get PERSISTENT_CACHE();
1062
+ /** Returns blockstate filenames from the selected version's `_list.json`, or an empty list. */
917
1063
  static getList(): Promise<string[]>;
918
1064
  static getDefaultStates(): Promise<Maybe<DefaultBlockStates>>;
1065
+ /** Looks up vanilla property definitions for the key's block path, or returns `undefined`. */
919
1066
  static getDefaultState(key: AssetKey): Promise<Maybe<BlockStatePropertyDefaults>>;
1067
+ /** Loads a cached blockstate definition for {@link MineRenderScene.addBlock}, or returns `undefined`. */
920
1068
  static get(key: AssetKey): Promise<Maybe<BlockState>>;
921
1069
  static getAll(keys: AssetKey[] | Iterable<AssetKey>): Promise<Maybe<BlockState>[]>;
1070
+ /** Clears persisted blockstates. Use {@link Caching.clear} to also discard in-memory assets. */
922
1071
  static clearCache(): Promise<void>;
923
1072
  }
924
1073
  declare class DefaultBlockStates implements MinecraftAsset {
@@ -930,6 +1079,7 @@ interface EntityAnimationFile extends MinecraftAsset {
930
1079
  id: string;
931
1080
  animations: Record<string, EntityAnimation>;
932
1081
  }
1082
+ /** A clip of pose offsets, played with {@link EntityObject.playAnimation} or sampled directly. */
933
1083
  interface EntityAnimation {
934
1084
  /** Seconds. */
935
1085
  length: number;
@@ -942,6 +1092,7 @@ interface EntityAnimation {
942
1092
  type EntityAnimationChannel = "position" | "rotation" | "scale";
943
1093
  /** Keyframes in time order per channel. */
944
1094
  type EntityAnimationBone = Partial<Record<EntityAnimationChannel, EntityAnimationKeyframe[]>>;
1095
+ /** One timed offset for a part's position, rotation, or scale channel. */
945
1096
  interface EntityAnimationKeyframe {
946
1097
  /** Seconds. */
947
1098
  time: number;
@@ -965,24 +1116,39 @@ declare function entityAnimationTime(animation: EntityAnimation, time: number, l
965
1116
  /** Samples every bone and channel of an animation at `time` seconds. */
966
1117
  declare function sampleEntityAnimation(animation: EntityAnimation, time: number, loop?: boolean): EntityAnimationPose;
967
1118
 
1119
+ /** Loads entity and block-entity geometry, texture selections, and animation clips from the dataset. */
968
1120
  declare class Entities {
1121
+ /** Lists model paths in the `minecraft` namespace, including subdirectories and excluding `.json`. */
969
1122
  static getEntityList(): Promise<string[]>;
970
1123
  private static getModelFile;
1124
+ /** Returns selectable geometry-layer names, or an empty list when the model is missing. */
971
1125
  static getLayerList(modelKey: BasicAssetKey): Promise<string[]>;
972
1126
  /** The dataset's extra draws on top of `main`; their `when` labels are the states `EntityModelOptions.when` can enable. */
973
1127
  static getPassList(modelKey: BasicAssetKey): Promise<EntityModelPass[]>;
1128
+ /**
1129
+ * Loads the layers and textures to pass to {@link MineRenderScene.addEntity}.
1130
+ * By default, selects `main`, unconditional passes, and passes enabled by `options.when`.
1131
+ *
1132
+ * @param modelKey - Dataset model, such as `new BasicAssetKey("minecraft", "zombie")`.
1133
+ * @param textureKey - Texture override for the first selected layer.
1134
+ * @param options - Layer selection, conditional passes, and per-layer texture overrides.
1135
+ * @returns The selected model, or `undefined` when its dataset file is missing.
1136
+ */
974
1137
  static getEntity(modelKey: BasicAssetKey, textureKey?: BasicAssetKey, options?: EntityModelOptions): Promise<Maybe<EntityModel>>;
975
1138
  /**
976
1139
  * Native and sampled vanilla clips by name, or undefined when the model or selected version has none.
977
1140
  */
978
1141
  static getAnimations(modelKey: BasicAssetKey): Promise<Maybe<Record<string, EntityAnimation>>>;
1142
+ /** Finds a fallback texture using the model path, its directory, and vanilla variant data. */
979
1143
  static resolveTexture(modelKey: BasicAssetKey): Promise<Maybe<AssetKey>>;
980
1144
  /** @deprecated Use getEntityList(); block entities share the entity dataset. */
981
1145
  static getBlockList(): Promise<string[]>;
982
1146
  /** @deprecated Use getEntity(); block entities share the entity dataset. */
983
1147
  static getBlock(modelKey: BasicAssetKey, textureKey?: BasicAssetKey, options?: EntityModelOptions): Promise<Maybe<EntityModel>>;
984
1148
  }
1149
+ /** Selection settings passed as the third argument to {@link Entities.getEntity}. */
985
1150
  interface EntityModelOptions {
1151
+ /** Selects one geometry layer without dataset passes. `layers` takes precedence when supplied. */
986
1152
  layer?: string;
987
1153
  /** Layer names in draw order; an explicit selection draws exactly these layers and no dataset passes. */
988
1154
  layers?: string[];
@@ -995,6 +1161,7 @@ interface EntityModelOptions {
995
1161
  textures?: Record<string, BasicAssetKey>;
996
1162
  }
997
1163
 
1164
+ /** A glyph's source pixels and layout metrics. Glyphs without an image contribute spacing only. */
998
1165
  interface BitmapGlyph {
999
1166
  image?: CompatCanvas;
1000
1167
  /** Source rectangle in the bitmap sheet, before applying scale. */
@@ -1006,48 +1173,69 @@ interface BitmapGlyph {
1006
1173
  ascent: number;
1007
1174
  advance: number;
1008
1175
  }
1176
+ /** Character-to-glyph lookup assembled from the active resource-pack fonts. */
1009
1177
  interface BitmapFont {
1010
1178
  glyphs: Map<string, BitmapGlyph>;
1011
1179
  }
1180
+ /** Loads Minecraft bitmap, space, and reference font providers for GUI text. */
1012
1181
  declare class Fonts {
1182
+ /** Combines font definitions in source-priority order. Unsupported Unihex and TrueType providers are skipped. */
1013
1183
  static get(key?: AssetKey | string): Promise<BitmapFont>;
1014
1184
  private static relatedKey;
1015
1185
  private static load;
1016
1186
  private static bitmap;
1017
1187
  }
1018
1188
 
1189
+ /** Loads and caches Java block/item models, including inherited geometry and textures. */
1019
1190
  declare class Models {
1020
1191
  private static _persistentCache;
1021
1192
  private static get PERSISTENT_CACHE();
1193
+ /** Lists item filenames from the asset source's `_list.json`, with a legacy model-directory fallback. */
1022
1194
  static getItemList(): Promise<string[]>;
1023
1195
  static loadAndMerge(key: AssetKey): Promise<Maybe<Model>>;
1024
1196
  private static getItemModel;
1025
1197
  private static defaultItemModel;
1198
+ /** Loads one model file without resolving its parents. Returns `undefined` when the file is missing. */
1026
1199
  static getRaw(key: AssetKey): Promise<Maybe<Model>>;
1200
+ /**
1201
+ * Loads a model and resolves its parent chain. Returns `undefined` when the model is missing.
1202
+ * Item keys use GUI context, false conditions, and zero numeric properties.
1203
+ *
1204
+ * @param key - Model key, for example `AssetKey.parse("models", "minecraft:item/diamond_sword")`.
1205
+ */
1027
1206
  static getMerged(key: AssetKey): Promise<Maybe<Model>>;
1207
+ /** Alias for {@link getMerged}. */
1028
1208
  static get(key: AssetKey): Promise<Maybe<Model>>;
1209
+ /** Clears persisted models. Use {@link Caching.clear} to also discard in-memory assets. */
1029
1210
  static clearCache(): Promise<void>;
1030
1211
  }
1031
1212
 
1213
+ /** Resolves Minecraft display poses and applies them to model geometry. */
1032
1214
  declare class DisplayTransforms {
1033
1215
  /** Resolve hand fallbacks within one model, before inheriting parent display entries. */
1034
1216
  static withHandFallbacks(display: Model["display"]): Model["display"];
1035
1217
  /** Build a display pose for geometry already centered at the model's [8, 8, 8] pivot. */
1036
1218
  static getMatrix(display: Model["display"], position: DisplayPosition): Matrix4;
1219
+ /** Transforms geometry in place and reverses triangle winding when the matrix reflects it. */
1037
1220
  static apply(geometry: BufferGeometry, matrix: Matrix4): void;
1038
1221
  }
1039
1222
 
1223
+ /** Resolves static item-preview colors from vanilla tint definitions and caller overrides. */
1040
1224
  declare class ItemTints {
1041
1225
  /** Resolves preview colors from item definitions; explicit per-index colors take precedence. */
1042
1226
  static get(model: Model, tints?: Record<number, number>): Promise<Record<number, number> | undefined>;
1043
1227
  private static rgb;
1044
1228
  }
1045
1229
 
1230
+ /** Identifies fully opaque cubes and maps neighbor visibility to model-local face masks. */
1046
1231
  declare class ModelCulling {
1232
+ /** Rotates a world-direction bit mask into model space. Bits follow {@link CUBE_FACES}. */
1047
1233
  static toLocalMask(worldMask: number, rotation: Euler): number;
1234
+ /** Whether a model fills one block with opaque faces and can hide adjacent block faces. */
1048
1235
  static isOpaqueFullCube(atlas: Maybe<TextureAtlas>): boolean;
1049
1236
  }
1050
1237
 
1238
+ /** Builds extruded item-model elements from sprite pixels, including edges around transparent regions. */
1051
1239
  declare class ModelGenerator {
1052
1240
  static readonly ITEM_LAYERS: string[];
1053
1241
  /**
@@ -1057,16 +1245,20 @@ declare class ModelGenerator {
1057
1245
  static generateItemModel(imageData: Pick<ImageData$1, "width" | "height" | "data">, layer: string): ModelElement[];
1058
1246
  }
1059
1247
 
1248
+ /** Resolves Java model inheritance, with child elements and display poses overriding their parents. */
1060
1249
  declare class ModelMerger {
1250
+ /** Loads the parent chain and returns a merged model without modifying the supplied definition. */
1061
1251
  static mergeWithParents(model: Model): Promise<Model>;
1062
1252
  protected static collectAllParents(model: Model): Promise<Model[]>;
1063
1253
  }
1064
1254
 
1255
+ /** Entity geometry and placement for a special item preview. Named part rotations use radians. */
1065
1256
  interface SpecialItemPart {
1066
1257
  model: EntityModel;
1067
1258
  transform: Matrix4;
1068
1259
  rotations: Record<string, TripleArray>;
1069
1260
  }
1261
+ /** Loads the entity geometry used by chest, bed, and supported mob-head item previews. */
1070
1262
  declare class SpecialItems {
1071
1263
  /** Resolves the static entity parts drawn by a special item renderer, in model units. */
1072
1264
  static getParts(special: SpecialItemRenderer, root?: string): Promise<SpecialItemPart[]>;
@@ -1074,25 +1266,34 @@ declare class SpecialItems {
1074
1266
  static createMaterial(source: MeshBasicMaterial, shade: boolean): MeshBasicMaterial;
1075
1267
  }
1076
1268
 
1269
+ /** Block data passed to world setters. `type` is a namespaced ID such as `minecraft:oak_log`. */
1077
1270
  interface Block {
1078
1271
  type: string;
1079
1272
  properties?: BlockStateProperties;
1080
1273
  nbt?: any;
1081
1274
  }
1082
1275
 
1276
+ /** Selects block models from property values, including multipart conditions and weighted alternatives. */
1083
1277
  declare class BlockStateResolver {
1278
+ /** Loads vanilla property defaults, falling back to preview values inferred from the blockstate file. */
1084
1279
  static defaults(blockState: BlockState): Promise<BlockStateProperties>;
1280
+ /** Selects matching models. Supply `choose` to control selection within each alternatives array. */
1085
1281
  static select(blockState: BlockState, state: BlockStateProperties, choose?: (variants: BlockStateVariant | BlockStateVariant[]) => BlockStateVariant): BlockStateVariant[];
1282
+ /** Returns matching model groups before choosing weighted alternatives. */
1086
1283
  static matching(blockState: BlockState, state: BlockStateProperties): (BlockStateVariant | BlockStateVariant[])[];
1284
+ /** Selects a random alternative using positive integer weights, each defaulting to 1. */
1087
1285
  static choose(variants: BlockStateVariant | BlockStateVariant[]): BlockStateVariant;
1286
+ /** Converts blockstate rotations in degrees into the Euler rotation used by model rendering. */
1088
1287
  static rotation(variant: BlockStateVariant): Euler;
1089
1288
  }
1090
1289
 
1290
+ /** Supplies block-preview tint colors from block properties and the active resource pack. */
1091
1291
  declare class BlockTints {
1092
1292
  /** Resolves block preview colors without biome context; explicit tints take precedence. */
1093
1293
  static get(key: AssetKey | undefined, state: BlockStateProperties, model: Model, tints?: Record<number, number>): Promise<Record<number, number> | undefined>;
1094
1294
  }
1095
1295
 
1296
+ /** A model that owns reusable instance slots and exposes per-slot transforms to {@link InstanceReference}. */
1096
1297
  interface Instanceable {
1097
1298
  nextInstance(): InstanceReference<SceneObject>;
1098
1299
  removeInstanceAt(index: number): void;
@@ -1110,6 +1311,10 @@ interface Instanceable {
1110
1311
  }
1111
1312
  declare function isInstanceable(obj: any): obj is Instanceable;
1112
1313
 
1314
+ /**
1315
+ * Controls one placement of a shared model. Transform methods affect only this instance.
1316
+ * After {@link removeFromScene} or {@link dispose}, accessing its transforms throws.
1317
+ */
1113
1318
  declare class InstanceReference<T extends Instanceable> implements Transformable, Disposable {
1114
1319
  readonly instanceable: T;
1115
1320
  readonly index: number;
@@ -1117,11 +1322,14 @@ declare class InstanceReference<T extends Instanceable> implements Transformable
1117
1322
  constructor(instanceable: T, index: number);
1118
1323
  nextInstance(): InstanceReference<SceneObject>;
1119
1324
  private get activeInstanceable();
1325
+ /** Releases this placement's slot for reuse. Repeated calls have no effect. */
1120
1326
  removeFromScene(): void;
1121
1327
  dispose(): void;
1122
1328
  getMatrix(matrix?: Matrix4): Matrix4;
1123
1329
  setMatrix(matrix: Matrix4): void;
1330
+ /** Hides or restores this placement while preserving its transform and allocated slot. */
1124
1331
  setVisible(visible: boolean): void;
1332
+ /** Updates the supplied transform components. Positions use scene units and rotations use radians. */
1125
1333
  setPositionRotationScale(position?: Vector3, rotation?: Euler, scale?: Vector3): void;
1126
1334
  setPosition(position: Vector3): void;
1127
1335
  getPosition(): Vector3;
@@ -1132,13 +1340,18 @@ declare class InstanceReference<T extends Instanceable> implements Transformable
1132
1340
  }
1133
1341
  declare function isInstanceReference(obj: any): obj is InstanceReference<any>;
1134
1342
 
1343
+ /** Shared settings passed to scene-object constructors or the scene's `addModel` and `addBlock` methods. */
1135
1344
  interface SceneObjectOptions {
1136
1345
  wireframe: boolean;
1346
+ /** Combines compatible model elements into one geometry. */
1137
1347
  mergeMeshes: boolean;
1348
+ /** Allows compatible models to share geometry through instance references. */
1138
1349
  instanceMeshes: boolean;
1350
+ /** Initial instance capacity. Buffers grow when more placements are added. */
1139
1351
  maxInstanceCount: number;
1140
1352
  }
1141
1353
 
1354
+ /** Builds render geometry from a merged Java model. Create it through {@link MineRenderScene.addModel}. */
1142
1355
  declare class ModelObject extends SceneObject {
1143
1356
  readonly originalModel: Model;
1144
1357
  readonly isModelObject: true;
@@ -1163,26 +1376,31 @@ declare class ModelObject extends SceneObject {
1163
1376
  removeInstanceAt(index: number): void;
1164
1377
  disposeAndRemoveAllChildren(): void;
1165
1378
  }
1379
+ /** Model settings passed to `scene.addModel(model, options)` or the ModelObject constructor. */
1166
1380
  interface ModelObjectOptions extends SceneObjectOptions {
1167
1381
  /** Minecraft display pose applied around the model center, before scene transforms. */
1168
1382
  displayPosition?: DisplayPosition;
1169
1383
  /** Quarter-turn block rotation in radians to compensate when locking UVs. */
1170
1384
  uvLockRotation?: TripleArray;
1171
- /** sRGB 0xRRGGBB colors by face tint index; omitted indices stay white. */
1385
+ /** sRGB 0xRRGGBB colors by face tint index, overriding automatic item or block preview colors. */
1172
1386
  tints?: Record<number, number>;
1173
1387
  /** Hidden neighbor directions in CUBE_FACES order, before the model's block rotation. */
1174
1388
  cullMask?: number;
1175
1389
  }
1176
1390
  declare function isModelObject(obj: any): obj is ModelObject;
1177
1391
 
1392
+ /** Shares initialized model objects by cache key and allocates references to their placements. */
1178
1393
  declare class InstanceManager {
1179
1394
  readonly isInstanceManager: true;
1180
1395
  protected readonly instanceCache: {
1181
1396
  [key: string]: Promise<InstanceReference<SceneObject>>;
1182
1397
  };
1183
1398
  constructor();
1399
+ /** Allocates a new placement of a cached model, or returns `undefined` if the key is unknown. */
1184
1400
  get<T extends SceneObject>(key: string): Promise<Maybe<InstanceReference<T>>>;
1401
+ /** Allocates a placement, calling the supplier once when the shared model is first needed. */
1185
1402
  getOrCreate<T extends SceneObject>(key: string, supplier: () => T | Promise<T>): Promise<InstanceReference<T>>;
1403
+ /** Forgets cached models without disposing them or releasing their existing placements. */
1186
1404
  reset(): void;
1187
1405
  }
1188
1406
  declare function isInstanceManager(obj: any): obj is InstanceManager;
@@ -1220,6 +1438,14 @@ declare class SkinObject extends SceneObject {
1220
1438
  init(): Promise<void>;
1221
1439
  protected removeMeshes(): void;
1222
1440
  protected createMeshes(): void;
1441
+ /**
1442
+ * Loads a skin texture, detecting slim arms and legacy layouts by default.
1443
+ * To override detection, set `slim` or `legacy` in the options passed to
1444
+ * `new SkinObject(options)` or `scene.addSkin(src, options)`.
1445
+ * Use {@link setSlim} or {@link setLegacy} to change these settings later.
1446
+ *
1447
+ * @param src - URL of the skin texture.
1448
+ */
1223
1449
  setSkinTexture(src: string): Promise<void>;
1224
1450
  /** Load a cape texture in the selected layout, or pass undefined to remove the cape. */
1225
1451
  setCapeTexture(src?: string, layout?: CapeLayout): Promise<void>;
@@ -1231,11 +1457,15 @@ declare class SkinObject extends SceneObject {
1231
1457
  dispose(): void;
1232
1458
  protected getBoxGeometry(part: SkinPart): BoxGeometry;
1233
1459
  }
1460
+ /** Player settings passed to `new SkinObject(options)` or `scene.addSkin(src, options)`. */
1234
1461
  interface SkinObjectOptions extends SceneObjectOptions {
1462
+ /** Forces slim (`true`) or classic (`false`) arms. Omit it to detect the model from the texture. */
1235
1463
  slim?: boolean;
1464
+ /** Forces the legacy (`true`) or modern (`false`) texture layout. Omit it to detect the layout. */
1236
1465
  legacy?: boolean;
1237
1466
  }
1238
1467
 
1468
+ /** Playback settings passed to {@link EntityObject.playAnimation}, {@link EntityObject.playAnimations}, or {@link EntityAnimationPlayer.play}. */
1239
1469
  interface EntityAnimationOptions {
1240
1470
  /** Overrides the animation's own `loop` flag. */
1241
1471
  loop?: boolean;
@@ -1266,11 +1496,14 @@ declare class EntityAnimationPlayer {
1266
1496
  stop(): boolean;
1267
1497
  /** Forgets the animation without touching the parts, for parts that no longer exist. */
1268
1498
  clear(): void;
1499
+ /** Applies the pose at an absolute playback time. Returns `false` when no clip is active. */
1269
1500
  setTime(seconds: number): boolean;
1501
+ /** Advances playback by elapsed seconds multiplied by the speed passed to {@link play}. */
1270
1502
  advance(deltaSeconds: number): boolean;
1271
1503
  private apply;
1272
1504
  }
1273
1505
 
1506
+ /** Renders selected entity layers as named part groups. Create it through {@link MineRenderScene.addEntity}. */
1274
1507
  declare class EntityObject extends SceneObject {
1275
1508
  readonly entity: EntityModel;
1276
1509
  readonly isEntityObject: true;
@@ -1314,8 +1547,11 @@ declare class EntityObject extends SceneObject {
1314
1547
  setAnimationTime(seconds: number): void;
1315
1548
  /** Advances the animation by a frame delta in seconds, scaled by its speed. Has no effect without an animation. */
1316
1549
  advanceAnimation(deltaSeconds: number): void;
1550
+ /** Finds a selected draw by its layer key, such as `main` or `main#2`, or returns `undefined`. */
1317
1551
  getLayerGroup(name: string): Maybe<Object3D>;
1552
+ /** Finds a part name without `group:`. Supply `layerName` to restrict the search to one draw. */
1318
1553
  getGroupByName(name: string, layerName?: string): Maybe<Object3D>;
1554
+ /** Finds a mesh name without `mesh:`. Supply `layerName` to restrict the search to one draw. */
1319
1555
  getMeshByName(name: string, layerName?: string): Maybe<Mesh>;
1320
1556
  private get entityLayers();
1321
1557
  private getTextureKey;
@@ -1324,6 +1560,7 @@ declare class EntityObject extends SceneObject {
1324
1560
  private createPart;
1325
1561
  protected applyTextures(): Promise<void>;
1326
1562
  }
1563
+ /** Render settings passed to `scene.addEntity(entity, options)` or the EntityObject constructor. */
1327
1564
  interface EntityObjectOptions extends SceneObjectOptions {
1328
1565
  /**
1329
1566
  * `true` applies only vanilla's entity flip, scale (-1, -1, 1); `false` keeps raw model space.
@@ -1335,17 +1572,20 @@ interface EntityObjectOptions extends SceneObjectOptions {
1335
1572
  }
1336
1573
  declare function isEntityObject(obj: any): obj is EntityObject;
1337
1574
 
1575
+ /** Text appearance set on a GUI text layer or overridden by an individual text run. */
1338
1576
  interface GuiTextStyle {
1339
1577
  /** sRGB 0xRRGGBB; defaults to white. */
1340
1578
  color?: number;
1341
1579
  bold?: boolean;
1342
1580
  italic?: boolean;
1343
1581
  }
1582
+ /** A text segment with optional style overrides within {@link GuiText}. */
1344
1583
  interface GuiTextRun extends GuiTextStyle {
1345
1584
  text: string;
1346
1585
  }
1347
1586
  /** Literal text, or styled runs. Newlines are preserved. */
1348
1587
  type GuiText = string | readonly GuiTextRun[];
1588
+ /** Text layout settings set on a GUI text layer or passed to {@link layoutGuiText}. */
1349
1589
  interface GuiTextOptions extends GuiTextStyle {
1350
1590
  /** Font resource ID; defaults to minecraft:default. */
1351
1591
  font?: AssetKey | string;
@@ -1356,6 +1596,7 @@ interface GuiTextOptions extends GuiTextStyle {
1356
1596
  /** Distance between line origins; defaults to 9 GUI pixels. */
1357
1597
  lineHeight?: number;
1358
1598
  }
1599
+ /** One measured glyph and its position in GUI pixels, produced by {@link layoutGuiText}. */
1359
1600
  interface PositionedGuiGlyph {
1360
1601
  character: string;
1361
1602
  glyph?: BitmapGlyph;
@@ -1364,6 +1605,7 @@ interface PositionedGuiGlyph {
1364
1605
  advance: number;
1365
1606
  style: Required<GuiTextStyle>;
1366
1607
  }
1608
+ /** Measured glyphs, line widths, and overall dimensions in GUI pixels. */
1367
1609
  interface GuiTextLayout {
1368
1610
  glyphs: PositionedGuiGlyph[];
1369
1611
  lineWidths: number[];
@@ -1387,21 +1629,28 @@ interface GuiLayerLayout {
1387
1629
  /** Output size; defaults to native texture/text dimensions, and [16, 16] for items. */
1388
1630
  size?: [number, number];
1389
1631
  }
1632
+ /** A texture layer for {@link MineRenderScene.addGui}. Uncropped textures use their `.mcmeta` scaling rules. */
1390
1633
  interface GuiTextureLayer extends GuiLayerLayout {
1391
1634
  texture: AssetKey | string;
1392
1635
  /** Source-image pixels: [x, y, width, height], measured from the top left. Crops ignore sprite scaling. */
1393
1636
  crop?: [number, number, number, number];
1394
1637
  }
1638
+ /** An item preview in a 16×16 GUI slot by default, with optional tint overrides. */
1395
1639
  interface GuiItemLayer extends GuiLayerLayout {
1396
1640
  /** Model key, such as minecraft:item/stone; uses the model's GUI display pose. */
1397
1641
  item: AssetKey | string;
1398
- /** sRGB 0xRRGGBB colors by face tint index; omitted indices stay white. */
1642
+ /** sRGB 0xRRGGBB colors by face tint index, overriding the item's automatic preview colors. */
1399
1643
  tints?: Record<number, number>;
1400
1644
  }
1645
+ /** A bitmap-text layer. Set font, wrapping, and style directly on the layer object. */
1401
1646
  interface GuiTextLayer extends GuiLayerLayout, GuiTextOptions {
1402
1647
  text: GuiText;
1403
1648
  }
1404
1649
 
1650
+ /**
1651
+ * Renders ordered texture, item, and text layers. Create it through {@link MineRenderScene.addGui}.
1652
+ * GUI coordinates grow right and down, with one pixel equal to one scene unit.
1653
+ */
1405
1654
  declare class GuiObject extends SceneObject {
1406
1655
  readonly textureLayers: readonly GuiLayer[];
1407
1656
  readonly isGuiObject: true;
@@ -1417,10 +1666,12 @@ declare class GuiObject extends SceneObject {
1417
1666
  private loadMaterial;
1418
1667
  disposeAndRemoveAllChildren(): void;
1419
1668
  }
1669
+ /** Scene-object settings for `scene.addGui(layers, options)`. GUI objects disable instancing and mesh merging. */
1420
1670
  interface GuiObjectOptions extends SceneObjectOptions {
1421
1671
  }
1422
1672
  declare function isGuiObject(obj: any): obj is GuiObject;
1423
1673
 
1674
+ /** A Three.js scene that initializes Minecraft objects and tracks changes that need a redraw. */
1424
1675
  declare class MineRenderScene extends Scene {
1425
1676
  readonly isMineRenderScene: true;
1426
1677
  static readonly DEFAULT_OPTIONS: MineRenderSceneOptions;
@@ -1434,18 +1685,48 @@ declare class MineRenderScene extends Scene {
1434
1685
  add(...objects: Object3D[]): this;
1435
1686
  remove(...objects: Object3D[]): this;
1436
1687
  private updateObjectRegistration;
1688
+ /** Initializes each object before attaching it to the scene. */
1437
1689
  initAndAdd(...object: SceneObject[]): Promise<this>;
1438
1690
  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>>;
1691
+ /**
1692
+ * Adds a model loaded with {@link Models.getMerged}.
1693
+ * Set `options.instanceMeshes` to `false` to create a separate ModelObject.
1694
+ *
1695
+ * @param parent - Object to attach the model to. Defaults to this scene.
1696
+ * @returns The model, or a reference to one placement of a shared model.
1697
+ */
1439
1698
  addModel(model: Model, options?: Partial<ModelObjectOptions>, parent?: Object3D): Promise<ModelObject | InstanceReference<ModelObject>>;
1699
+ /**
1700
+ * Adds the models selected by a blockstate loaded with {@link BlockStates.get}.
1701
+ * Set `options.initialState` to choose block properties such as `facing` or `axis`.
1702
+ * Use the returned object's `setPosition` method to move all of its model parts.
1703
+ */
1440
1704
  addBlock(blockState: BlockState, options?: Partial<BlockObjectOptions>, parent?: Object3D): Promise<BlockObject | InstanceReference<BlockObject>>;
1705
+ /**
1706
+ * Loads a skin and adds an initialized player model.
1707
+ *
1708
+ * @param skin - Texture URL, such as one returned by {@link Skins.fromUuidOrUsername}.
1709
+ * Omit it to assign a texture later with {@link SkinObject.setSkinTexture}.
1710
+ * @param options - Player settings, including `slim` and `legacy` detection overrides.
1711
+ * @param parent - Object to attach the player to. Defaults to this scene.
1712
+ */
1441
1713
  addSkin(skin?: string, options?: Partial<SkinObjectOptions>, parent?: Object3D): Promise<SkinObject>;
1714
+ /** Adds an entity loaded with {@link Entities.getEntity}, using its selected layers and textures. */
1442
1715
  addEntity(entity: EntityModel, options?: Partial<EntityObjectOptions>, parent?: Object3D): Promise<EntityObject | InstanceReference<EntityObject>>;
1716
+ /**
1717
+ * Adds GUI layers in draw order. One GUI pixel equals one scene unit.
1718
+ * Layer positions start at the top left, with positive GUI y pointing down.
1719
+ */
1443
1720
  addGui(layers: readonly GuiLayer[], options?: Partial<GuiObjectOptions>, parent?: Object3D): Promise<GuiObject>;
1444
1721
  }
1445
1722
  interface MineRenderSceneOptions {
1446
1723
  }
1447
1724
  declare function isMineRenderScene(obj: any): obj is MineRenderScene;
1448
1725
 
1726
+ /**
1727
+ * Base for renderable Minecraft objects, with named parts and optional shared instances.
1728
+ * Use {@link notifyDirty} after changing a part directly so the renderer redraws it.
1729
+ */
1449
1730
  declare class SceneObject extends Object3D<Object3DEventMap & {
1450
1731
  change: {};
1451
1732
  }> implements Disposable, Instanceable, Transformable {
@@ -1464,17 +1745,20 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
1464
1745
  set scene(scene: MineRenderScene);
1465
1746
  get scene(): MineRenderScene;
1466
1747
  init(): Promise<void>;
1748
+ /** Marks ancestor scenes for redraw and emits a `change` event. */
1467
1749
  notifyDirty(): void;
1468
1750
  protected createAndAddGroup(name?: string, x?: number, y?: number, z?: number, offsetAxis?: Axis, offset?: number): Object3D;
1469
1751
  protected createGroup(name?: string, x?: number, y?: number, z?: number, offsetAxis?: Axis, offset?: number): Object3D;
1470
1752
  /**
1471
- * Get a group by its name
1753
+ * Finds a named part, such as `head`, without the internal `group:` prefix.
1754
+ * Returns `undefined` when the group does not exist.
1472
1755
  */
1473
1756
  getGroupByName(name: string): Maybe<Object3D>;
1474
1757
  /**
1475
- * Toggle visibility of a group
1476
- * @param name name of the group
1477
- * @param visible set the visibility directly, if not set toggles it
1758
+ * Changes a named group's visibility and requests a redraw.
1759
+ * @param name - Part name without the `group:` prefix.
1760
+ * @param visible - Visibility to assign. Omit it to toggle the current value.
1761
+ * @returns The resulting visibility, or `false` if the group does not exist.
1478
1762
  */
1479
1763
  toggleGroupVisibility(name: string, visible?: boolean): boolean;
1480
1764
  protected addOrReplaceMesh(mesh: Mesh, parent: Object3D, name?: string): void;
@@ -1482,13 +1766,14 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
1482
1766
  protected createMesh(name?: string, geometry?: BufferGeometry, material?: Material | Material[], offsetAxis?: Axis, offset?: number): Mesh;
1483
1767
  protected createInstancedMesh(name: Maybe<string>, geometry: BufferGeometry, material: Material | Material[], count: number): InstancedMesh;
1484
1768
  /**
1485
- * Get a mesh by its name
1769
+ * Finds a named mesh without the internal `mesh:` prefix, or returns `undefined`.
1486
1770
  */
1487
1771
  getMeshByName(name: string): Maybe<Mesh>;
1488
1772
  /**
1489
- * Toggle visibility of a mesh
1490
- * @param name name of the mesh
1491
- * @param visible set the visibility directly, if not set toggles it
1773
+ * Changes a named mesh's visibility and requests a redraw.
1774
+ * @param name - Mesh name without the `mesh:` prefix.
1775
+ * @param visible - Visibility to assign. Omit it to toggle the current value.
1776
+ * @returns The resulting visibility, or `false` if the mesh does not exist.
1492
1777
  */
1493
1778
  toggleMeshVisibility(name: string, visible?: boolean): boolean;
1494
1779
  iterateAllMeshes(cb: (mesh: Mesh) => void): void;
@@ -1496,8 +1781,10 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
1496
1781
  protected _getBoxGeometryFromElement(element: ModelElement): BoxGeometry;
1497
1782
  protected _getBoxGeometryForDimensionsAndUv(width: number, height: number, depth: number, uv: number[]): BoxGeometry;
1498
1783
  get isInstanced(): boolean;
1784
+ /** Number of live placements, excluding released instance slots. */
1499
1785
  get instanceCounter(): number;
1500
1786
  protected constructInstanceReference(i: number): InstanceReference<SceneObject>;
1787
+ /** Allocates a placement of this instanced object, reusing a released slot when available. */
1501
1788
  nextInstance(): InstanceReference<SceneObject>;
1502
1789
  /** Returns the live reference for a raycast hit on this object's instance mesh. */
1503
1790
  getInstanceReference(mesh: Object3D, index: number): Maybe<InstanceReference<SceneObject>>;
@@ -1515,37 +1802,48 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
1515
1802
  getRotationAt(index: number, euler?: Euler): Euler;
1516
1803
  setScaleAt(index: number, scale: Vector3): void;
1517
1804
  getScaleAt(index: number, vector?: Vector3): Vector3;
1805
+ /** Updates supplied transform components. For a shared model, affects every live instance. */
1518
1806
  setPositionRotationScale(position?: Vector3, rotation?: Euler, scale?: Vector3): void;
1807
+ /** Sets position in scene units. For a shared model, updates every live instance. */
1519
1808
  setPosition(position: Vector3): void;
1520
1809
  getPosition(): Vector3;
1810
+ /** Sets rotation in radians. For a shared model, updates every live instance. */
1521
1811
  setRotation(rotation: Euler): void;
1522
1812
  getRotation(): Euler;
1813
+ /** Sets scale factors. For a shared model, updates every live instance. */
1523
1814
  setScale(scale: Vector3): void;
1524
1815
  getScale(): Vector3;
1525
1816
  protected toggleObjectVisibility(object?: Object3D, visible?: boolean): boolean;
1526
1817
  dispose(): void;
1818
+ /** Releases instance slots and removes children, disposing children that implement Disposable. */
1527
1819
  disposeAndRemoveAllChildren(): void;
1820
+ /** Detaches the object from its parent and requests a redraw. */
1528
1821
  removeFromScene(): void;
1529
1822
  }
1530
1823
  declare function isSceneObject(obj: any): obj is SceneObject;
1531
1824
 
1532
1825
  type FluidKind = "water" | "lava";
1826
+ /** Fluid contained in a block and whether the block's ordinary model is also drawn. */
1533
1827
  interface BlockFluidState {
1534
1828
  kind: FluidKind;
1535
1829
  level: number;
1536
1830
  renderModel: boolean;
1537
1831
  }
1832
+ /** Finds water or lava from the block ID and properties, including waterlogged blocks and aquatic plants. */
1538
1833
  declare function getBlockFluidState(key?: AssetKey, state?: BlockStateProperties): BlockFluidState | undefined;
1539
1834
  declare function getFluidKind(key?: AssetKey, state?: BlockStateProperties): FluidKind | undefined;
1835
+ /** A neighboring cell's fluid level and full-cube occlusion state. */
1540
1836
  interface FluidSample {
1541
1837
  fluid?: FluidKind;
1542
1838
  level?: number;
1543
1839
  solid?: boolean;
1544
1840
  }
1841
+ /** Reads cells at integer block offsets relative to the fluid being rendered, with `(0, 0, 0)` as the center. */
1545
1842
  type FluidSampler = (x: number, y: number, z: number) => FluidSample;
1546
1843
  /** Builds centered fluid faces with material groups 0 (still) and 1 (flowing). */
1547
1844
  declare function createFluidGeometry(kind: FluidKind, sample: FluidSampler): BufferGeometry;
1548
1845
 
1846
+ /** Controls the model parts selected by a blockstate. Create it through {@link MineRenderScene.addBlock}. */
1549
1847
  declare class BlockObject extends SceneObject {
1550
1848
  readonly blockState: BlockState;
1551
1849
  readonly isBlockObject: true;
@@ -1587,6 +1885,7 @@ declare class BlockObject extends SceneObject {
1587
1885
  private getModelMatrix;
1588
1886
  private getModelCullMask;
1589
1887
  setCullMask(worldMask: number): Promise<void>;
1888
+ /** Selected property values. Use {@link setState} to change properties and rebuild the rendered models. */
1590
1889
  get state(): {
1591
1890
  [key: string]: string;
1592
1891
  };
@@ -1601,7 +1900,13 @@ declare class BlockObject extends SceneObject {
1601
1900
  protected getSingleVariant(variants: BlockStateVariant | BlockStateVariant[]): BlockStateVariant;
1602
1901
  protected createAVariant(variants: BlockStateVariant | BlockStateVariant[], instanceInfo: Matrix4[]): Promise<void>;
1603
1902
  protected createVariant(variant: BlockStateVariant): Promise<ModelObject | InstanceReference<ModelObject>>;
1903
+ /** Clears selected properties and rebuilds models without reapplying property defaults. */
1604
1904
  resetState(): Promise<void>;
1905
+ /**
1906
+ * Updates properties and rebuilds the selected models.
1907
+ * Accepts `"facing=north,open=true"`, a property object, or a key and value.
1908
+ * Properties omitted from the call keep their current values.
1909
+ */
1605
1910
  setState(string: string): any;
1606
1911
  setState(state: BlockStateProperties): any;
1607
1912
  setState(key: string, value: string): any;
@@ -1611,7 +1916,9 @@ declare class BlockObject extends SceneObject {
1611
1916
  setMatrixAt(index: number, matrix: Matrix4): void;
1612
1917
  setPosition(position: Vector3): void;
1613
1918
  }
1919
+ /** Block settings passed to `scene.addBlock(blockState, options)` or the BlockObject constructor. */
1614
1920
  interface BlockObjectOptions extends ModelObjectOptions {
1921
+ /** Loads vanilla property defaults before applying `initialState`. Defaults to `true`. */
1615
1922
  applyDefaultState: boolean;
1616
1923
  /** Properties applied before model creation, overriding defaults when applyDefaultState is enabled. */
1617
1924
  initialState?: BlockStateProperties;
@@ -1623,6 +1930,7 @@ declare function sampleFluid(kind: FluidKind, sample: FluidSampler): {
1623
1930
  key: string;
1624
1931
  sample: FluidSampler;
1625
1932
  };
1933
+ /** Renders water or lava with neighbor-dependent surfaces and animated still/flow textures. */
1626
1934
  declare class FluidModelObject extends ModelObject {
1627
1935
  readonly kind: FluidKind;
1628
1936
  private readonly sample;
@@ -1633,21 +1941,25 @@ declare class FluidModelObject extends ModelObject {
1633
1941
  disposeAndRemoveAllChildren(): void;
1634
1942
  }
1635
1943
 
1944
+ /** Parsed blocks and entity data for {@link MineRenderWorld.placeMultiBlock}. Dimensions and positions use blocks. */
1636
1945
  interface MultiBlockStructure {
1637
1946
  readonly size: TripleArray;
1638
1947
  readonly blocks: MultiBlockBlock[];
1639
1948
  readonly dataVersion?: number;
1640
1949
  readonly entities?: MultiBlockEntity[];
1641
1950
  }
1951
+ /** Preserved entity position and NBT. World placement does not create a render object for it. */
1642
1952
  interface MultiBlockEntity {
1643
1953
  position: TripleArray;
1644
1954
  blockPosition?: TripleArray;
1645
1955
  nbt: unknown;
1646
1956
  }
1957
+ /** Block data and its position within a parsed structure. */
1647
1958
  interface MultiBlockBlock extends Block {
1648
1959
  position: TripleArray;
1649
1960
  }
1650
1961
 
1962
+ /** Converts legacy Alpha `.schematic` NBT with numeric block IDs into modern block names and properties. */
1651
1963
  declare class SchematicParser {
1652
1964
  /**
1653
1965
  * Parses a legacy schematic using custom mappings before the bundled defaults.
@@ -1663,9 +1975,16 @@ interface SchematicParserOptions {
1663
1975
  lenient?: boolean;
1664
1976
  }
1665
1977
 
1978
+ /** Converts Java structure NBT into blocks and preserved entity data for world placement. */
1666
1979
  declare class StructureParser {
1980
+ /**
1981
+ * Parses decoded NBT, omitting air blocks.
1982
+ * @param _nbt - Structure data decoded by {@link NBTHelper.fromBuffer}.
1983
+ * @param paletteIndex - Palette to select when the structure has several. Defaults to 0.
1984
+ */
1667
1985
  static parse(_nbt: NBT, paletteIndex?: number): Promise<MultiBlockStructure>;
1668
1986
  }
1987
+ /** Tagged NBT fields used by Java structure files. */
1669
1988
  interface StructureNBT {
1670
1989
  DataVersion?: {
1671
1990
  type: "int";
@@ -1761,20 +2080,27 @@ interface BlockEntry {
1761
2080
  };
1762
2081
  }
1763
2082
 
2083
+ /** Decodes Named Binary Tag (NBT) data for structure and world parsers. */
1764
2084
  declare class NBTHelper {
2085
+ /** Parses NBT bytes and preserves format and compression metadata. Omit `format` for automatic detection. */
1765
2086
  static fromBuffer(data: Uint8Array | ArrayBuffer, format?: NBTFormat): Promise<NBTAsset>;
1766
2087
  }
2088
+ /** Decoded NBT with the source format and parser metadata attached. */
1767
2089
  interface NBTAsset extends MinecraftAsset, NBT {
1768
2090
  format?: NBTFormat;
1769
2091
  metadata?: Metadata;
1770
2092
  compression?: "gzip" | "none";
1771
2093
  }
1772
2094
 
2095
+ /** Configures a hosted asset request and converts its response into an asset. */
1773
2096
  interface ResponseParser<T extends MinecraftAsset> {
2097
+ /** Sets response decoding or other request options before the request starts. */
1774
2098
  config(request: RequestConfig): any;
2099
+ /** Returns `undefined` to permit source fallback, or throws to report a parse failure. */
1775
2100
  parse(response: RequestResponse): Maybe<T> | Promise<Maybe<T>>;
1776
2101
  }
1777
2102
 
2103
+ /** Loads assets over HTTP from a Minecraft directory tree rooted at the constructor's URL. */
1778
2104
  declare class HostedAssetSource extends AssetSource {
1779
2105
  static readonly MODEL: ResponseParser<Model>;
1780
2106
  static readonly BLOCKSTATE: ResponseParser<BlockState>;
@@ -1784,11 +2110,16 @@ declare class HostedAssetSource extends AssetSource {
1784
2110
  static readonly LIST: ResponseParser<ListAsset>;
1785
2111
  static readonly JSON: ResponseParser<any>;
1786
2112
  static readonly PARSER_MAP: Map<AssetParser, ResponseParser<any>>;
2113
+ /** Retries missing assets with the `minecraft` namespace and default root. Other failures reject. */
1787
2114
  loadOrRetryWithDefaults<T extends MinecraftAsset>(key: AssetKey, parser: ResponseParser<T>): Promise<Maybe<T>>;
1788
2115
  protected load<T extends MinecraftAsset>(key: AssetKey, parser: ResponseParser<T>): Promise<Maybe<T>>;
1789
2116
  assetBasePath(key: AssetKey): string;
1790
2117
  private readonly _root;
1791
2118
  private readonly _options;
2119
+ /**
2120
+ * Creates a hosted source for {@link AssetLoader.addSource}.
2121
+ * Set `options.retryDefaults` to `false` to restrict lookups to the requested namespace and root.
2122
+ */
1792
2123
  constructor(root: string, options?: Partial<HostedAssetSourceOptions>);
1793
2124
  get root(): string;
1794
2125
  get cacheId(): string;
@@ -1799,12 +2130,14 @@ interface HostedAssetSourceOptions {
1799
2130
  retryDefaults: boolean;
1800
2131
  }
1801
2132
 
2133
+ /** A resource-pack ZIP entry, with its archive-relative path and lazily extracted bytes. */
1802
2134
  interface ArchiveEntry {
1803
2135
  filename: string;
1804
2136
  directory: boolean;
1805
2137
  getData(): Promise<Blob>;
1806
2138
  }
1807
2139
 
2140
+ /** Supplies resource-pack entries to {@link ArchiveAssetSource}. */
1808
2141
  interface ArchiveProxy {
1809
2142
  /** Identifies the archive's content across sessions; undefined when it cannot be identified. */
1810
2143
  readonly id?: string;
@@ -1830,12 +2163,14 @@ interface ArchiveAssetSourceOptions {
1830
2163
  /** Target data-pack format, used for assets under data/. Omit to look up the selected version. */
1831
2164
  dataPackFormat?: PackFormat;
1832
2165
  }
2166
+ /** Loads assets from resource-pack ZIP entries. Register it with {@link AssetLoader.addSource}. */
1833
2167
  declare class ArchiveAssetSource extends AssetSource implements ArchiveProxy {
1834
2168
  readonly _archiveProxy: ArchiveProxy;
1835
2169
  private readonly options;
1836
2170
  private entries?;
1837
2171
  private metadata?;
1838
2172
  constructor(archiveProxy: ArchiveProxy, options?: ArchiveAssetSourceOptions);
2173
+ /** Creates a browser ZIP source from a Blob or File. */
1839
2174
  static blob(blob: Blob, options?: ArchiveAssetSourceOptions): ArchiveAssetSource;
1840
2175
  get cacheId(): Maybe<string>;
1841
2176
  getEntries(): Promise<ArchiveEntry[]>;
@@ -1847,10 +2182,16 @@ declare class ArchiveAssetSource extends AssetSource implements ArchiveProxy {
1847
2182
  assetBasePath(key: AssetKey): string;
1848
2183
  }
1849
2184
 
2185
+ /** Reads a resource-pack ZIP from a browser Blob or File for {@link ArchiveAssetSource}. */
1850
2186
  declare class BrowserArchiveProxy implements ArchiveProxy {
1851
2187
  readonly _blob: Blob;
1852
2188
  readonly _reader: ZipReader<Blob>;
1853
2189
  readonly id?: string;
2190
+ /**
2191
+ * Opens a ZIP for asset lookup.
2192
+ * @param id - Cache identity for this content. Change it when the pack changes.
2193
+ * A File supplies an identity from its name, size, and modification time when omitted.
2194
+ */
1854
2195
  constructor(blob: Blob, id?: string);
1855
2196
  getEntries(): Promise<ArchiveEntry[]>;
1856
2197
  }
@@ -1862,6 +2203,7 @@ declare class PackFormats {
1862
2203
  private static load;
1863
2204
  }
1864
2205
 
2206
+ /** Bedrock client-entity resource references. This schema does not provide a Bedrock renderer. */
1865
2207
  interface BedrockEntityDescription {
1866
2208
  identifier: string;
1867
2209
  materials: {
@@ -1882,6 +2224,7 @@ interface BedrockEntityDescription {
1882
2224
  enable_attachables?: boolean;
1883
2225
  }
1884
2226
 
2227
+ /** Bedrock client-entity JSON schema, provided for typing only. */
1885
2228
  interface BedrockEntityFile {
1886
2229
  format_version: string;
1887
2230
  "minecraft:client_entity": {
@@ -1889,6 +2232,7 @@ interface BedrockEntityFile {
1889
2232
  };
1890
2233
  }
1891
2234
 
2235
+ /** Bedrock bone-and-cube geometry schema, provided for typing only. */
1892
2236
  interface BedrockGeometry {
1893
2237
  visible_bounds_width: number;
1894
2238
  visible_bounds_height: number;
@@ -1916,11 +2260,13 @@ interface BedrockCube {
1916
2260
  inflate?: number;
1917
2261
  }
1918
2262
 
2263
+ /** A versioned Bedrock JSON container for named geometry definitions. */
1919
2264
  interface BedrockGeometryFile {
1920
2265
  format_version: string;
1921
2266
  [key: string]: BedrockGeometry | any;
1922
2267
  }
1923
2268
 
2269
+ /** Shared in-memory caches for loaded assets and render resources. Persistent stores are managed separately. */
1924
2270
  declare class Caching {
1925
2271
  static readonly rawImageCache: AsyncLoadingCache<CacheKey, ImageInfo>;
1926
2272
  static readonly imageDataCache: AsyncLoadingCache<CacheKey, ImageData>;
@@ -1947,6 +2293,7 @@ declare class Caching {
1947
2293
  private static createAssetCache;
1948
2294
  /** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
1949
2295
  private static get all();
2296
+ /** Invalidates in-memory entries so later lookups reload them. Persisted entries are retained. */
1950
2297
  static clear(): void;
1951
2298
  /**
1952
2299
  * Clears every cache and stops its expiry timer.
@@ -1961,11 +2308,13 @@ declare class Caching {
1961
2308
  /** Copies the nontransparent bounds without resizing the source; empty images become one transparent pixel. */
1962
2309
  declare function trimCanvas(source: CompatCanvas): CompatCanvas;
1963
2310
 
2311
+ /** Reports invalid Minecraft data or an unsupported rendering operation. */
1964
2312
  declare class MineRenderError extends Error {
1965
2313
  constructor(msg: any);
1966
2314
  get name(): string;
1967
2315
  }
1968
2316
 
2317
+ /** Settings passed to {@link Renderer.toGLTF} or {@link SceneExporter.toGLTF}. */
1969
2318
  interface SceneGLTFExportOptions {
1970
2319
  /** Returns a GLB ArrayBuffer instead of a glTF object. */
1971
2320
  binary?: boolean;
@@ -1985,13 +2334,22 @@ declare class SceneExporter {
1985
2334
  static toGLTF(root: Object3D, options?: SceneGLTFExportOptions): Promise<Record<string, any> | ArrayBuffer>;
1986
2335
  }
1987
2336
 
2337
+ /** Creates GUI positions and layer lists for {@link MineRenderScene.addGui}. */
1988
2338
  declare class GuiHelper {
1989
2339
  /** Sizes a tooltip around supplied text; the first entry is its title. */
1990
2340
  static tooltip(lines: readonly GuiText[], options?: GuiTooltipOptions): Promise<GuiLayer[]>;
2341
+ /**
2342
+ * Calculates a slot's top-left position in GUI pixels.
2343
+ * @param slot - Zero-based slot index, or `[column, row]`.
2344
+ * @param origin - Position of the first slot.
2345
+ * @param offset - Horizontal and vertical spacing between slot origins, in pixels.
2346
+ * @param rowSize - Slots per row when `slot` is an index.
2347
+ */
1991
2348
  static inventorySlot(slot: number | [number, number], origin?: [number, number], offset?: [number, number], rowSize?: number): [number, number];
1992
2349
  /** Creates crafting-table layers for ingredients and the result; stack counts are not drawn. */
1993
2350
  static recipe(recipe: GuiRecipe, options?: GuiRecipeOptions): GuiLayer[];
1994
2351
  }
2352
+ /** Settings passed to {@link GuiHelper.tooltip}. Its default `lineHeight` is 10 GUI pixels. */
1995
2353
  interface GuiTooltipOptions extends GuiTextOptions {
1996
2354
  /** Top-left text position, inside the tooltip's padding. */
1997
2355
  position?: [number, number];
@@ -2003,7 +2361,9 @@ type GuiRecipeIngredientValue = string | {
2003
2361
  } | {
2004
2362
  tag: string;
2005
2363
  };
2364
+ /** An item, tag, or alternatives list. Tags and alternatives need `GuiRecipeOptions.resolveIngredient`. */
2006
2365
  type GuiRecipeIngredient = GuiRecipeIngredientValue | readonly GuiRecipeIngredientValue[];
2366
+ /** Shaped or shapeless crafting data accepted by {@link GuiHelper.recipe}. */
2007
2367
  type GuiRecipe = ({
2008
2368
  type: "minecraft:crafting_shaped" | "crafting_shaped";
2009
2369
  pattern: readonly string[];
@@ -2020,6 +2380,7 @@ type GuiRecipe = ({
2020
2380
  count?: number;
2021
2381
  };
2022
2382
  };
2383
+ /** Settings passed as the second argument to {@link GuiHelper.recipe}. */
2023
2384
  interface GuiRecipeOptions {
2024
2385
  /** Selects a concrete item ID or model AssetKey for a tag or alternatives array. */
2025
2386
  resolveIngredient?: (ingredient: GuiRecipeIngredient) => string | AssetKey;
@@ -2105,6 +2466,11 @@ declare class MapControls extends OrbitControls {
2105
2466
  constructor(object: Camera, domElement?: HTMLElement);
2106
2467
  }
2107
2468
 
2469
+ /**
2470
+ * Renders a Minecraft scene with a camera and an optional effects composer.
2471
+ * Requires a browser DOM and WebGL. Call {@link appendTo} to attach the canvas,
2472
+ * then {@link start} to render scene changes.
2473
+ */
2108
2474
  declare class Renderer implements Disposable {
2109
2475
  static readonly DEFAULT_OPTIONS: RendererOptions;
2110
2476
  readonly options: RendererOptions;
@@ -2135,12 +2501,14 @@ declare class Renderer implements Disposable {
2135
2501
  protected createControls(): Maybe<OrbitControls>;
2136
2502
  init(): void;
2137
2503
  get element(): Maybe<HTMLElement>;
2504
+ /** Attaches the canvas to an element and sizes it to that element's dimensions. */
2138
2505
  appendTo(element: HTMLElement): void;
2139
2506
  /**
2140
2507
  * Redraws when the dispatcher emits the selected event. Registering the same pair twice has no effect.
2141
2508
  * The renderer removes its listener on disposal; the caller retains ownership of the dispatcher.
2142
2509
  */
2143
2510
  registerEventDispatcher(dispatcher: EventDispatcher<any>, changeEvent?: string): void;
2511
+ /** Updates the camera and canvas size. Width and height are in CSS pixels. */
2144
2512
  resize(width: number, height: number): void;
2145
2513
  get dirty(): boolean;
2146
2514
  set dirty(dirty: boolean);
@@ -2150,7 +2518,9 @@ declare class Renderer implements Disposable {
2150
2518
  * Registering the same callback twice has no effect. Image exports do not invoke callbacks.
2151
2519
  */
2152
2520
  onFrame(callback: FrameCallback): () => void;
2521
+ /** Starts or resumes the animation loop and registered frame callbacks. */
2153
2522
  start(): void;
2523
+ /** Pauses rendering and frame callbacks. Call {@link start} to resume. */
2154
2524
  stop(): void;
2155
2525
  /**
2156
2526
  * Stops rendering and releases owned resources. Repeated calls have no effect, and a disposed
@@ -2166,8 +2536,11 @@ declare class Renderer implements Disposable {
2166
2536
  * MIME type support and lossy quality (0–1) follow the canvas encoder.
2167
2537
  */
2168
2538
  toImage(trim?: boolean, mime?: string, quality?: number): string;
2539
+ /** Exports visible scene meshes as OBJ text, without texture images. */
2169
2540
  toObj(): string;
2541
+ /** Exports visible scene meshes as PLY. Set `options.binary` for an ArrayBuffer. */
2170
2542
  toPLY(options?: PLYExporterOptions): string | ArrayBuffer;
2543
+ /** Exports a static textured scene in the browser. Set `options.binary` for GLB output. */
2171
2544
  toGLTF(options?: SceneGLTFExportOptions): Promise<Record<string, any> | ArrayBuffer>;
2172
2545
  protected get attachedToBody(): boolean;
2173
2546
  protected get viewWidth(): number;
@@ -2179,13 +2552,16 @@ declare class Renderer implements Disposable {
2179
2552
  /** Renderer-owned controls, or undefined when disabled at construction or after disposal. */
2180
2553
  get controls(): Maybe<OrbitControls>;
2181
2554
  }
2555
+ /** Timing passed to callbacks registered with {@link Renderer.onFrame}. */
2182
2556
  interface RendererFrame {
2183
2557
  /** Animation-loop timestamp in seconds, relative to the browser's performance time origin. */
2184
2558
  readonly time: number;
2185
2559
  /** Seconds since this callback's previous update; zero on its first update after subscribing or starting. */
2186
2560
  readonly delta: number;
2187
2561
  }
2562
+ /** A synchronous scene update registered with {@link Renderer.onFrame}. */
2188
2563
  type FrameCallback = (frame: RendererFrame) => void;
2564
+ /** Settings for `new Renderer(options)`. Omitted values use {@link Renderer.DEFAULT_OPTIONS}. */
2189
2565
  interface RendererOptions {
2190
2566
  camera: CameraOptions;
2191
2567
  render: RenderOptions;
@@ -2193,12 +2569,14 @@ interface RendererOptions {
2193
2569
  controls?: ControlsOptions;
2194
2570
  debug: DebugOptions;
2195
2571
  }
2572
+ /** Camera settings passed as `camera` in the Renderer constructor options. Positions use scene units. */
2196
2573
  interface CameraOptions {
2197
2574
  type: "perspective" | "orthographic";
2198
2575
  near: number;
2199
2576
  far: number;
2200
2577
  perspective: {
2201
2578
  aspect: undefined | number;
2579
+ /** Vertical field of view in degrees. */
2202
2580
  fov: number;
2203
2581
  };
2204
2582
  orthographic: {
@@ -2210,6 +2588,7 @@ interface CameraOptions {
2210
2588
  position: Vector3 | TripleArray;
2211
2589
  lookingAt: Vector3 | TripleArray;
2212
2590
  }
2591
+ /** Canvas and draw-loop settings passed as `render` in the Renderer constructor options. */
2213
2592
  interface RenderOptions {
2214
2593
  /** Maximum draw rate (60 by default); zero or a negative value disables the limit. */
2215
2594
  fpsLimit: number;
@@ -2218,20 +2597,29 @@ interface RenderOptions {
2218
2597
  stats: boolean;
2219
2598
  antialias: boolean;
2220
2599
  shade: boolean;
2600
+ /** Resizes to the attached element when the browser window resizes. */
2221
2601
  autoResize: boolean;
2602
+ /** Draws even when the scene is unchanged, while still respecting `fpsLimit`. */
2222
2603
  renderAlways: boolean;
2223
2604
  }
2605
+ /** Effects settings passed as `composer` in the Renderer constructor options. */
2224
2606
  interface ComposerOptions {
2225
2607
  enabled: boolean;
2226
2608
  }
2609
+ /** Set `controls: { enabled: true }` in the Renderer constructor to create owned OrbitControls. */
2227
2610
  interface ControlsOptions {
2228
2611
  enabled: boolean;
2229
2612
  }
2613
+ /** Scene helpers enabled through `debug` in the Renderer constructor options. */
2230
2614
  interface DebugOptions {
2231
2615
  grid: boolean;
2232
2616
  axes: boolean;
2233
2617
  }
2234
2618
 
2619
+ /**
2620
+ * Browser controls for inspecting and editing scene objects with Ctrl/Cmd-click selection.
2621
+ * Construct it with a renderer, attach its panels with {@link appendTo}, and call {@link dispose} when finished.
2622
+ */
2235
2623
  declare class SceneInspector {
2236
2624
  readonly renderer: Renderer;
2237
2625
  readonly objectInfoContainer: HTMLDivElement;
@@ -2261,6 +2649,7 @@ declare class SceneInspector {
2261
2649
  protected separator(name?: string): HTMLElement;
2262
2650
  }
2263
2651
 
2652
+ /** A browser statistics panel refreshed once per second. Dispose it separately from its renderer. */
2264
2653
  declare class SceneStatsDisplay implements Disposable {
2265
2654
  readonly renderer: Renderer;
2266
2655
  readonly statsContainer: HTMLDivElement;
@@ -2269,6 +2658,7 @@ declare class SceneStatsDisplay implements Disposable {
2269
2658
  constructor(renderer: Renderer);
2270
2659
  protected init(): void;
2271
2660
  appendTo(el: HTMLElement): void;
2661
+ /** Stops the refresh timer and removes the panel from the page. */
2272
2662
  dispose(): void;
2273
2663
  add(line?: StatLine): void;
2274
2664
  }
@@ -2284,10 +2674,130 @@ declare class StatLine {
2284
2674
  update(): void;
2285
2675
  }
2286
2676
 
2677
+ /** Portable scene setup. Positions use model units (16 per block); rotations use radians. */
2678
+ interface SceneDocument {
2679
+ format: "minerender-scene";
2680
+ version: 1;
2681
+ minecraftVersion?: string;
2682
+ camera?: {
2683
+ position: TripleArray;
2684
+ target: TripleArray;
2685
+ };
2686
+ objects: SceneObjectDefinition[];
2687
+ }
2688
+ interface SceneObjectDefinitionBase {
2689
+ id: string;
2690
+ name?: string;
2691
+ position?: TripleArray;
2692
+ rotation?: TripleArray;
2693
+ scale?: TripleArray;
2694
+ visible?: boolean;
2695
+ }
2696
+ type SceneSkinPosePart = "head" | "body" | "rightArm" | "leftArm" | "rightLeg" | "leftLeg" | "cape";
2697
+ interface SceneSkinDefinition extends SceneObjectDefinitionBase {
2698
+ type: "skin";
2699
+ /** Texture URL, Minecraft username, or UUID. Omit for Steve, or Alex with slim: true, from the active asset version. */
2700
+ skin?: string;
2701
+ cape?: {
2702
+ texture: string;
2703
+ layout?: CapeLayout;
2704
+ };
2705
+ options?: {
2706
+ slim?: boolean;
2707
+ legacy?: boolean;
2708
+ };
2709
+ /** Mesh names from SkinPart; hiding a base part does not hide its overlay. */
2710
+ hiddenParts?: string[];
2711
+ /** Absolute local XYZ joint rotations in radians; omitted joints keep their default pose. */
2712
+ pose?: Partial<Record<SceneSkinPosePart, TripleArray>>;
2713
+ }
2714
+ interface SceneBlockDefinition extends SceneObjectDefinitionBase {
2715
+ type: "block";
2716
+ asset: string;
2717
+ state?: Record<string, string>;
2718
+ options?: {
2719
+ wireframe?: boolean;
2720
+ tints?: Record<number, number>;
2721
+ };
2722
+ }
2723
+ interface SceneModelDefinition extends SceneObjectDefinitionBase {
2724
+ type: "item" | "model";
2725
+ asset: string;
2726
+ options?: {
2727
+ wireframe?: boolean;
2728
+ displayPosition?: DisplayPosition;
2729
+ tints?: Record<number, number>;
2730
+ };
2731
+ }
2732
+ interface SceneEntityDefinition extends SceneObjectDefinitionBase {
2733
+ type: "entity";
2734
+ asset: string;
2735
+ texture?: string;
2736
+ layers?: string[];
2737
+ when?: string[];
2738
+ textures?: Record<string, string>;
2739
+ options?: {
2740
+ flip?: boolean;
2741
+ wireframe?: boolean;
2742
+ tints?: Record<string, string | number>;
2743
+ };
2744
+ animation?: {
2745
+ name: string;
2746
+ loop?: boolean;
2747
+ speed?: number;
2748
+ time?: number;
2749
+ paused?: boolean;
2750
+ };
2751
+ }
2752
+ type SceneGuiLayer = (Omit<GuiTextureLayer, "texture"> & {
2753
+ texture: string;
2754
+ }) | (Omit<GuiItemLayer, "item"> & {
2755
+ item: string;
2756
+ }) | (Omit<GuiTextLayer, "font"> & {
2757
+ font?: string;
2758
+ });
2759
+ interface SceneGuiDefinition extends SceneObjectDefinitionBase {
2760
+ type: "gui";
2761
+ layers: SceneGuiLayer[];
2762
+ }
2763
+ type SceneObjectDefinition = SceneSkinDefinition | SceneBlockDefinition | SceneModelDefinition | SceneEntityDefinition | SceneGuiDefinition;
2764
+ /** Validates and copies a scene document without requesting assets or changing the active asset version. */
2765
+ declare function parseSceneDocument(value: unknown): SceneDocument;
2766
+
2767
+ interface LoadedSceneObject {
2768
+ readonly root: Group;
2769
+ readonly object: SceneObject;
2770
+ readonly definition: SceneObjectDefinition;
2771
+ /** Advances entity playback in seconds unless the definition has paused it. */
2772
+ advanceAnimation(delta: number): void;
2773
+ /** Removes this object and releases its owned resources. Safe to call more than once. */
2774
+ dispose(): void;
2775
+ }
2776
+ interface LoadedSceneDocument {
2777
+ readonly root: Group;
2778
+ readonly objects: LoadedSceneObject[];
2779
+ readonly definition: SceneDocument;
2780
+ advanceAnimations(delta: number): void;
2781
+ dispose(): void;
2782
+ }
2783
+ /** Loads portable scene documents using the asset sources already configured by the caller. */
2784
+ declare class SceneDocumentLoader {
2785
+ static parse(value: unknown): SceneDocument;
2786
+ /**
2787
+ * Loads objects concurrently and attaches them in document order after every load succeeds.
2788
+ * A failure waits for all loads, disposes staged objects, and reports the first error in document order.
2789
+ */
2790
+ static load(scene: MineRenderScene, value: unknown, parent?: Object3D): Promise<LoadedSceneDocument>;
2791
+ /** Loads an independently editable object. Its root owns the document's position, rotation, and scale. */
2792
+ static loadObject(scene: MineRenderScene, value: SceneObjectDefinition, parent?: Object3D): Promise<LoadedSceneObject>;
2793
+ private static loadValidatedObject;
2794
+ }
2795
+
2287
2796
  type SkinGeometries = Record<SkinPart, TripleArray>;
2288
2797
  declare const classicSkinGeometries: SkinGeometries;
2289
2798
  declare const slimSkinGeometries: SkinGeometries;
2290
2799
 
2800
+ /** Decodes skin pixels while preserving hidden RGB values in transparent PNG pixels. */
2291
2801
  declare class SkinImage {
2292
2802
  static getData(src: string): Promise<ImageData>;
2293
2803
  private static decodePng;
@@ -2297,12 +2807,15 @@ type SkinTextureCoordinates = Record<SkinPart, ModelFaces>;
2297
2807
  declare const classicSkinTextureCoordinates: Readonly<SkinTextureCoordinates>;
2298
2808
  declare const slimSkinTextureCoordinates: Readonly<SkinTextureCoordinates>;
2299
2809
 
2810
+ /** A prepared shared skin material with detected arm-model and texture-layout flags. */
2300
2811
  interface SkinTexture {
2301
2812
  material: MeshBasicMaterial;
2302
2813
  slim: boolean;
2303
2814
  legacy: boolean;
2304
2815
  }
2816
+ /** Prepares shared skin and cape materials, including legacy layout conversion and base-layer opacity. */
2305
2817
  declare class SkinTextures {
2818
+ /** Loads a skin URL. Pass `legacy` to override layout detection from the image dimensions. */
2306
2819
  static get(src: string, legacy?: boolean): Promise<SkinTexture>;
2307
2820
  static getCape(src: string, layout?: CapeLayout): Promise<MeshBasicMaterial>;
2308
2821
  private static createMaterial;
@@ -2311,12 +2824,18 @@ declare class SkinTextures {
2311
2824
  private static makeBaseOpaque;
2312
2825
  }
2313
2826
 
2827
+ /** Resolves player names, UUIDs, and service IDs to skin or cape texture URLs. */
2314
2828
  declare class Skins {
2829
+ /** Returns a skin URL for {@link MineRenderScene.addSkin}, or `undefined` if name lookup fails. */
2315
2830
  static fromUuidOrUsername(uuidOrUsername: string): Promise<Maybe<string>>;
2831
+ /** Builds a proxy URL for a UUID without downloading or checking the skin. */
2316
2832
  static fromUuid(uuid: string): Promise<Maybe<string>>;
2317
2833
  static fromUsername(username: string): Promise<Maybe<string>>;
2834
+ /** Looks up a saved MineSkin skin and returns its texture URL, or `undefined` on lookup failure. */
2318
2835
  static fromMineSkin(mineskinId: string): Promise<Maybe<string>>;
2836
+ /** Resolves a player's Minecraft cape URL for {@link SkinObject.setCapeTexture}. */
2319
2837
  static capeFromUuidOrUsername(uuidOrUsername: string): Promise<Maybe<string>>;
2838
+ /** Builds a proxy URL without checking whether the player has a cape. */
2320
2839
  static capeFromUuid(uuid: string): Promise<Maybe<string>>;
2321
2840
  static capeFromUsername(username: string): Promise<Maybe<string>>;
2322
2841
  /** Returns a full static cape texture for a username or UUID. */
@@ -2341,27 +2860,34 @@ declare class Skins {
2341
2860
  private static getMcProxyCapeUrl;
2342
2861
  }
2343
2862
 
2863
+ /** Samples resource-pack colormaps to produce packed sRGB tint colors. */
2344
2864
  declare class Colormaps {
2345
2865
  /** Samples the selected resource pack's grass colormap using Minecraft's climate coordinates. */
2346
2866
  static grassColor(origin?: AssetKey, temperature?: number, downfall?: number): Promise<number>;
2347
2867
  }
2348
2868
 
2869
+ /** Creates sRGB textures immediately and fills their pixels after asynchronous image loading. */
2349
2870
  declare class TextureLoader {
2350
2871
  private static readonly failedTextures;
2351
2872
  /** Reports whether image loading failed, so cached textures can be retried. */
2352
2873
  static hasFailed(texture: Texture): boolean;
2353
2874
  protected static createTexture(): Texture;
2354
2875
  static loadInBackground(src: string, format?: PixelFormat, rotation?: number): Texture;
2876
+ /** Loads image pixels in the background. `rotation` is in radians. Check {@link hasFailed} for load failures. */
2355
2877
  static load(src: string, format?: PixelFormat, rotation?: number): Texture;
2356
2878
  }
2357
2879
 
2880
+ /** Creates and caches Three.js textures with nearest-neighbor sampling for Minecraft artwork. */
2358
2881
  declare class Textures {
2359
2882
  /** Creates the shared checkerboard from pixels without fetching or decoding an image. */
2360
2883
  static getMissing(): DataTexture;
2884
+ /** Sets nearest-neighbor filters without changing the texture's color space. Returns the same texture. */
2361
2885
  static initTextureProps<T extends Texture>(texture: T): T;
2362
2886
  static createImage(key: TextureKey): Texture;
2363
2887
  static createAsset(key: AssetKey): Texture;
2888
+ /** Creates an sRGB color texture from a canvas. */
2364
2889
  static createCanvasTexture(canvas: HTMLCanvasElement): CanvasTexture;
2890
+ /** Returns a shared texture immediately and loads its image asynchronously. Failed cached loads are retried. */
2365
2891
  static getImage(key: TextureKey): Texture;
2366
2892
  }
2367
2893
 
@@ -2373,14 +2899,18 @@ declare function mergeVertices(geometry: BufferGeometry, tolerance?: number): Bu
2373
2899
  declare function toTrianglesDrawMode(geometry: BufferGeometry, drawMode: TrianglesDrawModes): BufferGeometry;
2374
2900
  declare function computeMorphedAttributes(object: Mesh | Line | Points): object;
2375
2901
 
2902
+ /** Stores 4,096 block cells in a shared state palette, with separate NBT for each cell. */
2376
2903
  declare class ChunkData {
2377
2904
  private readonly indices;
2378
2905
  private readonly palette;
2379
2906
  private readonly paletteIds;
2380
2907
  private readonly freeIds;
2381
2908
  private readonly nbt;
2909
+ /** Returns a detached copy of a cell, or `undefined` for air. Indices range from 0 to 4095. */
2382
2910
  get(index: number): Maybe<Block>;
2911
+ /** Captures a cell's data and returns a copy-producing reader that survives later cell changes. */
2383
2912
  snapshot(index: number): Maybe<() => Block>;
2913
+ /** Copies block data into a cell. An omitted block or an air block clears the cell. */
2384
2914
  set(index: number, block?: Block): void;
2385
2915
  clear(): void;
2386
2916
  static isAir(block: Maybe<Block>): boolean;
@@ -2389,9 +2919,11 @@ declare class ChunkData {
2389
2919
  }
2390
2920
 
2391
2921
  type RegionInput = Uint8Array | ArrayBuffer;
2922
+ /** Chunk columns decoded from an Anvil region file. */
2392
2923
  interface AnvilRegion {
2393
2924
  chunks: AnvilChunk[];
2394
2925
  }
2926
+ /** A decoded chunk column. `x` and `z` are absolute chunk coordinates, and section `y` is a section coordinate. */
2395
2927
  interface AnvilChunk {
2396
2928
  x: number;
2397
2929
  z: number;
@@ -2402,12 +2934,21 @@ interface AnvilChunk {
2402
2934
  }[];
2403
2935
  entities?: MultiBlockEntity[];
2404
2936
  }
2937
+ /** Reads Java 1.13+ paletted `.mca` regions. Entity NBT is preserved without data-version migration. */
2405
2938
  declare class AnvilParser {
2939
+ /** Lists occupied chunk positions within the region, using local coordinates from 0 to 31. */
2406
2940
  static getChunkList(data: RegionInput): {
2407
2941
  x: number;
2408
2942
  z: number;
2409
2943
  }[];
2944
+ /** Decodes all stored chunks. Gzip, zlib, and uncompressed payloads are supported. */
2410
2945
  static parse(data: RegionInput): Promise<AnvilRegion>;
2946
+ /**
2947
+ * Decodes one chunk for {@link MineRenderWorld.placeChunk}.
2948
+ * @param localX - Chunk x within the region, from 0 to 31.
2949
+ * @param localZ - Chunk z within the region, from 0 to 31.
2950
+ * @returns The chunk with absolute coordinates, or `undefined` if the region has no chunk there.
2951
+ */
2411
2952
  static parseChunk(data: RegionInput, localX: number, localZ: number): Promise<AnvilChunk | undefined>;
2412
2953
  private static bytes;
2413
2954
  private static locations;
@@ -2418,6 +2959,7 @@ declare class AnvilParser {
2418
2959
  private static unpack;
2419
2960
  }
2420
2961
 
2962
+ /** A placed block's data snapshot and optional render object, returned by world and chunk accessors. */
2421
2963
  interface BlockInfo<SectionMeshing extends boolean = false> {
2422
2964
  /** Detached block data; use world or chunk setters to update stored blocks. */
2423
2965
  readonly block: Block;
@@ -2425,33 +2967,45 @@ interface BlockInfo<SectionMeshing extends boolean = false> {
2425
2967
  object: SectionMeshing extends false ? BlockObject : BlockObject | undefined;
2426
2968
  }
2427
2969
 
2970
+ /** Shared cube geometry and atlas data prepared for section merging. */
2428
2971
  interface SectionMeshTemplate {
2429
2972
  geometry: BufferGeometry;
2430
2973
  atlas: TextureAtlas;
2431
2974
  cullFaces: readonly number[];
2432
2975
  }
2976
+ /** One block placement in a section, with its storage index and hidden-face mask. */
2433
2977
  interface SectionMeshEntry {
2434
2978
  index: number;
2435
2979
  template: SectionMeshTemplate;
2436
2980
  cullMask: number;
2437
2981
  }
2982
+ /** Merged terrain geometry and atlas pages for one 16×16×16 section. Owns its generated render resources. */
2438
2983
  declare class SectionMesh extends Group {
2439
2984
  private readonly ownedMeshes;
2985
+ /** Builds section-local meshes from visible cube faces. `maxAtlasSize` limits each atlas dimension in pixels. */
2440
2986
  static build(entries: readonly SectionMeshEntry[], maxAtlasSize?: number): SectionMesh;
2441
2987
  dispose(): void;
2442
2988
  }
2443
2989
 
2990
+ /** Prepares and caches static opaque cube geometry for merged world sections. */
2444
2991
  declare class SectionModels {
2445
2992
  readonly maxAtlasSize: number;
2446
2993
  private states;
2447
2994
  private models;
2448
2995
  private readonly templates;
2449
2996
  constructor(maxAtlasSize?: number);
2997
+ /** Returns a cube template, or `undefined` when the block requires an individual render object. */
2450
2998
  get(blockState: BlockState, properties?: BlockStateProperties): Promise<SectionMeshTemplate | undefined>;
2451
2999
  private prepare;
3000
+ /** Disposes prepared geometry and clears this world's template caches. */
2452
3001
  clear(): void;
2453
3002
  }
2454
3003
 
3004
+ /**
3005
+ * A 16×16×16 block section and its render objects.
3006
+ * Constructor coordinates identify the section. Block accessors use world block coordinates
3007
+ * unless their name explicitly refers to positions within the chunk.
3008
+ */
2455
3009
  declare class Chunk<SectionMeshing extends boolean = false> {
2456
3010
  private readonly onBlocksChanged?;
2457
3011
  private readonly sectionModels?;
@@ -2470,28 +3024,36 @@ declare class Chunk<SectionMeshing extends boolean = false> {
2470
3024
  getBlockAt(pos: Vector3): Maybe<BlockInfo<SectionMeshing>>;
2471
3025
  getBlockAt(pos: TripleArray): Maybe<BlockInfo<SectionMeshing>>;
2472
3026
  /**
2473
- * Set block at a _world_ position
3027
+ * Places a block at integer world block coordinates. Pass `undefined` to remove it.
2474
3028
  */
2475
3029
  setBlockAt(x: number, y: number, z: number, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
2476
3030
  setBlockAt(pos: Vector3, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
2477
3031
  setBlockAt(pos: TripleArray, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
2478
3032
  /**
2479
- * Set a block at integer chunk-local coordinates from 0 to 15.
3033
+ * Places a block at integer chunk-local coordinates from 0 to 15.
2480
3034
  */
2481
3035
  setBlockInChunkAt(pos: Vector3, block?: Block, worldPos?: Vector3, onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined): Promise<Maybe<BlockInfo<SectionMeshing>>>;
3036
+ /** Changes visibility at world block coordinates while preserving the block's data. */
2482
3037
  setBlockVisibleAt(pos: Vector3, visible: boolean): Promise<void>;
2483
3038
  isBlockVisibleAt(pos: Vector3): boolean;
2484
3039
  isOccludingAt(pos: Vector3): boolean;
2485
3040
  setCullMaskAt(pos: Vector3, mask: number): Promise<void>;
2486
3041
  rebuildSectionMesh(): void;
3042
+ /** Removes stored blocks and their render objects, then notifies the owning world of changed positions. */
2487
3043
  clear(onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined): Promise<void>;
2488
3044
  dispose(): Promise<void>;
2489
3045
  static isAir(block: Maybe<Block>): boolean;
3046
+ /** Maps chunk-local coordinates from 0 to 15 to a storage index, with x varying fastest, then z, then y. */
2490
3047
  static chunkPosToBlockIndex(pos: Vector3): number;
2491
3048
  worldPosToChunkPos(pos: Vector3): Vector3;
2492
3049
  chunkPosToWorldPos(pos: Vector3): Vector3;
2493
3050
  }
2494
3051
 
3052
+ /**
3053
+ * Stores and renders blocks in sparse 16×16×16 chunks.
3054
+ * Positions use integer block coordinates, including negatives. One block is 16 scene units.
3055
+ * Set `options.sectionMeshing` in `new MineRenderWorld(scene, options)` to merge compatible terrain.
3056
+ */
2495
3057
  declare class MineRenderWorld<SectionMeshing extends boolean = false> {
2496
3058
  readonly scene: MineRenderScene;
2497
3059
  private readonly _chunks;
@@ -2499,9 +3061,14 @@ declare class MineRenderWorld<SectionMeshing extends boolean = false> {
2499
3061
  private readonly pendingCulling;
2500
3062
  private culling?;
2501
3063
  constructor(scene: MineRenderScene, options?: MineRenderWorldOptions<SectionMeshing>);
3064
+ /** Returns a placed block at world block coordinates, or `undefined` for an empty position. */
2502
3065
  getBlockAt(x: number, y: number, z: number): Maybe<BlockInfo<SectionMeshing>>;
2503
3066
  getBlockAt(pos: Vector3): Maybe<BlockInfo<SectionMeshing>>;
2504
3067
  getBlockAt(pos: TripleArray): Maybe<BlockInfo<SectionMeshing>>;
3068
+ /**
3069
+ * Places or replaces a block and refreshes neighboring faces.
3070
+ * Pass `undefined` or an air block to remove the block at these world block coordinates.
3071
+ */
2505
3072
  setBlockAt(x: number, y: number, z: number, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
2506
3073
  setBlockAt(pos: Vector3, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
2507
3074
  setBlockAt(pos: TripleArray, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
@@ -2513,6 +3080,13 @@ declare class MineRenderWorld<SectionMeshing extends boolean = false> {
2513
3080
  setBlockVisibleAt(x: number, y: number, z: number, visible: boolean): Promise<void>;
2514
3081
  setBlockVisibleAt(pos: Vector3, visible: boolean): Promise<void>;
2515
3082
  setBlockVisibleAt(pos: TripleArray, visible: boolean): Promise<void>;
3083
+ /**
3084
+ * Places a structure's blocks at their stored positions, then refreshes neighboring faces.
3085
+ * Entity NBT is retained by the structure but is not rendered.
3086
+ *
3087
+ * @param useBatches - Uses bounded batches by default. Set to `false` for sequential placement.
3088
+ * @param executor - Optional queue for batched placement. The caller remains responsible for stopping it.
3089
+ */
2516
3090
  placeMultiBlock(multiblock: MultiBlockStructure, useBatches?: boolean, executor?: BatchedExecutor): Promise<void>;
2517
3091
  private placeBlocks;
2518
3092
  /** Replaces one chunk column's blocks. Entity NBT remains available on the parsed chunk. */
@@ -2523,15 +3097,20 @@ declare class MineRenderWorld<SectionMeshing extends boolean = false> {
2523
3097
  */
2524
3098
  unloadChunkColumn(x: number, z: number): Promise<void>;
2525
3099
  private clearChunkColumn;
3100
+ /** Removes all chunks and releases their block placements and section meshes. */
2526
3101
  clear(): Promise<void>;
2527
3102
  private updateCulling;
2528
3103
  private getOrCreateChunkAt;
3104
+ /** Returns the loaded chunk containing a world block position, without creating a chunk. */
2529
3105
  getChunkAt(pos: Vector3): Maybe<Chunk<SectionMeshing>>;
3106
+ /** Converts block coordinates to scene units by multiplying each component by 16. */
2530
3107
  static worldToScenePosition(pos: Vector3): Vector3;
3108
+ /** Converts scene units to block coordinates without rounding to an integer block. */
2531
3109
  static sceneToWorldPosition(pos: Vector3): Vector3;
2532
3110
  worldPosToChunkKey(pos: Vector3): string;
2533
3111
  validatePosBounds(pos: Vector3): void;
2534
3112
  }
3113
+ /** Settings passed as the second argument to `new MineRenderWorld(scene, options)`. */
2535
3114
  interface MineRenderWorldOptions<SectionMeshing extends boolean = boolean> {
2536
3115
  /** Merge static opaque cubes into section meshes. Merged blocks have no individual object. */
2537
3116
  sectionMeshing?: SectionMeshing;
@@ -2550,6 +3129,7 @@ declare class BrowserEnv implements EnvProvider {
2550
3129
  imageSize(data: Uint8Array): ImageSizeInfo;
2551
3130
  openCache(name: string, version: number): PersistentCache;
2552
3131
  }
3132
+ /** Installs the browser provider. The browser package entry calls this automatically. */
2553
3133
  declare function registerBrowserEnv(): BrowserEnv;
2554
3134
 
2555
3135
  /**
@@ -2575,4 +3155,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
2575
3155
  */
2576
3156
  declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
2577
3157
 
2578
- 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, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type BitmapFont, type BitmapGlyph, type Block, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, BrowserCache, BrowserEnv, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, Fonts, type FrameCallback, type FromTo, Geometries, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiSpriteScaling, type GuiText, type GuiTextLayer, type GuiTextLayout, type GuiTextOptions, type GuiTextRun, type GuiTextStyle, type GuiTextureLayer, type GuiTooltipOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, OrbitControls, 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, SceneExporter, type SceneGLTFExportOptions, SceneInspector, SceneObject, type SceneObjectOptions, 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, prefix, probeImageSize, registerBrowserEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
3158
+ 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, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type BitmapFont, type BitmapGlyph, type Block, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, BrowserCache, BrowserEnv, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, Fonts, type FrameCallback, type FromTo, Geometries, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiSpriteScaling, type GuiText, type GuiTextLayer, type GuiTextLayout, type GuiTextOptions, type GuiTextRun, type GuiTextStyle, type GuiTextureLayer, type GuiTooltipOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, type LoadedSceneDocument, type LoadedSceneObject, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, OrbitControls, type PackFormat, PackFormats, PackMetadata, PersistentCache, type PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererFrame, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResponseParser, SKIN_PARTS, type SceneBlockDefinition, type SceneDocument, SceneDocumentLoader, type SceneEntityDefinition, SceneExporter, type SceneGLTFExportOptions, type SceneGuiDefinition, type SceneGuiLayer, SceneInspector, type SceneModelDefinition, SceneObject, type SceneObjectDefinition, type SceneObjectDefinitionBase, type SceneObjectOptions, type SceneSkinDefinition, type SceneSkinPosePart, SceneStats, SceneStatsDisplay, SchematicParser, type SchematicParserOptions, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createFluidGeometry, createGuiTextGeometry, createGuiTextureGeometry, createImage, entityAnimationTime, estimateBytesUsed, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, layoutGuiText, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, parseSceneDocument, prefix, probeImageSize, registerBrowserEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };