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/browser/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';
|
|
@@ -199,11 +199,98 @@ interface ListAsset extends MinecraftAsset {
|
|
|
199
199
|
files: string[];
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
+
interface EntityLayer {
|
|
203
|
+
key: BasicAssetKey;
|
|
204
|
+
texture?: AssetKey;
|
|
205
|
+
layer: EntityModelLayer;
|
|
206
|
+
/** How this draw is rendered; defaults to the geometry layer's own mode, then `cutout`. */
|
|
207
|
+
render?: EntityRenderMode;
|
|
208
|
+
/** Label of the state colour that multiplies the texture, from the pass that selected this draw. */
|
|
209
|
+
tint?: string;
|
|
210
|
+
}
|
|
211
|
+
interface EntityModel extends EntityLayer {
|
|
212
|
+
id: string;
|
|
213
|
+
/** Root transform from the dataset; see {@link EntityTransformOp}. */
|
|
214
|
+
transform?: EntityTransformOp[];
|
|
215
|
+
/**
|
|
216
|
+
* Selected draws in draw order; the top-level fields describe the first selection.
|
|
217
|
+
* A key is the geometry layer's name; a further draw of the same geometry (a pass with another texture) is keyed `<layer>#<n>`, from 2.
|
|
218
|
+
*/
|
|
219
|
+
layers?: Record<string, EntityLayer>;
|
|
220
|
+
}
|
|
221
|
+
interface EntityModelFile extends MinecraftAsset {
|
|
222
|
+
id: string;
|
|
223
|
+
transform?: EntityTransformOp[];
|
|
224
|
+
layers: Record<string, EntityModelLayer>;
|
|
225
|
+
/** Extra draws vanilla adds on top of `main`, in draw order. */
|
|
226
|
+
passes?: EntityModelPass[];
|
|
227
|
+
}
|
|
228
|
+
/** Vanilla render type of a draw; see the dataset README for the mode table. */
|
|
229
|
+
type EntityRenderMode = "cutout" | "cutout_cull" | "cutout_z_offset" | "solid" | "translucent" | "translucent_emissive" | "eyes" | "energy_swirl" | "breeze_wind" | "water_mask";
|
|
230
|
+
interface EntityModelPass {
|
|
231
|
+
/** Geometry layer of the same file; a pass on `main` draws that geometry again. */
|
|
232
|
+
layer: string;
|
|
233
|
+
/** Present only when it differs from the layer's own. */
|
|
234
|
+
textureLocation?: string;
|
|
235
|
+
/** Present only when it differs from the layer's own. */
|
|
236
|
+
render?: EntityRenderMode;
|
|
237
|
+
/** Entity state that enables the draw, e.g. `powered`; without it the pass is always drawn. */
|
|
238
|
+
when?: string;
|
|
239
|
+
/** State colour that multiplies the texture, e.g. `wool_color`. */
|
|
240
|
+
tint?: string;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* One operation vanilla's renderer applies before drawing a model, in call order:
|
|
244
|
+
* each one is applied on top of the previous, so the last reaches the vertices first.
|
|
245
|
+
* Translations use model units and rotations use radians, like part poses.
|
|
246
|
+
*/
|
|
247
|
+
type EntityTransformOp = {
|
|
248
|
+
scale: [number, number, number];
|
|
249
|
+
} | {
|
|
250
|
+
translate: [number, number, number];
|
|
251
|
+
} | {
|
|
252
|
+
rotate: [number, number, number];
|
|
253
|
+
};
|
|
254
|
+
interface EntityModelLayer {
|
|
255
|
+
texture: [number, number];
|
|
256
|
+
textureLocation?: string;
|
|
257
|
+
/** Omitted for `cutout`. */
|
|
258
|
+
render?: EntityRenderMode;
|
|
259
|
+
root: EntityModelPart;
|
|
260
|
+
}
|
|
261
|
+
interface EntityModelPart {
|
|
262
|
+
pose: {
|
|
263
|
+
offset: [number, number, number];
|
|
264
|
+
rotation: [number, number, number];
|
|
265
|
+
scale?: [number, number, number];
|
|
266
|
+
};
|
|
267
|
+
texture?: [number, number];
|
|
268
|
+
cubes: EntityModelCube[];
|
|
269
|
+
children: Record<string, EntityModelPart>;
|
|
270
|
+
}
|
|
271
|
+
interface EntityModelCube {
|
|
272
|
+
origin: [number, number, number];
|
|
273
|
+
size: [number, number, number];
|
|
274
|
+
uv: [number, number];
|
|
275
|
+
grow?: [number, number, number];
|
|
276
|
+
mirror?: boolean;
|
|
277
|
+
}
|
|
278
|
+
|
|
202
279
|
declare class Materials {
|
|
203
280
|
private static readonly MISSING_TEXTURE_SRC;
|
|
204
281
|
static get MISSING_TEXTURE(): Material;
|
|
205
282
|
static createImage(key: MaterialKey): Material;
|
|
206
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;
|
|
207
294
|
static createGuiCanvasMaterial(canvas: HTMLCanvasElement): MeshBasicMaterial;
|
|
208
295
|
static createShadedCanvasMaterial(canvas: HTMLCanvasElement, transparent?: boolean, shade?: boolean): Material;
|
|
209
296
|
static getImage(key: MaterialKey): Material;
|
|
@@ -720,6 +807,55 @@ type BlockStateProperties = {
|
|
|
720
807
|
[key: string]: string;
|
|
721
808
|
};
|
|
722
809
|
|
|
810
|
+
/** One model drawn by a block-entity renderer. */
|
|
811
|
+
interface BlockEntityPart {
|
|
812
|
+
model: string;
|
|
813
|
+
/** Model layer; defaults to "main". */
|
|
814
|
+
layer?: string;
|
|
815
|
+
/** Set only when the texture differs from the layer's default. */
|
|
816
|
+
textureLocation?: string;
|
|
817
|
+
/** Blockstate multipart syntax: every property must match, and "a|b" matches either value. */
|
|
818
|
+
when?: Record<string, string>;
|
|
819
|
+
}
|
|
820
|
+
/** Degrees per property value, or degrees per unit of a numeric property. */
|
|
821
|
+
type BlockEntityRotation = {
|
|
822
|
+
property: string;
|
|
823
|
+
degrees: Record<string, number>;
|
|
824
|
+
} | {
|
|
825
|
+
property: string;
|
|
826
|
+
step: number;
|
|
827
|
+
};
|
|
828
|
+
interface BlockEntityEntry {
|
|
829
|
+
parts: BlockEntityPart[];
|
|
830
|
+
rotation?: BlockEntityRotation;
|
|
831
|
+
/** Offset in model units, applied before the rotation. */
|
|
832
|
+
translation?: TripleArray;
|
|
833
|
+
}
|
|
834
|
+
/** The dataset's `blocks.json`: block ID to the models its block-entity renderer draws. */
|
|
835
|
+
type BlockEntityIndex = MinecraftAsset & {
|
|
836
|
+
[block: string]: BlockEntityEntry;
|
|
837
|
+
};
|
|
838
|
+
interface ResolvedBlockEntity {
|
|
839
|
+
parts: BlockEntityPart[];
|
|
840
|
+
/** Degrees counter-clockwise seen from above, about the block's vertical centre axis. */
|
|
841
|
+
rotation: number;
|
|
842
|
+
translation: TripleArray;
|
|
843
|
+
}
|
|
844
|
+
declare class BlockEntities {
|
|
845
|
+
/**
|
|
846
|
+
* Loads the block index of a version. Versions and sources without one yield an empty index, and so does
|
|
847
|
+
* a failed load: the index is optional, and blocks must not retry or fail with it one by one. The empty
|
|
848
|
+
* result is cached like any other; `Caching.clear()` or `AssetLoader.setVersion()` forces a new attempt.
|
|
849
|
+
*/
|
|
850
|
+
static getIndex(root?: string): Promise<BlockEntityIndex>;
|
|
851
|
+
/** The index entry of a block ID such as `minecraft:chest`. */
|
|
852
|
+
static entry(index: BlockEntityIndex, block: string): Maybe<BlockEntityEntry>;
|
|
853
|
+
/** Selects the parts and placement for a block ID such as `minecraft:chest`; undefined when nothing is drawn. */
|
|
854
|
+
static resolve(index: BlockEntityIndex, block: string, state?: BlockStateProperties): Maybe<ResolvedBlockEntity>;
|
|
855
|
+
/** Placement in block space (0..16 per axis), applied on top of the model's own transform. */
|
|
856
|
+
static matrix(resolved: ResolvedBlockEntity, matrix?: Matrix4): Matrix4;
|
|
857
|
+
}
|
|
858
|
+
|
|
723
859
|
declare class BlockStates {
|
|
724
860
|
private static _persistentCache;
|
|
725
861
|
private static get PERSISTENT_CACHE();
|
|
@@ -734,48 +870,55 @@ declare class DefaultBlockStates implements MinecraftAsset {
|
|
|
734
870
|
[k: string]: BlockStatePropertyDefaults;
|
|
735
871
|
}
|
|
736
872
|
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
texture?: AssetKey;
|
|
740
|
-
layer: EntityModelLayer;
|
|
741
|
-
}
|
|
742
|
-
interface EntityModel extends EntityLayer {
|
|
743
|
-
id: string;
|
|
744
|
-
/** Selected layers; the top-level fields describe the first selection. */
|
|
745
|
-
layers?: Record<string, EntityLayer>;
|
|
746
|
-
}
|
|
747
|
-
interface EntityModelFile extends MinecraftAsset {
|
|
873
|
+
/** `entity-models/animations/<namespace>/<model id>.json`: vanilla's keyframe animations of one model. */
|
|
874
|
+
interface EntityAnimationFile extends MinecraftAsset {
|
|
748
875
|
id: string;
|
|
749
|
-
|
|
750
|
-
}
|
|
751
|
-
interface
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
876
|
+
animations: Record<string, EntityAnimation>;
|
|
877
|
+
}
|
|
878
|
+
interface EntityAnimation {
|
|
879
|
+
/** Seconds. */
|
|
880
|
+
length: number;
|
|
881
|
+
loop: boolean;
|
|
882
|
+
/** Part name anywhere in a layer; `root` is the layer's root part. */
|
|
883
|
+
bones: Record<string, EntityAnimationBone>;
|
|
884
|
+
}
|
|
885
|
+
type EntityAnimationChannel = "position" | "rotation" | "scale";
|
|
886
|
+
/** Keyframes in time order per channel. */
|
|
887
|
+
type EntityAnimationBone = Partial<Record<EntityAnimationChannel, EntityAnimationKeyframe[]>>;
|
|
888
|
+
interface EntityAnimationKeyframe {
|
|
889
|
+
/** Seconds. */
|
|
890
|
+
time: number;
|
|
891
|
+
/** Offset from the default pose: model units, radians, or scale minus one. */
|
|
892
|
+
value: TripleArray;
|
|
893
|
+
/** Value to arrive at when it differs from `value`; linear interpolation only. */
|
|
894
|
+
pre?: TripleArray;
|
|
895
|
+
/** Applies between the previous keyframe and this one. */
|
|
896
|
+
interpolation: "linear" | "catmullrom";
|
|
897
|
+
}
|
|
898
|
+
/** Sampled offsets from the default pose, per bone and channel. */
|
|
899
|
+
type EntityAnimationPose = Record<string, Partial<Record<EntityAnimationChannel, TripleArray>>>;
|
|
900
|
+
declare const ENTITY_ANIMATION_CHANNELS: readonly EntityAnimationChannel[];
|
|
901
|
+
/**
|
|
902
|
+
* Samples one channel like vanilla's `KeyframeAnimation.Entry`: the first value holds before the
|
|
903
|
+
* first keyframe and the last value after the last one; in between, the later keyframe selects the interpolation.
|
|
904
|
+
*/
|
|
905
|
+
declare function sampleEntityKeyframes(keyframes: readonly EntityAnimationKeyframe[], time: number): TripleArray;
|
|
906
|
+
/** Elapsed seconds within the animation: modulo `length` when looping, as vanilla does. */
|
|
907
|
+
declare function entityAnimationTime(animation: EntityAnimation, time: number, loop?: boolean): number;
|
|
908
|
+
/** Samples every bone and channel of an animation at `time` seconds. */
|
|
909
|
+
declare function sampleEntityAnimation(animation: EntityAnimation, time: number, loop?: boolean): EntityAnimationPose;
|
|
773
910
|
|
|
774
911
|
declare class Entities {
|
|
775
912
|
static getEntityList(): Promise<string[]>;
|
|
776
913
|
private static getModelFile;
|
|
777
914
|
static getLayerList(modelKey: BasicAssetKey): Promise<string[]>;
|
|
915
|
+
/** The dataset's extra draws on top of `main`; their `when` labels are the states `EntityModelOptions.when` can enable. */
|
|
916
|
+
static getPassList(modelKey: BasicAssetKey): Promise<EntityModelPass[]>;
|
|
778
917
|
static getEntity(modelKey: BasicAssetKey, textureKey?: BasicAssetKey, options?: EntityModelOptions): Promise<Maybe<EntityModel>>;
|
|
918
|
+
/**
|
|
919
|
+
* Vanilla's keyframe animations of a model by name, or undefined when the model or the selected version has none.
|
|
920
|
+
*/
|
|
921
|
+
static getAnimations(modelKey: BasicAssetKey): Promise<Maybe<Record<string, EntityAnimation>>>;
|
|
779
922
|
static resolveTexture(modelKey: BasicAssetKey): Promise<Maybe<AssetKey>>;
|
|
780
923
|
/** @deprecated Use getEntityList(); block entities share the entity dataset. */
|
|
781
924
|
static getBlockList(): Promise<string[]>;
|
|
@@ -784,9 +927,14 @@ declare class Entities {
|
|
|
784
927
|
}
|
|
785
928
|
interface EntityModelOptions {
|
|
786
929
|
layer?: string;
|
|
787
|
-
/** Layer names in draw order;
|
|
930
|
+
/** Layer names in draw order; an explicit selection draws exactly these layers and no dataset passes. */
|
|
788
931
|
layers?: string[];
|
|
789
|
-
/**
|
|
932
|
+
/**
|
|
933
|
+
* Entity states that enable the dataset's conditional passes, e.g. `["powered"]` for a charged creeper.
|
|
934
|
+
* Without `layer`/`layers`, `main` and every unconditional pass are always drawn.
|
|
935
|
+
*/
|
|
936
|
+
when?: string[];
|
|
937
|
+
/** Per-layer texture overrides, keyed like `EntityModel.layers`. The positional texture key applies to the first selected layer. */
|
|
790
938
|
textures?: Record<string, BasicAssetKey>;
|
|
791
939
|
}
|
|
792
940
|
|
|
@@ -990,15 +1138,76 @@ interface SkinObjectOptions extends SceneObjectOptions {
|
|
|
990
1138
|
legacy?: boolean;
|
|
991
1139
|
}
|
|
992
1140
|
|
|
1141
|
+
interface EntityAnimationOptions {
|
|
1142
|
+
/** Overrides the animation's own `loop` flag. */
|
|
1143
|
+
loop?: boolean;
|
|
1144
|
+
/** Playback rate applied to advanced time; defaults to 1. */
|
|
1145
|
+
speed?: number;
|
|
1146
|
+
/** Start time in seconds; defaults to 0. */
|
|
1147
|
+
time?: number;
|
|
1148
|
+
}
|
|
1149
|
+
/**
|
|
1150
|
+
* Poses part groups from a keyframe animation the way vanilla does: every update restores the
|
|
1151
|
+
* default pose of each animated part, then adds the sampled offsets to its position, Euler angles and scale.
|
|
1152
|
+
* It owns no timer; the owner advances it.
|
|
1153
|
+
*/
|
|
1154
|
+
declare class EntityAnimationPlayer {
|
|
1155
|
+
private parts;
|
|
1156
|
+
private _animation?;
|
|
1157
|
+
private _time;
|
|
1158
|
+
private loop;
|
|
1159
|
+
private speed;
|
|
1160
|
+
get animation(): EntityAnimation | undefined;
|
|
1161
|
+
get time(): number;
|
|
1162
|
+
/**
|
|
1163
|
+
* Starts an animation on the named parts below each layer root. The current pose of a part becomes its default;
|
|
1164
|
+
* bones without a matching part are skipped.
|
|
1165
|
+
*/
|
|
1166
|
+
play(layers: Object3D[], animation: EntityAnimation, options?: EntityAnimationOptions): void;
|
|
1167
|
+
/** Restores the default poses. Returns whether an animation was active. */
|
|
1168
|
+
stop(): boolean;
|
|
1169
|
+
/** Forgets the animation without touching the parts, for parts that no longer exist. */
|
|
1170
|
+
clear(): void;
|
|
1171
|
+
setTime(seconds: number): boolean;
|
|
1172
|
+
advance(deltaSeconds: number): boolean;
|
|
1173
|
+
private apply;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
993
1176
|
declare class EntityObject extends SceneObject {
|
|
994
1177
|
readonly entity: EntityModel;
|
|
995
1178
|
readonly isEntityObject: true;
|
|
996
1179
|
static readonly DEFAULT_OPTIONS: EntityObjectOptions;
|
|
997
1180
|
readonly options: EntityObjectOptions;
|
|
998
1181
|
private meshesCreated;
|
|
1182
|
+
/** Scrolling materials are owned: their texture offset follows this entity's age. */
|
|
1183
|
+
private readonly scrollMaterials;
|
|
1184
|
+
private scrollTicker;
|
|
1185
|
+
/** Entity age in ticks, as vanilla's `ageInTicks`; drives the scrolling render modes. */
|
|
1186
|
+
age: number;
|
|
1187
|
+
private readonly animationPlayer;
|
|
999
1188
|
constructor(entity: EntityModel, options?: Partial<EntityObjectOptions>);
|
|
1000
1189
|
init(): Promise<void>;
|
|
1001
1190
|
dispose(): void;
|
|
1191
|
+
disposeAndRemoveAllChildren(): void;
|
|
1192
|
+
private clearScrollMaterials;
|
|
1193
|
+
/** Applies the entity age to the scrolling materials; the ticker calls this 20 times per second. */
|
|
1194
|
+
private updateScroll;
|
|
1195
|
+
/** The animation started by {@link playAnimation}, until {@link stopAnimation} or disposal. */
|
|
1196
|
+
get animation(): Maybe<EntityAnimation>;
|
|
1197
|
+
/** Seconds since the animation started, before looping. */
|
|
1198
|
+
get animationTime(): number;
|
|
1199
|
+
/**
|
|
1200
|
+
* Poses the object from a keyframe animation of {@link Entities.getAnimations}, replacing the current one.
|
|
1201
|
+
* Parts of every layer are matched by name and their current pose is the default the offsets add to.
|
|
1202
|
+
* The object owns no clock: call {@link advanceAnimation} per frame, or {@link setAnimationTime}.
|
|
1203
|
+
*/
|
|
1204
|
+
playAnimation(animation: EntityAnimation, options?: EntityAnimationOptions): void;
|
|
1205
|
+
/** Stops the animation and restores the default pose. */
|
|
1206
|
+
stopAnimation(): void;
|
|
1207
|
+
/** Poses the object at an explicit time in seconds. Has no effect without an animation. */
|
|
1208
|
+
setAnimationTime(seconds: number): void;
|
|
1209
|
+
/** Advances the animation by a frame delta in seconds, scaled by its speed. Has no effect without an animation. */
|
|
1210
|
+
advanceAnimation(deltaSeconds: number): void;
|
|
1002
1211
|
getLayerGroup(name: string): Maybe<Object3D>;
|
|
1003
1212
|
getGroupByName(name: string, layerName?: string): Maybe<Object3D>;
|
|
1004
1213
|
getMeshByName(name: string, layerName?: string): Maybe<Mesh>;
|
|
@@ -1010,7 +1219,13 @@ declare class EntityObject extends SceneObject {
|
|
|
1010
1219
|
protected applyTextures(): Promise<void>;
|
|
1011
1220
|
}
|
|
1012
1221
|
interface EntityObjectOptions extends SceneObjectOptions {
|
|
1222
|
+
/**
|
|
1223
|
+
* `true` applies only vanilla's entity flip, scale (-1, -1, 1); `false` keeps raw model space.
|
|
1224
|
+
* By default the model's dataset transform is used, or the flip for models without one.
|
|
1225
|
+
*/
|
|
1013
1226
|
flip?: boolean;
|
|
1227
|
+
/** Colours for the dataset's tint labels, e.g. `{ wool_color: 0xf9801d }`; a pass whose label is absent stays untinted. */
|
|
1228
|
+
tints?: Record<string, ColorRepresentation>;
|
|
1014
1229
|
}
|
|
1015
1230
|
declare function isEntityObject(obj: any): obj is EntityObject;
|
|
1016
1231
|
|
|
@@ -1193,12 +1408,24 @@ declare class BlockObject extends SceneObject {
|
|
|
1193
1408
|
private _fluidKey?;
|
|
1194
1409
|
private _fluidSampler?;
|
|
1195
1410
|
private _fluidModel?;
|
|
1411
|
+
private _entities;
|
|
1412
|
+
private _entityPlacement;
|
|
1413
|
+
private _entityGeneration;
|
|
1196
1414
|
constructor(blockState: BlockState, options?: Partial<BlockObjectOptions>);
|
|
1197
1415
|
init(): Promise<void>;
|
|
1198
1416
|
dispose(): void;
|
|
1199
1417
|
removeFromScene(): void;
|
|
1200
1418
|
private clearModels;
|
|
1201
1419
|
private removeModels;
|
|
1420
|
+
private removeEntities;
|
|
1421
|
+
/** Entity models drawn for this block instead of its block model; they are scene children, unlike the block. */
|
|
1422
|
+
get blockEntities(): readonly EntityObject[];
|
|
1423
|
+
/**
|
|
1424
|
+
* Draws the block through the dataset's block-entity index. Returns false, leaving nothing behind,
|
|
1425
|
+
* when the block is not listed or one of its models cannot be loaded.
|
|
1426
|
+
*/
|
|
1427
|
+
private createBlockEntities;
|
|
1428
|
+
private placeEntities;
|
|
1202
1429
|
get isOccluding(): boolean;
|
|
1203
1430
|
private getModelMatrix;
|
|
1204
1431
|
private getModelCullMask;
|
|
@@ -1213,6 +1440,7 @@ declare class BlockObject extends SceneObject {
|
|
|
1213
1440
|
nextInstance(): InstanceReference<SceneObject>;
|
|
1214
1441
|
protected mapStateToVariant(state: BlockStateProperties): Promise<BlockStateVariant[]>;
|
|
1215
1442
|
recreateModels(): Promise<void>;
|
|
1443
|
+
private hasGeometry;
|
|
1216
1444
|
protected getSingleVariant(variants: BlockStateVariant | BlockStateVariant[]): BlockStateVariant;
|
|
1217
1445
|
protected createAVariant(variants: BlockStateVariant | BlockStateVariant[], instanceInfo: Matrix4[]): Promise<void>;
|
|
1218
1446
|
protected createVariant(variant: BlockStateVariant): Promise<ModelObject | InstanceReference<ModelObject>>;
|
|
@@ -1514,6 +1742,8 @@ declare class Caching {
|
|
|
1514
1742
|
static readonly blockTintCache: AsyncLoadingCache<CacheKey, number>;
|
|
1515
1743
|
static readonly entityModelCache: AsyncLoadingCache<CacheKey, EntityModelFile>;
|
|
1516
1744
|
static readonly entityTextureCache: AsyncLoadingCache<CacheKey, AssetKey>;
|
|
1745
|
+
static readonly entityAnimationCache: AsyncLoadingCache<CacheKey, EntityAnimationFile>;
|
|
1746
|
+
static readonly blockEntityIndexCache: AsyncLoadingCache<CacheKey, BlockEntityIndex>;
|
|
1517
1747
|
private static createAssetCache;
|
|
1518
1748
|
/** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
|
|
1519
1749
|
private static get all();
|
|
@@ -1557,6 +1787,34 @@ declare class SceneExporter {
|
|
|
1557
1787
|
|
|
1558
1788
|
declare class GuiHelper {
|
|
1559
1789
|
static inventorySlot(slot: number | [number, number], origin?: [number, number], offset?: [number, number], rowSize?: number): [number, number];
|
|
1790
|
+
/** Creates crafting-table layers for ingredients and the result; stack counts are not drawn. */
|
|
1791
|
+
static recipe(recipe: GuiRecipe, options?: GuiRecipeOptions): GuiLayer[];
|
|
1792
|
+
}
|
|
1793
|
+
type GuiRecipeIngredientValue = string | {
|
|
1794
|
+
item: string;
|
|
1795
|
+
} | {
|
|
1796
|
+
tag: string;
|
|
1797
|
+
};
|
|
1798
|
+
type GuiRecipeIngredient = GuiRecipeIngredientValue | readonly GuiRecipeIngredientValue[];
|
|
1799
|
+
type GuiRecipe = ({
|
|
1800
|
+
type: "minecraft:crafting_shaped" | "crafting_shaped";
|
|
1801
|
+
pattern: readonly string[];
|
|
1802
|
+
key: Readonly<Record<string, GuiRecipeIngredient>>;
|
|
1803
|
+
} | {
|
|
1804
|
+
type: "minecraft:crafting_shapeless" | "crafting_shapeless";
|
|
1805
|
+
ingredients: readonly GuiRecipeIngredient[];
|
|
1806
|
+
}) & {
|
|
1807
|
+
result: {
|
|
1808
|
+
id: string;
|
|
1809
|
+
count?: number;
|
|
1810
|
+
} | {
|
|
1811
|
+
item: string;
|
|
1812
|
+
count?: number;
|
|
1813
|
+
};
|
|
1814
|
+
};
|
|
1815
|
+
interface GuiRecipeOptions {
|
|
1816
|
+
/** Selects a concrete item ID or model AssetKey for a tag or alternatives array. */
|
|
1817
|
+
resolveIngredient?: (ingredient: GuiRecipeIngredient) => string | AssetKey;
|
|
1560
1818
|
}
|
|
1561
1819
|
|
|
1562
1820
|
declare class OrbitControls {
|
|
@@ -2083,4 +2341,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
|
|
|
2083
2341
|
*/
|
|
2084
2342
|
declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
|
|
2085
2343
|
|
|
2086
|
-
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, AnvilParser, type AnvilRegion, ArchiveAssetSource, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Block, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, BrowserCache, BrowserEnv, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type ElementFace, type ElementRotation, Entities, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, EntityObject, type EntityObjectOptions, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, type 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, 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, probeImageSize, registerBrowserEnv, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
|
|
2344
|
+
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, BrowserCache, BrowserEnv, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, 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, 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, probeImageSize, registerBrowserEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
|