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