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