minerender 2.1.0-alpha.8 → 2.1.0-beta.0
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 +5 -3
- package/dist/browser/index.d.mts +580 -153
- package/dist/browser/index.d.ts +580 -153
- package/dist/browser/index.js +11150 -4368
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +11038 -4209
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +81662 -73495
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +580 -153
- package/dist/node/index.d.ts +580 -153
- package/dist/node/index.js +11165 -4294
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +10801 -3903
- package/dist/node/index.mjs.map +1 -1
- package/package.json +8 -7
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;
|
|
@@ -65,6 +67,7 @@ declare abstract class PersistentCache<B = unknown> {
|
|
|
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;
|
|
@@ -540,8 +583,8 @@ declare class MinecraftFaceUV {
|
|
|
540
583
|
* Idle Node processes can exit without calling this: cache and Ticker timers are unref'd,
|
|
541
584
|
* and idle request queues hold no timer. Pending requests keep their normal timer references.
|
|
542
585
|
*
|
|
543
|
-
* Call this only when finished with MineRender.
|
|
544
|
-
* already running can finish. Queue shutdown is permanent, and cache expiry timers do not restart.
|
|
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.
|
|
545
588
|
*/
|
|
546
589
|
declare function shutdown(): void;
|
|
547
590
|
|
|
@@ -549,42 +592,15 @@ declare class BatchedExecutor {
|
|
|
549
592
|
readonly interval: number;
|
|
550
593
|
readonly batch: number;
|
|
551
594
|
private readonly queue;
|
|
552
|
-
private readonly task;
|
|
553
595
|
constructor(interval?: number, batch?: number);
|
|
554
|
-
submit(task: Task):
|
|
555
|
-
|
|
556
|
-
private runNext;
|
|
596
|
+
submit<T>(task: Task<T>): Promise<T>;
|
|
597
|
+
stop(): void;
|
|
557
598
|
}
|
|
558
|
-
type Task = () =>
|
|
599
|
+
type Task<T = unknown> = () => T | Promise<T>;
|
|
559
600
|
|
|
560
601
|
declare function prefix(prefix?: string): string;
|
|
561
602
|
|
|
562
|
-
interface ModelPart {
|
|
563
|
-
textureWidth: number;
|
|
564
|
-
textureHeight: number;
|
|
565
|
-
textureOffsetU: number;
|
|
566
|
-
textureOffsetV: number;
|
|
567
|
-
pivotX: number;
|
|
568
|
-
pivotY: number;
|
|
569
|
-
pivotZ: number;
|
|
570
|
-
pitch: number;
|
|
571
|
-
yaw: number;
|
|
572
|
-
roll: number;
|
|
573
|
-
mirror: boolean;
|
|
574
|
-
cubes: Cube[];
|
|
575
|
-
children: ModelPart[];
|
|
576
|
-
}
|
|
577
|
-
interface Cube {
|
|
578
|
-
minX: number;
|
|
579
|
-
minY: number;
|
|
580
|
-
minZ: number;
|
|
581
|
-
maxX: number;
|
|
582
|
-
maxY: number;
|
|
583
|
-
maxZ: number;
|
|
584
|
-
}
|
|
585
|
-
|
|
586
603
|
declare function applyElementRotation(rotation: ElementRotation, geometry: BufferGeometry): void;
|
|
587
|
-
declare function applyModelPartRotation(modelPart: ModelPart, geometry: BufferGeometry): void;
|
|
588
604
|
declare function applyGenericRotation(axis: Axis, rotation: number, obj: Object3D): void;
|
|
589
605
|
declare function addBox3WireframeToObject(box: Box3, obj: Object3D, color?: number, w?: number): void;
|
|
590
606
|
declare function addWireframeToObject(obj: Object3D, color?: number, w?: number): void;
|
|
@@ -613,16 +629,47 @@ declare enum AssetParser {
|
|
|
613
629
|
declare abstract class AssetSource {
|
|
614
630
|
protected constructor();
|
|
615
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);
|
|
616
646
|
}
|
|
617
647
|
|
|
618
648
|
declare class AssetLoader {
|
|
619
649
|
static ROOT: string;
|
|
620
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;
|
|
621
663
|
static addSource(key: string, source: AssetSource, override?: boolean): void;
|
|
622
664
|
static removeSource(key: string): Maybe<AssetSource>;
|
|
623
665
|
static getAll<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<T[]>;
|
|
624
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,20 +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
|
-
|
|
857
|
-
|
|
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>>;
|
|
858
1009
|
protected createMeshes(force?: boolean): void;
|
|
1010
|
+
private createPart;
|
|
859
1011
|
protected applyTextures(): Promise<void>;
|
|
860
1012
|
}
|
|
861
1013
|
interface EntityObjectOptions extends SceneObjectOptions {
|
|
1014
|
+
flip?: boolean;
|
|
862
1015
|
}
|
|
863
1016
|
declare function isEntityObject(obj: any): obj is EntityObject;
|
|
864
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
|
+
|
|
865
1047
|
declare class MineRenderScene extends Scene {
|
|
866
1048
|
readonly isMineRenderScene: true;
|
|
867
1049
|
static readonly DEFAULT_OPTIONS: MineRenderSceneOptions;
|
|
@@ -881,6 +1063,7 @@ declare class MineRenderScene extends Scene {
|
|
|
881
1063
|
addBlock(blockState: BlockState, options?: Partial<BlockObjectOptions>, parent?: Object3D): Promise<BlockObject | InstanceReference<BlockObject>>;
|
|
882
1064
|
addSkin(skin?: string, options?: Partial<SkinObjectOptions>, parent?: Object3D): Promise<SkinObject>;
|
|
883
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>;
|
|
884
1067
|
}
|
|
885
1068
|
interface MineRenderSceneOptions {
|
|
886
1069
|
}
|
|
@@ -896,6 +1079,9 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
|
|
|
896
1079
|
private materialCallbacks;
|
|
897
1080
|
protected _isInstanced: boolean;
|
|
898
1081
|
_instanceCounter: number;
|
|
1082
|
+
protected instanceMesh?: InstancedMesh;
|
|
1083
|
+
private readonly instanceReferences;
|
|
1084
|
+
private readonly freeInstanceIndices;
|
|
899
1085
|
constructor(options?: Partial<SceneObjectOptions>);
|
|
900
1086
|
set scene(scene: MineRenderScene);
|
|
901
1087
|
get scene(): MineRenderScene;
|
|
@@ -935,6 +1121,12 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
|
|
|
935
1121
|
get instanceCounter(): number;
|
|
936
1122
|
protected constructInstanceReference(i: number): InstanceReference<SceneObject>;
|
|
937
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>;
|
|
938
1130
|
getMatrixAt(index: number, matrix?: Matrix4): Matrix4;
|
|
939
1131
|
setMatrixAt(index: number, matrix: Matrix4): void;
|
|
940
1132
|
setPositionRotationScaleAt(index: number, position?: Vector3, rotation?: Euler, scale?: Vector3): void;
|
|
@@ -958,6 +1150,23 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
|
|
|
958
1150
|
}
|
|
959
1151
|
declare function isSceneObject(obj: any): obj is SceneObject;
|
|
960
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
|
+
|
|
961
1170
|
declare class BlockObject extends SceneObject {
|
|
962
1171
|
readonly blockState: BlockState;
|
|
963
1172
|
readonly isBlockObject: true;
|
|
@@ -971,13 +1180,27 @@ declare class BlockObject extends SceneObject {
|
|
|
971
1180
|
private _instanceModel;
|
|
972
1181
|
private _variants;
|
|
973
1182
|
private _models;
|
|
1183
|
+
private _cullMask;
|
|
1184
|
+
private _fluidKey?;
|
|
1185
|
+
private _fluidSampler?;
|
|
1186
|
+
private _fluidModel?;
|
|
974
1187
|
constructor(blockState: BlockState, options?: Partial<BlockObjectOptions>);
|
|
975
1188
|
init(): Promise<void>;
|
|
976
1189
|
dispose(): void;
|
|
977
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>;
|
|
978
1197
|
get state(): {
|
|
979
1198
|
[key: string]: string;
|
|
980
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>;
|
|
981
1204
|
nextInstance(): InstanceReference<SceneObject>;
|
|
982
1205
|
protected mapStateToVariant(state: BlockStateProperties): Promise<BlockStateVariant[]>;
|
|
983
1206
|
recreateModels(): Promise<void>;
|
|
@@ -996,26 +1219,50 @@ declare class BlockObject extends SceneObject {
|
|
|
996
1219
|
}
|
|
997
1220
|
interface BlockObjectOptions extends ModelObjectOptions {
|
|
998
1221
|
applyDefaultState: boolean;
|
|
1222
|
+
/** Properties applied before model creation, overriding defaults when applyDefaultState is enabled. */
|
|
1223
|
+
initialState?: BlockStateProperties;
|
|
999
1224
|
}
|
|
1000
1225
|
declare function isBlockObject(obj: any): obj is BlockObject;
|
|
1001
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
|
+
|
|
1002
1242
|
interface MultiBlockStructure {
|
|
1003
1243
|
readonly size: TripleArray;
|
|
1004
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;
|
|
1005
1252
|
}
|
|
1006
1253
|
interface MultiBlockBlock extends Block {
|
|
1007
1254
|
position: TripleArray;
|
|
1008
1255
|
}
|
|
1009
1256
|
|
|
1010
1257
|
declare class SchematicParser {
|
|
1011
|
-
static parse(): Promise<MultiBlockStructure>;
|
|
1258
|
+
static parse(nbt: NBT): Promise<MultiBlockStructure>;
|
|
1012
1259
|
}
|
|
1013
1260
|
|
|
1014
1261
|
declare class StructureParser {
|
|
1015
1262
|
static parse(_nbt: NBT, paletteIndex?: number): Promise<MultiBlockStructure>;
|
|
1016
1263
|
}
|
|
1017
1264
|
interface StructureNBT {
|
|
1018
|
-
DataVersion
|
|
1265
|
+
DataVersion?: {
|
|
1019
1266
|
type: "int";
|
|
1020
1267
|
value: number;
|
|
1021
1268
|
};
|
|
@@ -1027,7 +1274,13 @@ interface StructureNBT {
|
|
|
1027
1274
|
};
|
|
1028
1275
|
};
|
|
1029
1276
|
palette?: Palette;
|
|
1030
|
-
palettes?:
|
|
1277
|
+
palettes?: {
|
|
1278
|
+
type: "list";
|
|
1279
|
+
value: {
|
|
1280
|
+
type: "list";
|
|
1281
|
+
value: Palette["value"][];
|
|
1282
|
+
};
|
|
1283
|
+
};
|
|
1031
1284
|
blocks: {
|
|
1032
1285
|
type: "list";
|
|
1033
1286
|
value: {
|
|
@@ -1035,7 +1288,32 @@ interface StructureNBT {
|
|
|
1035
1288
|
value: BlockEntry[];
|
|
1036
1289
|
};
|
|
1037
1290
|
};
|
|
1038
|
-
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
|
+
};
|
|
1039
1317
|
}
|
|
1040
1318
|
interface Palette {
|
|
1041
1319
|
type: "list";
|
|
@@ -1079,14 +1357,17 @@ interface BlockEntry {
|
|
|
1079
1357
|
}
|
|
1080
1358
|
|
|
1081
1359
|
declare class NBTHelper {
|
|
1082
|
-
static fromBuffer(
|
|
1360
|
+
static fromBuffer(data: Uint8Array | ArrayBuffer, format?: NBTFormat): Promise<NBTAsset>;
|
|
1083
1361
|
}
|
|
1084
1362
|
interface NBTAsset extends MinecraftAsset, NBT {
|
|
1363
|
+
format?: NBTFormat;
|
|
1364
|
+
metadata?: Metadata;
|
|
1365
|
+
compression?: "gzip" | "none";
|
|
1085
1366
|
}
|
|
1086
1367
|
|
|
1087
1368
|
interface ResponseParser<T extends MinecraftAsset> {
|
|
1088
|
-
config(request:
|
|
1089
|
-
parse(response:
|
|
1369
|
+
config(request: RequestConfig): any;
|
|
1370
|
+
parse(response: RequestResponse): Maybe<T> | Promise<Maybe<T>>;
|
|
1090
1371
|
}
|
|
1091
1372
|
|
|
1092
1373
|
declare class HostedAssetSource extends AssetSource {
|
|
@@ -1105,6 +1386,7 @@ declare class HostedAssetSource extends AssetSource {
|
|
|
1105
1386
|
private readonly _options;
|
|
1106
1387
|
constructor(root: string, options?: Partial<HostedAssetSourceOptions>);
|
|
1107
1388
|
get root(): string;
|
|
1389
|
+
get cacheId(): string;
|
|
1108
1390
|
get options(): HostedAssetSourceOptions;
|
|
1109
1391
|
get<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser): Promise<Maybe<T>>;
|
|
1110
1392
|
}
|
|
@@ -1119,6 +1401,8 @@ interface ArchiveEntry {
|
|
|
1119
1401
|
}
|
|
1120
1402
|
|
|
1121
1403
|
interface ArchiveProxy {
|
|
1404
|
+
/** Identifies the archive's content across sessions; undefined when it cannot be identified. */
|
|
1405
|
+
readonly id?: string;
|
|
1122
1406
|
getEntries(): Promise<ArchiveEntry[]>;
|
|
1123
1407
|
}
|
|
1124
1408
|
|
|
@@ -1126,6 +1410,7 @@ declare class ArchiveAssetSource extends AssetSource implements ArchiveProxy {
|
|
|
1126
1410
|
readonly _archiveProxy: ArchiveProxy;
|
|
1127
1411
|
constructor(archiveProxy: ArchiveProxy);
|
|
1128
1412
|
static blob(blob: Blob): ArchiveAssetSource;
|
|
1413
|
+
get cacheId(): Maybe<string>;
|
|
1129
1414
|
getEntries(): Promise<ArchiveEntry[]>;
|
|
1130
1415
|
getEntry(path: string): Promise<Maybe<ArchiveEntry>>;
|
|
1131
1416
|
get<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<Maybe<T>>;
|
|
@@ -1136,7 +1421,8 @@ declare class ArchiveAssetSource extends AssetSource implements ArchiveProxy {
|
|
|
1136
1421
|
declare class BrowserArchiveProxy implements ArchiveProxy {
|
|
1137
1422
|
readonly _blob: Blob;
|
|
1138
1423
|
readonly _reader: ZipReader<Blob>;
|
|
1139
|
-
|
|
1424
|
+
readonly id?: string;
|
|
1425
|
+
constructor(blob: Blob, id?: string);
|
|
1140
1426
|
getEntries(): Promise<ArchiveEntry[]>;
|
|
1141
1427
|
}
|
|
1142
1428
|
|
|
@@ -1214,6 +1500,12 @@ declare class Caching {
|
|
|
1214
1500
|
static readonly mergedModelCache: AsyncLoadingCache<CacheKey, Model>;
|
|
1215
1501
|
static readonly modelTextureAtlasCache: AsyncLoadingCache<CacheKey, TextureAtlas>;
|
|
1216
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;
|
|
1217
1509
|
/** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
|
|
1218
1510
|
private static get all();
|
|
1219
1511
|
static clear(): void;
|
|
@@ -1227,14 +1519,35 @@ declare class Caching {
|
|
|
1227
1519
|
static get cacheSizes(): {};
|
|
1228
1520
|
}
|
|
1229
1521
|
|
|
1522
|
+
/** Copies the nontransparent bounds without resizing the source; empty images become one transparent pixel. */
|
|
1523
|
+
declare function trimCanvas(source: CompatCanvas): CompatCanvas;
|
|
1524
|
+
|
|
1230
1525
|
declare class MineRenderError extends Error {
|
|
1231
1526
|
constructor(msg: any);
|
|
1232
1527
|
get name(): string;
|
|
1233
1528
|
}
|
|
1234
1529
|
|
|
1235
|
-
|
|
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;
|
|
1236
1535
|
}
|
|
1237
|
-
|
|
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];
|
|
1238
1551
|
}
|
|
1239
1552
|
|
|
1240
1553
|
declare class OrbitControls {
|
|
@@ -1359,7 +1672,16 @@ declare class Renderer implements Disposable {
|
|
|
1359
1672
|
*/
|
|
1360
1673
|
dispose(): void;
|
|
1361
1674
|
private animate;
|
|
1362
|
-
|
|
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>;
|
|
1363
1685
|
protected get attachedToBody(): boolean;
|
|
1364
1686
|
protected get viewWidth(): number;
|
|
1365
1687
|
protected get viewHeight(): number;
|
|
@@ -1397,6 +1719,8 @@ interface CameraOptions {
|
|
|
1397
1719
|
interface RenderOptions {
|
|
1398
1720
|
/** Maximum draw rate (60 by default); zero or a negative value disables the limit. */
|
|
1399
1721
|
fpsLimit: number;
|
|
1722
|
+
/** Drawing-buffer pixels per CSS pixel (default 1); also scales toImage() output. */
|
|
1723
|
+
pixelRatio?: number;
|
|
1400
1724
|
stats: boolean;
|
|
1401
1725
|
antialias: boolean;
|
|
1402
1726
|
shade: boolean;
|
|
@@ -1421,17 +1745,21 @@ declare class SceneInspector {
|
|
|
1421
1745
|
protected readonly raycaster: Raycaster;
|
|
1422
1746
|
private readonly mouse;
|
|
1423
1747
|
private selectedObject?;
|
|
1748
|
+
private pointer?;
|
|
1749
|
+
private readonly listeners;
|
|
1424
1750
|
constructor(renderer: Renderer);
|
|
1425
1751
|
protected init(): void;
|
|
1752
|
+
dispose(): void;
|
|
1426
1753
|
findMeshChildren(from: Object3D, out?: Mesh[]): Mesh<three.BufferGeometry<three.NormalBufferAttributes>, three.Material | three.Material[], three.Object3DEventMap>[];
|
|
1427
|
-
onClick(event:
|
|
1754
|
+
onClick(event: MouseEvent): void;
|
|
1428
1755
|
appendTo(el: HTMLElement): void;
|
|
1429
1756
|
protected handleRaycasterObjects(intersections: Intersection[]): void;
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
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;
|
|
1433
1761
|
protected addInfoLine(name: string, id: string, value: any): HTMLElement;
|
|
1434
|
-
protected addObjectControls(target: Object3D, intersection: Maybe<Intersection>, container: HTMLElement): void;
|
|
1762
|
+
protected addObjectControls(target: Object3D, intersection: Maybe<Intersection>, container: HTMLElement, instance?: InstanceReference<SceneObject>): void;
|
|
1435
1763
|
protected buttonControl(name: string, id: string, click: () => void): HTMLElement;
|
|
1436
1764
|
protected selectControl(name: string, id: string, options: string[], change: (v: string) => void): HTMLElement;
|
|
1437
1765
|
protected toggleControl(name: string, id: string, val: boolean, change: (v: boolean) => void): HTMLElement;
|
|
@@ -1460,35 +1788,33 @@ declare class StatLine {
|
|
|
1460
1788
|
update(): void;
|
|
1461
1789
|
}
|
|
1462
1790
|
|
|
1463
|
-
declare class Requests {
|
|
1464
|
-
private static axiosInstance;
|
|
1465
|
-
private static mcAssetInstance;
|
|
1466
|
-
private static genericQueue;
|
|
1467
|
-
private static mcAssetRequestQueue;
|
|
1468
|
-
static genericRequest(request: AxiosRequestConfig): Promise<AxiosResponse>;
|
|
1469
|
-
static mcAssetRequest(request: AxiosRequestConfig): Promise<AxiosResponse>;
|
|
1470
|
-
private static shouldRetry;
|
|
1471
|
-
static setMcAssetRoot(root: string): void;
|
|
1472
|
-
static get queueSizes(): {
|
|
1473
|
-
generic: number;
|
|
1474
|
-
mcAsset: number;
|
|
1475
|
-
};
|
|
1476
|
-
/**
|
|
1477
|
-
* Permanently stops both queues and rejects waiting and future requests.
|
|
1478
|
-
* Requests already running can finish. Idle queues hold no timer, so Node can exit without
|
|
1479
|
-
* this cleanup. See {@link shutdown}.
|
|
1480
|
-
*/
|
|
1481
|
-
static end(): void;
|
|
1482
|
-
}
|
|
1483
|
-
|
|
1484
1791
|
type SkinGeometries = Record<SkinPart, TripleArray>;
|
|
1485
1792
|
declare const classicSkinGeometries: SkinGeometries;
|
|
1486
1793
|
declare const slimSkinGeometries: SkinGeometries;
|
|
1487
1794
|
|
|
1795
|
+
declare class SkinImage {
|
|
1796
|
+
static getData(src: string): Promise<ImageData>;
|
|
1797
|
+
private static decodePng;
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1488
1800
|
type SkinTextureCoordinates = Record<SkinPart, ModelFaces>;
|
|
1489
1801
|
declare const classicSkinTextureCoordinates: Readonly<SkinTextureCoordinates>;
|
|
1490
1802
|
declare const slimSkinTextureCoordinates: Readonly<SkinTextureCoordinates>;
|
|
1491
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
|
+
|
|
1492
1818
|
declare class Skins {
|
|
1493
1819
|
static fromUuidOrUsername(uuidOrUsername: string): Promise<Maybe<string>>;
|
|
1494
1820
|
static fromUuid(uuid: string): Promise<Maybe<string>>;
|
|
@@ -1497,8 +1823,11 @@ declare class Skins {
|
|
|
1497
1823
|
static capeFromUuidOrUsername(uuidOrUsername: string): Promise<Maybe<string>>;
|
|
1498
1824
|
static capeFromUuid(uuid: string): Promise<Maybe<string>>;
|
|
1499
1825
|
static capeFromUsername(username: string): Promise<Maybe<string>>;
|
|
1500
|
-
static
|
|
1826
|
+
/** Returns a full static cape texture for a username or UUID. */
|
|
1827
|
+
static capeFromCapesDev(player: string, capeType?: string): Promise<Maybe<string>>;
|
|
1501
1828
|
private static usernameToUuid;
|
|
1829
|
+
private static usernameToUuidMcProxy;
|
|
1830
|
+
/** @deprecated **/
|
|
1502
1831
|
private static usernameToUuidSkinProxy;
|
|
1503
1832
|
private static usernameToUuidMineTools;
|
|
1504
1833
|
private static getProfileFromMinetools;
|
|
@@ -1508,8 +1837,12 @@ declare class Skins {
|
|
|
1508
1837
|
private static getCrafatarCapeUrl;
|
|
1509
1838
|
private static getMcHeadsSkinUrl;
|
|
1510
1839
|
private static getMineSkinPlayerSkinUrl;
|
|
1840
|
+
/** @deprecated **/
|
|
1511
1841
|
private static getSkinProxySkinUrl;
|
|
1842
|
+
/** @deprecated **/
|
|
1512
1843
|
private static getSkinProxyCapeUrl;
|
|
1844
|
+
private static getMcProxySkinUrl;
|
|
1845
|
+
private static getMcProxyCapeUrl;
|
|
1513
1846
|
}
|
|
1514
1847
|
|
|
1515
1848
|
declare class TextureLoader {
|
|
@@ -1537,61 +1870,155 @@ declare function mergeVertices(geometry: BufferGeometry, tolerance?: number): Bu
|
|
|
1537
1870
|
declare function toTrianglesDrawMode(geometry: BufferGeometry, drawMode: TrianglesDrawModes): BufferGeometry;
|
|
1538
1871
|
declare function computeMorphedAttributes(object: Mesh | Line | Points): object;
|
|
1539
1872
|
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
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;
|
|
1939
|
+
}
|
|
1940
|
+
|
|
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;
|
|
1543
1950
|
}
|
|
1544
1951
|
|
|
1545
|
-
declare class Chunk {
|
|
1952
|
+
declare class Chunk<SectionMeshing extends boolean = false> {
|
|
1953
|
+
private readonly onBlocksChanged?;
|
|
1954
|
+
private readonly sectionModels?;
|
|
1546
1955
|
readonly scene: MineRenderScene;
|
|
1547
1956
|
readonly x: number;
|
|
1548
1957
|
readonly y: number;
|
|
1549
1958
|
readonly z: number;
|
|
1550
|
-
private readonly
|
|
1551
|
-
private readonly
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
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>>;
|
|
1556
1968
|
/**
|
|
1557
1969
|
* Set block at a _world_ position
|
|
1558
1970
|
*/
|
|
1559
|
-
setBlockAt(x: number, y: number, z: number, block: Maybe<Block>): Promise<Maybe<BlockInfo
|
|
1560
|
-
setBlockAt(pos: Vector3, block: Maybe<Block>): Promise<Maybe<BlockInfo
|
|
1561
|
-
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>>>;
|
|
1562
1974
|
/**
|
|
1563
|
-
* Set block at
|
|
1975
|
+
* Set a block at integer chunk-local coordinates from 0 to 15.
|
|
1564
1976
|
*/
|
|
1565
|
-
setBlockInChunkAt(pos: Vector3, block?: Block, worldPos?: Vector3): Promise<Maybe<BlockInfo
|
|
1566
|
-
|
|
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>;
|
|
1567
1982
|
dispose(): Promise<void>;
|
|
1983
|
+
static isAir(block: Maybe<Block>): boolean;
|
|
1568
1984
|
static chunkPosToBlockIndex(pos: Vector3): number;
|
|
1569
1985
|
worldPosToChunkPos(pos: Vector3): Vector3;
|
|
1570
1986
|
chunkPosToWorldPos(pos: Vector3): Vector3;
|
|
1571
1987
|
}
|
|
1572
1988
|
|
|
1573
|
-
declare class MineRenderWorld {
|
|
1989
|
+
declare class MineRenderWorld<SectionMeshing extends boolean = false> {
|
|
1574
1990
|
readonly scene: MineRenderScene;
|
|
1575
|
-
private _size;
|
|
1576
|
-
private _blockSize;
|
|
1577
1991
|
private readonly _chunks;
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
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;
|
|
1585
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>;
|
|
1586
2007
|
clear(): Promise<void>;
|
|
2008
|
+
private updateCulling;
|
|
1587
2009
|
private getOrCreateChunkAt;
|
|
1588
|
-
getChunkAt(pos: Vector3): Maybe<Chunk
|
|
2010
|
+
getChunkAt(pos: Vector3): Maybe<Chunk<SectionMeshing>>;
|
|
1589
2011
|
static worldToScenePosition(pos: Vector3): Vector3;
|
|
1590
2012
|
static sceneToWorldPosition(pos: Vector3): Vector3;
|
|
1591
|
-
worldPosToChunkIndex(pos: Vector3): number;
|
|
1592
2013
|
worldPosToChunkKey(pos: Vector3): string;
|
|
1593
2014
|
validatePosBounds(pos: Vector3): void;
|
|
1594
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
|
+
}
|
|
1595
2022
|
|
|
1596
2023
|
/**
|
|
1597
2024
|
* {@link EnvProvider} for headless Node.
|
|
@@ -1631,4 +2058,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
|
|
|
1631
2058
|
forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
|
|
1632
2059
|
}
|
|
1633
2060
|
|
|
1634
|
-
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 };
|