minerender 2.1.0-alpha.5 → 2.1.0-alpha.50
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 +585 -158
- package/dist/browser/index.d.ts +585 -158
- package/dist/browser/index.js +10923 -4157
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +10540 -3727
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +80717 -72353
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +584 -157
- package/dist/node/index.d.ts +584 -157
- package/dist/node/index.js +11174 -4319
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +10977 -4095
- 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,12 +796,27 @@ 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
|
static generateItemModel(imageData: ImageData$1, layer: string): ModelElement[];
|
|
@@ -735,8 +833,24 @@ interface Block {
|
|
|
735
833
|
nbt?: any;
|
|
736
834
|
}
|
|
737
835
|
|
|
836
|
+
declare class BlockStateResolver {
|
|
837
|
+
static defaults(blockState: BlockState): Promise<BlockStateProperties>;
|
|
838
|
+
static select(blockState: BlockState, state: BlockStateProperties, choose?: (variants: BlockStateVariant | BlockStateVariant[]) => BlockStateVariant): BlockStateVariant[];
|
|
839
|
+
static matching(blockState: BlockState, state: BlockStateProperties): (BlockStateVariant | BlockStateVariant[])[];
|
|
840
|
+
static choose(variants: BlockStateVariant | BlockStateVariant[]): BlockStateVariant;
|
|
841
|
+
static rotation(variant: BlockStateVariant): Euler;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
declare class BlockTints {
|
|
845
|
+
/** Resolves block preview colors without biome context; explicit tints take precedence. */
|
|
846
|
+
static get(key: AssetKey | undefined, state: BlockStateProperties, model: Model, tints?: Record<number, number>): Promise<Record<number, number> | undefined>;
|
|
847
|
+
private static grassColor;
|
|
848
|
+
}
|
|
849
|
+
|
|
738
850
|
interface Instanceable {
|
|
739
851
|
nextInstance(): InstanceReference<SceneObject>;
|
|
852
|
+
removeInstanceAt(index: number): void;
|
|
853
|
+
isInstanceActive(index: number, reference: InstanceReference<Instanceable>): boolean;
|
|
740
854
|
getMatrixAt(index: number, matrix?: Matrix4): Matrix4;
|
|
741
855
|
setMatrixAt(index: number, matrix: Matrix4): void;
|
|
742
856
|
setPositionRotationScaleAt(index: number, position?: Vector3, rotation?: Euler, scale?: Vector3): void;
|
|
@@ -749,12 +863,15 @@ interface Instanceable {
|
|
|
749
863
|
}
|
|
750
864
|
declare function isInstanceable(obj: any): obj is Instanceable;
|
|
751
865
|
|
|
752
|
-
declare class InstanceReference<T extends Instanceable> implements Transformable {
|
|
866
|
+
declare class InstanceReference<T extends Instanceable> implements Transformable, Disposable {
|
|
753
867
|
readonly instanceable: T;
|
|
754
868
|
readonly index: number;
|
|
755
869
|
readonly isInstanceReference: true;
|
|
756
870
|
constructor(instanceable: T, index: number);
|
|
757
871
|
nextInstance(): InstanceReference<SceneObject>;
|
|
872
|
+
private get activeInstanceable();
|
|
873
|
+
removeFromScene(): void;
|
|
874
|
+
dispose(): void;
|
|
758
875
|
getMatrix(matrix?: Matrix4): Matrix4;
|
|
759
876
|
setMatrix(matrix: Matrix4): void;
|
|
760
877
|
setPositionRotationScale(position?: Vector3, rotation?: Euler, scale?: Vector3): void;
|
|
@@ -779,18 +896,33 @@ declare class ModelObject extends SceneObject {
|
|
|
779
896
|
readonly isModelObject: true;
|
|
780
897
|
static readonly DEFAULT_OPTIONS: ModelObjectOptions;
|
|
781
898
|
readonly options: ModelObjectOptions;
|
|
782
|
-
|
|
899
|
+
protected atlas?: TextureAtlas;
|
|
900
|
+
private atlasMaterial?;
|
|
901
|
+
private atlasTexture?;
|
|
902
|
+
private unsubscribeAtlas?;
|
|
783
903
|
blockParent: Maybe<BlockObject>;
|
|
784
904
|
private meshesCreated;
|
|
785
905
|
constructor(originalModel: Model, options?: Partial<ModelObjectOptions>);
|
|
786
906
|
init(): Promise<void>;
|
|
787
|
-
dispose(): void;
|
|
788
907
|
get textureAtlas(): Maybe<TextureAtlas>;
|
|
908
|
+
get isOpaqueFullCube(): boolean;
|
|
789
909
|
protected loadTextures(): Promise<void>;
|
|
790
910
|
protected createMeshes(force?: boolean): void;
|
|
791
911
|
protected applyTextures(): void;
|
|
912
|
+
private updateAnimationSubscription;
|
|
913
|
+
nextInstance(): InstanceReference<SceneObject>;
|
|
914
|
+
removeInstanceAt(index: number): void;
|
|
915
|
+
disposeAndRemoveAllChildren(): void;
|
|
792
916
|
}
|
|
793
917
|
interface ModelObjectOptions extends SceneObjectOptions {
|
|
918
|
+
/** Minecraft display pose applied around the model center, before scene transforms. */
|
|
919
|
+
displayPosition?: DisplayPosition;
|
|
920
|
+
/** Quarter-turn block rotation in radians to compensate when locking UVs. */
|
|
921
|
+
uvLockRotation?: TripleArray;
|
|
922
|
+
/** sRGB 0xRRGGBB colors by face tint index; omitted indices stay white. */
|
|
923
|
+
tints?: Record<number, number>;
|
|
924
|
+
/** Hidden neighbor directions in CUBE_FACES order, before the model's block rotation. */
|
|
925
|
+
cullMask?: number;
|
|
794
926
|
}
|
|
795
927
|
declare function isModelObject(obj: any): obj is ModelObject;
|
|
796
928
|
|
|
@@ -823,24 +955,35 @@ declare enum SkinPart {
|
|
|
823
955
|
}
|
|
824
956
|
declare const SKIN_PARTS: SkinPart[];
|
|
825
957
|
|
|
958
|
+
type CapeLayout = "minecraft" | "optifine" | "labymod";
|
|
959
|
+
declare const capeTextureSizes: Record<CapeLayout, DoubleArray>;
|
|
960
|
+
|
|
826
961
|
declare class SkinObject extends SceneObject {
|
|
827
962
|
readonly options: SkinObjectOptions;
|
|
828
963
|
private slim;
|
|
829
|
-
private
|
|
964
|
+
private detectedSlim;
|
|
830
965
|
private skinTextureSrc?;
|
|
831
|
-
private
|
|
832
|
-
private
|
|
833
|
-
private
|
|
966
|
+
private skinMaterial?;
|
|
967
|
+
private skinLoad;
|
|
968
|
+
private capeLoad;
|
|
834
969
|
constructor(options?: DeepPartial<SkinObjectOptions>);
|
|
835
970
|
init(): Promise<void>;
|
|
836
971
|
protected removeMeshes(): void;
|
|
837
972
|
protected createMeshes(): void;
|
|
838
|
-
setSkinTexture(src: string): void
|
|
839
|
-
|
|
840
|
-
|
|
973
|
+
setSkinTexture(src: string): Promise<void>;
|
|
974
|
+
/** Load a cape texture in the selected layout, or pass undefined to remove the cape. */
|
|
975
|
+
setCapeTexture(src?: string, layout?: CapeLayout): Promise<void>;
|
|
976
|
+
/** Select the arm model, or pass undefined to use texture detection. */
|
|
977
|
+
setSlim(slim?: boolean): void;
|
|
978
|
+
private updateSlim;
|
|
979
|
+
/** Select the texture layout, or pass undefined to detect it from image dimensions. */
|
|
980
|
+
setLegacy(legacy?: boolean): Promise<void>;
|
|
981
|
+
dispose(): void;
|
|
841
982
|
protected getBoxGeometry(part: SkinPart): BoxGeometry;
|
|
842
983
|
}
|
|
843
984
|
interface SkinObjectOptions extends SceneObjectOptions {
|
|
985
|
+
slim?: boolean;
|
|
986
|
+
legacy?: boolean;
|
|
844
987
|
}
|
|
845
988
|
|
|
846
989
|
declare class EntityObject extends SceneObject {
|
|
@@ -848,19 +991,54 @@ declare class EntityObject extends SceneObject {
|
|
|
848
991
|
readonly isEntityObject: true;
|
|
849
992
|
static readonly DEFAULT_OPTIONS: EntityObjectOptions;
|
|
850
993
|
readonly options: EntityObjectOptions;
|
|
851
|
-
private imageData?;
|
|
852
994
|
private meshesCreated;
|
|
853
995
|
constructor(entity: EntityModel, options?: Partial<EntityObjectOptions>);
|
|
854
996
|
init(): Promise<void>;
|
|
855
997
|
dispose(): void;
|
|
856
|
-
|
|
998
|
+
getLayerGroup(name: string): Maybe<Object3D>;
|
|
999
|
+
getGroupByName(name: string, layerName?: string): Maybe<Object3D>;
|
|
1000
|
+
getMeshByName(name: string, layerName?: string): Maybe<Mesh>;
|
|
1001
|
+
private get entityLayers();
|
|
1002
|
+
private getTextureKey;
|
|
1003
|
+
protected loadTextures(layer?: EntityLayer): Promise<Maybe<ExtractableImageData>>;
|
|
857
1004
|
protected createMeshes(force?: boolean): void;
|
|
1005
|
+
private createPart;
|
|
858
1006
|
protected applyTextures(): Promise<void>;
|
|
859
1007
|
}
|
|
860
1008
|
interface EntityObjectOptions extends SceneObjectOptions {
|
|
1009
|
+
flip?: boolean;
|
|
861
1010
|
}
|
|
862
1011
|
declare function isEntityObject(obj: any): obj is EntityObject;
|
|
863
1012
|
|
|
1013
|
+
/** A texture layer in GUI pixels. Later layers draw above earlier layers. */
|
|
1014
|
+
interface GuiLayer {
|
|
1015
|
+
name?: string;
|
|
1016
|
+
texture: AssetKey | string;
|
|
1017
|
+
/** Source-image pixels: [x, y, width, height], measured from the top left. */
|
|
1018
|
+
crop?: [number, number, number, number];
|
|
1019
|
+
/** Top-left position; x grows right and y grows down. Defaults to [0, 0]. */
|
|
1020
|
+
position?: [number, number];
|
|
1021
|
+
/** Output width and height. Defaults to the crop or full image size. */
|
|
1022
|
+
size?: [number, number];
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
declare class GuiObject extends SceneObject {
|
|
1026
|
+
readonly textureLayers: readonly GuiLayer[];
|
|
1027
|
+
readonly isGuiObject: true;
|
|
1028
|
+
/** Local bounds in GUI pixels, with y growing down from the origin. */
|
|
1029
|
+
readonly bounds: Box2;
|
|
1030
|
+
private readonly geometries;
|
|
1031
|
+
private readonly ownedMaterials;
|
|
1032
|
+
private initialized;
|
|
1033
|
+
constructor(textureLayers: readonly GuiLayer[], options?: Partial<GuiObjectOptions>);
|
|
1034
|
+
init(): Promise<void>;
|
|
1035
|
+
private loadMaterial;
|
|
1036
|
+
disposeAndRemoveAllChildren(): void;
|
|
1037
|
+
}
|
|
1038
|
+
interface GuiObjectOptions extends SceneObjectOptions {
|
|
1039
|
+
}
|
|
1040
|
+
declare function isGuiObject(obj: any): obj is GuiObject;
|
|
1041
|
+
|
|
864
1042
|
declare class MineRenderScene extends Scene {
|
|
865
1043
|
readonly isMineRenderScene: true;
|
|
866
1044
|
static readonly DEFAULT_OPTIONS: MineRenderSceneOptions;
|
|
@@ -880,6 +1058,7 @@ declare class MineRenderScene extends Scene {
|
|
|
880
1058
|
addBlock(blockState: BlockState, options?: Partial<BlockObjectOptions>, parent?: Object3D): Promise<BlockObject | InstanceReference<BlockObject>>;
|
|
881
1059
|
addSkin(skin?: string, options?: Partial<SkinObjectOptions>, parent?: Object3D): Promise<SkinObject>;
|
|
882
1060
|
addEntity(entity: EntityModel, options?: Partial<EntityObjectOptions>, parent?: Object3D): Promise<EntityObject | InstanceReference<EntityObject>>;
|
|
1061
|
+
addGui(layers: readonly GuiLayer[], options?: Partial<GuiObjectOptions>, parent?: Object3D): Promise<GuiObject>;
|
|
883
1062
|
}
|
|
884
1063
|
interface MineRenderSceneOptions {
|
|
885
1064
|
}
|
|
@@ -895,6 +1074,9 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
|
|
|
895
1074
|
private materialCallbacks;
|
|
896
1075
|
protected _isInstanced: boolean;
|
|
897
1076
|
_instanceCounter: number;
|
|
1077
|
+
protected instanceMesh?: InstancedMesh;
|
|
1078
|
+
private readonly instanceReferences;
|
|
1079
|
+
private readonly freeInstanceIndices;
|
|
898
1080
|
constructor(options?: Partial<SceneObjectOptions>);
|
|
899
1081
|
set scene(scene: MineRenderScene);
|
|
900
1082
|
get scene(): MineRenderScene;
|
|
@@ -934,6 +1116,12 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
|
|
|
934
1116
|
get instanceCounter(): number;
|
|
935
1117
|
protected constructInstanceReference(i: number): InstanceReference<SceneObject>;
|
|
936
1118
|
nextInstance(): InstanceReference<SceneObject>;
|
|
1119
|
+
/** Returns the live reference for a raycast hit on this object's instance mesh. */
|
|
1120
|
+
getInstanceReference(mesh: Object3D, index: number): Maybe<InstanceReference<SceneObject>>;
|
|
1121
|
+
isInstanceActive(index: number, reference: InstanceReference<Instanceable>): boolean;
|
|
1122
|
+
removeInstanceAt(index: number): void;
|
|
1123
|
+
private growInstances;
|
|
1124
|
+
protected activeInstanceIndices(): Iterable<number>;
|
|
937
1125
|
getMatrixAt(index: number, matrix?: Matrix4): Matrix4;
|
|
938
1126
|
setMatrixAt(index: number, matrix: Matrix4): void;
|
|
939
1127
|
setPositionRotationScaleAt(index: number, position?: Vector3, rotation?: Euler, scale?: Vector3): void;
|
|
@@ -957,6 +1145,23 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
|
|
|
957
1145
|
}
|
|
958
1146
|
declare function isSceneObject(obj: any): obj is SceneObject;
|
|
959
1147
|
|
|
1148
|
+
type FluidKind = "water" | "lava";
|
|
1149
|
+
interface BlockFluidState {
|
|
1150
|
+
kind: FluidKind;
|
|
1151
|
+
level: number;
|
|
1152
|
+
renderModel: boolean;
|
|
1153
|
+
}
|
|
1154
|
+
declare function getBlockFluidState(key?: AssetKey, state?: BlockStateProperties): BlockFluidState | undefined;
|
|
1155
|
+
declare function getFluidKind(key?: AssetKey, state?: BlockStateProperties): FluidKind | undefined;
|
|
1156
|
+
interface FluidSample {
|
|
1157
|
+
fluid?: FluidKind;
|
|
1158
|
+
level?: number;
|
|
1159
|
+
solid?: boolean;
|
|
1160
|
+
}
|
|
1161
|
+
type FluidSampler = (x: number, y: number, z: number) => FluidSample;
|
|
1162
|
+
/** Builds centered fluid faces with material groups 0 (still) and 1 (flowing). */
|
|
1163
|
+
declare function createFluidGeometry(kind: FluidKind, sample: FluidSampler): BufferGeometry;
|
|
1164
|
+
|
|
960
1165
|
declare class BlockObject extends SceneObject {
|
|
961
1166
|
readonly blockState: BlockState;
|
|
962
1167
|
readonly isBlockObject: true;
|
|
@@ -970,13 +1175,27 @@ declare class BlockObject extends SceneObject {
|
|
|
970
1175
|
private _instanceModel;
|
|
971
1176
|
private _variants;
|
|
972
1177
|
private _models;
|
|
1178
|
+
private _cullMask;
|
|
1179
|
+
private _fluidKey?;
|
|
1180
|
+
private _fluidSampler?;
|
|
1181
|
+
private _fluidModel?;
|
|
973
1182
|
constructor(blockState: BlockState, options?: Partial<BlockObjectOptions>);
|
|
974
1183
|
init(): Promise<void>;
|
|
975
1184
|
dispose(): void;
|
|
976
1185
|
removeFromScene(): void;
|
|
1186
|
+
private clearModels;
|
|
1187
|
+
private removeModels;
|
|
1188
|
+
get isOccluding(): boolean;
|
|
1189
|
+
private getModelMatrix;
|
|
1190
|
+
private getModelCullMask;
|
|
1191
|
+
setCullMask(worldMask: number): Promise<void>;
|
|
977
1192
|
get state(): {
|
|
978
1193
|
[key: string]: string;
|
|
979
1194
|
};
|
|
1195
|
+
get fluidKind(): FluidKind | undefined;
|
|
1196
|
+
get fluidLevel(): number;
|
|
1197
|
+
/** Refreshes fluid surfaces from relative neighbors; standalone previews use air around the block. */
|
|
1198
|
+
updateFluid(sample?: FluidSampler): Promise<void>;
|
|
980
1199
|
nextInstance(): InstanceReference<SceneObject>;
|
|
981
1200
|
protected mapStateToVariant(state: BlockStateProperties): Promise<BlockStateVariant[]>;
|
|
982
1201
|
recreateModels(): Promise<void>;
|
|
@@ -995,26 +1214,50 @@ declare class BlockObject extends SceneObject {
|
|
|
995
1214
|
}
|
|
996
1215
|
interface BlockObjectOptions extends ModelObjectOptions {
|
|
997
1216
|
applyDefaultState: boolean;
|
|
1217
|
+
/** Properties applied before model creation, overriding defaults when applyDefaultState is enabled. */
|
|
1218
|
+
initialState?: BlockStateProperties;
|
|
998
1219
|
}
|
|
999
1220
|
declare function isBlockObject(obj: any): obj is BlockObject;
|
|
1000
1221
|
|
|
1222
|
+
/** Saved fluid levels and solid neighbors determine the geometry shared by an instance pool. */
|
|
1223
|
+
declare function sampleFluid(kind: FluidKind, sample: FluidSampler): {
|
|
1224
|
+
key: string;
|
|
1225
|
+
sample: FluidSampler;
|
|
1226
|
+
};
|
|
1227
|
+
declare class FluidModelObject extends ModelObject {
|
|
1228
|
+
readonly kind: FluidKind;
|
|
1229
|
+
private readonly sample;
|
|
1230
|
+
private geometry?;
|
|
1231
|
+
constructor(kind: FluidKind, sample: FluidSampler, origin?: AssetKey, options?: Partial<ModelObjectOptions>);
|
|
1232
|
+
protected createMeshes(): void;
|
|
1233
|
+
protected applyTextures(): void;
|
|
1234
|
+
disposeAndRemoveAllChildren(): void;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1001
1237
|
interface MultiBlockStructure {
|
|
1002
1238
|
readonly size: TripleArray;
|
|
1003
1239
|
readonly blocks: MultiBlockBlock[];
|
|
1240
|
+
readonly dataVersion?: number;
|
|
1241
|
+
readonly entities?: MultiBlockEntity[];
|
|
1242
|
+
}
|
|
1243
|
+
interface MultiBlockEntity {
|
|
1244
|
+
position: TripleArray;
|
|
1245
|
+
blockPosition?: TripleArray;
|
|
1246
|
+
nbt: unknown;
|
|
1004
1247
|
}
|
|
1005
1248
|
interface MultiBlockBlock extends Block {
|
|
1006
1249
|
position: TripleArray;
|
|
1007
1250
|
}
|
|
1008
1251
|
|
|
1009
1252
|
declare class SchematicParser {
|
|
1010
|
-
static parse(): Promise<MultiBlockStructure>;
|
|
1253
|
+
static parse(nbt: NBT): Promise<MultiBlockStructure>;
|
|
1011
1254
|
}
|
|
1012
1255
|
|
|
1013
1256
|
declare class StructureParser {
|
|
1014
1257
|
static parse(_nbt: NBT, paletteIndex?: number): Promise<MultiBlockStructure>;
|
|
1015
1258
|
}
|
|
1016
1259
|
interface StructureNBT {
|
|
1017
|
-
DataVersion
|
|
1260
|
+
DataVersion?: {
|
|
1018
1261
|
type: "int";
|
|
1019
1262
|
value: number;
|
|
1020
1263
|
};
|
|
@@ -1026,7 +1269,13 @@ interface StructureNBT {
|
|
|
1026
1269
|
};
|
|
1027
1270
|
};
|
|
1028
1271
|
palette?: Palette;
|
|
1029
|
-
palettes?:
|
|
1272
|
+
palettes?: {
|
|
1273
|
+
type: "list";
|
|
1274
|
+
value: {
|
|
1275
|
+
type: "list";
|
|
1276
|
+
value: Palette["value"][];
|
|
1277
|
+
};
|
|
1278
|
+
};
|
|
1030
1279
|
blocks: {
|
|
1031
1280
|
type: "list";
|
|
1032
1281
|
value: {
|
|
@@ -1034,7 +1283,32 @@ interface StructureNBT {
|
|
|
1034
1283
|
value: BlockEntry[];
|
|
1035
1284
|
};
|
|
1036
1285
|
};
|
|
1037
|
-
entities
|
|
1286
|
+
entities?: {
|
|
1287
|
+
type: "list";
|
|
1288
|
+
value: {
|
|
1289
|
+
type: "compound";
|
|
1290
|
+
value: {
|
|
1291
|
+
pos: {
|
|
1292
|
+
type: "list";
|
|
1293
|
+
value: {
|
|
1294
|
+
type: "double";
|
|
1295
|
+
value: TripleArray;
|
|
1296
|
+
};
|
|
1297
|
+
};
|
|
1298
|
+
blockPos: {
|
|
1299
|
+
type: "list";
|
|
1300
|
+
value: {
|
|
1301
|
+
type: "int";
|
|
1302
|
+
value: TripleArray;
|
|
1303
|
+
};
|
|
1304
|
+
};
|
|
1305
|
+
nbt: {
|
|
1306
|
+
type: "compound";
|
|
1307
|
+
value: any;
|
|
1308
|
+
};
|
|
1309
|
+
}[];
|
|
1310
|
+
};
|
|
1311
|
+
};
|
|
1038
1312
|
}
|
|
1039
1313
|
interface Palette {
|
|
1040
1314
|
type: "list";
|
|
@@ -1078,14 +1352,17 @@ interface BlockEntry {
|
|
|
1078
1352
|
}
|
|
1079
1353
|
|
|
1080
1354
|
declare class NBTHelper {
|
|
1081
|
-
static fromBuffer(
|
|
1355
|
+
static fromBuffer(data: Uint8Array | ArrayBuffer, format?: NBTFormat): Promise<NBTAsset>;
|
|
1082
1356
|
}
|
|
1083
1357
|
interface NBTAsset extends MinecraftAsset, NBT {
|
|
1358
|
+
format?: NBTFormat;
|
|
1359
|
+
metadata?: Metadata;
|
|
1360
|
+
compression?: "gzip" | "none";
|
|
1084
1361
|
}
|
|
1085
1362
|
|
|
1086
1363
|
interface ResponseParser<T extends MinecraftAsset> {
|
|
1087
|
-
config(request:
|
|
1088
|
-
parse(response:
|
|
1364
|
+
config(request: RequestConfig): any;
|
|
1365
|
+
parse(response: RequestResponse): Maybe<T> | Promise<Maybe<T>>;
|
|
1089
1366
|
}
|
|
1090
1367
|
|
|
1091
1368
|
declare class HostedAssetSource extends AssetSource {
|
|
@@ -1104,6 +1381,7 @@ declare class HostedAssetSource extends AssetSource {
|
|
|
1104
1381
|
private readonly _options;
|
|
1105
1382
|
constructor(root: string, options?: Partial<HostedAssetSourceOptions>);
|
|
1106
1383
|
get root(): string;
|
|
1384
|
+
get cacheId(): string;
|
|
1107
1385
|
get options(): HostedAssetSourceOptions;
|
|
1108
1386
|
get<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser): Promise<Maybe<T>>;
|
|
1109
1387
|
}
|
|
@@ -1118,6 +1396,8 @@ interface ArchiveEntry {
|
|
|
1118
1396
|
}
|
|
1119
1397
|
|
|
1120
1398
|
interface ArchiveProxy {
|
|
1399
|
+
/** Identifies the archive's content across sessions; undefined when it cannot be identified. */
|
|
1400
|
+
readonly id?: string;
|
|
1121
1401
|
getEntries(): Promise<ArchiveEntry[]>;
|
|
1122
1402
|
}
|
|
1123
1403
|
|
|
@@ -1125,6 +1405,7 @@ declare class ArchiveAssetSource extends AssetSource implements ArchiveProxy {
|
|
|
1125
1405
|
readonly _archiveProxy: ArchiveProxy;
|
|
1126
1406
|
constructor(archiveProxy: ArchiveProxy);
|
|
1127
1407
|
static blob(blob: Blob): ArchiveAssetSource;
|
|
1408
|
+
get cacheId(): Maybe<string>;
|
|
1128
1409
|
getEntries(): Promise<ArchiveEntry[]>;
|
|
1129
1410
|
getEntry(path: string): Promise<Maybe<ArchiveEntry>>;
|
|
1130
1411
|
get<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<Maybe<T>>;
|
|
@@ -1135,7 +1416,8 @@ declare class ArchiveAssetSource extends AssetSource implements ArchiveProxy {
|
|
|
1135
1416
|
declare class BrowserArchiveProxy implements ArchiveProxy {
|
|
1136
1417
|
readonly _blob: Blob;
|
|
1137
1418
|
readonly _reader: ZipReader<Blob>;
|
|
1138
|
-
|
|
1419
|
+
readonly id?: string;
|
|
1420
|
+
constructor(blob: Blob, id?: string);
|
|
1139
1421
|
getEntries(): Promise<ArchiveEntry[]>;
|
|
1140
1422
|
}
|
|
1141
1423
|
|
|
@@ -1213,27 +1495,54 @@ declare class Caching {
|
|
|
1213
1495
|
static readonly mergedModelCache: AsyncLoadingCache<CacheKey, Model>;
|
|
1214
1496
|
static readonly modelTextureAtlasCache: AsyncLoadingCache<CacheKey, TextureAtlas>;
|
|
1215
1497
|
static readonly blockStateCache: AsyncLoadingCache<CacheKey, BlockState>;
|
|
1498
|
+
static readonly listAssetCache: AsyncLoadingCache<CacheKey, ListAsset>;
|
|
1499
|
+
static readonly defaultBlockStatesCache: AsyncLoadingCache<CacheKey, DefaultBlockStates>;
|
|
1500
|
+
static readonly blockTintCache: AsyncLoadingCache<CacheKey, number>;
|
|
1501
|
+
static readonly entityModelCache: AsyncLoadingCache<CacheKey, EntityModelFile>;
|
|
1502
|
+
static readonly entityTextureCache: AsyncLoadingCache<CacheKey, AssetKey>;
|
|
1503
|
+
private static createAssetCache;
|
|
1216
1504
|
/** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
|
|
1217
1505
|
private static get all();
|
|
1218
1506
|
static clear(): void;
|
|
1219
1507
|
/**
|
|
1220
1508
|
* Clears every cache and stops its expiry timer.
|
|
1221
1509
|
*
|
|
1222
|
-
*
|
|
1223
|
-
*
|
|
1510
|
+
* Expiry timers are unref'd in Node, so idle processes can exit without this cleanup.
|
|
1511
|
+
* Use {@link shutdown} to also stop requests and the shared Ticker.
|
|
1224
1512
|
*/
|
|
1225
1513
|
static end(): void;
|
|
1226
1514
|
static get cacheSizes(): {};
|
|
1227
1515
|
}
|
|
1228
1516
|
|
|
1517
|
+
/** Copies the nontransparent bounds without resizing the source; empty images become one transparent pixel. */
|
|
1518
|
+
declare function trimCanvas(source: CompatCanvas): CompatCanvas;
|
|
1519
|
+
|
|
1229
1520
|
declare class MineRenderError extends Error {
|
|
1230
1521
|
constructor(msg: any);
|
|
1231
1522
|
get name(): string;
|
|
1232
1523
|
}
|
|
1233
1524
|
|
|
1234
|
-
|
|
1525
|
+
interface SceneGLTFExportOptions {
|
|
1526
|
+
/** Returns a GLB ArrayBuffer instead of a glTF object. */
|
|
1527
|
+
binary?: boolean;
|
|
1528
|
+
/** Maximum width and height of each exported texture, in pixels. */
|
|
1529
|
+
maxTextureSize?: number;
|
|
1235
1530
|
}
|
|
1236
|
-
|
|
1531
|
+
/** Exports the visible meshes at their current poses without changing the source scene. */
|
|
1532
|
+
declare class SceneExporter {
|
|
1533
|
+
/** Returns OBJ geometry with normals and UVs; material files and textures are not included. */
|
|
1534
|
+
static toObj(root: Object3D): string;
|
|
1535
|
+
/** Returns PLY geometry with vertex colors and UVs; texture images are not included. */
|
|
1536
|
+
static toPLY(root: Object3D, options?: PLYExporterOptions): string | ArrayBuffer;
|
|
1537
|
+
/**
|
|
1538
|
+
* Exports a static glTF/GLB snapshot in a browser. Atlas textures and vertex tints are retained;
|
|
1539
|
+
* MineRender's custom directional lighting is not baked into the exported materials.
|
|
1540
|
+
*/
|
|
1541
|
+
static toGLTF(root: Object3D, options?: SceneGLTFExportOptions): Promise<Record<string, any> | ArrayBuffer>;
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1544
|
+
declare class GuiHelper {
|
|
1545
|
+
static inventorySlot(slot: number | [number, number], origin?: [number, number], offset?: [number, number], rowSize?: number): [number, number];
|
|
1237
1546
|
}
|
|
1238
1547
|
|
|
1239
1548
|
declare class OrbitControls {
|
|
@@ -1358,7 +1667,16 @@ declare class Renderer implements Disposable {
|
|
|
1358
1667
|
*/
|
|
1359
1668
|
dispose(): void;
|
|
1360
1669
|
private animate;
|
|
1361
|
-
|
|
1670
|
+
private drawFrame;
|
|
1671
|
+
/**
|
|
1672
|
+
* Renders a fresh frame and returns an image data URL, including while the animation loop is stopped.
|
|
1673
|
+
* Trimming removes transparent borders; an empty image becomes one transparent pixel.
|
|
1674
|
+
* MIME type support and lossy quality (0–1) follow the canvas encoder.
|
|
1675
|
+
*/
|
|
1676
|
+
toImage(trim?: boolean, mime?: string, quality?: number): string;
|
|
1677
|
+
toObj(): string;
|
|
1678
|
+
toPLY(options?: PLYExporterOptions): string | ArrayBuffer;
|
|
1679
|
+
toGLTF(options?: SceneGLTFExportOptions): Promise<Record<string, any> | ArrayBuffer>;
|
|
1362
1680
|
protected get attachedToBody(): boolean;
|
|
1363
1681
|
protected get viewWidth(): number;
|
|
1364
1682
|
protected get viewHeight(): number;
|
|
@@ -1396,6 +1714,8 @@ interface CameraOptions {
|
|
|
1396
1714
|
interface RenderOptions {
|
|
1397
1715
|
/** Maximum draw rate (60 by default); zero or a negative value disables the limit. */
|
|
1398
1716
|
fpsLimit: number;
|
|
1717
|
+
/** Drawing-buffer pixels per CSS pixel (default 1); also scales toImage() output. */
|
|
1718
|
+
pixelRatio?: number;
|
|
1399
1719
|
stats: boolean;
|
|
1400
1720
|
antialias: boolean;
|
|
1401
1721
|
shade: boolean;
|
|
@@ -1420,17 +1740,21 @@ declare class SceneInspector {
|
|
|
1420
1740
|
protected readonly raycaster: Raycaster;
|
|
1421
1741
|
private readonly mouse;
|
|
1422
1742
|
private selectedObject?;
|
|
1743
|
+
private pointer?;
|
|
1744
|
+
private readonly listeners;
|
|
1423
1745
|
constructor(renderer: Renderer);
|
|
1424
1746
|
protected init(): void;
|
|
1747
|
+
dispose(): void;
|
|
1425
1748
|
findMeshChildren(from: Object3D, out?: Mesh[]): Mesh<three.BufferGeometry<three.NormalBufferAttributes>, three.Material | three.Material[], three.Object3DEventMap>[];
|
|
1426
|
-
onClick(event:
|
|
1749
|
+
onClick(event: MouseEvent): void;
|
|
1427
1750
|
appendTo(el: HTMLElement): void;
|
|
1428
1751
|
protected handleRaycasterObjects(intersections: Intersection[]): void;
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
protected
|
|
1752
|
+
private getIntersectionInstance;
|
|
1753
|
+
selectObject(targetObject: Object3D, targetIntersection?: Intersection, instance?: Maybe<InstanceReference<SceneObject>>): void;
|
|
1754
|
+
protected redraw(targetObject: Object3D, targetIntersection?: Intersection, instance?: InstanceReference<SceneObject>): void;
|
|
1755
|
+
protected addControls(object: Object3D, intersection?: Intersection, instance?: InstanceReference<SceneObject>): void;
|
|
1432
1756
|
protected addInfoLine(name: string, id: string, value: any): HTMLElement;
|
|
1433
|
-
protected addObjectControls(target: Object3D, intersection: Maybe<Intersection>, container: HTMLElement): void;
|
|
1757
|
+
protected addObjectControls(target: Object3D, intersection: Maybe<Intersection>, container: HTMLElement, instance?: InstanceReference<SceneObject>): void;
|
|
1434
1758
|
protected buttonControl(name: string, id: string, click: () => void): HTMLElement;
|
|
1435
1759
|
protected selectControl(name: string, id: string, options: string[], change: (v: string) => void): HTMLElement;
|
|
1436
1760
|
protected toggleControl(name: string, id: string, val: boolean, change: (v: boolean) => void): HTMLElement;
|
|
@@ -1459,34 +1783,33 @@ declare class StatLine {
|
|
|
1459
1783
|
update(): void;
|
|
1460
1784
|
}
|
|
1461
1785
|
|
|
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
1786
|
type SkinGeometries = Record<SkinPart, TripleArray>;
|
|
1483
1787
|
declare const classicSkinGeometries: SkinGeometries;
|
|
1484
1788
|
declare const slimSkinGeometries: SkinGeometries;
|
|
1485
1789
|
|
|
1790
|
+
declare class SkinImage {
|
|
1791
|
+
static getData(src: string): Promise<ImageData>;
|
|
1792
|
+
private static decodePng;
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1486
1795
|
type SkinTextureCoordinates = Record<SkinPart, ModelFaces>;
|
|
1487
1796
|
declare const classicSkinTextureCoordinates: Readonly<SkinTextureCoordinates>;
|
|
1488
1797
|
declare const slimSkinTextureCoordinates: Readonly<SkinTextureCoordinates>;
|
|
1489
1798
|
|
|
1799
|
+
interface SkinTexture {
|
|
1800
|
+
material: MeshBasicMaterial;
|
|
1801
|
+
slim: boolean;
|
|
1802
|
+
legacy: boolean;
|
|
1803
|
+
}
|
|
1804
|
+
declare class SkinTextures {
|
|
1805
|
+
static get(src: string, legacy?: boolean): Promise<SkinTexture>;
|
|
1806
|
+
static getCape(src: string, layout?: CapeLayout): Promise<MeshBasicMaterial>;
|
|
1807
|
+
private static createMaterial;
|
|
1808
|
+
private static isSlim;
|
|
1809
|
+
private static normalizeLegacy;
|
|
1810
|
+
private static makeBaseOpaque;
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1490
1813
|
declare class Skins {
|
|
1491
1814
|
static fromUuidOrUsername(uuidOrUsername: string): Promise<Maybe<string>>;
|
|
1492
1815
|
static fromUuid(uuid: string): Promise<Maybe<string>>;
|
|
@@ -1495,8 +1818,11 @@ declare class Skins {
|
|
|
1495
1818
|
static capeFromUuidOrUsername(uuidOrUsername: string): Promise<Maybe<string>>;
|
|
1496
1819
|
static capeFromUuid(uuid: string): Promise<Maybe<string>>;
|
|
1497
1820
|
static capeFromUsername(username: string): Promise<Maybe<string>>;
|
|
1498
|
-
static
|
|
1821
|
+
/** Returns a full static cape texture for a username or UUID. */
|
|
1822
|
+
static capeFromCapesDev(player: string, capeType?: string): Promise<Maybe<string>>;
|
|
1499
1823
|
private static usernameToUuid;
|
|
1824
|
+
private static usernameToUuidMcProxy;
|
|
1825
|
+
/** @deprecated **/
|
|
1500
1826
|
private static usernameToUuidSkinProxy;
|
|
1501
1827
|
private static usernameToUuidMineTools;
|
|
1502
1828
|
private static getProfileFromMinetools;
|
|
@@ -1506,11 +1832,18 @@ declare class Skins {
|
|
|
1506
1832
|
private static getCrafatarCapeUrl;
|
|
1507
1833
|
private static getMcHeadsSkinUrl;
|
|
1508
1834
|
private static getMineSkinPlayerSkinUrl;
|
|
1835
|
+
/** @deprecated **/
|
|
1509
1836
|
private static getSkinProxySkinUrl;
|
|
1837
|
+
/** @deprecated **/
|
|
1510
1838
|
private static getSkinProxyCapeUrl;
|
|
1839
|
+
private static getMcProxySkinUrl;
|
|
1840
|
+
private static getMcProxyCapeUrl;
|
|
1511
1841
|
}
|
|
1512
1842
|
|
|
1513
1843
|
declare class TextureLoader {
|
|
1844
|
+
private static readonly failedTextures;
|
|
1845
|
+
/** Reports whether image loading failed, so cached textures can be retried. */
|
|
1846
|
+
static hasFailed(texture: Texture): boolean;
|
|
1514
1847
|
protected static createTexture(): Texture;
|
|
1515
1848
|
static loadInBackground(src: string, format?: PixelFormat, rotation?: number): Texture;
|
|
1516
1849
|
static load(src: string, format?: PixelFormat, rotation?: number): Texture;
|
|
@@ -1532,61 +1865,155 @@ declare function mergeVertices(geometry: BufferGeometry, tolerance?: number): Bu
|
|
|
1532
1865
|
declare function toTrianglesDrawMode(geometry: BufferGeometry, drawMode: TrianglesDrawModes): BufferGeometry;
|
|
1533
1866
|
declare function computeMorphedAttributes(object: Mesh | Line | Points): object;
|
|
1534
1867
|
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1868
|
+
declare class ChunkData {
|
|
1869
|
+
private readonly indices;
|
|
1870
|
+
private readonly palette;
|
|
1871
|
+
private readonly paletteIds;
|
|
1872
|
+
private readonly freeIds;
|
|
1873
|
+
private readonly nbt;
|
|
1874
|
+
get(index: number): Maybe<Block>;
|
|
1875
|
+
snapshot(index: number): Maybe<() => Block>;
|
|
1876
|
+
set(index: number, block?: Block): void;
|
|
1877
|
+
clear(): void;
|
|
1878
|
+
static isAir(block: Maybe<Block>): boolean;
|
|
1879
|
+
private static copyBlock;
|
|
1880
|
+
private static validateIndex;
|
|
1881
|
+
}
|
|
1882
|
+
|
|
1883
|
+
type RegionInput = Uint8Array | ArrayBuffer;
|
|
1884
|
+
interface AnvilRegion {
|
|
1885
|
+
chunks: AnvilChunk[];
|
|
1886
|
+
}
|
|
1887
|
+
interface AnvilChunk {
|
|
1888
|
+
x: number;
|
|
1889
|
+
z: number;
|
|
1890
|
+
dataVersion?: number;
|
|
1891
|
+
sections: {
|
|
1892
|
+
y: number;
|
|
1893
|
+
data: ChunkData;
|
|
1894
|
+
}[];
|
|
1895
|
+
entities?: MultiBlockEntity[];
|
|
1896
|
+
}
|
|
1897
|
+
declare class AnvilParser {
|
|
1898
|
+
static getChunkList(data: RegionInput): {
|
|
1899
|
+
x: number;
|
|
1900
|
+
z: number;
|
|
1901
|
+
}[];
|
|
1902
|
+
static parse(data: RegionInput): Promise<AnvilRegion>;
|
|
1903
|
+
static parseChunk(data: RegionInput, localX: number, localZ: number): Promise<AnvilChunk | undefined>;
|
|
1904
|
+
private static bytes;
|
|
1905
|
+
private static locations;
|
|
1906
|
+
private static readChunk;
|
|
1907
|
+
private static compounds;
|
|
1908
|
+
private static integer;
|
|
1909
|
+
private static block;
|
|
1910
|
+
private static unpack;
|
|
1911
|
+
}
|
|
1912
|
+
|
|
1913
|
+
interface BlockInfo<SectionMeshing extends boolean = false> {
|
|
1914
|
+
/** Detached block data; use world or chunk setters to update stored blocks. */
|
|
1915
|
+
readonly block: Block;
|
|
1916
|
+
/** Merged terrain has no individual render object in section-meshing mode. */
|
|
1917
|
+
object: SectionMeshing extends false ? BlockObject : BlockObject | undefined;
|
|
1918
|
+
}
|
|
1919
|
+
|
|
1920
|
+
interface SectionMeshTemplate {
|
|
1921
|
+
geometry: BufferGeometry;
|
|
1922
|
+
atlas: TextureAtlas;
|
|
1923
|
+
cullFaces: readonly number[];
|
|
1924
|
+
}
|
|
1925
|
+
interface SectionMeshEntry {
|
|
1926
|
+
index: number;
|
|
1927
|
+
template: SectionMeshTemplate;
|
|
1928
|
+
cullMask: number;
|
|
1929
|
+
}
|
|
1930
|
+
declare class SectionMesh extends Group {
|
|
1931
|
+
private readonly ownedMeshes;
|
|
1932
|
+
static build(entries: readonly SectionMeshEntry[], maxAtlasSize?: number): SectionMesh;
|
|
1933
|
+
dispose(): void;
|
|
1538
1934
|
}
|
|
1539
1935
|
|
|
1540
|
-
declare class
|
|
1936
|
+
declare class SectionModels {
|
|
1937
|
+
readonly maxAtlasSize: number;
|
|
1938
|
+
private states;
|
|
1939
|
+
private models;
|
|
1940
|
+
private readonly templates;
|
|
1941
|
+
constructor(maxAtlasSize?: number);
|
|
1942
|
+
get(blockState: BlockState, properties?: BlockStateProperties): Promise<SectionMeshTemplate | undefined>;
|
|
1943
|
+
private prepare;
|
|
1944
|
+
clear(): void;
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
declare class Chunk<SectionMeshing extends boolean = false> {
|
|
1948
|
+
private readonly onBlocksChanged?;
|
|
1949
|
+
private readonly sectionModels?;
|
|
1541
1950
|
readonly scene: MineRenderScene;
|
|
1542
1951
|
readonly x: number;
|
|
1543
1952
|
readonly y: number;
|
|
1544
1953
|
readonly z: number;
|
|
1545
|
-
private readonly
|
|
1546
|
-
private readonly
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1954
|
+
private readonly data;
|
|
1955
|
+
private readonly renderedBlocks;
|
|
1956
|
+
private readonly sectionBlocks;
|
|
1957
|
+
private sectionMesh?;
|
|
1958
|
+
private meshDirty;
|
|
1959
|
+
constructor(scene: MineRenderScene, x: number, y: number, z: number, onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined, sectionModels?: SectionModels | undefined);
|
|
1960
|
+
getBlockAt(x: number, y: number, z: number): Maybe<BlockInfo<SectionMeshing>>;
|
|
1961
|
+
getBlockAt(pos: Vector3): Maybe<BlockInfo<SectionMeshing>>;
|
|
1962
|
+
getBlockAt(pos: TripleArray): Maybe<BlockInfo<SectionMeshing>>;
|
|
1551
1963
|
/**
|
|
1552
1964
|
* Set block at a _world_ position
|
|
1553
1965
|
*/
|
|
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
|
|
1966
|
+
setBlockAt(x: number, y: number, z: number, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
|
|
1967
|
+
setBlockAt(pos: Vector3, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
|
|
1968
|
+
setBlockAt(pos: TripleArray, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
|
|
1557
1969
|
/**
|
|
1558
|
-
* Set block at
|
|
1970
|
+
* Set a block at integer chunk-local coordinates from 0 to 15.
|
|
1559
1971
|
*/
|
|
1560
|
-
setBlockInChunkAt(pos: Vector3, block?: Block, worldPos?: Vector3): Promise<Maybe<BlockInfo
|
|
1561
|
-
|
|
1972
|
+
setBlockInChunkAt(pos: Vector3, block?: Block, worldPos?: Vector3, onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined): Promise<Maybe<BlockInfo<SectionMeshing>>>;
|
|
1973
|
+
isOccludingAt(pos: Vector3): boolean;
|
|
1974
|
+
setCullMaskAt(pos: Vector3, mask: number): Promise<void>;
|
|
1975
|
+
rebuildSectionMesh(): void;
|
|
1976
|
+
clear(onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined): Promise<void>;
|
|
1562
1977
|
dispose(): Promise<void>;
|
|
1978
|
+
static isAir(block: Maybe<Block>): boolean;
|
|
1563
1979
|
static chunkPosToBlockIndex(pos: Vector3): number;
|
|
1564
1980
|
worldPosToChunkPos(pos: Vector3): Vector3;
|
|
1565
1981
|
chunkPosToWorldPos(pos: Vector3): Vector3;
|
|
1566
1982
|
}
|
|
1567
1983
|
|
|
1568
|
-
declare class MineRenderWorld {
|
|
1984
|
+
declare class MineRenderWorld<SectionMeshing extends boolean = false> {
|
|
1569
1985
|
readonly scene: MineRenderScene;
|
|
1570
|
-
private _size;
|
|
1571
|
-
private _blockSize;
|
|
1572
1986
|
private readonly _chunks;
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1987
|
+
private readonly sectionModels?;
|
|
1988
|
+
private readonly pendingCulling;
|
|
1989
|
+
private culling?;
|
|
1990
|
+
constructor(scene: MineRenderScene, options?: MineRenderWorldOptions<SectionMeshing>);
|
|
1991
|
+
getBlockAt(x: number, y: number, z: number): Maybe<BlockInfo<SectionMeshing>>;
|
|
1992
|
+
getBlockAt(pos: Vector3): Maybe<BlockInfo<SectionMeshing>>;
|
|
1993
|
+
getBlockAt(pos: TripleArray): Maybe<BlockInfo<SectionMeshing>>;
|
|
1994
|
+
setBlockAt(x: number, y: number, z: number, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
|
|
1995
|
+
setBlockAt(pos: Vector3, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
|
|
1996
|
+
setBlockAt(pos: TripleArray, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
|
|
1997
|
+
private placeBlock;
|
|
1580
1998
|
placeMultiBlock(multiblock: MultiBlockStructure, useBatches?: boolean, executor?: BatchedExecutor): Promise<void>;
|
|
1999
|
+
private placeBlocks;
|
|
2000
|
+
/** Replaces one chunk column's blocks. Entity NBT remains available on the parsed chunk. */
|
|
2001
|
+
placeChunk(chunk: AnvilChunk, executor?: BatchedExecutor): Promise<void>;
|
|
1581
2002
|
clear(): Promise<void>;
|
|
2003
|
+
private updateCulling;
|
|
1582
2004
|
private getOrCreateChunkAt;
|
|
1583
|
-
getChunkAt(pos: Vector3): Maybe<Chunk
|
|
2005
|
+
getChunkAt(pos: Vector3): Maybe<Chunk<SectionMeshing>>;
|
|
1584
2006
|
static worldToScenePosition(pos: Vector3): Vector3;
|
|
1585
2007
|
static sceneToWorldPosition(pos: Vector3): Vector3;
|
|
1586
|
-
worldPosToChunkIndex(pos: Vector3): number;
|
|
1587
2008
|
worldPosToChunkKey(pos: Vector3): string;
|
|
1588
2009
|
validatePosBounds(pos: Vector3): void;
|
|
1589
2010
|
}
|
|
2011
|
+
interface MineRenderWorldOptions<SectionMeshing extends boolean = boolean> {
|
|
2012
|
+
/** Merge static opaque cubes into section meshes. Merged blocks have no individual object. */
|
|
2013
|
+
sectionMeshing?: SectionMeshing;
|
|
2014
|
+
/** Maximum width and height of each section atlas page, in pixels. */
|
|
2015
|
+
maxAtlasSize?: number;
|
|
2016
|
+
}
|
|
1590
2017
|
|
|
1591
2018
|
/**
|
|
1592
2019
|
* {@link EnvProvider} for headless Node.
|
|
@@ -1626,4 +2053,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
|
|
|
1626
2053
|
forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
|
|
1627
2054
|
}
|
|
1628
2055
|
|
|
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,
|
|
2056
|
+
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 };
|