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