minerender 2.1.0-alpha.9 → 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 +576 -154
- package/dist/browser/index.d.ts +576 -154
- package/dist/browser/index.js +11149 -4364
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +11024 -4192
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +81697 -73443
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +576 -154
- package/dist/node/index.d.ts +576 -154
- package/dist/node/index.js +11164 -4290
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +11119 -4218
- package/dist/node/index.mjs.map +1 -1
- package/package.json +7 -5
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;
|
|
@@ -175,6 +177,7 @@ declare class AssetKey extends BasicAssetKey {
|
|
|
175
177
|
rootType: "assets" | "data" | string;
|
|
176
178
|
extension: ".json" | ".png" | string;
|
|
177
179
|
root?: string | undefined;
|
|
180
|
+
readonly isAssetKey: true;
|
|
178
181
|
constructor(namespace: string, path: string, assetType?: AssetType | undefined, type?: string | undefined, rootType?: "assets" | "data" | string, extension?: ".json" | ".png" | string, root?: string | undefined);
|
|
179
182
|
static parse(assetType: AssetType, str: string, origin?: AssetKey): AssetKey;
|
|
180
183
|
toString(): string;
|
|
@@ -202,6 +205,7 @@ declare class Materials {
|
|
|
202
205
|
static get MISSING_TEXTURE(): Material;
|
|
203
206
|
static createImage(key: MaterialKey): Material;
|
|
204
207
|
static createBasicCanvasMaterial(canvas: HTMLCanvasElement, transparent?: boolean, shade?: boolean): Material;
|
|
208
|
+
static createGuiCanvasMaterial(canvas: HTMLCanvasElement): MeshBasicMaterial;
|
|
205
209
|
static createShadedCanvasMaterial(canvas: HTMLCanvasElement, transparent?: boolean, shade?: boolean): Material;
|
|
206
210
|
static getImage(key: MaterialKey): Material;
|
|
207
211
|
static needsUpdate(mat: Material): void;
|
|
@@ -247,7 +251,8 @@ declare enum DisplayPosition {
|
|
|
247
251
|
GUI = "gui",
|
|
248
252
|
HEAD = "head",
|
|
249
253
|
GROUND = "ground",
|
|
250
|
-
FIXED = "fixed"
|
|
254
|
+
FIXED = "fixed",
|
|
255
|
+
ON_SHELF = "on_shelf"
|
|
251
256
|
}
|
|
252
257
|
declare const DISPLAY_POSITIONS: DisplayPosition[];
|
|
253
258
|
|
|
@@ -256,6 +261,46 @@ declare enum GuiLight {
|
|
|
256
261
|
SIDE = "side"
|
|
257
262
|
}
|
|
258
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
|
+
|
|
259
304
|
declare class WrappedImage {
|
|
260
305
|
readonly dta: ExtractableImageData;
|
|
261
306
|
constructor(dta: ExtractableImageData);
|
|
@@ -279,7 +324,7 @@ interface ImageInfo {
|
|
|
279
324
|
width: number;
|
|
280
325
|
height: number;
|
|
281
326
|
type?: string;
|
|
282
|
-
data: Buffer
|
|
327
|
+
data: Buffer;
|
|
283
328
|
}
|
|
284
329
|
declare class ImageLoader {
|
|
285
330
|
protected static _createImage(): CompatImage;
|
|
@@ -291,7 +336,7 @@ declare class ImageLoader {
|
|
|
291
336
|
static infoToData(info: ImageInfo): Promise<ImageData>;
|
|
292
337
|
static getData(src: string): Promise<ImageData>;
|
|
293
338
|
static getCanvasData(src: string): Promise<ExtractableImageData>;
|
|
294
|
-
static processResponse(response:
|
|
339
|
+
static processResponse(response: Pick<RequestResponse<ArrayBuffer>, "data" | "url">): Promise<ImageInfo>;
|
|
295
340
|
static loadInfo(src: string): Promise<ImageInfo>;
|
|
296
341
|
static getInfo(src: string): Promise<ImageInfo>;
|
|
297
342
|
static loadWrapped(src: string): Promise<WrappedImage>;
|
|
@@ -305,7 +350,7 @@ declare const DEFAULT_ELEMENTS: ModelElement[];
|
|
|
305
350
|
interface Model extends MinecraftAsset {
|
|
306
351
|
textures?: IModelTextures;
|
|
307
352
|
parent?: string;
|
|
308
|
-
display?: ModelDisplay
|
|
353
|
+
display?: Partial<Record<DisplayPosition, ModelDisplay>>;
|
|
309
354
|
elements?: ModelElement[];
|
|
310
355
|
hierarchy?: string[];
|
|
311
356
|
}
|
|
@@ -320,7 +365,6 @@ interface ItemModel extends Model {
|
|
|
320
365
|
interface TextureAsset extends MinecraftAsset, ImageInfo {
|
|
321
366
|
}
|
|
322
367
|
interface ModelDisplay {
|
|
323
|
-
position?: DisplayPosition;
|
|
324
368
|
translation?: TripleArray;
|
|
325
369
|
rotation?: TripleArray;
|
|
326
370
|
scale?: TripleArray;
|
|
@@ -340,13 +384,7 @@ declare function isDoubleArray(obj: any): obj is DoubleArray;
|
|
|
340
384
|
declare function isTripleArray(obj: any): obj is TripleArray;
|
|
341
385
|
declare function isQuadArray(obj: any): obj is QuadArray;
|
|
342
386
|
|
|
343
|
-
/**
|
|
344
|
-
* down up
|
|
345
|
-
* east north west south
|
|
346
|
-
*
|
|
347
|
-
* bottom-left to top-right
|
|
348
|
-
* [bl, br, tl, tr]
|
|
349
|
-
*/
|
|
387
|
+
/** Vanilla Minecraft cube UVs in Three.js BoxGeometry face and vertex order. */
|
|
350
388
|
declare class MinecraftCubeTexture {
|
|
351
389
|
readonly u: number;
|
|
352
390
|
readonly v: number;
|
|
@@ -362,7 +400,7 @@ declare class MinecraftCubeTexture {
|
|
|
362
400
|
getUvSouth(w: number, h: number, l: number): QuadArray<DoubleArray>;
|
|
363
401
|
getUvNorth(w: number, h: number, l: number): QuadArray<DoubleArray>;
|
|
364
402
|
getFaceUv(face: CubeFace, w: number, h: number, l: number): QuadArray<DoubleArray>;
|
|
365
|
-
toUvArray(w: number, h: number, l: number): number[];
|
|
403
|
+
toUvArray(w: number, h: number, l: number, mirror?: boolean): number[];
|
|
366
404
|
}
|
|
367
405
|
|
|
368
406
|
interface MinecraftTextureMeta extends MinecraftAsset {
|
|
@@ -490,6 +528,7 @@ declare class TextureAtlas implements Disposable {
|
|
|
490
528
|
};
|
|
491
529
|
readonly hasTransparency: boolean;
|
|
492
530
|
ticker?: number;
|
|
531
|
+
private readonly subscribers;
|
|
493
532
|
constructor(model: Model, image: CanvasImage, sizes: {
|
|
494
533
|
[texture: string]: DoubleArray;
|
|
495
534
|
}, positions: {
|
|
@@ -497,6 +536,8 @@ declare class TextureAtlas implements Disposable {
|
|
|
497
536
|
}, hasAnimation: boolean, animatorFunctions: {
|
|
498
537
|
[p: string]: AnimatorFunction;
|
|
499
538
|
}, hasTransparency: boolean);
|
|
539
|
+
/** Calls subscribers when an animation frame changes; unused atlases do not tick. */
|
|
540
|
+
subscribe(callback: () => void): () => void;
|
|
500
541
|
getData(texture: string): ImageData$1;
|
|
501
542
|
dispose(): void;
|
|
502
543
|
}
|
|
@@ -515,6 +556,7 @@ declare class UVMapper {
|
|
|
515
556
|
static setCubeUvs(geometry: BoxGeometry, originalTextureSize: DoubleArray, actualTextureSize: DoubleArray, faces: ModelFaces): void;
|
|
516
557
|
static facesToUvArray(faces: ModelFaces, originalTextureSize: DoubleArray, actualTextureSize: DoubleArray): number[];
|
|
517
558
|
static facesToUv(faces: ModelFaces, originalTextureSize: DoubleArray, actualTextureSize: DoubleArray): Float32BufferAttribute;
|
|
559
|
+
static lockUvs(geometry: BoxGeometry, faces: ModelFaces, atlas: TextureAtlas, rotation: Euler): void;
|
|
518
560
|
static getAtlas(model: Model): Promise<Maybe<TextureAtlas>>;
|
|
519
561
|
static fillMissingTextureKeys<T>(textures: ModelTextures, target: {
|
|
520
562
|
[k: string]: T;
|
|
@@ -541,8 +583,8 @@ declare class MinecraftFaceUV {
|
|
|
541
583
|
* Idle Node processes can exit without calling this: cache and Ticker timers are unref'd,
|
|
542
584
|
* and idle request queues hold no timer. Pending requests keep their normal timer references.
|
|
543
585
|
*
|
|
544
|
-
* Call this only when finished with MineRender.
|
|
545
|
-
* 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.
|
|
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,16 +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[]>;
|
|
625
666
|
/** Returns the first defined result in source-priority order, without merging assets. */
|
|
626
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
|
+
}>>;
|
|
627
673
|
}
|
|
628
674
|
|
|
629
675
|
interface BlockState extends MinecraftAsset {
|
|
@@ -638,18 +684,19 @@ interface BlockStateVariant {
|
|
|
638
684
|
y?: number;
|
|
639
685
|
x?: number;
|
|
640
686
|
uvlock?: boolean;
|
|
687
|
+
weight?: number;
|
|
641
688
|
}
|
|
642
689
|
interface BlockStateMultipart {
|
|
643
|
-
when?: MultipartCondition
|
|
644
|
-
|
|
645
|
-
};
|
|
646
|
-
apply?: BlockStateVariant;
|
|
647
|
-
}
|
|
648
|
-
interface MultipartCondition {
|
|
649
|
-
[key: string]: string;
|
|
690
|
+
when?: MultipartCondition;
|
|
691
|
+
apply?: BlockStateVariant | BlockStateVariant[];
|
|
650
692
|
}
|
|
693
|
+
type MultipartCondition = Record<string, string> | {
|
|
694
|
+
OR: MultipartCondition[];
|
|
695
|
+
} | {
|
|
696
|
+
AND: MultipartCondition[];
|
|
697
|
+
};
|
|
651
698
|
|
|
652
|
-
declare const DEFAULT_ROOT = "https://assets.mcasset.cloud/1.
|
|
699
|
+
declare const DEFAULT_ROOT = "https://assets.mcasset.cloud/1.21.11";
|
|
653
700
|
declare const DEFAULT_NAMESPACE = "minecraft";
|
|
654
701
|
declare class Assets {
|
|
655
702
|
/**
|
|
@@ -688,25 +735,60 @@ declare class DefaultBlockStates implements MinecraftAsset {
|
|
|
688
735
|
[k: string]: BlockStatePropertyDefaults;
|
|
689
736
|
}
|
|
690
737
|
|
|
691
|
-
interface
|
|
692
|
-
|
|
693
|
-
|
|
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];
|
|
694
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;
|
|
695
773
|
}
|
|
696
774
|
|
|
697
775
|
declare class Entities {
|
|
698
|
-
static getBlockEntityModels(): Promise<Maybe<BlockEntityModels>>;
|
|
699
|
-
static getEntityModels(): Promise<Maybe<EntityModels>>;
|
|
700
|
-
static getBlockList(): Promise<string[]>;
|
|
701
776
|
static getEntityList(): Promise<string[]>;
|
|
702
|
-
static
|
|
703
|
-
static
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
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>>;
|
|
707
785
|
}
|
|
708
|
-
|
|
709
|
-
|
|
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>;
|
|
710
792
|
}
|
|
711
793
|
|
|
712
794
|
declare class Models {
|
|
@@ -714,15 +796,34 @@ declare class Models {
|
|
|
714
796
|
private static get PERSISTENT_CACHE();
|
|
715
797
|
static getItemList(): Promise<string[]>;
|
|
716
798
|
static loadAndMerge(key: AssetKey): Promise<Maybe<Model>>;
|
|
799
|
+
private static getItemModel;
|
|
800
|
+
private static defaultItemModel;
|
|
717
801
|
static getRaw(key: AssetKey): Promise<Maybe<Model>>;
|
|
718
802
|
static getMerged(key: AssetKey): Promise<Maybe<Model>>;
|
|
719
803
|
static get(key: AssetKey): Promise<Maybe<Model>>;
|
|
720
804
|
static clearCache(): Promise<void>;
|
|
721
805
|
}
|
|
722
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
|
+
|
|
723
820
|
declare class ModelGenerator {
|
|
724
821
|
static readonly ITEM_LAYERS: string[];
|
|
725
|
-
|
|
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[];
|
|
726
827
|
}
|
|
727
828
|
|
|
728
829
|
declare class ModelMerger {
|
|
@@ -736,8 +837,24 @@ interface Block {
|
|
|
736
837
|
nbt?: any;
|
|
737
838
|
}
|
|
738
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
|
+
|
|
739
854
|
interface Instanceable {
|
|
740
855
|
nextInstance(): InstanceReference<SceneObject>;
|
|
856
|
+
removeInstanceAt(index: number): void;
|
|
857
|
+
isInstanceActive(index: number, reference: InstanceReference<Instanceable>): boolean;
|
|
741
858
|
getMatrixAt(index: number, matrix?: Matrix4): Matrix4;
|
|
742
859
|
setMatrixAt(index: number, matrix: Matrix4): void;
|
|
743
860
|
setPositionRotationScaleAt(index: number, position?: Vector3, rotation?: Euler, scale?: Vector3): void;
|
|
@@ -750,12 +867,15 @@ interface Instanceable {
|
|
|
750
867
|
}
|
|
751
868
|
declare function isInstanceable(obj: any): obj is Instanceable;
|
|
752
869
|
|
|
753
|
-
declare class InstanceReference<T extends Instanceable> implements Transformable {
|
|
870
|
+
declare class InstanceReference<T extends Instanceable> implements Transformable, Disposable {
|
|
754
871
|
readonly instanceable: T;
|
|
755
872
|
readonly index: number;
|
|
756
873
|
readonly isInstanceReference: true;
|
|
757
874
|
constructor(instanceable: T, index: number);
|
|
758
875
|
nextInstance(): InstanceReference<SceneObject>;
|
|
876
|
+
private get activeInstanceable();
|
|
877
|
+
removeFromScene(): void;
|
|
878
|
+
dispose(): void;
|
|
759
879
|
getMatrix(matrix?: Matrix4): Matrix4;
|
|
760
880
|
setMatrix(matrix: Matrix4): void;
|
|
761
881
|
setPositionRotationScale(position?: Vector3, rotation?: Euler, scale?: Vector3): void;
|
|
@@ -780,18 +900,33 @@ declare class ModelObject extends SceneObject {
|
|
|
780
900
|
readonly isModelObject: true;
|
|
781
901
|
static readonly DEFAULT_OPTIONS: ModelObjectOptions;
|
|
782
902
|
readonly options: ModelObjectOptions;
|
|
783
|
-
|
|
903
|
+
protected atlas?: TextureAtlas;
|
|
904
|
+
private atlasMaterial?;
|
|
905
|
+
private atlasTexture?;
|
|
906
|
+
private unsubscribeAtlas?;
|
|
784
907
|
blockParent: Maybe<BlockObject>;
|
|
785
908
|
private meshesCreated;
|
|
786
909
|
constructor(originalModel: Model, options?: Partial<ModelObjectOptions>);
|
|
787
910
|
init(): Promise<void>;
|
|
788
|
-
dispose(): void;
|
|
789
911
|
get textureAtlas(): Maybe<TextureAtlas>;
|
|
912
|
+
get isOpaqueFullCube(): boolean;
|
|
790
913
|
protected loadTextures(): Promise<void>;
|
|
791
914
|
protected createMeshes(force?: boolean): void;
|
|
792
915
|
protected applyTextures(): void;
|
|
916
|
+
private updateAnimationSubscription;
|
|
917
|
+
nextInstance(): InstanceReference<SceneObject>;
|
|
918
|
+
removeInstanceAt(index: number): void;
|
|
919
|
+
disposeAndRemoveAllChildren(): void;
|
|
793
920
|
}
|
|
794
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;
|
|
795
930
|
}
|
|
796
931
|
declare function isModelObject(obj: any): obj is ModelObject;
|
|
797
932
|
|
|
@@ -824,24 +959,36 @@ declare enum SkinPart {
|
|
|
824
959
|
}
|
|
825
960
|
declare const SKIN_PARTS: SkinPart[];
|
|
826
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. */
|
|
827
966
|
declare class SkinObject extends SceneObject {
|
|
828
967
|
readonly options: SkinObjectOptions;
|
|
829
968
|
private slim;
|
|
830
|
-
private
|
|
969
|
+
private detectedSlim;
|
|
831
970
|
private skinTextureSrc?;
|
|
832
|
-
private
|
|
833
|
-
private
|
|
834
|
-
private
|
|
971
|
+
private skinMaterial?;
|
|
972
|
+
private skinLoad;
|
|
973
|
+
private capeLoad;
|
|
835
974
|
constructor(options?: DeepPartial<SkinObjectOptions>);
|
|
836
975
|
init(): Promise<void>;
|
|
837
976
|
protected removeMeshes(): void;
|
|
838
977
|
protected createMeshes(): void;
|
|
839
|
-
setSkinTexture(src: string): void
|
|
840
|
-
|
|
841
|
-
|
|
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;
|
|
842
987
|
protected getBoxGeometry(part: SkinPart): BoxGeometry;
|
|
843
988
|
}
|
|
844
989
|
interface SkinObjectOptions extends SceneObjectOptions {
|
|
990
|
+
slim?: boolean;
|
|
991
|
+
legacy?: boolean;
|
|
845
992
|
}
|
|
846
993
|
|
|
847
994
|
declare class EntityObject extends SceneObject {
|
|
@@ -849,20 +996,54 @@ declare class EntityObject extends SceneObject {
|
|
|
849
996
|
readonly isEntityObject: true;
|
|
850
997
|
static readonly DEFAULT_OPTIONS: EntityObjectOptions;
|
|
851
998
|
readonly options: EntityObjectOptions;
|
|
852
|
-
private imageData?;
|
|
853
999
|
private meshesCreated;
|
|
854
1000
|
constructor(entity: EntityModel, options?: Partial<EntityObjectOptions>);
|
|
855
1001
|
init(): Promise<void>;
|
|
856
1002
|
dispose(): void;
|
|
857
|
-
|
|
858
|
-
|
|
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>>;
|
|
859
1009
|
protected createMeshes(force?: boolean): void;
|
|
1010
|
+
private createPart;
|
|
860
1011
|
protected applyTextures(): Promise<void>;
|
|
861
1012
|
}
|
|
862
1013
|
interface EntityObjectOptions extends SceneObjectOptions {
|
|
1014
|
+
flip?: boolean;
|
|
863
1015
|
}
|
|
864
1016
|
declare function isEntityObject(obj: any): obj is EntityObject;
|
|
865
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
|
+
|
|
866
1047
|
declare class MineRenderScene extends Scene {
|
|
867
1048
|
readonly isMineRenderScene: true;
|
|
868
1049
|
static readonly DEFAULT_OPTIONS: MineRenderSceneOptions;
|
|
@@ -882,6 +1063,7 @@ declare class MineRenderScene extends Scene {
|
|
|
882
1063
|
addBlock(blockState: BlockState, options?: Partial<BlockObjectOptions>, parent?: Object3D): Promise<BlockObject | InstanceReference<BlockObject>>;
|
|
883
1064
|
addSkin(skin?: string, options?: Partial<SkinObjectOptions>, parent?: Object3D): Promise<SkinObject>;
|
|
884
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>;
|
|
885
1067
|
}
|
|
886
1068
|
interface MineRenderSceneOptions {
|
|
887
1069
|
}
|
|
@@ -897,6 +1079,9 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
|
|
|
897
1079
|
private materialCallbacks;
|
|
898
1080
|
protected _isInstanced: boolean;
|
|
899
1081
|
_instanceCounter: number;
|
|
1082
|
+
protected instanceMesh?: InstancedMesh;
|
|
1083
|
+
private readonly instanceReferences;
|
|
1084
|
+
private readonly freeInstanceIndices;
|
|
900
1085
|
constructor(options?: Partial<SceneObjectOptions>);
|
|
901
1086
|
set scene(scene: MineRenderScene);
|
|
902
1087
|
get scene(): MineRenderScene;
|
|
@@ -936,6 +1121,12 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
|
|
|
936
1121
|
get instanceCounter(): number;
|
|
937
1122
|
protected constructInstanceReference(i: number): InstanceReference<SceneObject>;
|
|
938
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>;
|
|
939
1130
|
getMatrixAt(index: number, matrix?: Matrix4): Matrix4;
|
|
940
1131
|
setMatrixAt(index: number, matrix: Matrix4): void;
|
|
941
1132
|
setPositionRotationScaleAt(index: number, position?: Vector3, rotation?: Euler, scale?: Vector3): void;
|
|
@@ -959,6 +1150,23 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
|
|
|
959
1150
|
}
|
|
960
1151
|
declare function isSceneObject(obj: any): obj is SceneObject;
|
|
961
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
|
+
|
|
962
1170
|
declare class BlockObject extends SceneObject {
|
|
963
1171
|
readonly blockState: BlockState;
|
|
964
1172
|
readonly isBlockObject: true;
|
|
@@ -972,13 +1180,27 @@ declare class BlockObject extends SceneObject {
|
|
|
972
1180
|
private _instanceModel;
|
|
973
1181
|
private _variants;
|
|
974
1182
|
private _models;
|
|
1183
|
+
private _cullMask;
|
|
1184
|
+
private _fluidKey?;
|
|
1185
|
+
private _fluidSampler?;
|
|
1186
|
+
private _fluidModel?;
|
|
975
1187
|
constructor(blockState: BlockState, options?: Partial<BlockObjectOptions>);
|
|
976
1188
|
init(): Promise<void>;
|
|
977
1189
|
dispose(): void;
|
|
978
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>;
|
|
979
1197
|
get state(): {
|
|
980
1198
|
[key: string]: string;
|
|
981
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>;
|
|
982
1204
|
nextInstance(): InstanceReference<SceneObject>;
|
|
983
1205
|
protected mapStateToVariant(state: BlockStateProperties): Promise<BlockStateVariant[]>;
|
|
984
1206
|
recreateModels(): Promise<void>;
|
|
@@ -997,26 +1219,50 @@ declare class BlockObject extends SceneObject {
|
|
|
997
1219
|
}
|
|
998
1220
|
interface BlockObjectOptions extends ModelObjectOptions {
|
|
999
1221
|
applyDefaultState: boolean;
|
|
1222
|
+
/** Properties applied before model creation, overriding defaults when applyDefaultState is enabled. */
|
|
1223
|
+
initialState?: BlockStateProperties;
|
|
1000
1224
|
}
|
|
1001
1225
|
declare function isBlockObject(obj: any): obj is BlockObject;
|
|
1002
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
|
+
|
|
1003
1242
|
interface MultiBlockStructure {
|
|
1004
1243
|
readonly size: TripleArray;
|
|
1005
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;
|
|
1006
1252
|
}
|
|
1007
1253
|
interface MultiBlockBlock extends Block {
|
|
1008
1254
|
position: TripleArray;
|
|
1009
1255
|
}
|
|
1010
1256
|
|
|
1011
1257
|
declare class SchematicParser {
|
|
1012
|
-
static parse(): Promise<MultiBlockStructure>;
|
|
1258
|
+
static parse(nbt: NBT): Promise<MultiBlockStructure>;
|
|
1013
1259
|
}
|
|
1014
1260
|
|
|
1015
1261
|
declare class StructureParser {
|
|
1016
1262
|
static parse(_nbt: NBT, paletteIndex?: number): Promise<MultiBlockStructure>;
|
|
1017
1263
|
}
|
|
1018
1264
|
interface StructureNBT {
|
|
1019
|
-
DataVersion
|
|
1265
|
+
DataVersion?: {
|
|
1020
1266
|
type: "int";
|
|
1021
1267
|
value: number;
|
|
1022
1268
|
};
|
|
@@ -1028,7 +1274,13 @@ interface StructureNBT {
|
|
|
1028
1274
|
};
|
|
1029
1275
|
};
|
|
1030
1276
|
palette?: Palette;
|
|
1031
|
-
palettes?:
|
|
1277
|
+
palettes?: {
|
|
1278
|
+
type: "list";
|
|
1279
|
+
value: {
|
|
1280
|
+
type: "list";
|
|
1281
|
+
value: Palette["value"][];
|
|
1282
|
+
};
|
|
1283
|
+
};
|
|
1032
1284
|
blocks: {
|
|
1033
1285
|
type: "list";
|
|
1034
1286
|
value: {
|
|
@@ -1036,7 +1288,32 @@ interface StructureNBT {
|
|
|
1036
1288
|
value: BlockEntry[];
|
|
1037
1289
|
};
|
|
1038
1290
|
};
|
|
1039
|
-
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
|
+
};
|
|
1040
1317
|
}
|
|
1041
1318
|
interface Palette {
|
|
1042
1319
|
type: "list";
|
|
@@ -1080,14 +1357,17 @@ interface BlockEntry {
|
|
|
1080
1357
|
}
|
|
1081
1358
|
|
|
1082
1359
|
declare class NBTHelper {
|
|
1083
|
-
static fromBuffer(
|
|
1360
|
+
static fromBuffer(data: Uint8Array | ArrayBuffer, format?: NBTFormat): Promise<NBTAsset>;
|
|
1084
1361
|
}
|
|
1085
1362
|
interface NBTAsset extends MinecraftAsset, NBT {
|
|
1363
|
+
format?: NBTFormat;
|
|
1364
|
+
metadata?: Metadata;
|
|
1365
|
+
compression?: "gzip" | "none";
|
|
1086
1366
|
}
|
|
1087
1367
|
|
|
1088
1368
|
interface ResponseParser<T extends MinecraftAsset> {
|
|
1089
|
-
config(request:
|
|
1090
|
-
parse(response:
|
|
1369
|
+
config(request: RequestConfig): any;
|
|
1370
|
+
parse(response: RequestResponse): Maybe<T> | Promise<Maybe<T>>;
|
|
1091
1371
|
}
|
|
1092
1372
|
|
|
1093
1373
|
declare class HostedAssetSource extends AssetSource {
|
|
@@ -1106,6 +1386,7 @@ declare class HostedAssetSource extends AssetSource {
|
|
|
1106
1386
|
private readonly _options;
|
|
1107
1387
|
constructor(root: string, options?: Partial<HostedAssetSourceOptions>);
|
|
1108
1388
|
get root(): string;
|
|
1389
|
+
get cacheId(): string;
|
|
1109
1390
|
get options(): HostedAssetSourceOptions;
|
|
1110
1391
|
get<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser): Promise<Maybe<T>>;
|
|
1111
1392
|
}
|
|
@@ -1120,6 +1401,8 @@ interface ArchiveEntry {
|
|
|
1120
1401
|
}
|
|
1121
1402
|
|
|
1122
1403
|
interface ArchiveProxy {
|
|
1404
|
+
/** Identifies the archive's content across sessions; undefined when it cannot be identified. */
|
|
1405
|
+
readonly id?: string;
|
|
1123
1406
|
getEntries(): Promise<ArchiveEntry[]>;
|
|
1124
1407
|
}
|
|
1125
1408
|
|
|
@@ -1127,6 +1410,7 @@ declare class ArchiveAssetSource extends AssetSource implements ArchiveProxy {
|
|
|
1127
1410
|
readonly _archiveProxy: ArchiveProxy;
|
|
1128
1411
|
constructor(archiveProxy: ArchiveProxy);
|
|
1129
1412
|
static blob(blob: Blob): ArchiveAssetSource;
|
|
1413
|
+
get cacheId(): Maybe<string>;
|
|
1130
1414
|
getEntries(): Promise<ArchiveEntry[]>;
|
|
1131
1415
|
getEntry(path: string): Promise<Maybe<ArchiveEntry>>;
|
|
1132
1416
|
get<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<Maybe<T>>;
|
|
@@ -1137,7 +1421,8 @@ declare class ArchiveAssetSource extends AssetSource implements ArchiveProxy {
|
|
|
1137
1421
|
declare class BrowserArchiveProxy implements ArchiveProxy {
|
|
1138
1422
|
readonly _blob: Blob;
|
|
1139
1423
|
readonly _reader: ZipReader<Blob>;
|
|
1140
|
-
|
|
1424
|
+
readonly id?: string;
|
|
1425
|
+
constructor(blob: Blob, id?: string);
|
|
1141
1426
|
getEntries(): Promise<ArchiveEntry[]>;
|
|
1142
1427
|
}
|
|
1143
1428
|
|
|
@@ -1217,7 +1502,9 @@ declare class Caching {
|
|
|
1217
1502
|
static readonly blockStateCache: AsyncLoadingCache<CacheKey, BlockState>;
|
|
1218
1503
|
static readonly listAssetCache: AsyncLoadingCache<CacheKey, ListAsset>;
|
|
1219
1504
|
static readonly defaultBlockStatesCache: AsyncLoadingCache<CacheKey, DefaultBlockStates>;
|
|
1220
|
-
static readonly
|
|
1505
|
+
static readonly blockTintCache: AsyncLoadingCache<CacheKey, number>;
|
|
1506
|
+
static readonly entityModelCache: AsyncLoadingCache<CacheKey, EntityModelFile>;
|
|
1507
|
+
static readonly entityTextureCache: AsyncLoadingCache<CacheKey, AssetKey>;
|
|
1221
1508
|
private static createAssetCache;
|
|
1222
1509
|
/** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
|
|
1223
1510
|
private static get all();
|
|
@@ -1232,14 +1519,35 @@ declare class Caching {
|
|
|
1232
1519
|
static get cacheSizes(): {};
|
|
1233
1520
|
}
|
|
1234
1521
|
|
|
1522
|
+
/** Copies the nontransparent bounds without resizing the source; empty images become one transparent pixel. */
|
|
1523
|
+
declare function trimCanvas(source: CompatCanvas): CompatCanvas;
|
|
1524
|
+
|
|
1235
1525
|
declare class MineRenderError extends Error {
|
|
1236
1526
|
constructor(msg: any);
|
|
1237
1527
|
get name(): string;
|
|
1238
1528
|
}
|
|
1239
1529
|
|
|
1240
|
-
|
|
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;
|
|
1241
1535
|
}
|
|
1242
|
-
|
|
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];
|
|
1243
1551
|
}
|
|
1244
1552
|
|
|
1245
1553
|
declare class OrbitControls {
|
|
@@ -1364,7 +1672,16 @@ declare class Renderer implements Disposable {
|
|
|
1364
1672
|
*/
|
|
1365
1673
|
dispose(): void;
|
|
1366
1674
|
private animate;
|
|
1367
|
-
|
|
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>;
|
|
1368
1685
|
protected get attachedToBody(): boolean;
|
|
1369
1686
|
protected get viewWidth(): number;
|
|
1370
1687
|
protected get viewHeight(): number;
|
|
@@ -1402,6 +1719,8 @@ interface CameraOptions {
|
|
|
1402
1719
|
interface RenderOptions {
|
|
1403
1720
|
/** Maximum draw rate (60 by default); zero or a negative value disables the limit. */
|
|
1404
1721
|
fpsLimit: number;
|
|
1722
|
+
/** Drawing-buffer pixels per CSS pixel (default 1); also scales toImage() output. */
|
|
1723
|
+
pixelRatio?: number;
|
|
1405
1724
|
stats: boolean;
|
|
1406
1725
|
antialias: boolean;
|
|
1407
1726
|
shade: boolean;
|
|
@@ -1426,17 +1745,21 @@ declare class SceneInspector {
|
|
|
1426
1745
|
protected readonly raycaster: Raycaster;
|
|
1427
1746
|
private readonly mouse;
|
|
1428
1747
|
private selectedObject?;
|
|
1748
|
+
private pointer?;
|
|
1749
|
+
private readonly listeners;
|
|
1429
1750
|
constructor(renderer: Renderer);
|
|
1430
1751
|
protected init(): void;
|
|
1752
|
+
dispose(): void;
|
|
1431
1753
|
findMeshChildren(from: Object3D, out?: Mesh[]): Mesh<three.BufferGeometry<three.NormalBufferAttributes>, three.Material | three.Material[], three.Object3DEventMap>[];
|
|
1432
|
-
onClick(event:
|
|
1754
|
+
onClick(event: MouseEvent): void;
|
|
1433
1755
|
appendTo(el: HTMLElement): void;
|
|
1434
1756
|
protected handleRaycasterObjects(intersections: Intersection[]): void;
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
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;
|
|
1438
1761
|
protected addInfoLine(name: string, id: string, value: any): HTMLElement;
|
|
1439
|
-
protected addObjectControls(target: Object3D, intersection: Maybe<Intersection>, container: HTMLElement): void;
|
|
1762
|
+
protected addObjectControls(target: Object3D, intersection: Maybe<Intersection>, container: HTMLElement, instance?: InstanceReference<SceneObject>): void;
|
|
1440
1763
|
protected buttonControl(name: string, id: string, click: () => void): HTMLElement;
|
|
1441
1764
|
protected selectControl(name: string, id: string, options: string[], change: (v: string) => void): HTMLElement;
|
|
1442
1765
|
protected toggleControl(name: string, id: string, val: boolean, change: (v: boolean) => void): HTMLElement;
|
|
@@ -1465,35 +1788,33 @@ declare class StatLine {
|
|
|
1465
1788
|
update(): void;
|
|
1466
1789
|
}
|
|
1467
1790
|
|
|
1468
|
-
declare class Requests {
|
|
1469
|
-
private static axiosInstance;
|
|
1470
|
-
private static mcAssetInstance;
|
|
1471
|
-
private static genericQueue;
|
|
1472
|
-
private static mcAssetRequestQueue;
|
|
1473
|
-
static genericRequest(request: AxiosRequestConfig): Promise<AxiosResponse>;
|
|
1474
|
-
static mcAssetRequest(request: AxiosRequestConfig): Promise<AxiosResponse>;
|
|
1475
|
-
private static shouldRetry;
|
|
1476
|
-
static setMcAssetRoot(root: string): void;
|
|
1477
|
-
static get queueSizes(): {
|
|
1478
|
-
generic: number;
|
|
1479
|
-
mcAsset: number;
|
|
1480
|
-
};
|
|
1481
|
-
/**
|
|
1482
|
-
* Permanently stops both queues and rejects waiting and future requests.
|
|
1483
|
-
* Requests already running can finish. Idle queues hold no timer, so Node can exit without
|
|
1484
|
-
* this cleanup. See {@link shutdown}.
|
|
1485
|
-
*/
|
|
1486
|
-
static end(): void;
|
|
1487
|
-
}
|
|
1488
|
-
|
|
1489
1791
|
type SkinGeometries = Record<SkinPart, TripleArray>;
|
|
1490
1792
|
declare const classicSkinGeometries: SkinGeometries;
|
|
1491
1793
|
declare const slimSkinGeometries: SkinGeometries;
|
|
1492
1794
|
|
|
1795
|
+
declare class SkinImage {
|
|
1796
|
+
static getData(src: string): Promise<ImageData>;
|
|
1797
|
+
private static decodePng;
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1493
1800
|
type SkinTextureCoordinates = Record<SkinPart, ModelFaces>;
|
|
1494
1801
|
declare const classicSkinTextureCoordinates: Readonly<SkinTextureCoordinates>;
|
|
1495
1802
|
declare const slimSkinTextureCoordinates: Readonly<SkinTextureCoordinates>;
|
|
1496
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
|
+
|
|
1497
1818
|
declare class Skins {
|
|
1498
1819
|
static fromUuidOrUsername(uuidOrUsername: string): Promise<Maybe<string>>;
|
|
1499
1820
|
static fromUuid(uuid: string): Promise<Maybe<string>>;
|
|
@@ -1502,8 +1823,11 @@ declare class Skins {
|
|
|
1502
1823
|
static capeFromUuidOrUsername(uuidOrUsername: string): Promise<Maybe<string>>;
|
|
1503
1824
|
static capeFromUuid(uuid: string): Promise<Maybe<string>>;
|
|
1504
1825
|
static capeFromUsername(username: string): Promise<Maybe<string>>;
|
|
1505
|
-
static
|
|
1826
|
+
/** Returns a full static cape texture for a username or UUID. */
|
|
1827
|
+
static capeFromCapesDev(player: string, capeType?: string): Promise<Maybe<string>>;
|
|
1506
1828
|
private static usernameToUuid;
|
|
1829
|
+
private static usernameToUuidMcProxy;
|
|
1830
|
+
/** @deprecated **/
|
|
1507
1831
|
private static usernameToUuidSkinProxy;
|
|
1508
1832
|
private static usernameToUuidMineTools;
|
|
1509
1833
|
private static getProfileFromMinetools;
|
|
@@ -1513,8 +1837,12 @@ declare class Skins {
|
|
|
1513
1837
|
private static getCrafatarCapeUrl;
|
|
1514
1838
|
private static getMcHeadsSkinUrl;
|
|
1515
1839
|
private static getMineSkinPlayerSkinUrl;
|
|
1840
|
+
/** @deprecated **/
|
|
1516
1841
|
private static getSkinProxySkinUrl;
|
|
1842
|
+
/** @deprecated **/
|
|
1517
1843
|
private static getSkinProxyCapeUrl;
|
|
1844
|
+
private static getMcProxySkinUrl;
|
|
1845
|
+
private static getMcProxyCapeUrl;
|
|
1518
1846
|
}
|
|
1519
1847
|
|
|
1520
1848
|
declare class TextureLoader {
|
|
@@ -1542,61 +1870,155 @@ declare function mergeVertices(geometry: BufferGeometry, tolerance?: number): Bu
|
|
|
1542
1870
|
declare function toTrianglesDrawMode(geometry: BufferGeometry, drawMode: TrianglesDrawModes): BufferGeometry;
|
|
1543
1871
|
declare function computeMorphedAttributes(object: Mesh | Line | Points): object;
|
|
1544
1872
|
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
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;
|
|
1548
1950
|
}
|
|
1549
1951
|
|
|
1550
|
-
declare class Chunk {
|
|
1952
|
+
declare class Chunk<SectionMeshing extends boolean = false> {
|
|
1953
|
+
private readonly onBlocksChanged?;
|
|
1954
|
+
private readonly sectionModels?;
|
|
1551
1955
|
readonly scene: MineRenderScene;
|
|
1552
1956
|
readonly x: number;
|
|
1553
1957
|
readonly y: number;
|
|
1554
1958
|
readonly z: number;
|
|
1555
|
-
private readonly
|
|
1556
|
-
private readonly
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
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>>;
|
|
1561
1968
|
/**
|
|
1562
1969
|
* Set block at a _world_ position
|
|
1563
1970
|
*/
|
|
1564
|
-
setBlockAt(x: number, y: number, z: number, block: Maybe<Block>): Promise<Maybe<BlockInfo
|
|
1565
|
-
setBlockAt(pos: Vector3, block: Maybe<Block>): Promise<Maybe<BlockInfo
|
|
1566
|
-
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>>>;
|
|
1567
1974
|
/**
|
|
1568
|
-
* Set block at
|
|
1975
|
+
* Set a block at integer chunk-local coordinates from 0 to 15.
|
|
1569
1976
|
*/
|
|
1570
|
-
setBlockInChunkAt(pos: Vector3, block?: Block, worldPos?: Vector3): Promise<Maybe<BlockInfo
|
|
1571
|
-
|
|
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>;
|
|
1572
1982
|
dispose(): Promise<void>;
|
|
1983
|
+
static isAir(block: Maybe<Block>): boolean;
|
|
1573
1984
|
static chunkPosToBlockIndex(pos: Vector3): number;
|
|
1574
1985
|
worldPosToChunkPos(pos: Vector3): Vector3;
|
|
1575
1986
|
chunkPosToWorldPos(pos: Vector3): Vector3;
|
|
1576
1987
|
}
|
|
1577
1988
|
|
|
1578
|
-
declare class MineRenderWorld {
|
|
1989
|
+
declare class MineRenderWorld<SectionMeshing extends boolean = false> {
|
|
1579
1990
|
readonly scene: MineRenderScene;
|
|
1580
|
-
private _size;
|
|
1581
|
-
private _blockSize;
|
|
1582
1991
|
private readonly _chunks;
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
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;
|
|
1590
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>;
|
|
1591
2007
|
clear(): Promise<void>;
|
|
2008
|
+
private updateCulling;
|
|
1592
2009
|
private getOrCreateChunkAt;
|
|
1593
|
-
getChunkAt(pos: Vector3): Maybe<Chunk
|
|
2010
|
+
getChunkAt(pos: Vector3): Maybe<Chunk<SectionMeshing>>;
|
|
1594
2011
|
static worldToScenePosition(pos: Vector3): Vector3;
|
|
1595
2012
|
static sceneToWorldPosition(pos: Vector3): Vector3;
|
|
1596
|
-
worldPosToChunkIndex(pos: Vector3): number;
|
|
1597
2013
|
worldPosToChunkKey(pos: Vector3): string;
|
|
1598
2014
|
validatePosBounds(pos: Vector3): void;
|
|
1599
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
|
+
}
|
|
1600
2022
|
|
|
1601
2023
|
/**
|
|
1602
2024
|
* {@link EnvProvider} for headless Node.
|
|
@@ -1636,4 +2058,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
|
|
|
1636
2058
|
forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
|
|
1637
2059
|
}
|
|
1638
2060
|
|
|
1639
|
-
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 };
|