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