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