minerender 2.1.0-alpha.61 → 2.1.0-alpha.63

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.
@@ -901,7 +901,7 @@ declare class DefaultBlockStates implements MinecraftAsset {
901
901
  [k: string]: BlockStatePropertyDefaults;
902
902
  }
903
903
 
904
- /** `entity-models/animations/<namespace>/<model id>.json`: vanilla's keyframe animations of one model. */
904
+ /** `entity-models/animations/<namespace>/<model id>.json`: native and sampled vanilla animation clips. */
905
905
  interface EntityAnimationFile extends MinecraftAsset {
906
906
  id: string;
907
907
  animations: Record<string, EntityAnimation>;
@@ -910,6 +910,8 @@ interface EntityAnimation {
910
910
  /** Seconds. */
911
911
  length: number;
912
912
  loop: boolean;
913
+ /** Geometry layer targeted by this clip; defaults to `main`. */
914
+ layer?: string;
913
915
  /** Part name anywhere in a layer; `root` is the layer's root part. */
914
916
  bones: Record<string, EntityAnimationBone>;
915
917
  }
@@ -947,7 +949,7 @@ declare class Entities {
947
949
  static getPassList(modelKey: BasicAssetKey): Promise<EntityModelPass[]>;
948
950
  static getEntity(modelKey: BasicAssetKey, textureKey?: BasicAssetKey, options?: EntityModelOptions): Promise<Maybe<EntityModel>>;
949
951
  /**
950
- * Vanilla's keyframe animations of a model by name, or undefined when the model or the selected version has none.
952
+ * Native and sampled vanilla clips by name, or undefined when the model or selected version has none.
951
953
  */
952
954
  static getAnimations(modelKey: BasicAssetKey): Promise<Maybe<Record<string, EntityAnimation>>>;
953
955
  static resolveTexture(modelKey: BasicAssetKey): Promise<Maybe<AssetKey>>;
@@ -1052,6 +1054,7 @@ interface Instanceable {
1052
1054
  isInstanceActive(index: number, reference: InstanceReference<Instanceable>): boolean;
1053
1055
  getMatrixAt(index: number, matrix?: Matrix4): Matrix4;
1054
1056
  setMatrixAt(index: number, matrix: Matrix4): void;
1057
+ setInstanceVisibleAt(index: number, visible: boolean): void;
1055
1058
  setPositionRotationScaleAt(index: number, position?: Vector3, rotation?: Euler, scale?: Vector3): void;
1056
1059
  setPositionAt(index: number, position: Vector3): void;
1057
1060
  getPositionAt(index: number, vector?: Vector3): Vector3;
@@ -1073,6 +1076,7 @@ declare class InstanceReference<T extends Instanceable> implements Transformable
1073
1076
  dispose(): void;
1074
1077
  getMatrix(matrix?: Matrix4): Matrix4;
1075
1078
  setMatrix(matrix: Matrix4): void;
1079
+ setVisible(visible: boolean): void;
1076
1080
  setPositionRotationScale(position?: Vector3, rotation?: Euler, scale?: Vector3): void;
1077
1081
  setPosition(position: Vector3): void;
1078
1082
  getPosition(): Vector3;
@@ -1209,11 +1213,11 @@ declare class EntityAnimationPlayer {
1209
1213
  get animation(): EntityAnimation | undefined;
1210
1214
  get time(): number;
1211
1215
  /**
1212
- * Starts an animation on the named parts below each layer root. The current pose of a part becomes its default;
1213
- * bones without a matching part are skipped.
1216
+ * Starts an animation on matching named parts. Supplied baked poses are the baseline for offsets;
1217
+ * without them, the current pose is used. Stopping restores the pose from before playback.
1214
1218
  */
1215
- play(layers: Object3D[], animation: EntityAnimation, options?: EntityAnimationOptions): void;
1216
- /** Restores the default poses. Returns whether an animation was active. */
1219
+ play(layers: Object3D[], animation: EntityAnimation, options?: EntityAnimationOptions, poses?: ReadonlyMap<Object3D, EntityModelPart["pose"]>): void;
1220
+ /** Restores the poses from before playback. Returns whether an animation was active. */
1217
1221
  stop(): boolean;
1218
1222
  /** Forgets the animation without touching the parts, for parts that no longer exist. */
1219
1223
  clear(): void;
@@ -1235,7 +1239,8 @@ declare class EntityObject extends SceneObject {
1235
1239
  private scrollTicker;
1236
1240
  /** Entity age in ticks, as vanilla's `ageInTicks`; drives the scrolling render modes. */
1237
1241
  age: number;
1238
- private readonly animationPlayer;
1242
+ private readonly animationPlayers;
1243
+ private readonly partPoses;
1239
1244
  constructor(entity: EntityModel, options?: Partial<EntityObjectOptions>);
1240
1245
  init(): Promise<void>;
1241
1246
  dispose(): void;
@@ -1244,17 +1249,21 @@ declare class EntityObject extends SceneObject {
1244
1249
  private updateScrollSubscription;
1245
1250
  /** Applies the entity age to the scrolling materials; the ticker calls this 20 times per second. */
1246
1251
  private updateScroll;
1247
- /** The animation started by {@link playAnimation}, until {@link stopAnimation} or disposal. */
1252
+ /** The first active clip, until playback is stopped or the object is disposed. */
1248
1253
  get animation(): Maybe<EntityAnimation>;
1254
+ /** Clips playing together, each targeting a separate geometry layer. */
1255
+ get activeAnimations(): readonly EntityAnimation[];
1249
1256
  /** Seconds since the animation started, before looping. */
1250
1257
  get animationTime(): number;
1251
1258
  /**
1252
- * Poses the object from a keyframe animation of {@link Entities.getAnimations}, replacing the current one.
1253
- * Parts of every layer are matched by name and their current pose is the default the offsets add to.
1259
+ * Plays a clip from {@link Entities.getAnimations}, replacing all active clips.
1260
+ * Offsets apply to the baked pose in the clip's layer (`main` by default), including repeated draws of that layer.
1254
1261
  * The object owns no clock: call {@link advanceAnimation} per frame, or {@link setAnimationTime}.
1255
1262
  */
1256
1263
  playAnimation(animation: EntityAnimation, options?: EntityAnimationOptions): void;
1257
- /** Stops the animation and restores the default pose. */
1264
+ /** Plays one clip per selected geometry layer, with a shared clock and no blending between clips. */
1265
+ playAnimations(animations: readonly EntityAnimation[], options?: EntityAnimationOptions): void;
1266
+ /** Stops all clips and restores the poses from before playback. */
1258
1267
  stopAnimation(): void;
1259
1268
  /** Poses the object at an explicit time in seconds. Has no effect without an animation. */
1260
1269
  setAnimationTime(seconds: number): void;
@@ -1358,6 +1367,7 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
1358
1367
  protected instanceMesh?: InstancedMesh;
1359
1368
  private readonly instanceReferences;
1360
1369
  private readonly freeInstanceIndices;
1370
+ private readonly hiddenInstanceMatrices;
1361
1371
  constructor(options?: Partial<SceneObjectOptions>);
1362
1372
  set scene(scene: MineRenderScene);
1363
1373
  get scene(): MineRenderScene;
@@ -1405,6 +1415,7 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
1405
1415
  protected activeInstanceIndices(): Iterable<number>;
1406
1416
  getMatrixAt(index: number, matrix?: Matrix4): Matrix4;
1407
1417
  setMatrixAt(index: number, matrix: Matrix4): void;
1418
+ setInstanceVisibleAt(index: number, visible: boolean): void;
1408
1419
  setPositionRotationScaleAt(index: number, position?: Vector3, rotation?: Euler, scale?: Vector3): void;
1409
1420
  setPositionAt(index: number, position: Vector3): void;
1410
1421
  getPositionAt(index: number, vector?: Vector3): Vector3;
@@ -1472,6 +1483,8 @@ declare class BlockObject extends SceneObject {
1472
1483
  private removeEntities;
1473
1484
  /** Entity models drawn for this block instead of its block model; they are scene children, unlike the block. */
1474
1485
  get blockEntities(): readonly EntityObject[];
1486
+ /** Sets visibility for this block's model instances and block entities. */
1487
+ setVisible(visible: boolean): void;
1475
1488
  /**
1476
1489
  * Draws the block through the dataset's block-entity index. Returns false, leaving nothing behind,
1477
1490
  * when the block is not listed or one of its models cannot be loaded.
@@ -2301,6 +2314,7 @@ declare class Chunk<SectionMeshing extends boolean = false> {
2301
2314
  private readonly data;
2302
2315
  private readonly renderedBlocks;
2303
2316
  private readonly sectionBlocks;
2317
+ private readonly hiddenBlocks;
2304
2318
  private sectionMesh?;
2305
2319
  private meshDirty;
2306
2320
  constructor(scene: MineRenderScene, x: number, y: number, z: number, onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined, sectionModels?: SectionModels | undefined);
@@ -2317,6 +2331,8 @@ declare class Chunk<SectionMeshing extends boolean = false> {
2317
2331
  * Set a block at integer chunk-local coordinates from 0 to 15.
2318
2332
  */
2319
2333
  setBlockInChunkAt(pos: Vector3, block?: Block, worldPos?: Vector3, onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined): Promise<Maybe<BlockInfo<SectionMeshing>>>;
2334
+ setBlockVisibleAt(pos: Vector3, visible: boolean): Promise<void>;
2335
+ isBlockVisibleAt(pos: Vector3): boolean;
2320
2336
  isOccludingAt(pos: Vector3): boolean;
2321
2337
  setCullMaskAt(pos: Vector3, mask: number): Promise<void>;
2322
2338
  rebuildSectionMesh(): void;
@@ -2342,6 +2358,13 @@ declare class MineRenderWorld<SectionMeshing extends boolean = false> {
2342
2358
  setBlockAt(pos: Vector3, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
2343
2359
  setBlockAt(pos: TripleArray, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
2344
2360
  private placeBlock;
2361
+ /**
2362
+ * Shows or hides a placed block without changing its data. Hidden blocks do not occlude neighbors.
2363
+ * Missing blocks are ignored; replacing or removing a block resets its visibility.
2364
+ */
2365
+ setBlockVisibleAt(x: number, y: number, z: number, visible: boolean): Promise<void>;
2366
+ setBlockVisibleAt(pos: Vector3, visible: boolean): Promise<void>;
2367
+ setBlockVisibleAt(pos: TripleArray, visible: boolean): Promise<void>;
2345
2368
  placeMultiBlock(multiblock: MultiBlockStructure, useBatches?: boolean, executor?: BatchedExecutor): Promise<void>;
2346
2369
  private placeBlocks;
2347
2370
  /** Replaces one chunk column's blocks. Entity NBT remains available on the parsed chunk. */
@@ -901,7 +901,7 @@ declare class DefaultBlockStates implements MinecraftAsset {
901
901
  [k: string]: BlockStatePropertyDefaults;
902
902
  }
903
903
 
904
- /** `entity-models/animations/<namespace>/<model id>.json`: vanilla's keyframe animations of one model. */
904
+ /** `entity-models/animations/<namespace>/<model id>.json`: native and sampled vanilla animation clips. */
905
905
  interface EntityAnimationFile extends MinecraftAsset {
906
906
  id: string;
907
907
  animations: Record<string, EntityAnimation>;
@@ -910,6 +910,8 @@ interface EntityAnimation {
910
910
  /** Seconds. */
911
911
  length: number;
912
912
  loop: boolean;
913
+ /** Geometry layer targeted by this clip; defaults to `main`. */
914
+ layer?: string;
913
915
  /** Part name anywhere in a layer; `root` is the layer's root part. */
914
916
  bones: Record<string, EntityAnimationBone>;
915
917
  }
@@ -947,7 +949,7 @@ declare class Entities {
947
949
  static getPassList(modelKey: BasicAssetKey): Promise<EntityModelPass[]>;
948
950
  static getEntity(modelKey: BasicAssetKey, textureKey?: BasicAssetKey, options?: EntityModelOptions): Promise<Maybe<EntityModel>>;
949
951
  /**
950
- * Vanilla's keyframe animations of a model by name, or undefined when the model or the selected version has none.
952
+ * Native and sampled vanilla clips by name, or undefined when the model or selected version has none.
951
953
  */
952
954
  static getAnimations(modelKey: BasicAssetKey): Promise<Maybe<Record<string, EntityAnimation>>>;
953
955
  static resolveTexture(modelKey: BasicAssetKey): Promise<Maybe<AssetKey>>;
@@ -1052,6 +1054,7 @@ interface Instanceable {
1052
1054
  isInstanceActive(index: number, reference: InstanceReference<Instanceable>): boolean;
1053
1055
  getMatrixAt(index: number, matrix?: Matrix4): Matrix4;
1054
1056
  setMatrixAt(index: number, matrix: Matrix4): void;
1057
+ setInstanceVisibleAt(index: number, visible: boolean): void;
1055
1058
  setPositionRotationScaleAt(index: number, position?: Vector3, rotation?: Euler, scale?: Vector3): void;
1056
1059
  setPositionAt(index: number, position: Vector3): void;
1057
1060
  getPositionAt(index: number, vector?: Vector3): Vector3;
@@ -1073,6 +1076,7 @@ declare class InstanceReference<T extends Instanceable> implements Transformable
1073
1076
  dispose(): void;
1074
1077
  getMatrix(matrix?: Matrix4): Matrix4;
1075
1078
  setMatrix(matrix: Matrix4): void;
1079
+ setVisible(visible: boolean): void;
1076
1080
  setPositionRotationScale(position?: Vector3, rotation?: Euler, scale?: Vector3): void;
1077
1081
  setPosition(position: Vector3): void;
1078
1082
  getPosition(): Vector3;
@@ -1209,11 +1213,11 @@ declare class EntityAnimationPlayer {
1209
1213
  get animation(): EntityAnimation | undefined;
1210
1214
  get time(): number;
1211
1215
  /**
1212
- * Starts an animation on the named parts below each layer root. The current pose of a part becomes its default;
1213
- * bones without a matching part are skipped.
1216
+ * Starts an animation on matching named parts. Supplied baked poses are the baseline for offsets;
1217
+ * without them, the current pose is used. Stopping restores the pose from before playback.
1214
1218
  */
1215
- play(layers: Object3D[], animation: EntityAnimation, options?: EntityAnimationOptions): void;
1216
- /** Restores the default poses. Returns whether an animation was active. */
1219
+ play(layers: Object3D[], animation: EntityAnimation, options?: EntityAnimationOptions, poses?: ReadonlyMap<Object3D, EntityModelPart["pose"]>): void;
1220
+ /** Restores the poses from before playback. Returns whether an animation was active. */
1217
1221
  stop(): boolean;
1218
1222
  /** Forgets the animation without touching the parts, for parts that no longer exist. */
1219
1223
  clear(): void;
@@ -1235,7 +1239,8 @@ declare class EntityObject extends SceneObject {
1235
1239
  private scrollTicker;
1236
1240
  /** Entity age in ticks, as vanilla's `ageInTicks`; drives the scrolling render modes. */
1237
1241
  age: number;
1238
- private readonly animationPlayer;
1242
+ private readonly animationPlayers;
1243
+ private readonly partPoses;
1239
1244
  constructor(entity: EntityModel, options?: Partial<EntityObjectOptions>);
1240
1245
  init(): Promise<void>;
1241
1246
  dispose(): void;
@@ -1244,17 +1249,21 @@ declare class EntityObject extends SceneObject {
1244
1249
  private updateScrollSubscription;
1245
1250
  /** Applies the entity age to the scrolling materials; the ticker calls this 20 times per second. */
1246
1251
  private updateScroll;
1247
- /** The animation started by {@link playAnimation}, until {@link stopAnimation} or disposal. */
1252
+ /** The first active clip, until playback is stopped or the object is disposed. */
1248
1253
  get animation(): Maybe<EntityAnimation>;
1254
+ /** Clips playing together, each targeting a separate geometry layer. */
1255
+ get activeAnimations(): readonly EntityAnimation[];
1249
1256
  /** Seconds since the animation started, before looping. */
1250
1257
  get animationTime(): number;
1251
1258
  /**
1252
- * Poses the object from a keyframe animation of {@link Entities.getAnimations}, replacing the current one.
1253
- * Parts of every layer are matched by name and their current pose is the default the offsets add to.
1259
+ * Plays a clip from {@link Entities.getAnimations}, replacing all active clips.
1260
+ * Offsets apply to the baked pose in the clip's layer (`main` by default), including repeated draws of that layer.
1254
1261
  * The object owns no clock: call {@link advanceAnimation} per frame, or {@link setAnimationTime}.
1255
1262
  */
1256
1263
  playAnimation(animation: EntityAnimation, options?: EntityAnimationOptions): void;
1257
- /** Stops the animation and restores the default pose. */
1264
+ /** Plays one clip per selected geometry layer, with a shared clock and no blending between clips. */
1265
+ playAnimations(animations: readonly EntityAnimation[], options?: EntityAnimationOptions): void;
1266
+ /** Stops all clips and restores the poses from before playback. */
1258
1267
  stopAnimation(): void;
1259
1268
  /** Poses the object at an explicit time in seconds. Has no effect without an animation. */
1260
1269
  setAnimationTime(seconds: number): void;
@@ -1358,6 +1367,7 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
1358
1367
  protected instanceMesh?: InstancedMesh;
1359
1368
  private readonly instanceReferences;
1360
1369
  private readonly freeInstanceIndices;
1370
+ private readonly hiddenInstanceMatrices;
1361
1371
  constructor(options?: Partial<SceneObjectOptions>);
1362
1372
  set scene(scene: MineRenderScene);
1363
1373
  get scene(): MineRenderScene;
@@ -1405,6 +1415,7 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
1405
1415
  protected activeInstanceIndices(): Iterable<number>;
1406
1416
  getMatrixAt(index: number, matrix?: Matrix4): Matrix4;
1407
1417
  setMatrixAt(index: number, matrix: Matrix4): void;
1418
+ setInstanceVisibleAt(index: number, visible: boolean): void;
1408
1419
  setPositionRotationScaleAt(index: number, position?: Vector3, rotation?: Euler, scale?: Vector3): void;
1409
1420
  setPositionAt(index: number, position: Vector3): void;
1410
1421
  getPositionAt(index: number, vector?: Vector3): Vector3;
@@ -1472,6 +1483,8 @@ declare class BlockObject extends SceneObject {
1472
1483
  private removeEntities;
1473
1484
  /** Entity models drawn for this block instead of its block model; they are scene children, unlike the block. */
1474
1485
  get blockEntities(): readonly EntityObject[];
1486
+ /** Sets visibility for this block's model instances and block entities. */
1487
+ setVisible(visible: boolean): void;
1475
1488
  /**
1476
1489
  * Draws the block through the dataset's block-entity index. Returns false, leaving nothing behind,
1477
1490
  * when the block is not listed or one of its models cannot be loaded.
@@ -2301,6 +2314,7 @@ declare class Chunk<SectionMeshing extends boolean = false> {
2301
2314
  private readonly data;
2302
2315
  private readonly renderedBlocks;
2303
2316
  private readonly sectionBlocks;
2317
+ private readonly hiddenBlocks;
2304
2318
  private sectionMesh?;
2305
2319
  private meshDirty;
2306
2320
  constructor(scene: MineRenderScene, x: number, y: number, z: number, onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined, sectionModels?: SectionModels | undefined);
@@ -2317,6 +2331,8 @@ declare class Chunk<SectionMeshing extends boolean = false> {
2317
2331
  * Set a block at integer chunk-local coordinates from 0 to 15.
2318
2332
  */
2319
2333
  setBlockInChunkAt(pos: Vector3, block?: Block, worldPos?: Vector3, onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined): Promise<Maybe<BlockInfo<SectionMeshing>>>;
2334
+ setBlockVisibleAt(pos: Vector3, visible: boolean): Promise<void>;
2335
+ isBlockVisibleAt(pos: Vector3): boolean;
2320
2336
  isOccludingAt(pos: Vector3): boolean;
2321
2337
  setCullMaskAt(pos: Vector3, mask: number): Promise<void>;
2322
2338
  rebuildSectionMesh(): void;
@@ -2342,6 +2358,13 @@ declare class MineRenderWorld<SectionMeshing extends boolean = false> {
2342
2358
  setBlockAt(pos: Vector3, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
2343
2359
  setBlockAt(pos: TripleArray, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
2344
2360
  private placeBlock;
2361
+ /**
2362
+ * Shows or hides a placed block without changing its data. Hidden blocks do not occlude neighbors.
2363
+ * Missing blocks are ignored; replacing or removing a block resets its visibility.
2364
+ */
2365
+ setBlockVisibleAt(x: number, y: number, z: number, visible: boolean): Promise<void>;
2366
+ setBlockVisibleAt(pos: Vector3, visible: boolean): Promise<void>;
2367
+ setBlockVisibleAt(pos: TripleArray, visible: boolean): Promise<void>;
2345
2368
  placeMultiBlock(multiblock: MultiBlockStructure, useBatches?: boolean, executor?: BatchedExecutor): Promise<void>;
2346
2369
  private placeBlocks;
2347
2370
  /** Replaces one chunk column's blocks. Entity NBT remains available on the parsed chunk. */