minerender 2.1.0-alpha.53 → 2.1.0-alpha.55
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/dist/browser/index.d.mts +297 -39
- package/dist/browser/index.d.ts +297 -39
- package/dist/browser/index.js +752 -279
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +536 -63
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +505 -23
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +297 -39
- package/dist/node/index.d.ts +297 -39
- package/dist/node/index.js +762 -279
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +540 -63
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.d.mts
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, 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,98 @@ 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
281
|
private static readonly MISSING_TEXTURE_SRC;
|
|
205
282
|
static get MISSING_TEXTURE(): Material;
|
|
206
283
|
static createImage(key: MaterialKey): Material;
|
|
207
284
|
static createBasicCanvasMaterial(canvas: HTMLCanvasElement, transparent?: boolean, shade?: boolean): Material;
|
|
285
|
+
/** Whether vanilla's render type for the mode culls back faces. */
|
|
286
|
+
static entityModeCulls(mode?: EntityRenderMode): boolean;
|
|
287
|
+
/** UV offset per tick of entity age for the scrolling modes, as vanilla's texture matrix applies it. */
|
|
288
|
+
static entityModeScroll(mode?: EntityRenderMode): [number, number] | undefined;
|
|
289
|
+
/**
|
|
290
|
+
* Entity material for one of vanilla's render types. Entities are unlit here, so the lit and full-bright modes
|
|
291
|
+
* differ only in blending and depth state. Culling is not a material property: {@link entityModeCulls} decides
|
|
292
|
+
* whether the geometry gets inward faces.
|
|
293
|
+
*/
|
|
294
|
+
static createEntityCanvasMaterial(canvas: HTMLCanvasElement, mode?: EntityRenderMode, tint?: ColorRepresentation): MeshBasicMaterial;
|
|
208
295
|
static createGuiCanvasMaterial(canvas: HTMLCanvasElement): MeshBasicMaterial;
|
|
209
296
|
static createShadedCanvasMaterial(canvas: HTMLCanvasElement, transparent?: boolean, shade?: boolean): Material;
|
|
210
297
|
static getImage(key: MaterialKey): Material;
|
|
@@ -721,6 +808,55 @@ type BlockStateProperties = {
|
|
|
721
808
|
[key: string]: string;
|
|
722
809
|
};
|
|
723
810
|
|
|
811
|
+
/** One model drawn by a block-entity renderer. */
|
|
812
|
+
interface BlockEntityPart {
|
|
813
|
+
model: string;
|
|
814
|
+
/** Model layer; defaults to "main". */
|
|
815
|
+
layer?: string;
|
|
816
|
+
/** Set only when the texture differs from the layer's default. */
|
|
817
|
+
textureLocation?: string;
|
|
818
|
+
/** Blockstate multipart syntax: every property must match, and "a|b" matches either value. */
|
|
819
|
+
when?: Record<string, string>;
|
|
820
|
+
}
|
|
821
|
+
/** Degrees per property value, or degrees per unit of a numeric property. */
|
|
822
|
+
type BlockEntityRotation = {
|
|
823
|
+
property: string;
|
|
824
|
+
degrees: Record<string, number>;
|
|
825
|
+
} | {
|
|
826
|
+
property: string;
|
|
827
|
+
step: number;
|
|
828
|
+
};
|
|
829
|
+
interface BlockEntityEntry {
|
|
830
|
+
parts: BlockEntityPart[];
|
|
831
|
+
rotation?: BlockEntityRotation;
|
|
832
|
+
/** Offset in model units, applied before the rotation. */
|
|
833
|
+
translation?: TripleArray;
|
|
834
|
+
}
|
|
835
|
+
/** The dataset's `blocks.json`: block ID to the models its block-entity renderer draws. */
|
|
836
|
+
type BlockEntityIndex = MinecraftAsset & {
|
|
837
|
+
[block: string]: BlockEntityEntry;
|
|
838
|
+
};
|
|
839
|
+
interface ResolvedBlockEntity {
|
|
840
|
+
parts: BlockEntityPart[];
|
|
841
|
+
/** Degrees counter-clockwise seen from above, about the block's vertical centre axis. */
|
|
842
|
+
rotation: number;
|
|
843
|
+
translation: TripleArray;
|
|
844
|
+
}
|
|
845
|
+
declare class BlockEntities {
|
|
846
|
+
/**
|
|
847
|
+
* Loads the block index of a version. Versions and sources without one yield an empty index, and so does
|
|
848
|
+
* a failed load: the index is optional, and blocks must not retry or fail with it one by one. The empty
|
|
849
|
+
* result is cached like any other; `Caching.clear()` or `AssetLoader.setVersion()` forces a new attempt.
|
|
850
|
+
*/
|
|
851
|
+
static getIndex(root?: string): Promise<BlockEntityIndex>;
|
|
852
|
+
/** The index entry of a block ID such as `minecraft:chest`. */
|
|
853
|
+
static entry(index: BlockEntityIndex, block: string): Maybe<BlockEntityEntry>;
|
|
854
|
+
/** Selects the parts and placement for a block ID such as `minecraft:chest`; undefined when nothing is drawn. */
|
|
855
|
+
static resolve(index: BlockEntityIndex, block: string, state?: BlockStateProperties): Maybe<ResolvedBlockEntity>;
|
|
856
|
+
/** Placement in block space (0..16 per axis), applied on top of the model's own transform. */
|
|
857
|
+
static matrix(resolved: ResolvedBlockEntity, matrix?: Matrix4): Matrix4;
|
|
858
|
+
}
|
|
859
|
+
|
|
724
860
|
declare class BlockStates {
|
|
725
861
|
private static _persistentCache;
|
|
726
862
|
private static get PERSISTENT_CACHE();
|
|
@@ -735,48 +871,55 @@ declare class DefaultBlockStates implements MinecraftAsset {
|
|
|
735
871
|
[k: string]: BlockStatePropertyDefaults;
|
|
736
872
|
}
|
|
737
873
|
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
texture?: AssetKey;
|
|
741
|
-
layer: EntityModelLayer;
|
|
742
|
-
}
|
|
743
|
-
interface EntityModel extends EntityLayer {
|
|
744
|
-
id: string;
|
|
745
|
-
/** Selected layers; the top-level fields describe the first selection. */
|
|
746
|
-
layers?: Record<string, EntityLayer>;
|
|
747
|
-
}
|
|
748
|
-
interface EntityModelFile extends MinecraftAsset {
|
|
874
|
+
/** `entity-models/animations/<namespace>/<model id>.json`: vanilla's keyframe animations of one model. */
|
|
875
|
+
interface EntityAnimationFile extends MinecraftAsset {
|
|
749
876
|
id: string;
|
|
750
|
-
|
|
751
|
-
}
|
|
752
|
-
interface
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
877
|
+
animations: Record<string, EntityAnimation>;
|
|
878
|
+
}
|
|
879
|
+
interface EntityAnimation {
|
|
880
|
+
/** Seconds. */
|
|
881
|
+
length: number;
|
|
882
|
+
loop: boolean;
|
|
883
|
+
/** Part name anywhere in a layer; `root` is the layer's root part. */
|
|
884
|
+
bones: Record<string, EntityAnimationBone>;
|
|
885
|
+
}
|
|
886
|
+
type EntityAnimationChannel = "position" | "rotation" | "scale";
|
|
887
|
+
/** Keyframes in time order per channel. */
|
|
888
|
+
type EntityAnimationBone = Partial<Record<EntityAnimationChannel, EntityAnimationKeyframe[]>>;
|
|
889
|
+
interface EntityAnimationKeyframe {
|
|
890
|
+
/** Seconds. */
|
|
891
|
+
time: number;
|
|
892
|
+
/** Offset from the default pose: model units, radians, or scale minus one. */
|
|
893
|
+
value: TripleArray;
|
|
894
|
+
/** Value to arrive at when it differs from `value`; linear interpolation only. */
|
|
895
|
+
pre?: TripleArray;
|
|
896
|
+
/** Applies between the previous keyframe and this one. */
|
|
897
|
+
interpolation: "linear" | "catmullrom";
|
|
898
|
+
}
|
|
899
|
+
/** Sampled offsets from the default pose, per bone and channel. */
|
|
900
|
+
type EntityAnimationPose = Record<string, Partial<Record<EntityAnimationChannel, TripleArray>>>;
|
|
901
|
+
declare const ENTITY_ANIMATION_CHANNELS: readonly EntityAnimationChannel[];
|
|
902
|
+
/**
|
|
903
|
+
* Samples one channel like vanilla's `KeyframeAnimation.Entry`: the first value holds before the
|
|
904
|
+
* first keyframe and the last value after the last one; in between, the later keyframe selects the interpolation.
|
|
905
|
+
*/
|
|
906
|
+
declare function sampleEntityKeyframes(keyframes: readonly EntityAnimationKeyframe[], time: number): TripleArray;
|
|
907
|
+
/** Elapsed seconds within the animation: modulo `length` when looping, as vanilla does. */
|
|
908
|
+
declare function entityAnimationTime(animation: EntityAnimation, time: number, loop?: boolean): number;
|
|
909
|
+
/** Samples every bone and channel of an animation at `time` seconds. */
|
|
910
|
+
declare function sampleEntityAnimation(animation: EntityAnimation, time: number, loop?: boolean): EntityAnimationPose;
|
|
774
911
|
|
|
775
912
|
declare class Entities {
|
|
776
913
|
static getEntityList(): Promise<string[]>;
|
|
777
914
|
private static getModelFile;
|
|
778
915
|
static getLayerList(modelKey: BasicAssetKey): Promise<string[]>;
|
|
916
|
+
/** The dataset's extra draws on top of `main`; their `when` labels are the states `EntityModelOptions.when` can enable. */
|
|
917
|
+
static getPassList(modelKey: BasicAssetKey): Promise<EntityModelPass[]>;
|
|
779
918
|
static getEntity(modelKey: BasicAssetKey, textureKey?: BasicAssetKey, options?: EntityModelOptions): Promise<Maybe<EntityModel>>;
|
|
919
|
+
/**
|
|
920
|
+
* Vanilla's keyframe animations of a model by name, or undefined when the model or the selected version has none.
|
|
921
|
+
*/
|
|
922
|
+
static getAnimations(modelKey: BasicAssetKey): Promise<Maybe<Record<string, EntityAnimation>>>;
|
|
780
923
|
static resolveTexture(modelKey: BasicAssetKey): Promise<Maybe<AssetKey>>;
|
|
781
924
|
/** @deprecated Use getEntityList(); block entities share the entity dataset. */
|
|
782
925
|
static getBlockList(): Promise<string[]>;
|
|
@@ -785,9 +928,14 @@ declare class Entities {
|
|
|
785
928
|
}
|
|
786
929
|
interface EntityModelOptions {
|
|
787
930
|
layer?: string;
|
|
788
|
-
/** Layer names in draw order;
|
|
931
|
+
/** Layer names in draw order; an explicit selection draws exactly these layers and no dataset passes. */
|
|
789
932
|
layers?: string[];
|
|
790
|
-
/**
|
|
933
|
+
/**
|
|
934
|
+
* Entity states that enable the dataset's conditional passes, e.g. `["powered"]` for a charged creeper.
|
|
935
|
+
* Without `layer`/`layers`, `main` and every unconditional pass are always drawn.
|
|
936
|
+
*/
|
|
937
|
+
when?: string[];
|
|
938
|
+
/** Per-layer texture overrides, keyed like `EntityModel.layers`. The positional texture key applies to the first selected layer. */
|
|
791
939
|
textures?: Record<string, BasicAssetKey>;
|
|
792
940
|
}
|
|
793
941
|
|
|
@@ -991,15 +1139,76 @@ interface SkinObjectOptions extends SceneObjectOptions {
|
|
|
991
1139
|
legacy?: boolean;
|
|
992
1140
|
}
|
|
993
1141
|
|
|
1142
|
+
interface EntityAnimationOptions {
|
|
1143
|
+
/** Overrides the animation's own `loop` flag. */
|
|
1144
|
+
loop?: boolean;
|
|
1145
|
+
/** Playback rate applied to advanced time; defaults to 1. */
|
|
1146
|
+
speed?: number;
|
|
1147
|
+
/** Start time in seconds; defaults to 0. */
|
|
1148
|
+
time?: number;
|
|
1149
|
+
}
|
|
1150
|
+
/**
|
|
1151
|
+
* Poses part groups from a keyframe animation the way vanilla does: every update restores the
|
|
1152
|
+
* default pose of each animated part, then adds the sampled offsets to its position, Euler angles and scale.
|
|
1153
|
+
* It owns no timer; the owner advances it.
|
|
1154
|
+
*/
|
|
1155
|
+
declare class EntityAnimationPlayer {
|
|
1156
|
+
private parts;
|
|
1157
|
+
private _animation?;
|
|
1158
|
+
private _time;
|
|
1159
|
+
private loop;
|
|
1160
|
+
private speed;
|
|
1161
|
+
get animation(): EntityAnimation | undefined;
|
|
1162
|
+
get time(): number;
|
|
1163
|
+
/**
|
|
1164
|
+
* Starts an animation on the named parts below each layer root. The current pose of a part becomes its default;
|
|
1165
|
+
* bones without a matching part are skipped.
|
|
1166
|
+
*/
|
|
1167
|
+
play(layers: Object3D[], animation: EntityAnimation, options?: EntityAnimationOptions): void;
|
|
1168
|
+
/** Restores the default poses. Returns whether an animation was active. */
|
|
1169
|
+
stop(): boolean;
|
|
1170
|
+
/** Forgets the animation without touching the parts, for parts that no longer exist. */
|
|
1171
|
+
clear(): void;
|
|
1172
|
+
setTime(seconds: number): boolean;
|
|
1173
|
+
advance(deltaSeconds: number): boolean;
|
|
1174
|
+
private apply;
|
|
1175
|
+
}
|
|
1176
|
+
|
|
994
1177
|
declare class EntityObject extends SceneObject {
|
|
995
1178
|
readonly entity: EntityModel;
|
|
996
1179
|
readonly isEntityObject: true;
|
|
997
1180
|
static readonly DEFAULT_OPTIONS: EntityObjectOptions;
|
|
998
1181
|
readonly options: EntityObjectOptions;
|
|
999
1182
|
private meshesCreated;
|
|
1183
|
+
/** Scrolling materials are owned: their texture offset follows this entity's age. */
|
|
1184
|
+
private readonly scrollMaterials;
|
|
1185
|
+
private scrollTicker;
|
|
1186
|
+
/** Entity age in ticks, as vanilla's `ageInTicks`; drives the scrolling render modes. */
|
|
1187
|
+
age: number;
|
|
1188
|
+
private readonly animationPlayer;
|
|
1000
1189
|
constructor(entity: EntityModel, options?: Partial<EntityObjectOptions>);
|
|
1001
1190
|
init(): Promise<void>;
|
|
1002
1191
|
dispose(): void;
|
|
1192
|
+
disposeAndRemoveAllChildren(): void;
|
|
1193
|
+
private clearScrollMaterials;
|
|
1194
|
+
/** Applies the entity age to the scrolling materials; the ticker calls this 20 times per second. */
|
|
1195
|
+
private updateScroll;
|
|
1196
|
+
/** The animation started by {@link playAnimation}, until {@link stopAnimation} or disposal. */
|
|
1197
|
+
get animation(): Maybe<EntityAnimation>;
|
|
1198
|
+
/** Seconds since the animation started, before looping. */
|
|
1199
|
+
get animationTime(): number;
|
|
1200
|
+
/**
|
|
1201
|
+
* Poses the object from a keyframe animation of {@link Entities.getAnimations}, replacing the current one.
|
|
1202
|
+
* Parts of every layer are matched by name and their current pose is the default the offsets add to.
|
|
1203
|
+
* The object owns no clock: call {@link advanceAnimation} per frame, or {@link setAnimationTime}.
|
|
1204
|
+
*/
|
|
1205
|
+
playAnimation(animation: EntityAnimation, options?: EntityAnimationOptions): void;
|
|
1206
|
+
/** Stops the animation and restores the default pose. */
|
|
1207
|
+
stopAnimation(): void;
|
|
1208
|
+
/** Poses the object at an explicit time in seconds. Has no effect without an animation. */
|
|
1209
|
+
setAnimationTime(seconds: number): void;
|
|
1210
|
+
/** Advances the animation by a frame delta in seconds, scaled by its speed. Has no effect without an animation. */
|
|
1211
|
+
advanceAnimation(deltaSeconds: number): void;
|
|
1003
1212
|
getLayerGroup(name: string): Maybe<Object3D>;
|
|
1004
1213
|
getGroupByName(name: string, layerName?: string): Maybe<Object3D>;
|
|
1005
1214
|
getMeshByName(name: string, layerName?: string): Maybe<Mesh>;
|
|
@@ -1011,7 +1220,13 @@ declare class EntityObject extends SceneObject {
|
|
|
1011
1220
|
protected applyTextures(): Promise<void>;
|
|
1012
1221
|
}
|
|
1013
1222
|
interface EntityObjectOptions extends SceneObjectOptions {
|
|
1223
|
+
/**
|
|
1224
|
+
* `true` applies only vanilla's entity flip, scale (-1, -1, 1); `false` keeps raw model space.
|
|
1225
|
+
* By default the model's dataset transform is used, or the flip for models without one.
|
|
1226
|
+
*/
|
|
1014
1227
|
flip?: boolean;
|
|
1228
|
+
/** Colours for the dataset's tint labels, e.g. `{ wool_color: 0xf9801d }`; a pass whose label is absent stays untinted. */
|
|
1229
|
+
tints?: Record<string, ColorRepresentation>;
|
|
1015
1230
|
}
|
|
1016
1231
|
declare function isEntityObject(obj: any): obj is EntityObject;
|
|
1017
1232
|
|
|
@@ -1194,12 +1409,24 @@ declare class BlockObject extends SceneObject {
|
|
|
1194
1409
|
private _fluidKey?;
|
|
1195
1410
|
private _fluidSampler?;
|
|
1196
1411
|
private _fluidModel?;
|
|
1412
|
+
private _entities;
|
|
1413
|
+
private _entityPlacement;
|
|
1414
|
+
private _entityGeneration;
|
|
1197
1415
|
constructor(blockState: BlockState, options?: Partial<BlockObjectOptions>);
|
|
1198
1416
|
init(): Promise<void>;
|
|
1199
1417
|
dispose(): void;
|
|
1200
1418
|
removeFromScene(): void;
|
|
1201
1419
|
private clearModels;
|
|
1202
1420
|
private removeModels;
|
|
1421
|
+
private removeEntities;
|
|
1422
|
+
/** Entity models drawn for this block instead of its block model; they are scene children, unlike the block. */
|
|
1423
|
+
get blockEntities(): readonly EntityObject[];
|
|
1424
|
+
/**
|
|
1425
|
+
* Draws the block through the dataset's block-entity index. Returns false, leaving nothing behind,
|
|
1426
|
+
* when the block is not listed or one of its models cannot be loaded.
|
|
1427
|
+
*/
|
|
1428
|
+
private createBlockEntities;
|
|
1429
|
+
private placeEntities;
|
|
1203
1430
|
get isOccluding(): boolean;
|
|
1204
1431
|
private getModelMatrix;
|
|
1205
1432
|
private getModelCullMask;
|
|
@@ -1214,6 +1441,7 @@ declare class BlockObject extends SceneObject {
|
|
|
1214
1441
|
nextInstance(): InstanceReference<SceneObject>;
|
|
1215
1442
|
protected mapStateToVariant(state: BlockStateProperties): Promise<BlockStateVariant[]>;
|
|
1216
1443
|
recreateModels(): Promise<void>;
|
|
1444
|
+
private hasGeometry;
|
|
1217
1445
|
protected getSingleVariant(variants: BlockStateVariant | BlockStateVariant[]): BlockStateVariant;
|
|
1218
1446
|
protected createAVariant(variants: BlockStateVariant | BlockStateVariant[], instanceInfo: Matrix4[]): Promise<void>;
|
|
1219
1447
|
protected createVariant(variant: BlockStateVariant): Promise<ModelObject | InstanceReference<ModelObject>>;
|
|
@@ -1515,6 +1743,8 @@ declare class Caching {
|
|
|
1515
1743
|
static readonly blockTintCache: AsyncLoadingCache<CacheKey, number>;
|
|
1516
1744
|
static readonly entityModelCache: AsyncLoadingCache<CacheKey, EntityModelFile>;
|
|
1517
1745
|
static readonly entityTextureCache: AsyncLoadingCache<CacheKey, AssetKey>;
|
|
1746
|
+
static readonly entityAnimationCache: AsyncLoadingCache<CacheKey, EntityAnimationFile>;
|
|
1747
|
+
static readonly blockEntityIndexCache: AsyncLoadingCache<CacheKey, BlockEntityIndex>;
|
|
1518
1748
|
private static createAssetCache;
|
|
1519
1749
|
/** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
|
|
1520
1750
|
private static get all();
|
|
@@ -1558,6 +1788,34 @@ declare class SceneExporter {
|
|
|
1558
1788
|
|
|
1559
1789
|
declare class GuiHelper {
|
|
1560
1790
|
static inventorySlot(slot: number | [number, number], origin?: [number, number], offset?: [number, number], rowSize?: number): [number, number];
|
|
1791
|
+
/** Creates crafting-table layers for ingredients and the result; stack counts are not drawn. */
|
|
1792
|
+
static recipe(recipe: GuiRecipe, options?: GuiRecipeOptions): GuiLayer[];
|
|
1793
|
+
}
|
|
1794
|
+
type GuiRecipeIngredientValue = string | {
|
|
1795
|
+
item: string;
|
|
1796
|
+
} | {
|
|
1797
|
+
tag: string;
|
|
1798
|
+
};
|
|
1799
|
+
type GuiRecipeIngredient = GuiRecipeIngredientValue | readonly GuiRecipeIngredientValue[];
|
|
1800
|
+
type GuiRecipe = ({
|
|
1801
|
+
type: "minecraft:crafting_shaped" | "crafting_shaped";
|
|
1802
|
+
pattern: readonly string[];
|
|
1803
|
+
key: Readonly<Record<string, GuiRecipeIngredient>>;
|
|
1804
|
+
} | {
|
|
1805
|
+
type: "minecraft:crafting_shapeless" | "crafting_shapeless";
|
|
1806
|
+
ingredients: readonly GuiRecipeIngredient[];
|
|
1807
|
+
}) & {
|
|
1808
|
+
result: {
|
|
1809
|
+
id: string;
|
|
1810
|
+
count?: number;
|
|
1811
|
+
} | {
|
|
1812
|
+
item: string;
|
|
1813
|
+
count?: number;
|
|
1814
|
+
};
|
|
1815
|
+
};
|
|
1816
|
+
interface GuiRecipeOptions {
|
|
1817
|
+
/** Selects a concrete item ID or model AssetKey for a tag or alternatives array. */
|
|
1818
|
+
resolveIngredient?: (ingredient: GuiRecipeIngredient) => string | AssetKey;
|
|
1561
1819
|
}
|
|
1562
1820
|
|
|
1563
1821
|
declare class OrbitControls {
|
|
@@ -2086,4 +2344,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
|
|
|
2086
2344
|
forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
|
|
2087
2345
|
}
|
|
2088
2346
|
|
|
2089
|
-
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 FrameCallback, type FromTo, Geometries, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiTextureLayer, 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 RendererFrame, 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 };
|
|
2347
|
+
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, 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, 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, type FrameCallback, type FromTo, Geometries, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiTextureLayer, 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 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 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, 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, 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 };
|