minerender 2.1.0-beta.0 → 2.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/browser/index.d.mts +523 -51
- package/dist/browser/index.d.ts +523 -51
- package/dist/browser/index.js +2799 -947
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +2723 -875
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +29992 -18666
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +523 -51
- package/dist/node/index.d.ts +523 -51
- package/dist/node/index.js +2808 -938
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +2718 -865
- package/dist/node/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/browser/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as three 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';
|
|
2
|
+
import { Vector3, PixelFormat, BoxGeometry, Material, ColorRepresentation, MeshBasicMaterial, Mesh, Euler, Vector2, BufferAttribute, Float32BufferAttribute, BufferGeometry, Object3D, Box3, InstancedMesh, PerspectiveCamera, OrthographicCamera, Matrix4, Box2, Scene, Object3DEventMap, Texture, Camera, MOUSE, TOUCH, WebGLRenderer, EventDispatcher, Raycaster, Intersection, DataTexture, 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
5
|
import { Buffer } from 'buffer';
|
|
@@ -199,11 +199,97 @@ interface ListAsset extends MinecraftAsset {
|
|
|
199
199
|
files: string[];
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
+
interface EntityLayer {
|
|
203
|
+
key: BasicAssetKey;
|
|
204
|
+
texture?: AssetKey;
|
|
205
|
+
layer: EntityModelLayer;
|
|
206
|
+
/** How this draw is rendered; defaults to the geometry layer's own mode, then `cutout`. */
|
|
207
|
+
render?: EntityRenderMode;
|
|
208
|
+
/** Label of the state colour that multiplies the texture, from the pass that selected this draw. */
|
|
209
|
+
tint?: string;
|
|
210
|
+
}
|
|
211
|
+
interface EntityModel extends EntityLayer {
|
|
212
|
+
id: string;
|
|
213
|
+
/** Root transform from the dataset; see {@link EntityTransformOp}. */
|
|
214
|
+
transform?: EntityTransformOp[];
|
|
215
|
+
/**
|
|
216
|
+
* Selected draws in draw order; the top-level fields describe the first selection.
|
|
217
|
+
* A key is the geometry layer's name; a further draw of the same geometry (a pass with another texture) is keyed `<layer>#<n>`, from 2.
|
|
218
|
+
*/
|
|
219
|
+
layers?: Record<string, EntityLayer>;
|
|
220
|
+
}
|
|
221
|
+
interface EntityModelFile extends MinecraftAsset {
|
|
222
|
+
id: string;
|
|
223
|
+
transform?: EntityTransformOp[];
|
|
224
|
+
layers: Record<string, EntityModelLayer>;
|
|
225
|
+
/** Extra draws vanilla adds on top of `main`, in draw order. */
|
|
226
|
+
passes?: EntityModelPass[];
|
|
227
|
+
}
|
|
228
|
+
/** Vanilla render type of a draw; see the dataset README for the mode table. */
|
|
229
|
+
type EntityRenderMode = "cutout" | "cutout_cull" | "cutout_z_offset" | "solid" | "translucent" | "translucent_emissive" | "eyes" | "energy_swirl" | "breeze_wind" | "water_mask";
|
|
230
|
+
interface EntityModelPass {
|
|
231
|
+
/** Geometry layer of the same file; a pass on `main` draws that geometry again. */
|
|
232
|
+
layer: string;
|
|
233
|
+
/** Present only when it differs from the layer's own. */
|
|
234
|
+
textureLocation?: string;
|
|
235
|
+
/** Present only when it differs from the layer's own. */
|
|
236
|
+
render?: EntityRenderMode;
|
|
237
|
+
/** Entity state that enables the draw, e.g. `powered`; without it the pass is always drawn. */
|
|
238
|
+
when?: string;
|
|
239
|
+
/** State colour that multiplies the texture, e.g. `wool_color`. */
|
|
240
|
+
tint?: string;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* One operation vanilla's renderer applies before drawing a model, in call order:
|
|
244
|
+
* each one is applied on top of the previous, so the last reaches the vertices first.
|
|
245
|
+
* Translations use model units and rotations use radians, like part poses.
|
|
246
|
+
*/
|
|
247
|
+
type EntityTransformOp = {
|
|
248
|
+
scale: [number, number, number];
|
|
249
|
+
} | {
|
|
250
|
+
translate: [number, number, number];
|
|
251
|
+
} | {
|
|
252
|
+
rotate: [number, number, number];
|
|
253
|
+
};
|
|
254
|
+
interface EntityModelLayer {
|
|
255
|
+
texture: [number, number];
|
|
256
|
+
textureLocation?: string;
|
|
257
|
+
/** Omitted for `cutout`. */
|
|
258
|
+
render?: EntityRenderMode;
|
|
259
|
+
root: EntityModelPart;
|
|
260
|
+
}
|
|
261
|
+
interface EntityModelPart {
|
|
262
|
+
pose: {
|
|
263
|
+
offset: [number, number, number];
|
|
264
|
+
rotation: [number, number, number];
|
|
265
|
+
scale?: [number, number, number];
|
|
266
|
+
};
|
|
267
|
+
texture?: [number, number];
|
|
268
|
+
cubes: EntityModelCube[];
|
|
269
|
+
children: Record<string, EntityModelPart>;
|
|
270
|
+
}
|
|
271
|
+
interface EntityModelCube {
|
|
272
|
+
origin: [number, number, number];
|
|
273
|
+
size: [number, number, number];
|
|
274
|
+
uv: [number, number];
|
|
275
|
+
grow?: [number, number, number];
|
|
276
|
+
mirror?: boolean;
|
|
277
|
+
}
|
|
278
|
+
|
|
202
279
|
declare class Materials {
|
|
203
|
-
private static readonly MISSING_TEXTURE_SRC;
|
|
204
280
|
static get MISSING_TEXTURE(): Material;
|
|
205
281
|
static createImage(key: MaterialKey): Material;
|
|
206
282
|
static createBasicCanvasMaterial(canvas: HTMLCanvasElement, transparent?: boolean, shade?: boolean): Material;
|
|
283
|
+
/** Whether vanilla's render type for the mode culls back faces. */
|
|
284
|
+
static entityModeCulls(mode?: EntityRenderMode): boolean;
|
|
285
|
+
/** UV offset per tick of entity age for the scrolling modes, as vanilla's texture matrix applies it. */
|
|
286
|
+
static entityModeScroll(mode?: EntityRenderMode): [number, number] | undefined;
|
|
287
|
+
/**
|
|
288
|
+
* Entity material for one of vanilla's render types. Entities are unlit here, so the lit and full-bright modes
|
|
289
|
+
* differ only in blending and depth state. Culling is not a material property: {@link entityModeCulls} decides
|
|
290
|
+
* whether the geometry gets inward faces.
|
|
291
|
+
*/
|
|
292
|
+
static createEntityCanvasMaterial(canvas: HTMLCanvasElement, mode?: EntityRenderMode, tint?: ColorRepresentation): MeshBasicMaterial;
|
|
207
293
|
static createGuiCanvasMaterial(canvas: HTMLCanvasElement): MeshBasicMaterial;
|
|
208
294
|
static createShadedCanvasMaterial(canvas: HTMLCanvasElement, transparent?: boolean, shade?: boolean): Material;
|
|
209
295
|
static getImage(key: MaterialKey): Material;
|
|
@@ -360,7 +446,38 @@ interface BlockModel extends Model {
|
|
|
360
446
|
interface ItemModel extends Model {
|
|
361
447
|
textures?: ItemModelTextures;
|
|
362
448
|
gui_light?: GuiLight;
|
|
449
|
+
special?: SpecialItemRenderer;
|
|
450
|
+
tints?: ItemTintSource[];
|
|
363
451
|
}
|
|
452
|
+
type ItemTintColor = number | TripleArray;
|
|
453
|
+
type ItemTintSource = {
|
|
454
|
+
type: "constant" | "minecraft:constant";
|
|
455
|
+
value: ItemTintColor;
|
|
456
|
+
} | {
|
|
457
|
+
type: "grass" | "minecraft:grass";
|
|
458
|
+
temperature: number;
|
|
459
|
+
downfall: number;
|
|
460
|
+
} | {
|
|
461
|
+
type: "dye" | "minecraft:dye" | "potion" | "minecraft:potion" | "map_color" | "minecraft:map_color" | "firework" | "minecraft:firework" | "team" | "minecraft:team";
|
|
462
|
+
default: ItemTintColor;
|
|
463
|
+
} | {
|
|
464
|
+
type: "custom_model_data" | "minecraft:custom_model_data";
|
|
465
|
+
index?: number;
|
|
466
|
+
default: ItemTintColor;
|
|
467
|
+
};
|
|
468
|
+
type SpecialItemRenderer = {
|
|
469
|
+
type: "chest" | "minecraft:chest";
|
|
470
|
+
texture: string;
|
|
471
|
+
openness?: number;
|
|
472
|
+
} | {
|
|
473
|
+
type: "bed" | "minecraft:bed";
|
|
474
|
+
texture: string;
|
|
475
|
+
} | {
|
|
476
|
+
type: "head" | "minecraft:head";
|
|
477
|
+
kind: string;
|
|
478
|
+
texture?: string;
|
|
479
|
+
animation?: number;
|
|
480
|
+
};
|
|
364
481
|
interface TextureAsset extends MinecraftAsset, ImageInfo {
|
|
365
482
|
}
|
|
366
483
|
interface ModelDisplay {
|
|
@@ -403,8 +520,29 @@ declare class MinecraftCubeTexture {
|
|
|
403
520
|
}
|
|
404
521
|
|
|
405
522
|
interface MinecraftTextureMeta extends MinecraftAsset {
|
|
406
|
-
animation
|
|
523
|
+
animation?: AnimationMeta;
|
|
524
|
+
gui?: {
|
|
525
|
+
scaling?: GuiSpriteScaling;
|
|
526
|
+
};
|
|
407
527
|
}
|
|
528
|
+
type GuiSpriteScaling = {
|
|
529
|
+
type: "stretch";
|
|
530
|
+
} | {
|
|
531
|
+
type: "tile";
|
|
532
|
+
width: number;
|
|
533
|
+
height: number;
|
|
534
|
+
} | {
|
|
535
|
+
type: "nine_slice";
|
|
536
|
+
width: number;
|
|
537
|
+
height: number;
|
|
538
|
+
border: number | {
|
|
539
|
+
left: number;
|
|
540
|
+
top: number;
|
|
541
|
+
right: number;
|
|
542
|
+
bottom: number;
|
|
543
|
+
};
|
|
544
|
+
stretch_inner?: boolean;
|
|
545
|
+
};
|
|
408
546
|
interface AnimationMeta {
|
|
409
547
|
interpolate: boolean;
|
|
410
548
|
width: number;
|
|
@@ -603,7 +741,7 @@ declare function applyElementRotation(rotation: ElementRotation, geometry: Buffe
|
|
|
603
741
|
declare function applyGenericRotation(axis: Axis, rotation: number, obj: Object3D): void;
|
|
604
742
|
declare function addBox3WireframeToObject(box: Box3, obj: Object3D, color?: number, w?: number): void;
|
|
605
743
|
declare function addWireframeToObject(obj: Object3D, color?: number, w?: number): void;
|
|
606
|
-
declare function addWireframeToMesh(geo: BufferGeometry, mesh: Mesh, color?: number, w?: number): void;
|
|
744
|
+
declare function addWireframeToMesh(geo: BufferGeometry, mesh: Mesh, color?: number, w?: number): () => void;
|
|
607
745
|
|
|
608
746
|
declare function captureException(e: any, ...extra: any[]): void;
|
|
609
747
|
declare function timingStart(marker: string): void;
|
|
@@ -720,6 +858,55 @@ type BlockStateProperties = {
|
|
|
720
858
|
[key: string]: string;
|
|
721
859
|
};
|
|
722
860
|
|
|
861
|
+
/** One model drawn by a block-entity renderer. */
|
|
862
|
+
interface BlockEntityPart {
|
|
863
|
+
model: string;
|
|
864
|
+
/** Model layer; defaults to "main". */
|
|
865
|
+
layer?: string;
|
|
866
|
+
/** Set only when the texture differs from the layer's default. */
|
|
867
|
+
textureLocation?: string;
|
|
868
|
+
/** Blockstate multipart syntax: every property must match, and "a|b" matches either value. */
|
|
869
|
+
when?: Record<string, string>;
|
|
870
|
+
}
|
|
871
|
+
/** Degrees per property value, or degrees per unit of a numeric property. */
|
|
872
|
+
type BlockEntityRotation = {
|
|
873
|
+
property: string;
|
|
874
|
+
degrees: Record<string, number>;
|
|
875
|
+
} | {
|
|
876
|
+
property: string;
|
|
877
|
+
step: number;
|
|
878
|
+
};
|
|
879
|
+
interface BlockEntityEntry {
|
|
880
|
+
parts: BlockEntityPart[];
|
|
881
|
+
rotation?: BlockEntityRotation;
|
|
882
|
+
/** Offset in model units, applied before the rotation. */
|
|
883
|
+
translation?: TripleArray;
|
|
884
|
+
}
|
|
885
|
+
/** The dataset's `blocks.json`: block ID to the models its block-entity renderer draws. */
|
|
886
|
+
type BlockEntityIndex = MinecraftAsset & {
|
|
887
|
+
[block: string]: BlockEntityEntry;
|
|
888
|
+
};
|
|
889
|
+
interface ResolvedBlockEntity {
|
|
890
|
+
parts: BlockEntityPart[];
|
|
891
|
+
/** Degrees counter-clockwise seen from above, about the block's vertical centre axis. */
|
|
892
|
+
rotation: number;
|
|
893
|
+
translation: TripleArray;
|
|
894
|
+
}
|
|
895
|
+
declare class BlockEntities {
|
|
896
|
+
/**
|
|
897
|
+
* Loads the block index of a version. Versions and sources without one yield an empty index, and so does
|
|
898
|
+
* a failed load: the index is optional, and blocks must not retry or fail with it one by one. The empty
|
|
899
|
+
* result is cached like any other; `Caching.clear()` or `AssetLoader.setVersion()` forces a new attempt.
|
|
900
|
+
*/
|
|
901
|
+
static getIndex(root?: string): Promise<BlockEntityIndex>;
|
|
902
|
+
/** The index entry of a block ID such as `minecraft:chest`. */
|
|
903
|
+
static entry(index: BlockEntityIndex, block: string): Maybe<BlockEntityEntry>;
|
|
904
|
+
/** Selects the parts and placement for a block ID such as `minecraft:chest`; undefined when nothing is drawn. */
|
|
905
|
+
static resolve(index: BlockEntityIndex, block: string, state?: BlockStateProperties): Maybe<ResolvedBlockEntity>;
|
|
906
|
+
/** Placement in block space (0..16 per axis), applied on top of the model's own transform. */
|
|
907
|
+
static matrix(resolved: ResolvedBlockEntity, matrix?: Matrix4): Matrix4;
|
|
908
|
+
}
|
|
909
|
+
|
|
723
910
|
declare class BlockStates {
|
|
724
911
|
private static _persistentCache;
|
|
725
912
|
private static get PERSISTENT_CACHE();
|
|
@@ -734,48 +921,57 @@ declare class DefaultBlockStates implements MinecraftAsset {
|
|
|
734
921
|
[k: string]: BlockStatePropertyDefaults;
|
|
735
922
|
}
|
|
736
923
|
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
texture?: AssetKey;
|
|
740
|
-
layer: EntityModelLayer;
|
|
741
|
-
}
|
|
742
|
-
interface EntityModel extends EntityLayer {
|
|
924
|
+
/** `entity-models/animations/<namespace>/<model id>.json`: native and sampled vanilla animation clips. */
|
|
925
|
+
interface EntityAnimationFile extends MinecraftAsset {
|
|
743
926
|
id: string;
|
|
744
|
-
|
|
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];
|
|
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;
|
|
927
|
+
animations: Record<string, EntityAnimation>;
|
|
772
928
|
}
|
|
929
|
+
interface EntityAnimation {
|
|
930
|
+
/** Seconds. */
|
|
931
|
+
length: number;
|
|
932
|
+
loop: boolean;
|
|
933
|
+
/** Geometry layer targeted by this clip; defaults to `main`. */
|
|
934
|
+
layer?: string;
|
|
935
|
+
/** Part name anywhere in a layer; `root` is the layer's root part. */
|
|
936
|
+
bones: Record<string, EntityAnimationBone>;
|
|
937
|
+
}
|
|
938
|
+
type EntityAnimationChannel = "position" | "rotation" | "scale";
|
|
939
|
+
/** Keyframes in time order per channel. */
|
|
940
|
+
type EntityAnimationBone = Partial<Record<EntityAnimationChannel, EntityAnimationKeyframe[]>>;
|
|
941
|
+
interface EntityAnimationKeyframe {
|
|
942
|
+
/** Seconds. */
|
|
943
|
+
time: number;
|
|
944
|
+
/** Offset from the default pose: model units, radians, or scale minus one. */
|
|
945
|
+
value: TripleArray;
|
|
946
|
+
/** Value to arrive at when it differs from `value`; linear interpolation only. */
|
|
947
|
+
pre?: TripleArray;
|
|
948
|
+
/** Applies between the previous keyframe and this one. */
|
|
949
|
+
interpolation: "linear" | "catmullrom";
|
|
950
|
+
}
|
|
951
|
+
/** Sampled offsets from the default pose, per bone and channel. */
|
|
952
|
+
type EntityAnimationPose = Record<string, Partial<Record<EntityAnimationChannel, TripleArray>>>;
|
|
953
|
+
declare const ENTITY_ANIMATION_CHANNELS: readonly EntityAnimationChannel[];
|
|
954
|
+
/**
|
|
955
|
+
* Samples one channel like vanilla's `KeyframeAnimation.Entry`: the first value holds before the
|
|
956
|
+
* first keyframe and the last value after the last one; in between, the later keyframe selects the interpolation.
|
|
957
|
+
*/
|
|
958
|
+
declare function sampleEntityKeyframes(keyframes: readonly EntityAnimationKeyframe[], time: number): TripleArray;
|
|
959
|
+
/** Elapsed seconds within the animation: modulo `length` when looping, as vanilla does. */
|
|
960
|
+
declare function entityAnimationTime(animation: EntityAnimation, time: number, loop?: boolean): number;
|
|
961
|
+
/** Samples every bone and channel of an animation at `time` seconds. */
|
|
962
|
+
declare function sampleEntityAnimation(animation: EntityAnimation, time: number, loop?: boolean): EntityAnimationPose;
|
|
773
963
|
|
|
774
964
|
declare class Entities {
|
|
775
965
|
static getEntityList(): Promise<string[]>;
|
|
776
966
|
private static getModelFile;
|
|
777
967
|
static getLayerList(modelKey: BasicAssetKey): Promise<string[]>;
|
|
968
|
+
/** The dataset's extra draws on top of `main`; their `when` labels are the states `EntityModelOptions.when` can enable. */
|
|
969
|
+
static getPassList(modelKey: BasicAssetKey): Promise<EntityModelPass[]>;
|
|
778
970
|
static getEntity(modelKey: BasicAssetKey, textureKey?: BasicAssetKey, options?: EntityModelOptions): Promise<Maybe<EntityModel>>;
|
|
971
|
+
/**
|
|
972
|
+
* Native and sampled vanilla clips by name, or undefined when the model or selected version has none.
|
|
973
|
+
*/
|
|
974
|
+
static getAnimations(modelKey: BasicAssetKey): Promise<Maybe<Record<string, EntityAnimation>>>;
|
|
779
975
|
static resolveTexture(modelKey: BasicAssetKey): Promise<Maybe<AssetKey>>;
|
|
780
976
|
/** @deprecated Use getEntityList(); block entities share the entity dataset. */
|
|
781
977
|
static getBlockList(): Promise<string[]>;
|
|
@@ -784,12 +980,38 @@ declare class Entities {
|
|
|
784
980
|
}
|
|
785
981
|
interface EntityModelOptions {
|
|
786
982
|
layer?: string;
|
|
787
|
-
/** Layer names in draw order;
|
|
983
|
+
/** Layer names in draw order; an explicit selection draws exactly these layers and no dataset passes. */
|
|
788
984
|
layers?: string[];
|
|
789
|
-
/**
|
|
985
|
+
/**
|
|
986
|
+
* Entity states that enable the dataset's conditional passes, e.g. `["powered"]` for a charged creeper.
|
|
987
|
+
* Without `layer`/`layers`, `main` and every unconditional pass are always drawn.
|
|
988
|
+
*/
|
|
989
|
+
when?: string[];
|
|
990
|
+
/** Per-layer texture overrides, keyed like `EntityModel.layers`. The positional texture key applies to the first selected layer. */
|
|
790
991
|
textures?: Record<string, BasicAssetKey>;
|
|
791
992
|
}
|
|
792
993
|
|
|
994
|
+
interface BitmapGlyph {
|
|
995
|
+
image?: CompatCanvas;
|
|
996
|
+
/** Source rectangle in the bitmap sheet, before applying scale. */
|
|
997
|
+
x: number;
|
|
998
|
+
y: number;
|
|
999
|
+
width: number;
|
|
1000
|
+
height: number;
|
|
1001
|
+
scale: number;
|
|
1002
|
+
ascent: number;
|
|
1003
|
+
advance: number;
|
|
1004
|
+
}
|
|
1005
|
+
interface BitmapFont {
|
|
1006
|
+
glyphs: Map<string, BitmapGlyph>;
|
|
1007
|
+
}
|
|
1008
|
+
declare class Fonts {
|
|
1009
|
+
static get(key?: AssetKey | string): Promise<BitmapFont>;
|
|
1010
|
+
private static relatedKey;
|
|
1011
|
+
private static load;
|
|
1012
|
+
private static bitmap;
|
|
1013
|
+
}
|
|
1014
|
+
|
|
793
1015
|
declare class Models {
|
|
794
1016
|
private static _persistentCache;
|
|
795
1017
|
private static get PERSISTENT_CACHE();
|
|
@@ -811,6 +1033,12 @@ declare class DisplayTransforms {
|
|
|
811
1033
|
static apply(geometry: BufferGeometry, matrix: Matrix4): void;
|
|
812
1034
|
}
|
|
813
1035
|
|
|
1036
|
+
declare class ItemTints {
|
|
1037
|
+
/** Resolves preview colors from item definitions; explicit per-index colors take precedence. */
|
|
1038
|
+
static get(model: Model, tints?: Record<number, number>): Promise<Record<number, number> | undefined>;
|
|
1039
|
+
private static rgb;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
814
1042
|
declare class ModelCulling {
|
|
815
1043
|
static toLocalMask(worldMask: number, rotation: Euler): number;
|
|
816
1044
|
static isOpaqueFullCube(atlas: Maybe<TextureAtlas>): boolean;
|
|
@@ -830,6 +1058,18 @@ declare class ModelMerger {
|
|
|
830
1058
|
protected static collectAllParents(model: Model): Promise<Model[]>;
|
|
831
1059
|
}
|
|
832
1060
|
|
|
1061
|
+
interface SpecialItemPart {
|
|
1062
|
+
model: EntityModel;
|
|
1063
|
+
transform: Matrix4;
|
|
1064
|
+
rotations: Record<string, TripleArray>;
|
|
1065
|
+
}
|
|
1066
|
+
declare class SpecialItems {
|
|
1067
|
+
/** Resolves the static entity parts drawn by a special item renderer, in model units. */
|
|
1068
|
+
static getParts(special: SpecialItemRenderer, root?: string): Promise<SpecialItemPart[]>;
|
|
1069
|
+
/** An owned material with model-preview shading; its entity texture remains shared. */
|
|
1070
|
+
static createMaterial(source: MeshBasicMaterial, shade: boolean): MeshBasicMaterial;
|
|
1071
|
+
}
|
|
1072
|
+
|
|
833
1073
|
interface Block {
|
|
834
1074
|
type: string;
|
|
835
1075
|
properties?: BlockStateProperties;
|
|
@@ -847,7 +1087,6 @@ declare class BlockStateResolver {
|
|
|
847
1087
|
declare class BlockTints {
|
|
848
1088
|
/** Resolves block preview colors without biome context; explicit tints take precedence. */
|
|
849
1089
|
static get(key: AssetKey | undefined, state: BlockStateProperties, model: Model, tints?: Record<number, number>): Promise<Record<number, number> | undefined>;
|
|
850
|
-
private static grassColor;
|
|
851
1090
|
}
|
|
852
1091
|
|
|
853
1092
|
interface Instanceable {
|
|
@@ -856,6 +1095,7 @@ interface Instanceable {
|
|
|
856
1095
|
isInstanceActive(index: number, reference: InstanceReference<Instanceable>): boolean;
|
|
857
1096
|
getMatrixAt(index: number, matrix?: Matrix4): Matrix4;
|
|
858
1097
|
setMatrixAt(index: number, matrix: Matrix4): void;
|
|
1098
|
+
setInstanceVisibleAt(index: number, visible: boolean): void;
|
|
859
1099
|
setPositionRotationScaleAt(index: number, position?: Vector3, rotation?: Euler, scale?: Vector3): void;
|
|
860
1100
|
setPositionAt(index: number, position: Vector3): void;
|
|
861
1101
|
getPositionAt(index: number, vector?: Vector3): Vector3;
|
|
@@ -877,6 +1117,7 @@ declare class InstanceReference<T extends Instanceable> implements Transformable
|
|
|
877
1117
|
dispose(): void;
|
|
878
1118
|
getMatrix(matrix?: Matrix4): Matrix4;
|
|
879
1119
|
setMatrix(matrix: Matrix4): void;
|
|
1120
|
+
setVisible(visible: boolean): void;
|
|
880
1121
|
setPositionRotationScale(position?: Vector3, rotation?: Euler, scale?: Vector3): void;
|
|
881
1122
|
setPosition(position: Vector3): void;
|
|
882
1123
|
getPosition(): Vector3;
|
|
@@ -903,6 +1144,7 @@ declare class ModelObject extends SceneObject {
|
|
|
903
1144
|
private atlasMaterial?;
|
|
904
1145
|
private atlasTexture?;
|
|
905
1146
|
private unsubscribeAtlas?;
|
|
1147
|
+
private readonly specialMaterials;
|
|
906
1148
|
blockParent: Maybe<BlockObject>;
|
|
907
1149
|
private meshesCreated;
|
|
908
1150
|
constructor(originalModel: Model, options?: Partial<ModelObjectOptions>);
|
|
@@ -990,15 +1232,84 @@ interface SkinObjectOptions extends SceneObjectOptions {
|
|
|
990
1232
|
legacy?: boolean;
|
|
991
1233
|
}
|
|
992
1234
|
|
|
1235
|
+
interface EntityAnimationOptions {
|
|
1236
|
+
/** Overrides the animation's own `loop` flag. */
|
|
1237
|
+
loop?: boolean;
|
|
1238
|
+
/** Playback rate applied to advanced time; defaults to 1. */
|
|
1239
|
+
speed?: number;
|
|
1240
|
+
/** Start time in seconds; defaults to 0. */
|
|
1241
|
+
time?: number;
|
|
1242
|
+
}
|
|
1243
|
+
/**
|
|
1244
|
+
* Poses part groups from a keyframe animation the way vanilla does: every update restores the
|
|
1245
|
+
* default pose of each animated part, then adds the sampled offsets to its position, Euler angles and scale.
|
|
1246
|
+
* It owns no timer; the owner advances it.
|
|
1247
|
+
*/
|
|
1248
|
+
declare class EntityAnimationPlayer {
|
|
1249
|
+
private parts;
|
|
1250
|
+
private _animation?;
|
|
1251
|
+
private _time;
|
|
1252
|
+
private loop;
|
|
1253
|
+
private speed;
|
|
1254
|
+
get animation(): EntityAnimation | undefined;
|
|
1255
|
+
get time(): number;
|
|
1256
|
+
/**
|
|
1257
|
+
* Starts an animation on matching named parts. Supplied baked poses are the baseline for offsets;
|
|
1258
|
+
* without them, the current pose is used. Stopping restores the pose from before playback.
|
|
1259
|
+
*/
|
|
1260
|
+
play(layers: Object3D[], animation: EntityAnimation, options?: EntityAnimationOptions, poses?: ReadonlyMap<Object3D, EntityModelPart["pose"]>): void;
|
|
1261
|
+
/** Restores the poses from before playback. Returns whether an animation was active. */
|
|
1262
|
+
stop(): boolean;
|
|
1263
|
+
/** Forgets the animation without touching the parts, for parts that no longer exist. */
|
|
1264
|
+
clear(): void;
|
|
1265
|
+
setTime(seconds: number): boolean;
|
|
1266
|
+
advance(deltaSeconds: number): boolean;
|
|
1267
|
+
private apply;
|
|
1268
|
+
}
|
|
1269
|
+
|
|
993
1270
|
declare class EntityObject extends SceneObject {
|
|
994
1271
|
readonly entity: EntityModel;
|
|
995
1272
|
readonly isEntityObject: true;
|
|
996
1273
|
static readonly DEFAULT_OPTIONS: EntityObjectOptions;
|
|
997
1274
|
readonly options: EntityObjectOptions;
|
|
998
1275
|
private meshesCreated;
|
|
1276
|
+
private readonly geometries;
|
|
1277
|
+
private readonly disposeWireframes;
|
|
1278
|
+
/** Scrolling materials are owned: their texture offset follows this entity's age. */
|
|
1279
|
+
private readonly scrollMaterials;
|
|
1280
|
+
private scrollTicker;
|
|
1281
|
+
/** Entity age in ticks, as vanilla's `ageInTicks`; drives the scrolling render modes. */
|
|
1282
|
+
age: number;
|
|
1283
|
+
private readonly animationPlayers;
|
|
1284
|
+
private readonly partPoses;
|
|
999
1285
|
constructor(entity: EntityModel, options?: Partial<EntityObjectOptions>);
|
|
1000
1286
|
init(): Promise<void>;
|
|
1001
1287
|
dispose(): void;
|
|
1288
|
+
disposeAndRemoveAllChildren(): void;
|
|
1289
|
+
private clearScrollMaterials;
|
|
1290
|
+
private updateScrollSubscription;
|
|
1291
|
+
/** Applies the entity age to the scrolling materials; the ticker calls this 20 times per second. */
|
|
1292
|
+
private updateScroll;
|
|
1293
|
+
/** The first active clip, until playback is stopped or the object is disposed. */
|
|
1294
|
+
get animation(): Maybe<EntityAnimation>;
|
|
1295
|
+
/** Clips playing together, each targeting a separate geometry layer. */
|
|
1296
|
+
get activeAnimations(): readonly EntityAnimation[];
|
|
1297
|
+
/** Seconds since the animation started, before looping. */
|
|
1298
|
+
get animationTime(): number;
|
|
1299
|
+
/**
|
|
1300
|
+
* Plays a clip from {@link Entities.getAnimations}, replacing all active clips.
|
|
1301
|
+
* Offsets apply to the baked pose in the clip's layer (`main` by default), including repeated draws of that layer.
|
|
1302
|
+
* The object owns no clock: call {@link advanceAnimation} per frame, or {@link setAnimationTime}.
|
|
1303
|
+
*/
|
|
1304
|
+
playAnimation(animation: EntityAnimation, options?: EntityAnimationOptions): void;
|
|
1305
|
+
/** Plays one clip per selected geometry layer, with a shared clock and no blending between clips. */
|
|
1306
|
+
playAnimations(animations: readonly EntityAnimation[], options?: EntityAnimationOptions): void;
|
|
1307
|
+
/** Stops all clips and restores the poses from before playback. */
|
|
1308
|
+
stopAnimation(): void;
|
|
1309
|
+
/** Poses the object at an explicit time in seconds. Has no effect without an animation. */
|
|
1310
|
+
setAnimationTime(seconds: number): void;
|
|
1311
|
+
/** Advances the animation by a frame delta in seconds, scaled by its speed. Has no effect without an animation. */
|
|
1312
|
+
advanceAnimation(deltaSeconds: number): void;
|
|
1002
1313
|
getLayerGroup(name: string): Maybe<Object3D>;
|
|
1003
1314
|
getGroupByName(name: string, layerName?: string): Maybe<Object3D>;
|
|
1004
1315
|
getMeshByName(name: string, layerName?: string): Maybe<Mesh>;
|
|
@@ -1010,21 +1321,82 @@ declare class EntityObject extends SceneObject {
|
|
|
1010
1321
|
protected applyTextures(): Promise<void>;
|
|
1011
1322
|
}
|
|
1012
1323
|
interface EntityObjectOptions extends SceneObjectOptions {
|
|
1324
|
+
/**
|
|
1325
|
+
* `true` applies only vanilla's entity flip, scale (-1, -1, 1); `false` keeps raw model space.
|
|
1326
|
+
* By default the model's dataset transform is used, or the flip for models without one.
|
|
1327
|
+
*/
|
|
1013
1328
|
flip?: boolean;
|
|
1329
|
+
/** Colours for the dataset's tint labels, e.g. `{ wool_color: 0xf9801d }`; a pass whose label is absent stays untinted. */
|
|
1330
|
+
tints?: Record<string, ColorRepresentation>;
|
|
1014
1331
|
}
|
|
1015
1332
|
declare function isEntityObject(obj: any): obj is EntityObject;
|
|
1016
1333
|
|
|
1017
|
-
|
|
1018
|
-
|
|
1334
|
+
interface GuiTextStyle {
|
|
1335
|
+
/** sRGB 0xRRGGBB; defaults to white. */
|
|
1336
|
+
color?: number;
|
|
1337
|
+
bold?: boolean;
|
|
1338
|
+
italic?: boolean;
|
|
1339
|
+
}
|
|
1340
|
+
interface GuiTextRun extends GuiTextStyle {
|
|
1341
|
+
text: string;
|
|
1342
|
+
}
|
|
1343
|
+
/** Literal text, or styled runs. Newlines are preserved. */
|
|
1344
|
+
type GuiText = string | readonly GuiTextRun[];
|
|
1345
|
+
interface GuiTextOptions extends GuiTextStyle {
|
|
1346
|
+
/** Font resource ID; defaults to minecraft:default. */
|
|
1347
|
+
font?: AssetKey | string;
|
|
1348
|
+
/** Draws a one-pixel shadow; defaults to true. */
|
|
1349
|
+
shadow?: boolean;
|
|
1350
|
+
/** Wrap width in GUI pixels. Long words break at glyph boundaries. */
|
|
1351
|
+
maxWidth?: number;
|
|
1352
|
+
/** Distance between line origins; defaults to 9 GUI pixels. */
|
|
1353
|
+
lineHeight?: number;
|
|
1354
|
+
}
|
|
1355
|
+
interface PositionedGuiGlyph {
|
|
1356
|
+
character: string;
|
|
1357
|
+
glyph?: BitmapGlyph;
|
|
1358
|
+
x: number;
|
|
1359
|
+
y: number;
|
|
1360
|
+
advance: number;
|
|
1361
|
+
style: Required<GuiTextStyle>;
|
|
1362
|
+
}
|
|
1363
|
+
interface GuiTextLayout {
|
|
1364
|
+
glyphs: PositionedGuiGlyph[];
|
|
1365
|
+
lineWidths: number[];
|
|
1366
|
+
width: number;
|
|
1367
|
+
height: number;
|
|
1368
|
+
}
|
|
1369
|
+
/** Measures and wraps text using the same glyph advances used for rendering. */
|
|
1370
|
+
declare function layoutGuiText(text: GuiText, options?: GuiTextOptions): Promise<GuiTextLayout>;
|
|
1371
|
+
/** Creates glyph batches in painter order. Unsupported characters use an outlined missing glyph. */
|
|
1372
|
+
declare function createGuiTextGeometry(layout: GuiTextLayout, shadow?: boolean): {
|
|
1373
|
+
image?: CompatCanvas;
|
|
1374
|
+
geometry: BufferGeometry;
|
|
1375
|
+
}[];
|
|
1376
|
+
|
|
1377
|
+
/** GUI layers use pixel coordinates. Later layers draw above earlier layers. */
|
|
1378
|
+
type GuiLayer = GuiTextureLayer | GuiItemLayer | GuiTextLayer;
|
|
1379
|
+
interface GuiLayerLayout {
|
|
1019
1380
|
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
1381
|
/** Top-left position; x grows right and y grows down. Defaults to [0, 0]. */
|
|
1024
1382
|
position?: [number, number];
|
|
1025
|
-
/** Output
|
|
1383
|
+
/** Output size; defaults to native texture/text dimensions, and [16, 16] for items. */
|
|
1026
1384
|
size?: [number, number];
|
|
1027
1385
|
}
|
|
1386
|
+
interface GuiTextureLayer extends GuiLayerLayout {
|
|
1387
|
+
texture: AssetKey | string;
|
|
1388
|
+
/** Source-image pixels: [x, y, width, height], measured from the top left. Crops ignore sprite scaling. */
|
|
1389
|
+
crop?: [number, number, number, number];
|
|
1390
|
+
}
|
|
1391
|
+
interface GuiItemLayer extends GuiLayerLayout {
|
|
1392
|
+
/** Model key, such as minecraft:item/stone; uses the model's GUI display pose. */
|
|
1393
|
+
item: AssetKey | string;
|
|
1394
|
+
/** sRGB 0xRRGGBB colors by face tint index; omitted indices stay white. */
|
|
1395
|
+
tints?: Record<number, number>;
|
|
1396
|
+
}
|
|
1397
|
+
interface GuiTextLayer extends GuiLayerLayout, GuiTextOptions {
|
|
1398
|
+
text: GuiText;
|
|
1399
|
+
}
|
|
1028
1400
|
|
|
1029
1401
|
declare class GuiObject extends SceneObject {
|
|
1030
1402
|
readonly textureLayers: readonly GuiLayer[];
|
|
@@ -1033,9 +1405,11 @@ declare class GuiObject extends SceneObject {
|
|
|
1033
1405
|
readonly bounds: Box2;
|
|
1034
1406
|
private readonly geometries;
|
|
1035
1407
|
private readonly ownedMaterials;
|
|
1408
|
+
private readonly textMaterials;
|
|
1036
1409
|
private initialized;
|
|
1037
1410
|
constructor(textureLayers: readonly GuiLayer[], options?: Partial<GuiObjectOptions>);
|
|
1038
1411
|
init(): Promise<void>;
|
|
1412
|
+
private createItem;
|
|
1039
1413
|
private loadMaterial;
|
|
1040
1414
|
disposeAndRemoveAllChildren(): void;
|
|
1041
1415
|
}
|
|
@@ -1081,6 +1455,7 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
|
|
|
1081
1455
|
protected instanceMesh?: InstancedMesh;
|
|
1082
1456
|
private readonly instanceReferences;
|
|
1083
1457
|
private readonly freeInstanceIndices;
|
|
1458
|
+
private readonly hiddenInstanceMatrices;
|
|
1084
1459
|
constructor(options?: Partial<SceneObjectOptions>);
|
|
1085
1460
|
set scene(scene: MineRenderScene);
|
|
1086
1461
|
get scene(): MineRenderScene;
|
|
@@ -1128,6 +1503,7 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
|
|
|
1128
1503
|
protected activeInstanceIndices(): Iterable<number>;
|
|
1129
1504
|
getMatrixAt(index: number, matrix?: Matrix4): Matrix4;
|
|
1130
1505
|
setMatrixAt(index: number, matrix: Matrix4): void;
|
|
1506
|
+
setInstanceVisibleAt(index: number, visible: boolean): void;
|
|
1131
1507
|
setPositionRotationScaleAt(index: number, position?: Vector3, rotation?: Euler, scale?: Vector3): void;
|
|
1132
1508
|
setPositionAt(index: number, position: Vector3): void;
|
|
1133
1509
|
getPositionAt(index: number, vector?: Vector3): Vector3;
|
|
@@ -1183,12 +1559,26 @@ declare class BlockObject extends SceneObject {
|
|
|
1183
1559
|
private _fluidKey?;
|
|
1184
1560
|
private _fluidSampler?;
|
|
1185
1561
|
private _fluidModel?;
|
|
1562
|
+
private _entities;
|
|
1563
|
+
private _entityPlacement;
|
|
1564
|
+
private _entityGeneration;
|
|
1186
1565
|
constructor(blockState: BlockState, options?: Partial<BlockObjectOptions>);
|
|
1187
1566
|
init(): Promise<void>;
|
|
1188
1567
|
dispose(): void;
|
|
1189
1568
|
removeFromScene(): void;
|
|
1190
1569
|
private clearModels;
|
|
1191
1570
|
private removeModels;
|
|
1571
|
+
private removeEntities;
|
|
1572
|
+
/** Entity models drawn for this block instead of its block model; they are scene children, unlike the block. */
|
|
1573
|
+
get blockEntities(): readonly EntityObject[];
|
|
1574
|
+
/** Sets visibility for this block's model instances and block entities. */
|
|
1575
|
+
setVisible(visible: boolean): void;
|
|
1576
|
+
/**
|
|
1577
|
+
* Draws the block through the dataset's block-entity index. Returns false, leaving nothing behind,
|
|
1578
|
+
* when the block is not listed or one of its models cannot be loaded.
|
|
1579
|
+
*/
|
|
1580
|
+
private createBlockEntities;
|
|
1581
|
+
private placeEntities;
|
|
1192
1582
|
get isOccluding(): boolean;
|
|
1193
1583
|
private getModelMatrix;
|
|
1194
1584
|
private getModelCullMask;
|
|
@@ -1203,6 +1593,7 @@ declare class BlockObject extends SceneObject {
|
|
|
1203
1593
|
nextInstance(): InstanceReference<SceneObject>;
|
|
1204
1594
|
protected mapStateToVariant(state: BlockStateProperties): Promise<BlockStateVariant[]>;
|
|
1205
1595
|
recreateModels(): Promise<void>;
|
|
1596
|
+
private hasGeometry;
|
|
1206
1597
|
protected getSingleVariant(variants: BlockStateVariant | BlockStateVariant[]): BlockStateVariant;
|
|
1207
1598
|
protected createAVariant(variants: BlockStateVariant | BlockStateVariant[], instanceInfo: Matrix4[]): Promise<void>;
|
|
1208
1599
|
protected createVariant(variant: BlockStateVariant): Promise<ModelObject | InstanceReference<ModelObject>>;
|
|
@@ -1254,7 +1645,11 @@ interface MultiBlockBlock extends Block {
|
|
|
1254
1645
|
}
|
|
1255
1646
|
|
|
1256
1647
|
declare class SchematicParser {
|
|
1257
|
-
|
|
1648
|
+
/**
|
|
1649
|
+
* Parses a legacy schematic using custom mappings before the bundled defaults.
|
|
1650
|
+
* Keys are `id:metadata`; values are block states such as `minecraft:oak_log[axis=x]`.
|
|
1651
|
+
*/
|
|
1652
|
+
static parse(nbt: NBT, customMappings?: Readonly<Record<string, string>>): Promise<MultiBlockStructure>;
|
|
1258
1653
|
}
|
|
1259
1654
|
|
|
1260
1655
|
declare class StructureParser {
|
|
@@ -1504,6 +1899,9 @@ declare class Caching {
|
|
|
1504
1899
|
static readonly blockTintCache: AsyncLoadingCache<CacheKey, number>;
|
|
1505
1900
|
static readonly entityModelCache: AsyncLoadingCache<CacheKey, EntityModelFile>;
|
|
1506
1901
|
static readonly entityTextureCache: AsyncLoadingCache<CacheKey, AssetKey>;
|
|
1902
|
+
static readonly entityAnimationCache: AsyncLoadingCache<CacheKey, EntityAnimationFile>;
|
|
1903
|
+
static readonly blockEntityIndexCache: AsyncLoadingCache<CacheKey, BlockEntityIndex>;
|
|
1904
|
+
static readonly fontCache: AsyncLoadingCache<CacheKey, BitmapFont>;
|
|
1507
1905
|
private static createAssetCache;
|
|
1508
1906
|
/** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
|
|
1509
1907
|
private static get all();
|
|
@@ -1546,9 +1944,48 @@ declare class SceneExporter {
|
|
|
1546
1944
|
}
|
|
1547
1945
|
|
|
1548
1946
|
declare class GuiHelper {
|
|
1947
|
+
/** Sizes a tooltip around supplied text; the first entry is its title. */
|
|
1948
|
+
static tooltip(lines: readonly GuiText[], options?: GuiTooltipOptions): Promise<GuiLayer[]>;
|
|
1549
1949
|
static inventorySlot(slot: number | [number, number], origin?: [number, number], offset?: [number, number], rowSize?: number): [number, number];
|
|
1950
|
+
/** Creates crafting-table layers for ingredients and the result; stack counts are not drawn. */
|
|
1951
|
+
static recipe(recipe: GuiRecipe, options?: GuiRecipeOptions): GuiLayer[];
|
|
1952
|
+
}
|
|
1953
|
+
interface GuiTooltipOptions extends GuiTextOptions {
|
|
1954
|
+
/** Top-left text position, inside the tooltip's padding. */
|
|
1955
|
+
position?: [number, number];
|
|
1956
|
+
/** Extra space after the title, in pixels. Defaults to 2. */
|
|
1957
|
+
titleGap?: number;
|
|
1958
|
+
}
|
|
1959
|
+
type GuiRecipeIngredientValue = string | {
|
|
1960
|
+
item: string;
|
|
1961
|
+
} | {
|
|
1962
|
+
tag: string;
|
|
1963
|
+
};
|
|
1964
|
+
type GuiRecipeIngredient = GuiRecipeIngredientValue | readonly GuiRecipeIngredientValue[];
|
|
1965
|
+
type GuiRecipe = ({
|
|
1966
|
+
type: "minecraft:crafting_shaped" | "crafting_shaped";
|
|
1967
|
+
pattern: readonly string[];
|
|
1968
|
+
key: Readonly<Record<string, GuiRecipeIngredient>>;
|
|
1969
|
+
} | {
|
|
1970
|
+
type: "minecraft:crafting_shapeless" | "crafting_shapeless";
|
|
1971
|
+
ingredients: readonly GuiRecipeIngredient[];
|
|
1972
|
+
}) & {
|
|
1973
|
+
result: {
|
|
1974
|
+
id: string;
|
|
1975
|
+
count?: number;
|
|
1976
|
+
} | {
|
|
1977
|
+
item: string;
|
|
1978
|
+
count?: number;
|
|
1979
|
+
};
|
|
1980
|
+
};
|
|
1981
|
+
interface GuiRecipeOptions {
|
|
1982
|
+
/** Selects a concrete item ID or model AssetKey for a tag or alternatives array. */
|
|
1983
|
+
resolveIngredient?: (ingredient: GuiRecipeIngredient) => string | AssetKey;
|
|
1550
1984
|
}
|
|
1551
1985
|
|
|
1986
|
+
/** Builds one centered mesh; explicit source-pixel crops always stretch. */
|
|
1987
|
+
declare function createGuiTextureGeometry(width: number, height: number, imageWidth: number, imageHeight: number, crop?: [number, number, number, number], scaling?: GuiSpriteScaling): BufferGeometry;
|
|
1988
|
+
|
|
1552
1989
|
declare class OrbitControls {
|
|
1553
1990
|
constructor(object: Camera, domElement?: HTMLElement);
|
|
1554
1991
|
|
|
@@ -1641,7 +2078,10 @@ declare class Renderer implements Disposable {
|
|
|
1641
2078
|
protected _frameInterval?: number;
|
|
1642
2079
|
protected _resizeListener?: () => void;
|
|
1643
2080
|
private _nextFrameTime?;
|
|
2081
|
+
private _running;
|
|
2082
|
+
private _inAnimationLoop;
|
|
1644
2083
|
private _disposed;
|
|
2084
|
+
private readonly _frameCallbacks;
|
|
1645
2085
|
private readonly _debugHelpers;
|
|
1646
2086
|
private readonly _eventDispatchers;
|
|
1647
2087
|
private readonly _changeListener;
|
|
@@ -1662,6 +2102,12 @@ declare class Renderer implements Disposable {
|
|
|
1662
2102
|
resize(width: number, height: number): void;
|
|
1663
2103
|
get dirty(): boolean;
|
|
1664
2104
|
set dirty(dirty: boolean);
|
|
2105
|
+
/**
|
|
2106
|
+
* Calls a synchronous animation update before each FPS-limited draw while started.
|
|
2107
|
+
* Subscriptions keep the scene drawing without manual dirty flags. Returns an unsubscribe function.
|
|
2108
|
+
* Registering the same callback twice has no effect. Image exports do not invoke callbacks.
|
|
2109
|
+
*/
|
|
2110
|
+
onFrame(callback: FrameCallback): () => void;
|
|
1665
2111
|
start(): void;
|
|
1666
2112
|
stop(): void;
|
|
1667
2113
|
/**
|
|
@@ -1691,6 +2137,13 @@ declare class Renderer implements Disposable {
|
|
|
1691
2137
|
/** Renderer-owned controls, or undefined when disabled at construction or after disposal. */
|
|
1692
2138
|
get controls(): Maybe<OrbitControls>;
|
|
1693
2139
|
}
|
|
2140
|
+
interface RendererFrame {
|
|
2141
|
+
/** Animation-loop timestamp in seconds, relative to the browser's performance time origin. */
|
|
2142
|
+
readonly time: number;
|
|
2143
|
+
/** Seconds since this callback's previous update; zero on its first update after subscribing or starting. */
|
|
2144
|
+
readonly delta: number;
|
|
2145
|
+
}
|
|
2146
|
+
type FrameCallback = (frame: RendererFrame) => void;
|
|
1694
2147
|
interface RendererOptions {
|
|
1695
2148
|
camera: CameraOptions;
|
|
1696
2149
|
render: RenderOptions;
|
|
@@ -1749,7 +2202,7 @@ declare class SceneInspector {
|
|
|
1749
2202
|
constructor(renderer: Renderer);
|
|
1750
2203
|
protected init(): void;
|
|
1751
2204
|
dispose(): void;
|
|
1752
|
-
findMeshChildren(from: Object3D, out?: Mesh[]): Mesh<three.BufferGeometry<three.NormalBufferAttributes>, three.Material | three.Material[], three.Object3DEventMap>[];
|
|
2205
|
+
findMeshChildren(from: Object3D, out?: Mesh[]): Mesh<three.BufferGeometry<three.NormalBufferAttributes, three.BufferGeometryEventMap>, three.Material<three.MaterialEventMap> | three.Material<three.MaterialEventMap>[], three.Object3DEventMap>[];
|
|
1753
2206
|
onClick(event: MouseEvent): void;
|
|
1754
2207
|
appendTo(el: HTMLElement): void;
|
|
1755
2208
|
protected handleRaycasterObjects(intersections: Intersection[]): void;
|
|
@@ -1766,13 +2219,15 @@ declare class SceneInspector {
|
|
|
1766
2219
|
protected separator(name?: string): HTMLElement;
|
|
1767
2220
|
}
|
|
1768
2221
|
|
|
1769
|
-
declare class SceneStatsDisplay {
|
|
2222
|
+
declare class SceneStatsDisplay implements Disposable {
|
|
1770
2223
|
readonly renderer: Renderer;
|
|
1771
2224
|
readonly statsContainer: HTMLDivElement;
|
|
1772
2225
|
private readonly lines;
|
|
2226
|
+
private interval?;
|
|
1773
2227
|
constructor(renderer: Renderer);
|
|
1774
2228
|
protected init(): void;
|
|
1775
2229
|
appendTo(el: HTMLElement): void;
|
|
2230
|
+
dispose(): void;
|
|
1776
2231
|
add(line?: StatLine): void;
|
|
1777
2232
|
}
|
|
1778
2233
|
declare class StatLine {
|
|
@@ -1844,6 +2299,11 @@ declare class Skins {
|
|
|
1844
2299
|
private static getMcProxyCapeUrl;
|
|
1845
2300
|
}
|
|
1846
2301
|
|
|
2302
|
+
declare class Colormaps {
|
|
2303
|
+
/** Samples the selected resource pack's grass colormap using Minecraft's climate coordinates. */
|
|
2304
|
+
static grassColor(origin?: AssetKey, temperature?: number, downfall?: number): Promise<number>;
|
|
2305
|
+
}
|
|
2306
|
+
|
|
1847
2307
|
declare class TextureLoader {
|
|
1848
2308
|
private static readonly failedTextures;
|
|
1849
2309
|
/** Reports whether image loading failed, so cached textures can be retried. */
|
|
@@ -1854,6 +2314,8 @@ declare class TextureLoader {
|
|
|
1854
2314
|
}
|
|
1855
2315
|
|
|
1856
2316
|
declare class Textures {
|
|
2317
|
+
/** Creates the shared checkerboard from pixels without fetching or decoding an image. */
|
|
2318
|
+
static getMissing(): DataTexture;
|
|
1857
2319
|
static initTextureProps<T extends Texture>(texture: T): T;
|
|
1858
2320
|
static createImage(key: TextureKey): Texture;
|
|
1859
2321
|
static createAsset(key: AssetKey): Texture;
|
|
@@ -1958,6 +2420,7 @@ declare class Chunk<SectionMeshing extends boolean = false> {
|
|
|
1958
2420
|
private readonly data;
|
|
1959
2421
|
private readonly renderedBlocks;
|
|
1960
2422
|
private readonly sectionBlocks;
|
|
2423
|
+
private readonly hiddenBlocks;
|
|
1961
2424
|
private sectionMesh?;
|
|
1962
2425
|
private meshDirty;
|
|
1963
2426
|
constructor(scene: MineRenderScene, x: number, y: number, z: number, onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined, sectionModels?: SectionModels | undefined);
|
|
@@ -1974,6 +2437,8 @@ declare class Chunk<SectionMeshing extends boolean = false> {
|
|
|
1974
2437
|
* Set a block at integer chunk-local coordinates from 0 to 15.
|
|
1975
2438
|
*/
|
|
1976
2439
|
setBlockInChunkAt(pos: Vector3, block?: Block, worldPos?: Vector3, onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined): Promise<Maybe<BlockInfo<SectionMeshing>>>;
|
|
2440
|
+
setBlockVisibleAt(pos: Vector3, visible: boolean): Promise<void>;
|
|
2441
|
+
isBlockVisibleAt(pos: Vector3): boolean;
|
|
1977
2442
|
isOccludingAt(pos: Vector3): boolean;
|
|
1978
2443
|
setCullMaskAt(pos: Vector3, mask: number): Promise<void>;
|
|
1979
2444
|
rebuildSectionMesh(): void;
|
|
@@ -1999,6 +2464,13 @@ declare class MineRenderWorld<SectionMeshing extends boolean = false> {
|
|
|
1999
2464
|
setBlockAt(pos: Vector3, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
|
|
2000
2465
|
setBlockAt(pos: TripleArray, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
|
|
2001
2466
|
private placeBlock;
|
|
2467
|
+
/**
|
|
2468
|
+
* Shows or hides a placed block without changing its data. Hidden blocks do not occlude neighbors.
|
|
2469
|
+
* Missing blocks are ignored; replacing or removing a block resets its visibility.
|
|
2470
|
+
*/
|
|
2471
|
+
setBlockVisibleAt(x: number, y: number, z: number, visible: boolean): Promise<void>;
|
|
2472
|
+
setBlockVisibleAt(pos: Vector3, visible: boolean): Promise<void>;
|
|
2473
|
+
setBlockVisibleAt(pos: TripleArray, visible: boolean): Promise<void>;
|
|
2002
2474
|
placeMultiBlock(multiblock: MultiBlockStructure, useBatches?: boolean, executor?: BatchedExecutor): Promise<void>;
|
|
2003
2475
|
private placeBlocks;
|
|
2004
2476
|
/** Replaces one chunk column's blocks. Entity NBT remains available on the parsed chunk. */
|
|
@@ -2055,4 +2527,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
|
|
|
2055
2527
|
*/
|
|
2056
2528
|
declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
|
|
2057
2529
|
|
|
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 };
|
|
2530
|
+
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 BitmapFont, type BitmapGlyph, type Block, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, 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, Colormaps, 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, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, Fonts, type FrameCallback, type FromTo, Geometries, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiSpriteScaling, type GuiText, type GuiTextLayer, type GuiTextLayout, type GuiTextOptions, type GuiTextRun, type GuiTextStyle, type GuiTextureLayer, type GuiTooltipOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, 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 PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererFrame, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, 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 SpecialItemPart, type SpecialItemRenderer, SpecialItems, 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, createGuiTextGeometry, createGuiTextureGeometry, createImage, entityAnimationTime, 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, layoutGuiText, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, probeImageSize, registerBrowserEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
|