minerender 2.1.0-alpha.5 → 2.1.0-alpha.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/browser/index.d.mts +591 -159
- package/dist/browser/index.d.ts +591 -159
- package/dist/browser/index.js +11251 -4439
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +10698 -3839
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +81958 -73548
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +590 -158
- package/dist/node/index.d.ts +590 -158
- package/dist/node/index.js +11413 -4512
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +10800 -3872
- package/dist/node/index.mjs.map +1 -1
- package/package.json +8 -8
package/dist/browser/index.d.mts
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import * as three from 'three';
|
|
2
|
-
import { Vector3, PixelFormat, BoxGeometry, Material, Mesh, Euler, Vector2, BufferAttribute, Float32BufferAttribute, BufferGeometry, Object3D, Box3, InstancedMesh, PerspectiveCamera, OrthographicCamera, Matrix4, Scene, Object3DEventMap, Texture, Camera, MOUSE, TOUCH, WebGLRenderer, EventDispatcher, Raycaster, Intersection, CanvasTexture, InterleavedBufferAttribute, TrianglesDrawModes, Line, Points } from 'three';
|
|
2
|
+
import { Vector3, PixelFormat, BoxGeometry, Material, MeshBasicMaterial, Mesh, Euler, Vector2, BufferAttribute, Float32BufferAttribute, BufferGeometry, Object3D, Box3, InstancedMesh, PerspectiveCamera, OrthographicCamera, Matrix4, Box2, Scene, Object3DEventMap, Texture, Camera, MOUSE, TOUCH, WebGLRenderer, EventDispatcher, Raycaster, Intersection, CanvasTexture, InterleavedBufferAttribute, TrianglesDrawModes, Line, Points, Group } from 'three';
|
|
3
3
|
import * as nodeCanvas from 'canvas';
|
|
4
4
|
import { ImageData as ImageData$1, CanvasRenderingContext2D } from 'canvas';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { NBT } from 'prismarine-nbt';
|
|
5
|
+
import { Buffer } from 'buffer';
|
|
6
|
+
import { NBT, NBTFormat, Metadata } from 'prismarine-nbt';
|
|
8
7
|
import { ZipReader } from '@zip.js/zip.js';
|
|
9
8
|
import { AsyncLoadingCache, SimpleCache } from '@inventivetalent/loading-cache';
|
|
9
|
+
import { PLYExporterOptions } from 'three/examples/jsm/exporters/PLYExporter.js';
|
|
10
|
+
export { PLYExporterOptions } from 'three/examples/jsm/exporters/PLYExporter.js';
|
|
10
11
|
import Stats from 'stats.js';
|
|
11
12
|
import { EffectComposer } from 'postprocessing';
|
|
12
13
|
|
|
13
14
|
interface AnimatorFunction {
|
|
14
|
-
(): void;
|
|
15
|
+
(): boolean | void;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
declare enum Axis {
|
|
18
|
-
X = "
|
|
19
|
+
X = "x",
|
|
19
20
|
Y = "y",
|
|
20
21
|
Z = "z"
|
|
21
22
|
}
|
|
@@ -39,6 +40,7 @@ declare enum CubeFaceIndex {
|
|
|
39
40
|
NORTH = 5
|
|
40
41
|
}
|
|
41
42
|
declare const CUBE_FACES: CubeFace[];
|
|
43
|
+
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]];
|
|
42
44
|
|
|
43
45
|
interface Disposable {
|
|
44
46
|
dispose(): void;
|
|
@@ -60,10 +62,11 @@ declare function createCanvas(width: number, height: number): CompatCanvas;
|
|
|
60
62
|
declare abstract class PersistentCache<B = unknown> {
|
|
61
63
|
readonly backing: B;
|
|
62
64
|
/** Bump to invalidate every persisted entry. */
|
|
63
|
-
static readonly VERSION =
|
|
65
|
+
static readonly VERSION = 2;
|
|
64
66
|
static open(name: string): PersistentCache;
|
|
65
67
|
protected constructor(backing: B);
|
|
66
68
|
abstract get<T>(key: string): Promise<T>;
|
|
69
|
+
/** Loads a missing entry and stores only non-nullish results. */
|
|
67
70
|
getOrLoad<T>(key: string, loader: (key: string) => Promise<T>): Promise<T>;
|
|
68
71
|
abstract put<T>(key: string, value: T): Promise<T>;
|
|
69
72
|
abstract delete<T>(key: string): Promise<void>;
|
|
@@ -173,6 +176,7 @@ declare class AssetKey extends BasicAssetKey {
|
|
|
173
176
|
rootType: "assets" | "data" | string;
|
|
174
177
|
extension: ".json" | ".png" | string;
|
|
175
178
|
root?: string | undefined;
|
|
179
|
+
readonly isAssetKey: true;
|
|
176
180
|
constructor(namespace: string, path: string, assetType?: AssetType | undefined, type?: string | undefined, rootType?: "assets" | "data" | string, extension?: ".json" | ".png" | string, root?: string | undefined);
|
|
177
181
|
static parse(assetType: AssetType, str: string, origin?: AssetKey): AssetKey;
|
|
178
182
|
toString(): string;
|
|
@@ -200,6 +204,7 @@ declare class Materials {
|
|
|
200
204
|
static get MISSING_TEXTURE(): Material;
|
|
201
205
|
static createImage(key: MaterialKey): Material;
|
|
202
206
|
static createBasicCanvasMaterial(canvas: HTMLCanvasElement, transparent?: boolean, shade?: boolean): Material;
|
|
207
|
+
static createGuiCanvasMaterial(canvas: HTMLCanvasElement): MeshBasicMaterial;
|
|
203
208
|
static createShadedCanvasMaterial(canvas: HTMLCanvasElement, transparent?: boolean, shade?: boolean): Material;
|
|
204
209
|
static getImage(key: MaterialKey): Material;
|
|
205
210
|
static needsUpdate(mat: Material): void;
|
|
@@ -245,7 +250,8 @@ declare enum DisplayPosition {
|
|
|
245
250
|
GUI = "gui",
|
|
246
251
|
HEAD = "head",
|
|
247
252
|
GROUND = "ground",
|
|
248
|
-
FIXED = "fixed"
|
|
253
|
+
FIXED = "fixed",
|
|
254
|
+
ON_SHELF = "on_shelf"
|
|
249
255
|
}
|
|
250
256
|
declare const DISPLAY_POSITIONS: DisplayPosition[];
|
|
251
257
|
|
|
@@ -254,6 +260,46 @@ declare enum GuiLight {
|
|
|
254
260
|
SIDE = "side"
|
|
255
261
|
}
|
|
256
262
|
|
|
263
|
+
interface RequestConfig extends RequestInit {
|
|
264
|
+
url: string;
|
|
265
|
+
/** Prepended to relative URLs, preserving any path in the base URL. */
|
|
266
|
+
baseURL?: string;
|
|
267
|
+
/** Timeout per attempt in milliseconds, including body reading. Defaults to 5000; 0 disables it. */
|
|
268
|
+
timeout?: number;
|
|
269
|
+
responseType?: "json" | "arraybuffer";
|
|
270
|
+
}
|
|
271
|
+
interface RequestResponse<T = any> {
|
|
272
|
+
data: T;
|
|
273
|
+
status: number;
|
|
274
|
+
statusText: string;
|
|
275
|
+
headers: Headers;
|
|
276
|
+
/** Final URL after redirects. */
|
|
277
|
+
url: string;
|
|
278
|
+
}
|
|
279
|
+
declare class RequestError extends Error {
|
|
280
|
+
readonly response?: RequestResponse<undefined> | undefined;
|
|
281
|
+
readonly cause?: unknown;
|
|
282
|
+
constructor(message: string, response?: RequestResponse<undefined> | undefined, cause?: unknown);
|
|
283
|
+
}
|
|
284
|
+
declare class Requests {
|
|
285
|
+
private static genericQueue;
|
|
286
|
+
private static mcAssetRequestQueue;
|
|
287
|
+
static genericRequest(request: RequestConfig): Promise<RequestResponse>;
|
|
288
|
+
static mcAssetRequest(request: RequestConfig): Promise<RequestResponse>;
|
|
289
|
+
static setMcAssetRoot(root: string): void;
|
|
290
|
+
/** Counts unsettled calls, including retry delays and requests still running after shutdown. */
|
|
291
|
+
static get queueSizes(): {
|
|
292
|
+
generic: number;
|
|
293
|
+
mcAsset: number;
|
|
294
|
+
};
|
|
295
|
+
/**
|
|
296
|
+
* Permanently stops both queues and rejects waiting, retrying, and future requests.
|
|
297
|
+
* Requests already running can finish. Idle queues hold no timer, so Node can exit without
|
|
298
|
+
* this cleanup. See {@link shutdown}.
|
|
299
|
+
*/
|
|
300
|
+
static end(): void;
|
|
301
|
+
}
|
|
302
|
+
|
|
257
303
|
declare class WrappedImage {
|
|
258
304
|
readonly dta: ExtractableImageData;
|
|
259
305
|
constructor(dta: ExtractableImageData);
|
|
@@ -277,7 +323,7 @@ interface ImageInfo {
|
|
|
277
323
|
width: number;
|
|
278
324
|
height: number;
|
|
279
325
|
type?: string;
|
|
280
|
-
data: Buffer
|
|
326
|
+
data: Buffer;
|
|
281
327
|
}
|
|
282
328
|
declare class ImageLoader {
|
|
283
329
|
protected static _createImage(): CompatImage;
|
|
@@ -289,7 +335,7 @@ declare class ImageLoader {
|
|
|
289
335
|
static infoToData(info: ImageInfo): Promise<ImageData>;
|
|
290
336
|
static getData(src: string): Promise<ImageData>;
|
|
291
337
|
static getCanvasData(src: string): Promise<ExtractableImageData>;
|
|
292
|
-
static processResponse(response:
|
|
338
|
+
static processResponse(response: Pick<RequestResponse<ArrayBuffer>, "data" | "url">): Promise<ImageInfo>;
|
|
293
339
|
static loadInfo(src: string): Promise<ImageInfo>;
|
|
294
340
|
static getInfo(src: string): Promise<ImageInfo>;
|
|
295
341
|
static loadWrapped(src: string): Promise<WrappedImage>;
|
|
@@ -303,7 +349,7 @@ declare const DEFAULT_ELEMENTS: ModelElement[];
|
|
|
303
349
|
interface Model extends MinecraftAsset {
|
|
304
350
|
textures?: IModelTextures;
|
|
305
351
|
parent?: string;
|
|
306
|
-
display?: ModelDisplay
|
|
352
|
+
display?: Partial<Record<DisplayPosition, ModelDisplay>>;
|
|
307
353
|
elements?: ModelElement[];
|
|
308
354
|
hierarchy?: string[];
|
|
309
355
|
}
|
|
@@ -318,7 +364,6 @@ interface ItemModel extends Model {
|
|
|
318
364
|
interface TextureAsset extends MinecraftAsset, ImageInfo {
|
|
319
365
|
}
|
|
320
366
|
interface ModelDisplay {
|
|
321
|
-
position?: DisplayPosition;
|
|
322
367
|
translation?: TripleArray;
|
|
323
368
|
rotation?: TripleArray;
|
|
324
369
|
scale?: TripleArray;
|
|
@@ -338,13 +383,7 @@ declare function isDoubleArray(obj: any): obj is DoubleArray;
|
|
|
338
383
|
declare function isTripleArray(obj: any): obj is TripleArray;
|
|
339
384
|
declare function isQuadArray(obj: any): obj is QuadArray;
|
|
340
385
|
|
|
341
|
-
/**
|
|
342
|
-
* down up
|
|
343
|
-
* east north west south
|
|
344
|
-
*
|
|
345
|
-
* bottom-left to top-right
|
|
346
|
-
* [bl, br, tl, tr]
|
|
347
|
-
*/
|
|
386
|
+
/** Vanilla Minecraft cube UVs in Three.js BoxGeometry face and vertex order. */
|
|
348
387
|
declare class MinecraftCubeTexture {
|
|
349
388
|
readonly u: number;
|
|
350
389
|
readonly v: number;
|
|
@@ -360,7 +399,7 @@ declare class MinecraftCubeTexture {
|
|
|
360
399
|
getUvSouth(w: number, h: number, l: number): QuadArray<DoubleArray>;
|
|
361
400
|
getUvNorth(w: number, h: number, l: number): QuadArray<DoubleArray>;
|
|
362
401
|
getFaceUv(face: CubeFace, w: number, h: number, l: number): QuadArray<DoubleArray>;
|
|
363
|
-
toUvArray(w: number, h: number, l: number): number[];
|
|
402
|
+
toUvArray(w: number, h: number, l: number, mirror?: boolean): number[];
|
|
364
403
|
}
|
|
365
404
|
|
|
366
405
|
interface MinecraftTextureMeta extends MinecraftAsset {
|
|
@@ -488,6 +527,7 @@ declare class TextureAtlas implements Disposable {
|
|
|
488
527
|
};
|
|
489
528
|
readonly hasTransparency: boolean;
|
|
490
529
|
ticker?: number;
|
|
530
|
+
private readonly subscribers;
|
|
491
531
|
constructor(model: Model, image: CanvasImage, sizes: {
|
|
492
532
|
[texture: string]: DoubleArray;
|
|
493
533
|
}, positions: {
|
|
@@ -495,6 +535,8 @@ declare class TextureAtlas implements Disposable {
|
|
|
495
535
|
}, hasAnimation: boolean, animatorFunctions: {
|
|
496
536
|
[p: string]: AnimatorFunction;
|
|
497
537
|
}, hasTransparency: boolean);
|
|
538
|
+
/** Calls subscribers when an animation frame changes; unused atlases do not tick. */
|
|
539
|
+
subscribe(callback: () => void): () => void;
|
|
498
540
|
getData(texture: string): ImageData$1;
|
|
499
541
|
dispose(): void;
|
|
500
542
|
}
|
|
@@ -513,6 +555,7 @@ declare class UVMapper {
|
|
|
513
555
|
static setCubeUvs(geometry: BoxGeometry, originalTextureSize: DoubleArray, actualTextureSize: DoubleArray, faces: ModelFaces): void;
|
|
514
556
|
static facesToUvArray(faces: ModelFaces, originalTextureSize: DoubleArray, actualTextureSize: DoubleArray): number[];
|
|
515
557
|
static facesToUv(faces: ModelFaces, originalTextureSize: DoubleArray, actualTextureSize: DoubleArray): Float32BufferAttribute;
|
|
558
|
+
static lockUvs(geometry: BoxGeometry, faces: ModelFaces, atlas: TextureAtlas, rotation: Euler): void;
|
|
516
559
|
static getAtlas(model: Model): Promise<Maybe<TextureAtlas>>;
|
|
517
560
|
static fillMissingTextureKeys<T>(textures: ModelTextures, target: {
|
|
518
561
|
[k: string]: T;
|
|
@@ -534,14 +577,13 @@ declare class MinecraftFaceUV {
|
|
|
534
577
|
}
|
|
535
578
|
|
|
536
579
|
/**
|
|
537
|
-
*
|
|
580
|
+
* Stops the shared Ticker and request queues, and clears the in-memory caches.
|
|
538
581
|
*
|
|
539
|
-
*
|
|
540
|
-
*
|
|
541
|
-
* the library is loaded. Browsers don't care, but anything headless - a render server, a CLI, a
|
|
542
|
-
* test run - has to call this when it's done.
|
|
582
|
+
* Idle Node processes can exit without calling this: cache and Ticker timers are unref'd,
|
|
583
|
+
* and idle request queues hold no timer. Pending requests keep their normal timer references.
|
|
543
584
|
*
|
|
544
|
-
*
|
|
585
|
+
* Call this only when finished with MineRender. Queued, retrying, and future requests reject;
|
|
586
|
+
* HTTP requests already running can finish. Queue shutdown is permanent, and cache expiry timers do not restart.
|
|
545
587
|
*/
|
|
546
588
|
declare function shutdown(): void;
|
|
547
589
|
|
|
@@ -549,42 +591,15 @@ declare class BatchedExecutor {
|
|
|
549
591
|
readonly interval: number;
|
|
550
592
|
readonly batch: number;
|
|
551
593
|
private readonly queue;
|
|
552
|
-
private readonly task;
|
|
553
594
|
constructor(interval?: number, batch?: number);
|
|
554
|
-
submit(task: Task):
|
|
555
|
-
|
|
556
|
-
private runNext;
|
|
595
|
+
submit<T>(task: Task<T>): Promise<T>;
|
|
596
|
+
stop(): void;
|
|
557
597
|
}
|
|
558
|
-
type Task = () =>
|
|
598
|
+
type Task<T = unknown> = () => T | Promise<T>;
|
|
559
599
|
|
|
560
600
|
declare function prefix(prefix?: string): string;
|
|
561
601
|
|
|
562
|
-
interface ModelPart {
|
|
563
|
-
textureWidth: number;
|
|
564
|
-
textureHeight: number;
|
|
565
|
-
textureOffsetU: number;
|
|
566
|
-
textureOffsetV: number;
|
|
567
|
-
pivotX: number;
|
|
568
|
-
pivotY: number;
|
|
569
|
-
pivotZ: number;
|
|
570
|
-
pitch: number;
|
|
571
|
-
yaw: number;
|
|
572
|
-
roll: number;
|
|
573
|
-
mirror: boolean;
|
|
574
|
-
cubes: Cube[];
|
|
575
|
-
children: ModelPart[];
|
|
576
|
-
}
|
|
577
|
-
interface Cube {
|
|
578
|
-
minX: number;
|
|
579
|
-
minY: number;
|
|
580
|
-
minZ: number;
|
|
581
|
-
maxX: number;
|
|
582
|
-
maxY: number;
|
|
583
|
-
maxZ: number;
|
|
584
|
-
}
|
|
585
|
-
|
|
586
602
|
declare function applyElementRotation(rotation: ElementRotation, geometry: BufferGeometry): void;
|
|
587
|
-
declare function applyModelPartRotation(modelPart: ModelPart, geometry: BufferGeometry): void;
|
|
588
603
|
declare function applyGenericRotation(axis: Axis, rotation: number, obj: Object3D): void;
|
|
589
604
|
declare function addBox3WireframeToObject(box: Box3, obj: Object3D, color?: number, w?: number): void;
|
|
590
605
|
declare function addWireframeToObject(obj: Object3D, color?: number, w?: number): void;
|
|
@@ -613,15 +628,47 @@ declare enum AssetParser {
|
|
|
613
628
|
declare abstract class AssetSource {
|
|
614
629
|
protected constructor();
|
|
615
630
|
abstract get<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<Maybe<T>>;
|
|
631
|
+
/**
|
|
632
|
+
* Identifies this source's content across sessions for persistent caching. Sources that
|
|
633
|
+
* cannot tell whether their content changed (an unnamed archive, for example) return
|
|
634
|
+
* undefined, which keeps their results out of long-lived caches.
|
|
635
|
+
*/
|
|
636
|
+
get cacheId(): Maybe<string>;
|
|
637
|
+
}
|
|
638
|
+
/** A source failed to load or parse an asset; cause retains the original failure. */
|
|
639
|
+
declare class AssetLoadError extends Error {
|
|
640
|
+
readonly source: AssetSource;
|
|
641
|
+
readonly key: AssetKey;
|
|
642
|
+
readonly path: string;
|
|
643
|
+
readonly cause: unknown;
|
|
644
|
+
constructor(source: AssetSource, key: AssetKey, path: string, cause: unknown);
|
|
616
645
|
}
|
|
617
646
|
|
|
618
647
|
declare class AssetLoader {
|
|
619
648
|
static ROOT: string;
|
|
620
649
|
private static _SOURCES;
|
|
650
|
+
/** Used when a registered source cannot identify its content, so nothing persists past this session. */
|
|
651
|
+
private static readonly SESSION_SCOPE;
|
|
652
|
+
static get version(): string;
|
|
653
|
+
static setVersion(version: string): void;
|
|
654
|
+
/**
|
|
655
|
+
* Scope for persistent cache keys. Empty with only the default vanilla sources, so their
|
|
656
|
+
* entries stay valid across sessions; otherwise it names every added source (resource packs,
|
|
657
|
+
* mirrors) so their results never masquerade as vanilla assets after a reload.
|
|
658
|
+
*/
|
|
659
|
+
static get persistentScope(): string;
|
|
660
|
+
/** Prefixes a persistent cache key with the current source scope. */
|
|
661
|
+
static persistentKey(key: string): string;
|
|
621
662
|
static addSource(key: string, source: AssetSource, override?: boolean): void;
|
|
622
663
|
static removeSource(key: string): Maybe<AssetSource>;
|
|
623
664
|
static getAll<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<T[]>;
|
|
665
|
+
/** Returns the first defined result in source-priority order, without merging assets. */
|
|
624
666
|
static get<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<Maybe<T>>;
|
|
667
|
+
/** Tries each path within a source before considering lower-priority sources. */
|
|
668
|
+
static getFirst<T extends MinecraftAsset>(keys: readonly AssetKey[], parser: AssetParser | string): Promise<Maybe<{
|
|
669
|
+
key: AssetKey;
|
|
670
|
+
asset: T;
|
|
671
|
+
}>>;
|
|
625
672
|
}
|
|
626
673
|
|
|
627
674
|
interface BlockState extends MinecraftAsset {
|
|
@@ -636,18 +683,19 @@ interface BlockStateVariant {
|
|
|
636
683
|
y?: number;
|
|
637
684
|
x?: number;
|
|
638
685
|
uvlock?: boolean;
|
|
686
|
+
weight?: number;
|
|
639
687
|
}
|
|
640
688
|
interface BlockStateMultipart {
|
|
641
|
-
when?: MultipartCondition
|
|
642
|
-
|
|
643
|
-
};
|
|
644
|
-
apply?: BlockStateVariant;
|
|
645
|
-
}
|
|
646
|
-
interface MultipartCondition {
|
|
647
|
-
[key: string]: string;
|
|
689
|
+
when?: MultipartCondition;
|
|
690
|
+
apply?: BlockStateVariant | BlockStateVariant[];
|
|
648
691
|
}
|
|
692
|
+
type MultipartCondition = Record<string, string> | {
|
|
693
|
+
OR: MultipartCondition[];
|
|
694
|
+
} | {
|
|
695
|
+
AND: MultipartCondition[];
|
|
696
|
+
};
|
|
649
697
|
|
|
650
|
-
declare const DEFAULT_ROOT = "https://assets.mcasset.cloud/1.
|
|
698
|
+
declare const DEFAULT_ROOT = "https://assets.mcasset.cloud/1.21.11";
|
|
651
699
|
declare const DEFAULT_NAMESPACE = "minecraft";
|
|
652
700
|
declare class Assets {
|
|
653
701
|
/**
|
|
@@ -686,25 +734,60 @@ declare class DefaultBlockStates implements MinecraftAsset {
|
|
|
686
734
|
[k: string]: BlockStatePropertyDefaults;
|
|
687
735
|
}
|
|
688
736
|
|
|
689
|
-
interface
|
|
690
|
-
|
|
691
|
-
|
|
737
|
+
interface EntityLayer {
|
|
738
|
+
key: BasicAssetKey;
|
|
739
|
+
texture?: AssetKey;
|
|
740
|
+
layer: EntityModelLayer;
|
|
741
|
+
}
|
|
742
|
+
interface EntityModel extends EntityLayer {
|
|
743
|
+
id: string;
|
|
744
|
+
/** Selected layers; the top-level fields describe the first selection. */
|
|
745
|
+
layers?: Record<string, EntityLayer>;
|
|
746
|
+
}
|
|
747
|
+
interface EntityModelFile extends MinecraftAsset {
|
|
748
|
+
id: string;
|
|
749
|
+
layers: Record<string, EntityModelLayer>;
|
|
750
|
+
}
|
|
751
|
+
interface EntityModelLayer {
|
|
752
|
+
texture: [number, number];
|
|
753
|
+
textureLocation?: string;
|
|
754
|
+
root: EntityModelPart;
|
|
755
|
+
}
|
|
756
|
+
interface EntityModelPart {
|
|
757
|
+
pose: {
|
|
758
|
+
offset: [number, number, number];
|
|
759
|
+
rotation: [number, number, number];
|
|
760
|
+
scale?: [number, number, number];
|
|
692
761
|
};
|
|
762
|
+
texture?: [number, number];
|
|
763
|
+
cubes: EntityModelCube[];
|
|
764
|
+
children: Record<string, EntityModelPart>;
|
|
765
|
+
}
|
|
766
|
+
interface EntityModelCube {
|
|
767
|
+
origin: [number, number, number];
|
|
768
|
+
size: [number, number, number];
|
|
769
|
+
uv: [number, number];
|
|
770
|
+
grow?: [number, number, number];
|
|
771
|
+
mirror?: boolean;
|
|
693
772
|
}
|
|
694
773
|
|
|
695
774
|
declare class Entities {
|
|
696
|
-
static getBlockEntityModels(): Promise<Maybe<BlockEntityModels>>;
|
|
697
|
-
static getEntityModels(): Promise<Maybe<EntityModels>>;
|
|
698
|
-
static getBlockList(): Promise<string[]>;
|
|
699
775
|
static getEntityList(): Promise<string[]>;
|
|
700
|
-
static
|
|
701
|
-
static
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
776
|
+
private static getModelFile;
|
|
777
|
+
static getLayerList(modelKey: BasicAssetKey): Promise<string[]>;
|
|
778
|
+
static getEntity(modelKey: BasicAssetKey, textureKey?: BasicAssetKey, options?: EntityModelOptions): Promise<Maybe<EntityModel>>;
|
|
779
|
+
static resolveTexture(modelKey: BasicAssetKey): Promise<Maybe<AssetKey>>;
|
|
780
|
+
/** @deprecated Use getEntityList(); block entities share the entity dataset. */
|
|
781
|
+
static getBlockList(): Promise<string[]>;
|
|
782
|
+
/** @deprecated Use getEntity(); block entities share the entity dataset. */
|
|
783
|
+
static getBlock(modelKey: BasicAssetKey, textureKey?: BasicAssetKey, options?: EntityModelOptions): Promise<Maybe<EntityModel>>;
|
|
705
784
|
}
|
|
706
|
-
|
|
707
|
-
|
|
785
|
+
interface EntityModelOptions {
|
|
786
|
+
layer?: string;
|
|
787
|
+
/** Layer names in draw order; defaults to layer or "main". */
|
|
788
|
+
layers?: string[];
|
|
789
|
+
/** Per-layer texture overrides. The positional texture key applies to the first selected layer. */
|
|
790
|
+
textures?: Record<string, BasicAssetKey>;
|
|
708
791
|
}
|
|
709
792
|
|
|
710
793
|
declare class Models {
|
|
@@ -712,15 +795,34 @@ declare class Models {
|
|
|
712
795
|
private static get PERSISTENT_CACHE();
|
|
713
796
|
static getItemList(): Promise<string[]>;
|
|
714
797
|
static loadAndMerge(key: AssetKey): Promise<Maybe<Model>>;
|
|
798
|
+
private static getItemModel;
|
|
799
|
+
private static defaultItemModel;
|
|
715
800
|
static getRaw(key: AssetKey): Promise<Maybe<Model>>;
|
|
716
801
|
static getMerged(key: AssetKey): Promise<Maybe<Model>>;
|
|
717
802
|
static get(key: AssetKey): Promise<Maybe<Model>>;
|
|
718
803
|
static clearCache(): Promise<void>;
|
|
719
804
|
}
|
|
720
805
|
|
|
806
|
+
declare class DisplayTransforms {
|
|
807
|
+
/** Resolve hand fallbacks within one model, before inheriting parent display entries. */
|
|
808
|
+
static withHandFallbacks(display: Model["display"]): Model["display"];
|
|
809
|
+
/** Build a display pose for geometry already centered at the model's [8, 8, 8] pivot. */
|
|
810
|
+
static getMatrix(display: Model["display"], position: DisplayPosition): Matrix4;
|
|
811
|
+
static apply(geometry: BufferGeometry, matrix: Matrix4): void;
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
declare class ModelCulling {
|
|
815
|
+
static toLocalMask(worldMask: number, rotation: Euler): number;
|
|
816
|
+
static isOpaqueFullCube(atlas: Maybe<TextureAtlas>): boolean;
|
|
817
|
+
}
|
|
818
|
+
|
|
721
819
|
declare class ModelGenerator {
|
|
722
820
|
static readonly ITEM_LAYERS: string[];
|
|
723
|
-
|
|
821
|
+
/**
|
|
822
|
+
* Front and back faces plus one zero-thickness side face per run of texels that border a transparent texel,
|
|
823
|
+
* like vanilla's ItemModelGenerator. Pass the pixels of a single (first) animation frame.
|
|
824
|
+
*/
|
|
825
|
+
static generateItemModel(imageData: Pick<ImageData$1, "width" | "height" | "data">, layer: string): ModelElement[];
|
|
724
826
|
}
|
|
725
827
|
|
|
726
828
|
declare class ModelMerger {
|
|
@@ -734,8 +836,24 @@ interface Block {
|
|
|
734
836
|
nbt?: any;
|
|
735
837
|
}
|
|
736
838
|
|
|
839
|
+
declare class BlockStateResolver {
|
|
840
|
+
static defaults(blockState: BlockState): Promise<BlockStateProperties>;
|
|
841
|
+
static select(blockState: BlockState, state: BlockStateProperties, choose?: (variants: BlockStateVariant | BlockStateVariant[]) => BlockStateVariant): BlockStateVariant[];
|
|
842
|
+
static matching(blockState: BlockState, state: BlockStateProperties): (BlockStateVariant | BlockStateVariant[])[];
|
|
843
|
+
static choose(variants: BlockStateVariant | BlockStateVariant[]): BlockStateVariant;
|
|
844
|
+
static rotation(variant: BlockStateVariant): Euler;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
declare class BlockTints {
|
|
848
|
+
/** Resolves block preview colors without biome context; explicit tints take precedence. */
|
|
849
|
+
static get(key: AssetKey | undefined, state: BlockStateProperties, model: Model, tints?: Record<number, number>): Promise<Record<number, number> | undefined>;
|
|
850
|
+
private static grassColor;
|
|
851
|
+
}
|
|
852
|
+
|
|
737
853
|
interface Instanceable {
|
|
738
854
|
nextInstance(): InstanceReference<SceneObject>;
|
|
855
|
+
removeInstanceAt(index: number): void;
|
|
856
|
+
isInstanceActive(index: number, reference: InstanceReference<Instanceable>): boolean;
|
|
739
857
|
getMatrixAt(index: number, matrix?: Matrix4): Matrix4;
|
|
740
858
|
setMatrixAt(index: number, matrix: Matrix4): void;
|
|
741
859
|
setPositionRotationScaleAt(index: number, position?: Vector3, rotation?: Euler, scale?: Vector3): void;
|
|
@@ -748,12 +866,15 @@ interface Instanceable {
|
|
|
748
866
|
}
|
|
749
867
|
declare function isInstanceable(obj: any): obj is Instanceable;
|
|
750
868
|
|
|
751
|
-
declare class InstanceReference<T extends Instanceable> implements Transformable {
|
|
869
|
+
declare class InstanceReference<T extends Instanceable> implements Transformable, Disposable {
|
|
752
870
|
readonly instanceable: T;
|
|
753
871
|
readonly index: number;
|
|
754
872
|
readonly isInstanceReference: true;
|
|
755
873
|
constructor(instanceable: T, index: number);
|
|
756
874
|
nextInstance(): InstanceReference<SceneObject>;
|
|
875
|
+
private get activeInstanceable();
|
|
876
|
+
removeFromScene(): void;
|
|
877
|
+
dispose(): void;
|
|
757
878
|
getMatrix(matrix?: Matrix4): Matrix4;
|
|
758
879
|
setMatrix(matrix: Matrix4): void;
|
|
759
880
|
setPositionRotationScale(position?: Vector3, rotation?: Euler, scale?: Vector3): void;
|
|
@@ -778,18 +899,33 @@ declare class ModelObject extends SceneObject {
|
|
|
778
899
|
readonly isModelObject: true;
|
|
779
900
|
static readonly DEFAULT_OPTIONS: ModelObjectOptions;
|
|
780
901
|
readonly options: ModelObjectOptions;
|
|
781
|
-
|
|
902
|
+
protected atlas?: TextureAtlas;
|
|
903
|
+
private atlasMaterial?;
|
|
904
|
+
private atlasTexture?;
|
|
905
|
+
private unsubscribeAtlas?;
|
|
782
906
|
blockParent: Maybe<BlockObject>;
|
|
783
907
|
private meshesCreated;
|
|
784
908
|
constructor(originalModel: Model, options?: Partial<ModelObjectOptions>);
|
|
785
909
|
init(): Promise<void>;
|
|
786
|
-
dispose(): void;
|
|
787
910
|
get textureAtlas(): Maybe<TextureAtlas>;
|
|
911
|
+
get isOpaqueFullCube(): boolean;
|
|
788
912
|
protected loadTextures(): Promise<void>;
|
|
789
913
|
protected createMeshes(force?: boolean): void;
|
|
790
914
|
protected applyTextures(): void;
|
|
915
|
+
private updateAnimationSubscription;
|
|
916
|
+
nextInstance(): InstanceReference<SceneObject>;
|
|
917
|
+
removeInstanceAt(index: number): void;
|
|
918
|
+
disposeAndRemoveAllChildren(): void;
|
|
791
919
|
}
|
|
792
920
|
interface ModelObjectOptions extends SceneObjectOptions {
|
|
921
|
+
/** Minecraft display pose applied around the model center, before scene transforms. */
|
|
922
|
+
displayPosition?: DisplayPosition;
|
|
923
|
+
/** Quarter-turn block rotation in radians to compensate when locking UVs. */
|
|
924
|
+
uvLockRotation?: TripleArray;
|
|
925
|
+
/** sRGB 0xRRGGBB colors by face tint index; omitted indices stay white. */
|
|
926
|
+
tints?: Record<number, number>;
|
|
927
|
+
/** Hidden neighbor directions in CUBE_FACES order, before the model's block rotation. */
|
|
928
|
+
cullMask?: number;
|
|
793
929
|
}
|
|
794
930
|
declare function isModelObject(obj: any): obj is ModelObject;
|
|
795
931
|
|
|
@@ -822,24 +958,36 @@ declare enum SkinPart {
|
|
|
822
958
|
}
|
|
823
959
|
declare const SKIN_PARTS: SkinPart[];
|
|
824
960
|
|
|
961
|
+
type CapeLayout = "minecraft" | "optifine" | "labymod";
|
|
962
|
+
declare const capeTextureSizes: Record<CapeLayout, DoubleArray>;
|
|
963
|
+
|
|
964
|
+
/** A player model facing +Z. Left and right parts are the player's own: left is +X, right is -X. */
|
|
825
965
|
declare class SkinObject extends SceneObject {
|
|
826
966
|
readonly options: SkinObjectOptions;
|
|
827
967
|
private slim;
|
|
828
|
-
private
|
|
968
|
+
private detectedSlim;
|
|
829
969
|
private skinTextureSrc?;
|
|
830
|
-
private
|
|
831
|
-
private
|
|
832
|
-
private
|
|
970
|
+
private skinMaterial?;
|
|
971
|
+
private skinLoad;
|
|
972
|
+
private capeLoad;
|
|
833
973
|
constructor(options?: DeepPartial<SkinObjectOptions>);
|
|
834
974
|
init(): Promise<void>;
|
|
835
975
|
protected removeMeshes(): void;
|
|
836
976
|
protected createMeshes(): void;
|
|
837
|
-
setSkinTexture(src: string): void
|
|
838
|
-
|
|
839
|
-
|
|
977
|
+
setSkinTexture(src: string): Promise<void>;
|
|
978
|
+
/** Load a cape texture in the selected layout, or pass undefined to remove the cape. */
|
|
979
|
+
setCapeTexture(src?: string, layout?: CapeLayout): Promise<void>;
|
|
980
|
+
/** Select the arm model, or pass undefined to use texture detection. */
|
|
981
|
+
setSlim(slim?: boolean): void;
|
|
982
|
+
private updateSlim;
|
|
983
|
+
/** Select the texture layout, or pass undefined to detect it from image dimensions. */
|
|
984
|
+
setLegacy(legacy?: boolean): Promise<void>;
|
|
985
|
+
dispose(): void;
|
|
840
986
|
protected getBoxGeometry(part: SkinPart): BoxGeometry;
|
|
841
987
|
}
|
|
842
988
|
interface SkinObjectOptions extends SceneObjectOptions {
|
|
989
|
+
slim?: boolean;
|
|
990
|
+
legacy?: boolean;
|
|
843
991
|
}
|
|
844
992
|
|
|
845
993
|
declare class EntityObject extends SceneObject {
|
|
@@ -847,19 +995,54 @@ declare class EntityObject extends SceneObject {
|
|
|
847
995
|
readonly isEntityObject: true;
|
|
848
996
|
static readonly DEFAULT_OPTIONS: EntityObjectOptions;
|
|
849
997
|
readonly options: EntityObjectOptions;
|
|
850
|
-
private imageData?;
|
|
851
998
|
private meshesCreated;
|
|
852
999
|
constructor(entity: EntityModel, options?: Partial<EntityObjectOptions>);
|
|
853
1000
|
init(): Promise<void>;
|
|
854
1001
|
dispose(): void;
|
|
855
|
-
|
|
1002
|
+
getLayerGroup(name: string): Maybe<Object3D>;
|
|
1003
|
+
getGroupByName(name: string, layerName?: string): Maybe<Object3D>;
|
|
1004
|
+
getMeshByName(name: string, layerName?: string): Maybe<Mesh>;
|
|
1005
|
+
private get entityLayers();
|
|
1006
|
+
private getTextureKey;
|
|
1007
|
+
protected loadTextures(layer?: EntityLayer): Promise<Maybe<ExtractableImageData>>;
|
|
856
1008
|
protected createMeshes(force?: boolean): void;
|
|
1009
|
+
private createPart;
|
|
857
1010
|
protected applyTextures(): Promise<void>;
|
|
858
1011
|
}
|
|
859
1012
|
interface EntityObjectOptions extends SceneObjectOptions {
|
|
1013
|
+
flip?: boolean;
|
|
860
1014
|
}
|
|
861
1015
|
declare function isEntityObject(obj: any): obj is EntityObject;
|
|
862
1016
|
|
|
1017
|
+
/** A texture layer in GUI pixels. Later layers draw above earlier layers. */
|
|
1018
|
+
interface GuiLayer {
|
|
1019
|
+
name?: string;
|
|
1020
|
+
texture: AssetKey | string;
|
|
1021
|
+
/** Source-image pixels: [x, y, width, height], measured from the top left. */
|
|
1022
|
+
crop?: [number, number, number, number];
|
|
1023
|
+
/** Top-left position; x grows right and y grows down. Defaults to [0, 0]. */
|
|
1024
|
+
position?: [number, number];
|
|
1025
|
+
/** Output width and height. Defaults to the crop or full image size. */
|
|
1026
|
+
size?: [number, number];
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
declare class GuiObject extends SceneObject {
|
|
1030
|
+
readonly textureLayers: readonly GuiLayer[];
|
|
1031
|
+
readonly isGuiObject: true;
|
|
1032
|
+
/** Local bounds in GUI pixels, with y growing down from the origin. */
|
|
1033
|
+
readonly bounds: Box2;
|
|
1034
|
+
private readonly geometries;
|
|
1035
|
+
private readonly ownedMaterials;
|
|
1036
|
+
private initialized;
|
|
1037
|
+
constructor(textureLayers: readonly GuiLayer[], options?: Partial<GuiObjectOptions>);
|
|
1038
|
+
init(): Promise<void>;
|
|
1039
|
+
private loadMaterial;
|
|
1040
|
+
disposeAndRemoveAllChildren(): void;
|
|
1041
|
+
}
|
|
1042
|
+
interface GuiObjectOptions extends SceneObjectOptions {
|
|
1043
|
+
}
|
|
1044
|
+
declare function isGuiObject(obj: any): obj is GuiObject;
|
|
1045
|
+
|
|
863
1046
|
declare class MineRenderScene extends Scene {
|
|
864
1047
|
readonly isMineRenderScene: true;
|
|
865
1048
|
static readonly DEFAULT_OPTIONS: MineRenderSceneOptions;
|
|
@@ -879,6 +1062,7 @@ declare class MineRenderScene extends Scene {
|
|
|
879
1062
|
addBlock(blockState: BlockState, options?: Partial<BlockObjectOptions>, parent?: Object3D): Promise<BlockObject | InstanceReference<BlockObject>>;
|
|
880
1063
|
addSkin(skin?: string, options?: Partial<SkinObjectOptions>, parent?: Object3D): Promise<SkinObject>;
|
|
881
1064
|
addEntity(entity: EntityModel, options?: Partial<EntityObjectOptions>, parent?: Object3D): Promise<EntityObject | InstanceReference<EntityObject>>;
|
|
1065
|
+
addGui(layers: readonly GuiLayer[], options?: Partial<GuiObjectOptions>, parent?: Object3D): Promise<GuiObject>;
|
|
882
1066
|
}
|
|
883
1067
|
interface MineRenderSceneOptions {
|
|
884
1068
|
}
|
|
@@ -894,6 +1078,9 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
|
|
|
894
1078
|
private materialCallbacks;
|
|
895
1079
|
protected _isInstanced: boolean;
|
|
896
1080
|
_instanceCounter: number;
|
|
1081
|
+
protected instanceMesh?: InstancedMesh;
|
|
1082
|
+
private readonly instanceReferences;
|
|
1083
|
+
private readonly freeInstanceIndices;
|
|
897
1084
|
constructor(options?: Partial<SceneObjectOptions>);
|
|
898
1085
|
set scene(scene: MineRenderScene);
|
|
899
1086
|
get scene(): MineRenderScene;
|
|
@@ -933,6 +1120,12 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
|
|
|
933
1120
|
get instanceCounter(): number;
|
|
934
1121
|
protected constructInstanceReference(i: number): InstanceReference<SceneObject>;
|
|
935
1122
|
nextInstance(): InstanceReference<SceneObject>;
|
|
1123
|
+
/** Returns the live reference for a raycast hit on this object's instance mesh. */
|
|
1124
|
+
getInstanceReference(mesh: Object3D, index: number): Maybe<InstanceReference<SceneObject>>;
|
|
1125
|
+
isInstanceActive(index: number, reference: InstanceReference<Instanceable>): boolean;
|
|
1126
|
+
removeInstanceAt(index: number): void;
|
|
1127
|
+
private growInstances;
|
|
1128
|
+
protected activeInstanceIndices(): Iterable<number>;
|
|
936
1129
|
getMatrixAt(index: number, matrix?: Matrix4): Matrix4;
|
|
937
1130
|
setMatrixAt(index: number, matrix: Matrix4): void;
|
|
938
1131
|
setPositionRotationScaleAt(index: number, position?: Vector3, rotation?: Euler, scale?: Vector3): void;
|
|
@@ -956,6 +1149,23 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
|
|
|
956
1149
|
}
|
|
957
1150
|
declare function isSceneObject(obj: any): obj is SceneObject;
|
|
958
1151
|
|
|
1152
|
+
type FluidKind = "water" | "lava";
|
|
1153
|
+
interface BlockFluidState {
|
|
1154
|
+
kind: FluidKind;
|
|
1155
|
+
level: number;
|
|
1156
|
+
renderModel: boolean;
|
|
1157
|
+
}
|
|
1158
|
+
declare function getBlockFluidState(key?: AssetKey, state?: BlockStateProperties): BlockFluidState | undefined;
|
|
1159
|
+
declare function getFluidKind(key?: AssetKey, state?: BlockStateProperties): FluidKind | undefined;
|
|
1160
|
+
interface FluidSample {
|
|
1161
|
+
fluid?: FluidKind;
|
|
1162
|
+
level?: number;
|
|
1163
|
+
solid?: boolean;
|
|
1164
|
+
}
|
|
1165
|
+
type FluidSampler = (x: number, y: number, z: number) => FluidSample;
|
|
1166
|
+
/** Builds centered fluid faces with material groups 0 (still) and 1 (flowing). */
|
|
1167
|
+
declare function createFluidGeometry(kind: FluidKind, sample: FluidSampler): BufferGeometry;
|
|
1168
|
+
|
|
959
1169
|
declare class BlockObject extends SceneObject {
|
|
960
1170
|
readonly blockState: BlockState;
|
|
961
1171
|
readonly isBlockObject: true;
|
|
@@ -969,13 +1179,27 @@ declare class BlockObject extends SceneObject {
|
|
|
969
1179
|
private _instanceModel;
|
|
970
1180
|
private _variants;
|
|
971
1181
|
private _models;
|
|
1182
|
+
private _cullMask;
|
|
1183
|
+
private _fluidKey?;
|
|
1184
|
+
private _fluidSampler?;
|
|
1185
|
+
private _fluidModel?;
|
|
972
1186
|
constructor(blockState: BlockState, options?: Partial<BlockObjectOptions>);
|
|
973
1187
|
init(): Promise<void>;
|
|
974
1188
|
dispose(): void;
|
|
975
1189
|
removeFromScene(): void;
|
|
1190
|
+
private clearModels;
|
|
1191
|
+
private removeModels;
|
|
1192
|
+
get isOccluding(): boolean;
|
|
1193
|
+
private getModelMatrix;
|
|
1194
|
+
private getModelCullMask;
|
|
1195
|
+
setCullMask(worldMask: number): Promise<void>;
|
|
976
1196
|
get state(): {
|
|
977
1197
|
[key: string]: string;
|
|
978
1198
|
};
|
|
1199
|
+
get fluidKind(): FluidKind | undefined;
|
|
1200
|
+
get fluidLevel(): number;
|
|
1201
|
+
/** Refreshes fluid surfaces from relative neighbors; standalone previews use air around the block. */
|
|
1202
|
+
updateFluid(sample?: FluidSampler): Promise<void>;
|
|
979
1203
|
nextInstance(): InstanceReference<SceneObject>;
|
|
980
1204
|
protected mapStateToVariant(state: BlockStateProperties): Promise<BlockStateVariant[]>;
|
|
981
1205
|
recreateModels(): Promise<void>;
|
|
@@ -994,26 +1218,50 @@ declare class BlockObject extends SceneObject {
|
|
|
994
1218
|
}
|
|
995
1219
|
interface BlockObjectOptions extends ModelObjectOptions {
|
|
996
1220
|
applyDefaultState: boolean;
|
|
1221
|
+
/** Properties applied before model creation, overriding defaults when applyDefaultState is enabled. */
|
|
1222
|
+
initialState?: BlockStateProperties;
|
|
997
1223
|
}
|
|
998
1224
|
declare function isBlockObject(obj: any): obj is BlockObject;
|
|
999
1225
|
|
|
1226
|
+
/** Saved fluid levels and solid neighbors determine the geometry shared by an instance pool. */
|
|
1227
|
+
declare function sampleFluid(kind: FluidKind, sample: FluidSampler): {
|
|
1228
|
+
key: string;
|
|
1229
|
+
sample: FluidSampler;
|
|
1230
|
+
};
|
|
1231
|
+
declare class FluidModelObject extends ModelObject {
|
|
1232
|
+
readonly kind: FluidKind;
|
|
1233
|
+
private readonly sample;
|
|
1234
|
+
private geometry?;
|
|
1235
|
+
constructor(kind: FluidKind, sample: FluidSampler, origin?: AssetKey, options?: Partial<ModelObjectOptions>);
|
|
1236
|
+
protected createMeshes(): void;
|
|
1237
|
+
protected applyTextures(): void;
|
|
1238
|
+
disposeAndRemoveAllChildren(): void;
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1000
1241
|
interface MultiBlockStructure {
|
|
1001
1242
|
readonly size: TripleArray;
|
|
1002
1243
|
readonly blocks: MultiBlockBlock[];
|
|
1244
|
+
readonly dataVersion?: number;
|
|
1245
|
+
readonly entities?: MultiBlockEntity[];
|
|
1246
|
+
}
|
|
1247
|
+
interface MultiBlockEntity {
|
|
1248
|
+
position: TripleArray;
|
|
1249
|
+
blockPosition?: TripleArray;
|
|
1250
|
+
nbt: unknown;
|
|
1003
1251
|
}
|
|
1004
1252
|
interface MultiBlockBlock extends Block {
|
|
1005
1253
|
position: TripleArray;
|
|
1006
1254
|
}
|
|
1007
1255
|
|
|
1008
1256
|
declare class SchematicParser {
|
|
1009
|
-
static parse(): Promise<MultiBlockStructure>;
|
|
1257
|
+
static parse(nbt: NBT): Promise<MultiBlockStructure>;
|
|
1010
1258
|
}
|
|
1011
1259
|
|
|
1012
1260
|
declare class StructureParser {
|
|
1013
1261
|
static parse(_nbt: NBT, paletteIndex?: number): Promise<MultiBlockStructure>;
|
|
1014
1262
|
}
|
|
1015
1263
|
interface StructureNBT {
|
|
1016
|
-
DataVersion
|
|
1264
|
+
DataVersion?: {
|
|
1017
1265
|
type: "int";
|
|
1018
1266
|
value: number;
|
|
1019
1267
|
};
|
|
@@ -1025,7 +1273,13 @@ interface StructureNBT {
|
|
|
1025
1273
|
};
|
|
1026
1274
|
};
|
|
1027
1275
|
palette?: Palette;
|
|
1028
|
-
palettes?:
|
|
1276
|
+
palettes?: {
|
|
1277
|
+
type: "list";
|
|
1278
|
+
value: {
|
|
1279
|
+
type: "list";
|
|
1280
|
+
value: Palette["value"][];
|
|
1281
|
+
};
|
|
1282
|
+
};
|
|
1029
1283
|
blocks: {
|
|
1030
1284
|
type: "list";
|
|
1031
1285
|
value: {
|
|
@@ -1033,7 +1287,32 @@ interface StructureNBT {
|
|
|
1033
1287
|
value: BlockEntry[];
|
|
1034
1288
|
};
|
|
1035
1289
|
};
|
|
1036
|
-
entities
|
|
1290
|
+
entities?: {
|
|
1291
|
+
type: "list";
|
|
1292
|
+
value: {
|
|
1293
|
+
type: "compound";
|
|
1294
|
+
value: {
|
|
1295
|
+
pos: {
|
|
1296
|
+
type: "list";
|
|
1297
|
+
value: {
|
|
1298
|
+
type: "double";
|
|
1299
|
+
value: TripleArray;
|
|
1300
|
+
};
|
|
1301
|
+
};
|
|
1302
|
+
blockPos: {
|
|
1303
|
+
type: "list";
|
|
1304
|
+
value: {
|
|
1305
|
+
type: "int";
|
|
1306
|
+
value: TripleArray;
|
|
1307
|
+
};
|
|
1308
|
+
};
|
|
1309
|
+
nbt: {
|
|
1310
|
+
type: "compound";
|
|
1311
|
+
value: any;
|
|
1312
|
+
};
|
|
1313
|
+
}[];
|
|
1314
|
+
};
|
|
1315
|
+
};
|
|
1037
1316
|
}
|
|
1038
1317
|
interface Palette {
|
|
1039
1318
|
type: "list";
|
|
@@ -1077,14 +1356,17 @@ interface BlockEntry {
|
|
|
1077
1356
|
}
|
|
1078
1357
|
|
|
1079
1358
|
declare class NBTHelper {
|
|
1080
|
-
static fromBuffer(
|
|
1359
|
+
static fromBuffer(data: Uint8Array | ArrayBuffer, format?: NBTFormat): Promise<NBTAsset>;
|
|
1081
1360
|
}
|
|
1082
1361
|
interface NBTAsset extends MinecraftAsset, NBT {
|
|
1362
|
+
format?: NBTFormat;
|
|
1363
|
+
metadata?: Metadata;
|
|
1364
|
+
compression?: "gzip" | "none";
|
|
1083
1365
|
}
|
|
1084
1366
|
|
|
1085
1367
|
interface ResponseParser<T extends MinecraftAsset> {
|
|
1086
|
-
config(request:
|
|
1087
|
-
parse(response:
|
|
1368
|
+
config(request: RequestConfig): any;
|
|
1369
|
+
parse(response: RequestResponse): Maybe<T> | Promise<Maybe<T>>;
|
|
1088
1370
|
}
|
|
1089
1371
|
|
|
1090
1372
|
declare class HostedAssetSource extends AssetSource {
|
|
@@ -1103,6 +1385,7 @@ declare class HostedAssetSource extends AssetSource {
|
|
|
1103
1385
|
private readonly _options;
|
|
1104
1386
|
constructor(root: string, options?: Partial<HostedAssetSourceOptions>);
|
|
1105
1387
|
get root(): string;
|
|
1388
|
+
get cacheId(): string;
|
|
1106
1389
|
get options(): HostedAssetSourceOptions;
|
|
1107
1390
|
get<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser): Promise<Maybe<T>>;
|
|
1108
1391
|
}
|
|
@@ -1117,6 +1400,8 @@ interface ArchiveEntry {
|
|
|
1117
1400
|
}
|
|
1118
1401
|
|
|
1119
1402
|
interface ArchiveProxy {
|
|
1403
|
+
/** Identifies the archive's content across sessions; undefined when it cannot be identified. */
|
|
1404
|
+
readonly id?: string;
|
|
1120
1405
|
getEntries(): Promise<ArchiveEntry[]>;
|
|
1121
1406
|
}
|
|
1122
1407
|
|
|
@@ -1124,6 +1409,7 @@ declare class ArchiveAssetSource extends AssetSource implements ArchiveProxy {
|
|
|
1124
1409
|
readonly _archiveProxy: ArchiveProxy;
|
|
1125
1410
|
constructor(archiveProxy: ArchiveProxy);
|
|
1126
1411
|
static blob(blob: Blob): ArchiveAssetSource;
|
|
1412
|
+
get cacheId(): Maybe<string>;
|
|
1127
1413
|
getEntries(): Promise<ArchiveEntry[]>;
|
|
1128
1414
|
getEntry(path: string): Promise<Maybe<ArchiveEntry>>;
|
|
1129
1415
|
get<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<Maybe<T>>;
|
|
@@ -1134,7 +1420,8 @@ declare class ArchiveAssetSource extends AssetSource implements ArchiveProxy {
|
|
|
1134
1420
|
declare class BrowserArchiveProxy implements ArchiveProxy {
|
|
1135
1421
|
readonly _blob: Blob;
|
|
1136
1422
|
readonly _reader: ZipReader<Blob>;
|
|
1137
|
-
|
|
1423
|
+
readonly id?: string;
|
|
1424
|
+
constructor(blob: Blob, id?: string);
|
|
1138
1425
|
getEntries(): Promise<ArchiveEntry[]>;
|
|
1139
1426
|
}
|
|
1140
1427
|
|
|
@@ -1212,27 +1499,54 @@ declare class Caching {
|
|
|
1212
1499
|
static readonly mergedModelCache: AsyncLoadingCache<CacheKey, Model>;
|
|
1213
1500
|
static readonly modelTextureAtlasCache: AsyncLoadingCache<CacheKey, TextureAtlas>;
|
|
1214
1501
|
static readonly blockStateCache: AsyncLoadingCache<CacheKey, BlockState>;
|
|
1502
|
+
static readonly listAssetCache: AsyncLoadingCache<CacheKey, ListAsset>;
|
|
1503
|
+
static readonly defaultBlockStatesCache: AsyncLoadingCache<CacheKey, DefaultBlockStates>;
|
|
1504
|
+
static readonly blockTintCache: AsyncLoadingCache<CacheKey, number>;
|
|
1505
|
+
static readonly entityModelCache: AsyncLoadingCache<CacheKey, EntityModelFile>;
|
|
1506
|
+
static readonly entityTextureCache: AsyncLoadingCache<CacheKey, AssetKey>;
|
|
1507
|
+
private static createAssetCache;
|
|
1215
1508
|
/** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
|
|
1216
1509
|
private static get all();
|
|
1217
1510
|
static clear(): void;
|
|
1218
1511
|
/**
|
|
1219
1512
|
* Clears every cache and stops its expiry timer.
|
|
1220
1513
|
*
|
|
1221
|
-
*
|
|
1222
|
-
*
|
|
1514
|
+
* Expiry timers are unref'd in Node, so idle processes can exit without this cleanup.
|
|
1515
|
+
* Use {@link shutdown} to also stop requests and the shared Ticker.
|
|
1223
1516
|
*/
|
|
1224
1517
|
static end(): void;
|
|
1225
1518
|
static get cacheSizes(): {};
|
|
1226
1519
|
}
|
|
1227
1520
|
|
|
1521
|
+
/** Copies the nontransparent bounds without resizing the source; empty images become one transparent pixel. */
|
|
1522
|
+
declare function trimCanvas(source: CompatCanvas): CompatCanvas;
|
|
1523
|
+
|
|
1228
1524
|
declare class MineRenderError extends Error {
|
|
1229
1525
|
constructor(msg: any);
|
|
1230
1526
|
get name(): string;
|
|
1231
1527
|
}
|
|
1232
1528
|
|
|
1233
|
-
|
|
1529
|
+
interface SceneGLTFExportOptions {
|
|
1530
|
+
/** Returns a GLB ArrayBuffer instead of a glTF object. */
|
|
1531
|
+
binary?: boolean;
|
|
1532
|
+
/** Maximum width and height of each exported texture, in pixels. */
|
|
1533
|
+
maxTextureSize?: number;
|
|
1234
1534
|
}
|
|
1235
|
-
|
|
1535
|
+
/** Exports the visible meshes at their current poses without changing the source scene. */
|
|
1536
|
+
declare class SceneExporter {
|
|
1537
|
+
/** Returns OBJ geometry with normals and UVs; material files and textures are not included. */
|
|
1538
|
+
static toObj(root: Object3D): string;
|
|
1539
|
+
/** Returns PLY geometry with vertex colors and UVs; texture images are not included. */
|
|
1540
|
+
static toPLY(root: Object3D, options?: PLYExporterOptions): string | ArrayBuffer;
|
|
1541
|
+
/**
|
|
1542
|
+
* Exports a static glTF/GLB snapshot in a browser. Atlas textures and vertex tints are retained;
|
|
1543
|
+
* MineRender's custom directional lighting is not baked into the exported materials.
|
|
1544
|
+
*/
|
|
1545
|
+
static toGLTF(root: Object3D, options?: SceneGLTFExportOptions): Promise<Record<string, any> | ArrayBuffer>;
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
declare class GuiHelper {
|
|
1549
|
+
static inventorySlot(slot: number | [number, number], origin?: [number, number], offset?: [number, number], rowSize?: number): [number, number];
|
|
1236
1550
|
}
|
|
1237
1551
|
|
|
1238
1552
|
declare class OrbitControls {
|
|
@@ -1357,7 +1671,16 @@ declare class Renderer implements Disposable {
|
|
|
1357
1671
|
*/
|
|
1358
1672
|
dispose(): void;
|
|
1359
1673
|
private animate;
|
|
1360
|
-
|
|
1674
|
+
private drawFrame;
|
|
1675
|
+
/**
|
|
1676
|
+
* Renders a fresh frame and returns an image data URL, including while the animation loop is stopped.
|
|
1677
|
+
* Trimming removes transparent borders; an empty image becomes one transparent pixel.
|
|
1678
|
+
* MIME type support and lossy quality (0–1) follow the canvas encoder.
|
|
1679
|
+
*/
|
|
1680
|
+
toImage(trim?: boolean, mime?: string, quality?: number): string;
|
|
1681
|
+
toObj(): string;
|
|
1682
|
+
toPLY(options?: PLYExporterOptions): string | ArrayBuffer;
|
|
1683
|
+
toGLTF(options?: SceneGLTFExportOptions): Promise<Record<string, any> | ArrayBuffer>;
|
|
1361
1684
|
protected get attachedToBody(): boolean;
|
|
1362
1685
|
protected get viewWidth(): number;
|
|
1363
1686
|
protected get viewHeight(): number;
|
|
@@ -1395,6 +1718,8 @@ interface CameraOptions {
|
|
|
1395
1718
|
interface RenderOptions {
|
|
1396
1719
|
/** Maximum draw rate (60 by default); zero or a negative value disables the limit. */
|
|
1397
1720
|
fpsLimit: number;
|
|
1721
|
+
/** Drawing-buffer pixels per CSS pixel (default 1); also scales toImage() output. */
|
|
1722
|
+
pixelRatio?: number;
|
|
1398
1723
|
stats: boolean;
|
|
1399
1724
|
antialias: boolean;
|
|
1400
1725
|
shade: boolean;
|
|
@@ -1419,17 +1744,21 @@ declare class SceneInspector {
|
|
|
1419
1744
|
protected readonly raycaster: Raycaster;
|
|
1420
1745
|
private readonly mouse;
|
|
1421
1746
|
private selectedObject?;
|
|
1747
|
+
private pointer?;
|
|
1748
|
+
private readonly listeners;
|
|
1422
1749
|
constructor(renderer: Renderer);
|
|
1423
1750
|
protected init(): void;
|
|
1751
|
+
dispose(): void;
|
|
1424
1752
|
findMeshChildren(from: Object3D, out?: Mesh[]): Mesh<three.BufferGeometry<three.NormalBufferAttributes>, three.Material | three.Material[], three.Object3DEventMap>[];
|
|
1425
|
-
onClick(event:
|
|
1753
|
+
onClick(event: MouseEvent): void;
|
|
1426
1754
|
appendTo(el: HTMLElement): void;
|
|
1427
1755
|
protected handleRaycasterObjects(intersections: Intersection[]): void;
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
protected
|
|
1756
|
+
private getIntersectionInstance;
|
|
1757
|
+
selectObject(targetObject: Object3D, targetIntersection?: Intersection, instance?: Maybe<InstanceReference<SceneObject>>): void;
|
|
1758
|
+
protected redraw(targetObject: Object3D, targetIntersection?: Intersection, instance?: InstanceReference<SceneObject>): void;
|
|
1759
|
+
protected addControls(object: Object3D, intersection?: Intersection, instance?: InstanceReference<SceneObject>): void;
|
|
1431
1760
|
protected addInfoLine(name: string, id: string, value: any): HTMLElement;
|
|
1432
|
-
protected addObjectControls(target: Object3D, intersection: Maybe<Intersection>, container: HTMLElement): void;
|
|
1761
|
+
protected addObjectControls(target: Object3D, intersection: Maybe<Intersection>, container: HTMLElement, instance?: InstanceReference<SceneObject>): void;
|
|
1433
1762
|
protected buttonControl(name: string, id: string, click: () => void): HTMLElement;
|
|
1434
1763
|
protected selectControl(name: string, id: string, options: string[], change: (v: string) => void): HTMLElement;
|
|
1435
1764
|
protected toggleControl(name: string, id: string, val: boolean, change: (v: boolean) => void): HTMLElement;
|
|
@@ -1458,34 +1787,33 @@ declare class StatLine {
|
|
|
1458
1787
|
update(): void;
|
|
1459
1788
|
}
|
|
1460
1789
|
|
|
1461
|
-
declare class Requests {
|
|
1462
|
-
private static axiosInstance;
|
|
1463
|
-
private static mcAssetInstance;
|
|
1464
|
-
private static genericQueue;
|
|
1465
|
-
private static mcAssetRequestQueue;
|
|
1466
|
-
static genericRequest(request: AxiosRequestConfig): Promise<AxiosResponse>;
|
|
1467
|
-
static mcAssetRequest(request: AxiosRequestConfig): Promise<AxiosResponse>;
|
|
1468
|
-
private static shouldRetry;
|
|
1469
|
-
static setMcAssetRoot(root: string): void;
|
|
1470
|
-
static get queueSizes(): {
|
|
1471
|
-
generic: number;
|
|
1472
|
-
mcAsset: number;
|
|
1473
|
-
};
|
|
1474
|
-
/**
|
|
1475
|
-
* Stops both queue timers. jobqu reschedules itself indefinitely, so a Node process will not
|
|
1476
|
-
* exit until this is called - see {@link shutdown}.
|
|
1477
|
-
*/
|
|
1478
|
-
static end(): void;
|
|
1479
|
-
}
|
|
1480
|
-
|
|
1481
1790
|
type SkinGeometries = Record<SkinPart, TripleArray>;
|
|
1482
1791
|
declare const classicSkinGeometries: SkinGeometries;
|
|
1483
1792
|
declare const slimSkinGeometries: SkinGeometries;
|
|
1484
1793
|
|
|
1794
|
+
declare class SkinImage {
|
|
1795
|
+
static getData(src: string): Promise<ImageData>;
|
|
1796
|
+
private static decodePng;
|
|
1797
|
+
}
|
|
1798
|
+
|
|
1485
1799
|
type SkinTextureCoordinates = Record<SkinPart, ModelFaces>;
|
|
1486
1800
|
declare const classicSkinTextureCoordinates: Readonly<SkinTextureCoordinates>;
|
|
1487
1801
|
declare const slimSkinTextureCoordinates: Readonly<SkinTextureCoordinates>;
|
|
1488
1802
|
|
|
1803
|
+
interface SkinTexture {
|
|
1804
|
+
material: MeshBasicMaterial;
|
|
1805
|
+
slim: boolean;
|
|
1806
|
+
legacy: boolean;
|
|
1807
|
+
}
|
|
1808
|
+
declare class SkinTextures {
|
|
1809
|
+
static get(src: string, legacy?: boolean): Promise<SkinTexture>;
|
|
1810
|
+
static getCape(src: string, layout?: CapeLayout): Promise<MeshBasicMaterial>;
|
|
1811
|
+
private static createMaterial;
|
|
1812
|
+
private static isSlim;
|
|
1813
|
+
private static normalizeLegacy;
|
|
1814
|
+
private static makeBaseOpaque;
|
|
1815
|
+
}
|
|
1816
|
+
|
|
1489
1817
|
declare class Skins {
|
|
1490
1818
|
static fromUuidOrUsername(uuidOrUsername: string): Promise<Maybe<string>>;
|
|
1491
1819
|
static fromUuid(uuid: string): Promise<Maybe<string>>;
|
|
@@ -1494,8 +1822,11 @@ declare class Skins {
|
|
|
1494
1822
|
static capeFromUuidOrUsername(uuidOrUsername: string): Promise<Maybe<string>>;
|
|
1495
1823
|
static capeFromUuid(uuid: string): Promise<Maybe<string>>;
|
|
1496
1824
|
static capeFromUsername(username: string): Promise<Maybe<string>>;
|
|
1497
|
-
static
|
|
1825
|
+
/** Returns a full static cape texture for a username or UUID. */
|
|
1826
|
+
static capeFromCapesDev(player: string, capeType?: string): Promise<Maybe<string>>;
|
|
1498
1827
|
private static usernameToUuid;
|
|
1828
|
+
private static usernameToUuidMcProxy;
|
|
1829
|
+
/** @deprecated **/
|
|
1499
1830
|
private static usernameToUuidSkinProxy;
|
|
1500
1831
|
private static usernameToUuidMineTools;
|
|
1501
1832
|
private static getProfileFromMinetools;
|
|
@@ -1505,11 +1836,18 @@ declare class Skins {
|
|
|
1505
1836
|
private static getCrafatarCapeUrl;
|
|
1506
1837
|
private static getMcHeadsSkinUrl;
|
|
1507
1838
|
private static getMineSkinPlayerSkinUrl;
|
|
1839
|
+
/** @deprecated **/
|
|
1508
1840
|
private static getSkinProxySkinUrl;
|
|
1841
|
+
/** @deprecated **/
|
|
1509
1842
|
private static getSkinProxyCapeUrl;
|
|
1843
|
+
private static getMcProxySkinUrl;
|
|
1844
|
+
private static getMcProxyCapeUrl;
|
|
1510
1845
|
}
|
|
1511
1846
|
|
|
1512
1847
|
declare class TextureLoader {
|
|
1848
|
+
private static readonly failedTextures;
|
|
1849
|
+
/** Reports whether image loading failed, so cached textures can be retried. */
|
|
1850
|
+
static hasFailed(texture: Texture): boolean;
|
|
1513
1851
|
protected static createTexture(): Texture;
|
|
1514
1852
|
static loadInBackground(src: string, format?: PixelFormat, rotation?: number): Texture;
|
|
1515
1853
|
static load(src: string, format?: PixelFormat, rotation?: number): Texture;
|
|
@@ -1531,61 +1869,155 @@ declare function mergeVertices(geometry: BufferGeometry, tolerance?: number): Bu
|
|
|
1531
1869
|
declare function toTrianglesDrawMode(geometry: BufferGeometry, drawMode: TrianglesDrawModes): BufferGeometry;
|
|
1532
1870
|
declare function computeMorphedAttributes(object: Mesh | Line | Points): object;
|
|
1533
1871
|
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1872
|
+
declare class ChunkData {
|
|
1873
|
+
private readonly indices;
|
|
1874
|
+
private readonly palette;
|
|
1875
|
+
private readonly paletteIds;
|
|
1876
|
+
private readonly freeIds;
|
|
1877
|
+
private readonly nbt;
|
|
1878
|
+
get(index: number): Maybe<Block>;
|
|
1879
|
+
snapshot(index: number): Maybe<() => Block>;
|
|
1880
|
+
set(index: number, block?: Block): void;
|
|
1881
|
+
clear(): void;
|
|
1882
|
+
static isAir(block: Maybe<Block>): boolean;
|
|
1883
|
+
private static copyBlock;
|
|
1884
|
+
private static validateIndex;
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
type RegionInput = Uint8Array | ArrayBuffer;
|
|
1888
|
+
interface AnvilRegion {
|
|
1889
|
+
chunks: AnvilChunk[];
|
|
1890
|
+
}
|
|
1891
|
+
interface AnvilChunk {
|
|
1892
|
+
x: number;
|
|
1893
|
+
z: number;
|
|
1894
|
+
dataVersion?: number;
|
|
1895
|
+
sections: {
|
|
1896
|
+
y: number;
|
|
1897
|
+
data: ChunkData;
|
|
1898
|
+
}[];
|
|
1899
|
+
entities?: MultiBlockEntity[];
|
|
1900
|
+
}
|
|
1901
|
+
declare class AnvilParser {
|
|
1902
|
+
static getChunkList(data: RegionInput): {
|
|
1903
|
+
x: number;
|
|
1904
|
+
z: number;
|
|
1905
|
+
}[];
|
|
1906
|
+
static parse(data: RegionInput): Promise<AnvilRegion>;
|
|
1907
|
+
static parseChunk(data: RegionInput, localX: number, localZ: number): Promise<AnvilChunk | undefined>;
|
|
1908
|
+
private static bytes;
|
|
1909
|
+
private static locations;
|
|
1910
|
+
private static readChunk;
|
|
1911
|
+
private static compounds;
|
|
1912
|
+
private static integer;
|
|
1913
|
+
private static block;
|
|
1914
|
+
private static unpack;
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1917
|
+
interface BlockInfo<SectionMeshing extends boolean = false> {
|
|
1918
|
+
/** Detached block data; use world or chunk setters to update stored blocks. */
|
|
1919
|
+
readonly block: Block;
|
|
1920
|
+
/** Merged terrain has no individual render object in section-meshing mode. */
|
|
1921
|
+
object: SectionMeshing extends false ? BlockObject : BlockObject | undefined;
|
|
1922
|
+
}
|
|
1923
|
+
|
|
1924
|
+
interface SectionMeshTemplate {
|
|
1925
|
+
geometry: BufferGeometry;
|
|
1926
|
+
atlas: TextureAtlas;
|
|
1927
|
+
cullFaces: readonly number[];
|
|
1928
|
+
}
|
|
1929
|
+
interface SectionMeshEntry {
|
|
1930
|
+
index: number;
|
|
1931
|
+
template: SectionMeshTemplate;
|
|
1932
|
+
cullMask: number;
|
|
1933
|
+
}
|
|
1934
|
+
declare class SectionMesh extends Group {
|
|
1935
|
+
private readonly ownedMeshes;
|
|
1936
|
+
static build(entries: readonly SectionMeshEntry[], maxAtlasSize?: number): SectionMesh;
|
|
1937
|
+
dispose(): void;
|
|
1537
1938
|
}
|
|
1538
1939
|
|
|
1539
|
-
declare class
|
|
1940
|
+
declare class SectionModels {
|
|
1941
|
+
readonly maxAtlasSize: number;
|
|
1942
|
+
private states;
|
|
1943
|
+
private models;
|
|
1944
|
+
private readonly templates;
|
|
1945
|
+
constructor(maxAtlasSize?: number);
|
|
1946
|
+
get(blockState: BlockState, properties?: BlockStateProperties): Promise<SectionMeshTemplate | undefined>;
|
|
1947
|
+
private prepare;
|
|
1948
|
+
clear(): void;
|
|
1949
|
+
}
|
|
1950
|
+
|
|
1951
|
+
declare class Chunk<SectionMeshing extends boolean = false> {
|
|
1952
|
+
private readonly onBlocksChanged?;
|
|
1953
|
+
private readonly sectionModels?;
|
|
1540
1954
|
readonly scene: MineRenderScene;
|
|
1541
1955
|
readonly x: number;
|
|
1542
1956
|
readonly y: number;
|
|
1543
1957
|
readonly z: number;
|
|
1544
|
-
private readonly
|
|
1545
|
-
private readonly
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1958
|
+
private readonly data;
|
|
1959
|
+
private readonly renderedBlocks;
|
|
1960
|
+
private readonly sectionBlocks;
|
|
1961
|
+
private sectionMesh?;
|
|
1962
|
+
private meshDirty;
|
|
1963
|
+
constructor(scene: MineRenderScene, x: number, y: number, z: number, onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined, sectionModels?: SectionModels | undefined);
|
|
1964
|
+
getBlockAt(x: number, y: number, z: number): Maybe<BlockInfo<SectionMeshing>>;
|
|
1965
|
+
getBlockAt(pos: Vector3): Maybe<BlockInfo<SectionMeshing>>;
|
|
1966
|
+
getBlockAt(pos: TripleArray): Maybe<BlockInfo<SectionMeshing>>;
|
|
1550
1967
|
/**
|
|
1551
1968
|
* Set block at a _world_ position
|
|
1552
1969
|
*/
|
|
1553
|
-
setBlockAt(x: number, y: number, z: number, block: Maybe<Block>): Promise<Maybe<BlockInfo
|
|
1554
|
-
setBlockAt(pos: Vector3, block: Maybe<Block>): Promise<Maybe<BlockInfo
|
|
1555
|
-
setBlockAt(pos: TripleArray, block: Maybe<Block>): Promise<Maybe<BlockInfo
|
|
1970
|
+
setBlockAt(x: number, y: number, z: number, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
|
|
1971
|
+
setBlockAt(pos: Vector3, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
|
|
1972
|
+
setBlockAt(pos: TripleArray, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
|
|
1556
1973
|
/**
|
|
1557
|
-
* Set block at
|
|
1974
|
+
* Set a block at integer chunk-local coordinates from 0 to 15.
|
|
1558
1975
|
*/
|
|
1559
|
-
setBlockInChunkAt(pos: Vector3, block?: Block, worldPos?: Vector3): Promise<Maybe<BlockInfo
|
|
1560
|
-
|
|
1976
|
+
setBlockInChunkAt(pos: Vector3, block?: Block, worldPos?: Vector3, onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined): Promise<Maybe<BlockInfo<SectionMeshing>>>;
|
|
1977
|
+
isOccludingAt(pos: Vector3): boolean;
|
|
1978
|
+
setCullMaskAt(pos: Vector3, mask: number): Promise<void>;
|
|
1979
|
+
rebuildSectionMesh(): void;
|
|
1980
|
+
clear(onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined): Promise<void>;
|
|
1561
1981
|
dispose(): Promise<void>;
|
|
1982
|
+
static isAir(block: Maybe<Block>): boolean;
|
|
1562
1983
|
static chunkPosToBlockIndex(pos: Vector3): number;
|
|
1563
1984
|
worldPosToChunkPos(pos: Vector3): Vector3;
|
|
1564
1985
|
chunkPosToWorldPos(pos: Vector3): Vector3;
|
|
1565
1986
|
}
|
|
1566
1987
|
|
|
1567
|
-
declare class MineRenderWorld {
|
|
1988
|
+
declare class MineRenderWorld<SectionMeshing extends boolean = false> {
|
|
1568
1989
|
readonly scene: MineRenderScene;
|
|
1569
|
-
private _size;
|
|
1570
|
-
private _blockSize;
|
|
1571
1990
|
private readonly _chunks;
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1991
|
+
private readonly sectionModels?;
|
|
1992
|
+
private readonly pendingCulling;
|
|
1993
|
+
private culling?;
|
|
1994
|
+
constructor(scene: MineRenderScene, options?: MineRenderWorldOptions<SectionMeshing>);
|
|
1995
|
+
getBlockAt(x: number, y: number, z: number): Maybe<BlockInfo<SectionMeshing>>;
|
|
1996
|
+
getBlockAt(pos: Vector3): Maybe<BlockInfo<SectionMeshing>>;
|
|
1997
|
+
getBlockAt(pos: TripleArray): Maybe<BlockInfo<SectionMeshing>>;
|
|
1998
|
+
setBlockAt(x: number, y: number, z: number, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
|
|
1999
|
+
setBlockAt(pos: Vector3, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
|
|
2000
|
+
setBlockAt(pos: TripleArray, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
|
|
2001
|
+
private placeBlock;
|
|
1579
2002
|
placeMultiBlock(multiblock: MultiBlockStructure, useBatches?: boolean, executor?: BatchedExecutor): Promise<void>;
|
|
2003
|
+
private placeBlocks;
|
|
2004
|
+
/** Replaces one chunk column's blocks. Entity NBT remains available on the parsed chunk. */
|
|
2005
|
+
placeChunk(chunk: AnvilChunk, executor?: BatchedExecutor): Promise<void>;
|
|
1580
2006
|
clear(): Promise<void>;
|
|
2007
|
+
private updateCulling;
|
|
1581
2008
|
private getOrCreateChunkAt;
|
|
1582
|
-
getChunkAt(pos: Vector3): Maybe<Chunk
|
|
2009
|
+
getChunkAt(pos: Vector3): Maybe<Chunk<SectionMeshing>>;
|
|
1583
2010
|
static worldToScenePosition(pos: Vector3): Vector3;
|
|
1584
2011
|
static sceneToWorldPosition(pos: Vector3): Vector3;
|
|
1585
|
-
worldPosToChunkIndex(pos: Vector3): number;
|
|
1586
2012
|
worldPosToChunkKey(pos: Vector3): string;
|
|
1587
2013
|
validatePosBounds(pos: Vector3): void;
|
|
1588
2014
|
}
|
|
2015
|
+
interface MineRenderWorldOptions<SectionMeshing extends boolean = boolean> {
|
|
2016
|
+
/** Merge static opaque cubes into section meshes. Merged blocks have no individual object. */
|
|
2017
|
+
sectionMeshing?: SectionMeshing;
|
|
2018
|
+
/** Maximum width and height of each section atlas page, in pixels. */
|
|
2019
|
+
maxAtlasSize?: number;
|
|
2020
|
+
}
|
|
1589
2021
|
|
|
1590
2022
|
/**
|
|
1591
2023
|
* {@link EnvProvider} backed by the DOM. Uses nothing outside of standard browser APIs and
|
|
@@ -1619,8 +2051,8 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
|
|
|
1619
2051
|
*
|
|
1620
2052
|
* `image-size` pulls in `fs`/`path` at module scope, so it can only live in the Node build.
|
|
1621
2053
|
* Everything MineRender loads is a PNG in practice; GIF and JPEG are handled as a courtesy and
|
|
1622
|
-
* anything else falls through to an empty result
|
|
2054
|
+
* anything else falls through to an empty result, which ImageLoader rejects.
|
|
1623
2055
|
*/
|
|
1624
2056
|
declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
|
|
1625
2057
|
|
|
1626
|
-
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, ArchiveAssetSource, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Block,
|
|
2058
|
+
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, AnvilParser, type AnvilRegion, ArchiveAssetSource, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Block, 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, 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, type ElementFace, type ElementRotation, Entities, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, EntityObject, type EntityObjectOptions, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, type FromTo, Geometries, GuiHelper, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelTextures, type ListAsset, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, OrbitControls, PersistentCache, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResponseParser, SKIN_PARTS, SceneExporter, type SceneGLTFExportOptions, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createFluidGeometry, createImage, estimateBytesUsed, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, probeImageSize, registerBrowserEnv, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
|