@minecraft/server 1.6.0-beta.1.20.30-preview.24 → 1.6.0-beta.1.20.40-preview.20

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/index.d.ts +654 -292
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -6,4 +6,4 @@ Contains many types related to manipulating a Minecraft world, including entitie
6
6
 
7
7
  See full documentation for this module here:
8
8
 
9
- https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/minecraft/server/minecraft-server
9
+ https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/@minecraft/server/@minecraft/server
package/index.d.ts CHANGED
@@ -16,7 +16,7 @@
16
16
  * ```json
17
17
  * {
18
18
  * "module_name": "@minecraft/server",
19
- * "version": "1.6.0-internal.1.20.30-preview.24"
19
+ * "version": "1.6.0-internal.1.20.40-preview.20"
20
20
  * }
21
21
  * ```
22
22
  *
@@ -776,6 +776,20 @@ export class Block {
776
776
  *
777
777
  */
778
778
  readonly z: number;
779
+ /**
780
+ * @beta
781
+ * @throws This function can throw errors.
782
+ */
783
+ above(steps?: number): Block | undefined;
784
+ /**
785
+ * @beta
786
+ * @throws This function can throw errors.
787
+ */
788
+ below(steps?: number): Block | undefined;
789
+ /**
790
+ * @beta
791
+ */
792
+ bottomCenter(): Vector3;
779
793
  /**
780
794
  * @beta
781
795
  * @remarks
@@ -794,6 +808,15 @@ export class Block {
794
808
  * @throws This function can throw errors.
795
809
  */
796
810
  canPlace(blockToPlace: BlockPermutation | BlockType | string, faceToPlaceOn?: Direction): boolean;
811
+ /**
812
+ * @beta
813
+ */
814
+ center(): Vector3;
815
+ /**
816
+ * @beta
817
+ * @throws This function can throw errors.
818
+ */
819
+ east(steps?: number): Block | undefined;
797
820
  /**
798
821
  * @beta
799
822
  * @remarks
@@ -882,6 +905,16 @@ export class Block {
882
905
  * True if this block object is still working and valid.
883
906
  */
884
907
  isValid(): boolean;
908
+ /**
909
+ * @beta
910
+ * @throws This function can throw errors.
911
+ */
912
+ north(steps?: number): Block | undefined;
913
+ /**
914
+ * @beta
915
+ * @throws This function can throw errors.
916
+ */
917
+ offset(offset: Vector3): Block | undefined;
885
918
  /**
886
919
  * @remarks
887
920
  * Sets the block in the dimension to the state of the
@@ -908,6 +941,11 @@ export class Block {
908
941
  * @throws This function can throw errors.
909
942
  */
910
943
  setType(blockType: BlockType | string): void;
944
+ /**
945
+ * @beta
946
+ * @throws This function can throw errors.
947
+ */
948
+ south(steps?: number): Block | undefined;
911
949
  /**
912
950
  * @beta
913
951
  * @remarks
@@ -925,6 +963,11 @@ export class Block {
925
963
  * @throws This function can throw errors.
926
964
  */
927
965
  trySetPermutation(permutation: BlockPermutation): boolean;
966
+ /**
967
+ * @beta
968
+ * @throws This function can throw errors.
969
+ */
970
+ west(steps?: number): Block | undefined;
928
971
  }
929
972
 
930
973
  /**
@@ -1195,7 +1238,7 @@ export class BlockPermutation {
1195
1238
  * Number of instances of this block to place in the prototype
1196
1239
  * item stack.
1197
1240
  */
1198
- getItemStack(amount?: number): ItemStack;
1241
+ getItemStack(amount?: number): ItemStack | undefined;
1199
1242
  /**
1200
1243
  * @beta
1201
1244
  * @remarks
@@ -1572,7 +1615,7 @@ export class BlockStates {
1572
1615
  * Returns the block state instance if it is found. If the
1573
1616
  * block state instance is not found returns undefined.
1574
1617
  */
1575
- static get(stateName: string): BlockStateType;
1618
+ static get(stateName: string): BlockStateType | undefined;
1576
1619
  /**
1577
1620
  * @remarks
1578
1621
  * Retrieves a set of all available block states.
@@ -1995,11 +2038,11 @@ export class Camera {
1995
2038
  setCamera(
1996
2039
  cameraPreset: string,
1997
2040
  setOptions?:
1998
- | ScriptCameraDefaultOptions
1999
- | ScriptCameraSetFacingOptions
2000
- | ScriptCameraSetLocationOptions
2001
- | ScriptCameraSetPosOptions
2002
- | ScriptCameraSetRotOptions,
2041
+ | CameraDefaultOptions
2042
+ | CameraSetFacingOptions
2043
+ | CameraSetLocationOptions
2044
+ | CameraSetPosOptions
2045
+ | CameraSetRotOptions,
2003
2046
  ): void;
2004
2047
  }
2005
2048
 
@@ -3483,47 +3526,6 @@ export class DimensionTypes {
3483
3526
  static getAll(): DimensionType[];
3484
3527
  }
3485
3528
 
3486
- /**
3487
- * @beta
3488
- * Class used in conjunction with {@link PropertyRegistry} to
3489
- * define dynamic properties that can be used on entities of a
3490
- * specified type or at the global World- level.
3491
- */
3492
- export class DynamicPropertiesDefinition {
3493
- /**
3494
- * @remarks
3495
- * Defines a boolean dynamic property.
3496
- *
3497
- * @throws This function can throw errors.
3498
- */
3499
- defineBoolean(identifier: string, defaultValue?: boolean): DynamicPropertiesDefinition;
3500
- /**
3501
- * @remarks
3502
- * Defines a number dynamic property.
3503
- *
3504
- * @throws This function can throw errors.
3505
- */
3506
- defineNumber(identifier: string, defaultValue?: number): DynamicPropertiesDefinition;
3507
- /**
3508
- * @remarks
3509
- * Defines a string dynamic property.
3510
- *
3511
- * @throws This function can throw errors.
3512
- */
3513
- defineString(identifier: string, maxLength: number, defaultValue?: string): DynamicPropertiesDefinition;
3514
- /**
3515
- * @remarks
3516
- * Defines a new Vector3-based dynamic property.
3517
- *
3518
- * @param identifier
3519
- * Identifier of the Vector3 property.
3520
- * @param defaultValue
3521
- * Optional default starting Vector for this property.
3522
- * @throws This function can throw errors.
3523
- */
3524
- defineVector(identifier: string, defaultValue?: Vector3): DynamicPropertiesDefinition;
3525
- }
3526
-
3527
3529
  /**
3528
3530
  * @beta
3529
3531
  * Represents an effect - like poison - that has been added to
@@ -4212,6 +4214,11 @@ export class Entity {
4212
4214
  * ```
4213
4215
  */
4214
4216
  applyKnockback(directionX: number, directionZ: number, horizontalStrength: number, verticalStrength: number): void;
4217
+ /**
4218
+ * @beta
4219
+ * @throws This function can throw errors.
4220
+ */
4221
+ clearDynamicProperties(): void;
4215
4222
  /**
4216
4223
  * @beta
4217
4224
  * @remarks
@@ -4330,6 +4337,16 @@ export class Entity {
4330
4337
  * @throws This function can throw errors.
4331
4338
  */
4332
4339
  getDynamicProperty(identifier: string): boolean | number | string | Vector3 | undefined;
4340
+ /**
4341
+ * @beta
4342
+ * @throws This function can throw errors.
4343
+ */
4344
+ getDynamicPropertyIds(): string[];
4345
+ /**
4346
+ * @beta
4347
+ * @throws This function can throw errors.
4348
+ */
4349
+ getDynamicPropertyTotalByteCount(): number;
4333
4350
  /**
4334
4351
  * @beta
4335
4352
  * @remarks
@@ -4548,18 +4565,6 @@ export class Entity {
4548
4565
  * @throws This function can throw errors.
4549
4566
  */
4550
4567
  remove(): void;
4551
- /**
4552
- * @beta
4553
- * @remarks
4554
- * Removes a specified property.
4555
- *
4556
- * @param identifier
4557
- * The property identifier.
4558
- * @returns
4559
- * Returns whether the given property existed on the entity.
4560
- * @throws This function can throw errors.
4561
- */
4562
- removeDynamicProperty(identifier: string): boolean;
4563
4568
  /**
4564
4569
  * @beta
4565
4570
  * @remarks
@@ -4652,7 +4657,7 @@ export class Entity {
4652
4657
  * Data value of the property to set.
4653
4658
  * @throws This function can throw errors.
4654
4659
  */
4655
- setDynamicProperty(identifier: string, value: boolean | number | string | Vector3): void;
4660
+ setDynamicProperty(identifier: string, value?: boolean | number | string | Vector3): void;
4656
4661
  /**
4657
4662
  * @beta
4658
4663
  * @remarks
@@ -6956,7 +6961,7 @@ export class ExplosionAfterEvent {
6956
6961
  * A collection of blocks impacted by this explosion event.
6957
6962
  *
6958
6963
  */
6959
- getImpactedBlocks(): Vector3[];
6964
+ getImpactedBlocks(): Block[];
6960
6965
  }
6961
6966
 
6962
6967
  /**
@@ -7009,7 +7014,7 @@ export class ExplosionBeforeEvent extends ExplosionAfterEvent {
7009
7014
  * @param blocks
7010
7015
  * New list of blocks that are impacted by this explosion.
7011
7016
  */
7012
- setImpactedBlocks(blocks: Vector3[]): void;
7017
+ setImpactedBlocks(blocks: Block[]): void;
7013
7018
  }
7014
7019
 
7015
7020
  /**
@@ -7437,7 +7442,7 @@ export class ItemDefinitionTriggeredAfterEvent {
7437
7442
  * Returns the source entity that triggered this item event.
7438
7443
  *
7439
7444
  */
7440
- readonly source: Player;
7445
+ readonly source?: Player;
7441
7446
  }
7442
7447
 
7443
7448
  /**
@@ -8218,7 +8223,7 @@ export class ItemTypes {
8218
8223
  * Returns a specific item type, if available within Minecraft.
8219
8224
  *
8220
8225
  */
8221
- static get(itemId: string): ItemType;
8226
+ static get(itemId: string): ItemType | undefined;
8222
8227
  /**
8223
8228
  * @remarks
8224
8229
  * Retrieves all available item types registered within
@@ -8975,6 +8980,14 @@ export class Player extends Entity {
8975
8980
  * @throws This function can throw errors.
8976
8981
  */
8977
8982
  isOp(): boolean;
8983
+ /**
8984
+ * @beta
8985
+ * @remarks
8986
+ * This function can't be called in read-only mode.
8987
+ *
8988
+ * @throws This function can throw errors.
8989
+ */
8990
+ playMusic(trackId: string, musicOptions?: MusicOptions): void;
8978
8991
  /**
8979
8992
  * @beta
8980
8993
  * @remarks
@@ -8982,8 +8995,6 @@ export class Player extends Entity {
8982
8995
  *
8983
8996
  * This function can't be called in read-only mode.
8984
8997
  *
8985
- * @param soundID
8986
- * Identifier of the sound to play.
8987
8998
  * @param soundOptions
8988
8999
  * Additional optional options for the sound.
8989
9000
  * @throws This function can throw errors.
@@ -9012,7 +9023,7 @@ export class Player extends Entity {
9012
9023
  * players[0].playSound("bucket.fill_water", playerSoundOptions);
9013
9024
  * ```
9014
9025
  */
9015
- playSound(soundID: string, soundOptions?: PlayerSoundOptions): void;
9026
+ playSound(soundId: string, soundOptions?: PlayerSoundOptions): void;
9016
9027
  /**
9017
9028
  * @beta
9018
9029
  * @remarks
@@ -9024,6 +9035,14 @@ export class Player extends Entity {
9024
9035
  * @throws This function can throw errors.
9025
9036
  */
9026
9037
  postClientMessage(id: string, value: string): void;
9038
+ /**
9039
+ * @beta
9040
+ * @remarks
9041
+ * This function can't be called in read-only mode.
9042
+ *
9043
+ * @throws This function can throw errors.
9044
+ */
9045
+ queueMusic(trackId: string, musicOptions?: MusicOptions): void;
9027
9046
  /**
9028
9047
  * @beta
9029
9048
  * @remarks
@@ -9123,6 +9142,14 @@ export class Player extends Entity {
9123
9142
  * @throws This function can throw errors.
9124
9143
  */
9125
9144
  startItemCooldown(itemCategory: string, tickDuration: number): void;
9145
+ /**
9146
+ * @beta
9147
+ * @remarks
9148
+ * This function can't be called in read-only mode.
9149
+ *
9150
+ * @throws This function can throw errors.
9151
+ */
9152
+ stopMusic(): void;
9126
9153
  }
9127
9154
 
9128
9155
  /**
@@ -9255,178 +9282,167 @@ export class PlayerBreakBlockBeforeEventSignal {
9255
9282
 
9256
9283
  /**
9257
9284
  * @beta
9258
- * This type is usable for iterating over a set of players.
9259
- * This means it can be used in statements like for...of
9260
- * statements, Array.from(iterator), and more.
9285
+ * Contains information related to changes to a player's
9286
+ * dimension having been changed.
9261
9287
  */
9262
- export class PlayerIterator implements Iterable<Player> {
9288
+ export class PlayerDimensionChangeAfterEvent {
9263
9289
  private constructor();
9264
9290
  /**
9265
9291
  * @remarks
9266
- * This function can't be called in read-only mode.
9292
+ * The dimension the player is changing from.
9267
9293
  *
9268
9294
  */
9269
- [Symbol.iterator](): Iterator<Player>;
9295
+ readonly fromDimension: Dimension;
9270
9296
  /**
9271
9297
  * @remarks
9272
- * Retrieves the next item in this iteration. The resulting
9273
- * IteratorResult contains .done and .value properties which
9274
- * can be used to see the next Player in the iteration.
9298
+ * The location the player was at before changing dimensions.
9275
9299
  *
9276
- * This function can't be called in read-only mode.
9300
+ */
9301
+ readonly fromLocation: Vector3;
9302
+ /**
9303
+ * @remarks
9304
+ * Handle to the player that is changing dimensions.
9277
9305
  *
9278
9306
  */
9279
- next(): IteratorResult<Player>;
9280
- }
9281
-
9282
- /**
9283
- * @beta
9284
- * Contains information regarding a player that has joined.
9285
- * See the playerSpawn event for more detailed information that
9286
- * could be returned after the first time a player has spawned
9287
- * within the game.
9288
- */
9289
- export class PlayerJoinAfterEvent {
9290
- private constructor();
9307
+ readonly player: Player;
9291
9308
  /**
9292
9309
  * @remarks
9293
- * Opaque string identifier of the player that joined the game.
9310
+ * The dimension that the player is changing to.
9294
9311
  *
9295
9312
  */
9296
- readonly playerId: string;
9313
+ readonly toDimension: Dimension;
9297
9314
  /**
9298
9315
  * @remarks
9299
- * Name of the player that has joined.
9316
+ * The location the player will spawn to after changing
9317
+ * dimensions.
9300
9318
  *
9301
9319
  */
9302
- readonly playerName: string;
9303
- }
9304
-
9305
- /**
9306
- * @beta
9307
- * Manages callbacks that are connected to a player joining the
9308
- * world.
9309
- */
9310
- // @ts-ignore Class inheritance allowed for native defined classes
9311
- export class PlayerJoinAfterEventSignal extends IPlayerJoinAfterEventSignal {
9312
- private constructor();
9320
+ readonly toLocation: Vector3;
9313
9321
  }
9314
9322
 
9315
9323
  /**
9316
9324
  * @beta
9317
- * Contains information regarding a player that has left the
9318
- * world.
9325
+ * Manages callbacks that are connected to successful player
9326
+ * dimension changes.
9319
9327
  */
9320
- export class PlayerLeaveAfterEvent {
9328
+ export class PlayerDimensionChangeAfterEventSignal {
9321
9329
  private constructor();
9322
9330
  /**
9323
9331
  * @remarks
9324
- * Opaque string identifier of the player that has left the
9325
- * event.
9332
+ * This function can't be called in read-only mode.
9326
9333
  *
9327
9334
  */
9328
- readonly playerId: string;
9335
+ subscribe(callback: (arg: PlayerDimensionChangeAfterEvent) => void): (arg: PlayerDimensionChangeAfterEvent) => void;
9329
9336
  /**
9330
9337
  * @remarks
9331
- * Player that has left the world.
9338
+ * This function can't be called in read-only mode.
9332
9339
  *
9340
+ * @throws This function can throw errors.
9333
9341
  */
9334
- readonly playerName: string;
9335
- }
9336
-
9337
- /**
9338
- * @beta
9339
- * Manages callbacks that are connected to a player leaving the
9340
- * world.
9341
- */
9342
- // @ts-ignore Class inheritance allowed for native defined classes
9343
- export class PlayerLeaveAfterEventSignal extends IPlayerLeaveAfterEventSignal {
9344
- private constructor();
9342
+ unsubscribe(callback: (arg: PlayerDimensionChangeAfterEvent) => void): void;
9345
9343
  }
9346
9344
 
9347
9345
  /**
9348
9346
  * @beta
9349
- * Contains information regarding an event where a player
9350
- * places a block.
9347
+ * Contains information related to a player's dimension
9348
+ * changing.
9351
9349
  */
9352
- // @ts-ignore Class inheritance allowed for native defined classes
9353
- export class PlayerPlaceBlockAfterEvent extends BlockEvent {
9350
+ export class PlayerDimensionChangeBeforeEvent {
9354
9351
  private constructor();
9355
9352
  /**
9356
9353
  * @remarks
9357
- * Player that placed the block for this event.
9354
+ * The dimension the player is changing from.
9355
+ *
9356
+ */
9357
+ readonly fromDimension: Dimension;
9358
+ /**
9359
+ * @remarks
9360
+ * The location the player was at before changing dimensions.
9361
+ *
9362
+ */
9363
+ readonly fromLocation: Vector3;
9364
+ /**
9365
+ * @remarks
9366
+ * Handle to the player that is changing dimensions.
9358
9367
  *
9359
9368
  */
9360
9369
  readonly player: Player;
9370
+ /**
9371
+ * @remarks
9372
+ * The dimension that the player is changing to, property will
9373
+ * modify dimension change request.
9374
+ *
9375
+ */
9376
+ readonly toDimension: Dimension;
9377
+ /**
9378
+ * @remarks
9379
+ * The location the player will spawn to after changing
9380
+ * dimensions, property will modify spawn location request.
9381
+ *
9382
+ */
9383
+ readonly toLocation: Vector3;
9361
9384
  }
9362
9385
 
9363
9386
  /**
9364
9387
  * @beta
9365
- * Manages callbacks that are connected to when a block is
9366
- * placed by a player.
9388
+ * Manages callbacks that are connected to player dimension
9389
+ * change requests.
9367
9390
  */
9368
- export class PlayerPlaceBlockAfterEventSignal {
9391
+ export class PlayerDimensionChangeBeforeEventSignal {
9369
9392
  private constructor();
9370
9393
  /**
9371
9394
  * @remarks
9372
- * Adds a callback that will be called when a block is placed
9373
- * by a player.
9374
- *
9375
9395
  * This function can't be called in read-only mode.
9376
9396
  *
9377
9397
  */
9378
9398
  subscribe(
9379
- callback: (arg: PlayerPlaceBlockAfterEvent) => void,
9380
- options?: BlockEventOptions,
9381
- ): (arg: PlayerPlaceBlockAfterEvent) => void;
9399
+ callback: (arg: PlayerDimensionChangeBeforeEvent) => void,
9400
+ ): (arg: PlayerDimensionChangeBeforeEvent) => void;
9382
9401
  /**
9383
9402
  * @remarks
9384
- * Removes a callback from being called when an block is placed
9385
- * by a player.
9386
- *
9387
9403
  * This function can't be called in read-only mode.
9388
9404
  *
9389
9405
  * @throws This function can throw errors.
9390
9406
  */
9391
- unsubscribe(callback: (arg: PlayerPlaceBlockAfterEvent) => void): void;
9407
+ unsubscribe(callback: (arg: PlayerDimensionChangeBeforeEvent) => void): void;
9392
9408
  }
9393
9409
 
9394
9410
  /**
9395
9411
  * @beta
9396
- * Contains information regarding an event before a player
9397
- * places a block.
9412
+ * Contains information regarding an event after a player
9413
+ * interacts with a block.
9398
9414
  */
9399
- // @ts-ignore Class inheritance allowed for native defined classes
9400
- export class PlayerPlaceBlockBeforeEvent extends BlockEvent {
9415
+ export class PlayerInteractWithBlockAfterEvent {
9401
9416
  private constructor();
9402
9417
  /**
9403
9418
  * @remarks
9404
- * If set to true, cancels the block place event.
9419
+ * The block that will be interacted with.
9405
9420
  *
9406
9421
  */
9407
- cancel: boolean;
9422
+ readonly block: Block;
9408
9423
  /**
9409
9424
  * @remarks
9410
- * The face of the block that the new block is being placed on.
9425
+ * The face of the block that is being interacted with.
9411
9426
  *
9412
9427
  */
9413
- readonly face: Direction;
9428
+ readonly blockFace: Direction;
9414
9429
  /**
9415
9430
  * @remarks
9416
9431
  * Location relative to the bottom north-west corner of the
9417
- * block where the new block is being placed onto.
9432
+ * block where the item is placed.
9418
9433
  *
9419
9434
  */
9420
9435
  readonly faceLocation: Vector3;
9421
9436
  /**
9422
9437
  * @remarks
9423
- * The item being used to place the block.
9438
+ * The item stack that is being used in the interaction, or
9439
+ * undefined if empty hand.
9424
9440
  *
9425
9441
  */
9426
- itemStack: ItemStack;
9442
+ readonly itemStack?: ItemStack;
9427
9443
  /**
9428
9444
  * @remarks
9429
- * Player that is placing the block for this event.
9445
+ * Source Player for this event.
9430
9446
  *
9431
9447
  */
9432
9448
  readonly player: Player;
@@ -9434,63 +9450,439 @@ export class PlayerPlaceBlockBeforeEvent extends BlockEvent {
9434
9450
 
9435
9451
  /**
9436
9452
  * @beta
9437
- * Manages callbacks that are connected to before a block is
9438
- * placed by a player.
9439
9453
  */
9440
- export class PlayerPlaceBlockBeforeEventSignal {
9454
+ export class PlayerInteractWithBlockAfterEventSignal {
9441
9455
  private constructor();
9442
9456
  /**
9443
9457
  * @remarks
9444
- * Adds a callback that will be called before a block is placed
9445
- * by a player.
9446
- *
9447
9458
  * This function can't be called in read-only mode.
9448
9459
  *
9449
9460
  */
9450
9461
  subscribe(
9451
- callback: (arg: PlayerPlaceBlockBeforeEvent) => void,
9452
- options?: BlockEventOptions,
9453
- ): (arg: PlayerPlaceBlockBeforeEvent) => void;
9462
+ callback: (arg: PlayerInteractWithBlockAfterEvent) => void,
9463
+ ): (arg: PlayerInteractWithBlockAfterEvent) => void;
9454
9464
  /**
9455
9465
  * @remarks
9456
- * Removes a callback from being called before an block is
9457
- * placed by a player.
9458
- *
9459
9466
  * This function can't be called in read-only mode.
9460
9467
  *
9461
9468
  * @throws This function can throw errors.
9462
9469
  */
9463
- unsubscribe(callback: (arg: PlayerPlaceBlockBeforeEvent) => void): void;
9470
+ unsubscribe(callback: (arg: PlayerInteractWithBlockAfterEvent) => void): void;
9464
9471
  }
9465
9472
 
9466
9473
  /**
9467
9474
  * @beta
9468
- * An event that contains more information about a player
9469
- * spawning.
9475
+ * Contains information regarding an event before a player
9476
+ * interacts with a block.
9470
9477
  */
9471
- export class PlayerSpawnAfterEvent {
9478
+ export class PlayerInteractWithBlockBeforeEvent {
9472
9479
  private constructor();
9473
9480
  /**
9474
9481
  * @remarks
9475
- * If true, this is the initial spawn of a player after joining
9476
- * the game.
9482
+ * The block that will be interacted with.
9477
9483
  *
9478
- * This property can't be edited in read-only mode.
9484
+ */
9485
+ readonly block: Block;
9486
+ /**
9487
+ * @remarks
9488
+ * The face of the block that is being interacted with.
9479
9489
  *
9480
9490
  */
9481
- initialSpawn: boolean;
9491
+ readonly blockFace: Direction;
9482
9492
  /**
9483
9493
  * @remarks
9484
- * Object that represents the player that joined the game.
9494
+ * If set to true the interaction will be cancelled.
9485
9495
  *
9486
- * This property can't be edited in read-only mode.
9496
+ */
9497
+ cancel: boolean;
9498
+ /**
9499
+ * @remarks
9500
+ * Location relative to the bottom north-west corner of the
9501
+ * block where the item is placed.
9487
9502
  *
9488
9503
  */
9489
- player: Player;
9490
- }
9491
-
9492
- /**
9493
- * @beta
9504
+ readonly faceLocation: Vector3;
9505
+ /**
9506
+ * @remarks
9507
+ * The item stack that is being used in the interaction, or
9508
+ * undefined if empty hand.
9509
+ *
9510
+ */
9511
+ readonly itemStack?: ItemStack;
9512
+ /**
9513
+ * @remarks
9514
+ * Source Player for this event.
9515
+ *
9516
+ */
9517
+ readonly player: Player;
9518
+ }
9519
+
9520
+ /**
9521
+ * @beta
9522
+ */
9523
+ export class PlayerInteractWithBlockBeforeEventSignal {
9524
+ private constructor();
9525
+ /**
9526
+ * @remarks
9527
+ * This function can't be called in read-only mode.
9528
+ *
9529
+ */
9530
+ subscribe(
9531
+ callback: (arg: PlayerInteractWithBlockBeforeEvent) => void,
9532
+ ): (arg: PlayerInteractWithBlockBeforeEvent) => void;
9533
+ /**
9534
+ * @remarks
9535
+ * This function can't be called in read-only mode.
9536
+ *
9537
+ * @throws This function can throw errors.
9538
+ */
9539
+ unsubscribe(callback: (arg: PlayerInteractWithBlockBeforeEvent) => void): void;
9540
+ }
9541
+
9542
+ /**
9543
+ * @beta
9544
+ * Contains information regarding an event after a player
9545
+ * interacts with an entity.
9546
+ */
9547
+ export class PlayerInteractWithEntityAfterEvent {
9548
+ private constructor();
9549
+ /**
9550
+ * @remarks
9551
+ * The item stack that is being used in the interaction, or
9552
+ * undefined if empty hand.
9553
+ *
9554
+ */
9555
+ readonly itemStack?: ItemStack;
9556
+ /**
9557
+ * @remarks
9558
+ * Source Player for this event.
9559
+ *
9560
+ */
9561
+ readonly player: Player;
9562
+ /**
9563
+ * @remarks
9564
+ * The entity that will be interacted with.
9565
+ *
9566
+ */
9567
+ readonly target: Entity;
9568
+ }
9569
+
9570
+ /**
9571
+ * @beta
9572
+ */
9573
+ export class PlayerInteractWithEntityAfterEventSignal {
9574
+ private constructor();
9575
+ /**
9576
+ * @remarks
9577
+ * This function can't be called in read-only mode.
9578
+ *
9579
+ */
9580
+ subscribe(
9581
+ callback: (arg: PlayerInteractWithEntityAfterEvent) => void,
9582
+ ): (arg: PlayerInteractWithEntityAfterEvent) => void;
9583
+ /**
9584
+ * @remarks
9585
+ * This function can't be called in read-only mode.
9586
+ *
9587
+ * @throws This function can throw errors.
9588
+ */
9589
+ unsubscribe(callback: (arg: PlayerInteractWithEntityAfterEvent) => void): void;
9590
+ }
9591
+
9592
+ /**
9593
+ * @beta
9594
+ * Contains information regarding an event before a player
9595
+ * interacts with an entity.
9596
+ */
9597
+ export class PlayerInteractWithEntityBeforeEvent {
9598
+ private constructor();
9599
+ /**
9600
+ * @remarks
9601
+ * If set to true the interaction will be cancelled.
9602
+ *
9603
+ */
9604
+ cancel: boolean;
9605
+ /**
9606
+ * @remarks
9607
+ * The item stack that is being used in the interaction, or
9608
+ * undefined if empty hand.
9609
+ *
9610
+ */
9611
+ readonly itemStack?: ItemStack;
9612
+ /**
9613
+ * @remarks
9614
+ * Source Player for this event.
9615
+ *
9616
+ */
9617
+ readonly player: Player;
9618
+ /**
9619
+ * @remarks
9620
+ * The entity that will be interacted with.
9621
+ *
9622
+ */
9623
+ readonly target: Entity;
9624
+ }
9625
+
9626
+ /**
9627
+ * @beta
9628
+ */
9629
+ export class PlayerInteractWithEntityBeforeEventSignal {
9630
+ private constructor();
9631
+ /**
9632
+ * @remarks
9633
+ * This function can't be called in read-only mode.
9634
+ *
9635
+ */
9636
+ subscribe(
9637
+ callback: (arg: PlayerInteractWithEntityBeforeEvent) => void,
9638
+ ): (arg: PlayerInteractWithEntityBeforeEvent) => void;
9639
+ /**
9640
+ * @remarks
9641
+ * This function can't be called in read-only mode.
9642
+ *
9643
+ * @throws This function can throw errors.
9644
+ */
9645
+ unsubscribe(callback: (arg: PlayerInteractWithEntityBeforeEvent) => void): void;
9646
+ }
9647
+
9648
+ /**
9649
+ * @beta
9650
+ * This type is usable for iterating over a set of players.
9651
+ * This means it can be used in statements like for...of
9652
+ * statements, Array.from(iterator), and more.
9653
+ */
9654
+ export class PlayerIterator implements Iterable<Player> {
9655
+ private constructor();
9656
+ /**
9657
+ * @remarks
9658
+ * This function can't be called in read-only mode.
9659
+ *
9660
+ */
9661
+ [Symbol.iterator](): Iterator<Player>;
9662
+ /**
9663
+ * @remarks
9664
+ * Retrieves the next item in this iteration. The resulting
9665
+ * IteratorResult contains .done and .value properties which
9666
+ * can be used to see the next Player in the iteration.
9667
+ *
9668
+ * This function can't be called in read-only mode.
9669
+ *
9670
+ */
9671
+ next(): IteratorResult<Player>;
9672
+ }
9673
+
9674
+ /**
9675
+ * @beta
9676
+ * Contains information regarding a player that has joined.
9677
+ * See the playerSpawn event for more detailed information that
9678
+ * could be returned after the first time a player has spawned
9679
+ * within the game.
9680
+ */
9681
+ export class PlayerJoinAfterEvent {
9682
+ private constructor();
9683
+ /**
9684
+ * @remarks
9685
+ * Opaque string identifier of the player that joined the game.
9686
+ *
9687
+ */
9688
+ readonly playerId: string;
9689
+ /**
9690
+ * @remarks
9691
+ * Name of the player that has joined.
9692
+ *
9693
+ */
9694
+ readonly playerName: string;
9695
+ }
9696
+
9697
+ /**
9698
+ * @beta
9699
+ * Manages callbacks that are connected to a player joining the
9700
+ * world.
9701
+ */
9702
+ // @ts-ignore Class inheritance allowed for native defined classes
9703
+ export class PlayerJoinAfterEventSignal extends IPlayerJoinAfterEventSignal {
9704
+ private constructor();
9705
+ }
9706
+
9707
+ /**
9708
+ * @beta
9709
+ * Contains information regarding a player that has left the
9710
+ * world.
9711
+ */
9712
+ export class PlayerLeaveAfterEvent {
9713
+ private constructor();
9714
+ /**
9715
+ * @remarks
9716
+ * Opaque string identifier of the player that has left the
9717
+ * event.
9718
+ *
9719
+ */
9720
+ readonly playerId: string;
9721
+ /**
9722
+ * @remarks
9723
+ * Player that has left the world.
9724
+ *
9725
+ */
9726
+ readonly playerName: string;
9727
+ }
9728
+
9729
+ /**
9730
+ * @beta
9731
+ * Manages callbacks that are connected to a player leaving the
9732
+ * world.
9733
+ */
9734
+ // @ts-ignore Class inheritance allowed for native defined classes
9735
+ export class PlayerLeaveAfterEventSignal extends IPlayerLeaveAfterEventSignal {
9736
+ private constructor();
9737
+ }
9738
+
9739
+ /**
9740
+ * @beta
9741
+ * Contains information regarding an event where a player
9742
+ * places a block.
9743
+ */
9744
+ // @ts-ignore Class inheritance allowed for native defined classes
9745
+ export class PlayerPlaceBlockAfterEvent extends BlockEvent {
9746
+ private constructor();
9747
+ /**
9748
+ * @remarks
9749
+ * Player that placed the block for this event.
9750
+ *
9751
+ */
9752
+ readonly player: Player;
9753
+ }
9754
+
9755
+ /**
9756
+ * @beta
9757
+ * Manages callbacks that are connected to when a block is
9758
+ * placed by a player.
9759
+ */
9760
+ export class PlayerPlaceBlockAfterEventSignal {
9761
+ private constructor();
9762
+ /**
9763
+ * @remarks
9764
+ * Adds a callback that will be called when a block is placed
9765
+ * by a player.
9766
+ *
9767
+ * This function can't be called in read-only mode.
9768
+ *
9769
+ */
9770
+ subscribe(
9771
+ callback: (arg: PlayerPlaceBlockAfterEvent) => void,
9772
+ options?: BlockEventOptions,
9773
+ ): (arg: PlayerPlaceBlockAfterEvent) => void;
9774
+ /**
9775
+ * @remarks
9776
+ * Removes a callback from being called when an block is placed
9777
+ * by a player.
9778
+ *
9779
+ * This function can't be called in read-only mode.
9780
+ *
9781
+ * @throws This function can throw errors.
9782
+ */
9783
+ unsubscribe(callback: (arg: PlayerPlaceBlockAfterEvent) => void): void;
9784
+ }
9785
+
9786
+ /**
9787
+ * @beta
9788
+ * Contains information regarding an event before a player
9789
+ * places a block.
9790
+ */
9791
+ // @ts-ignore Class inheritance allowed for native defined classes
9792
+ export class PlayerPlaceBlockBeforeEvent extends BlockEvent {
9793
+ private constructor();
9794
+ /**
9795
+ * @remarks
9796
+ * If set to true, cancels the block place event.
9797
+ *
9798
+ */
9799
+ cancel: boolean;
9800
+ /**
9801
+ * @remarks
9802
+ * The face of the block that the new block is being placed on.
9803
+ *
9804
+ */
9805
+ readonly face: Direction;
9806
+ /**
9807
+ * @remarks
9808
+ * Location relative to the bottom north-west corner of the
9809
+ * block where the new block is being placed onto.
9810
+ *
9811
+ */
9812
+ readonly faceLocation: Vector3;
9813
+ /**
9814
+ * @remarks
9815
+ * The item being used to place the block.
9816
+ *
9817
+ */
9818
+ itemStack: ItemStack;
9819
+ /**
9820
+ * @remarks
9821
+ * Player that is placing the block for this event.
9822
+ *
9823
+ */
9824
+ readonly player: Player;
9825
+ }
9826
+
9827
+ /**
9828
+ * @beta
9829
+ * Manages callbacks that are connected to before a block is
9830
+ * placed by a player.
9831
+ */
9832
+ export class PlayerPlaceBlockBeforeEventSignal {
9833
+ private constructor();
9834
+ /**
9835
+ * @remarks
9836
+ * Adds a callback that will be called before a block is placed
9837
+ * by a player.
9838
+ *
9839
+ * This function can't be called in read-only mode.
9840
+ *
9841
+ */
9842
+ subscribe(
9843
+ callback: (arg: PlayerPlaceBlockBeforeEvent) => void,
9844
+ options?: BlockEventOptions,
9845
+ ): (arg: PlayerPlaceBlockBeforeEvent) => void;
9846
+ /**
9847
+ * @remarks
9848
+ * Removes a callback from being called before an block is
9849
+ * placed by a player.
9850
+ *
9851
+ * This function can't be called in read-only mode.
9852
+ *
9853
+ * @throws This function can throw errors.
9854
+ */
9855
+ unsubscribe(callback: (arg: PlayerPlaceBlockBeforeEvent) => void): void;
9856
+ }
9857
+
9858
+ /**
9859
+ * @beta
9860
+ * An event that contains more information about a player
9861
+ * spawning.
9862
+ */
9863
+ export class PlayerSpawnAfterEvent {
9864
+ private constructor();
9865
+ /**
9866
+ * @remarks
9867
+ * If true, this is the initial spawn of a player after joining
9868
+ * the game.
9869
+ *
9870
+ * This property can't be edited in read-only mode.
9871
+ *
9872
+ */
9873
+ initialSpawn: boolean;
9874
+ /**
9875
+ * @remarks
9876
+ * Object that represents the player that joined the game.
9877
+ *
9878
+ * This property can't be edited in read-only mode.
9879
+ *
9880
+ */
9881
+ player: Player;
9882
+ }
9883
+
9884
+ /**
9885
+ * @beta
9494
9886
  * Registers an event when a player is spawned (or re-spawned
9495
9887
  * after death) and fully ready within the world.
9496
9888
  */
@@ -9761,38 +10153,6 @@ export class ProjectileHitEntityAfterEventSignal {
9761
10153
  unsubscribe(callback: (arg: ProjectileHitEntityAfterEvent) => void): void;
9762
10154
  }
9763
10155
 
9764
- /**
9765
- * @beta
9766
- * Provides methods that should be used within the World
9767
- * Initialize event to register dynamic properties that can be
9768
- * used and stored within Minecraft.
9769
- */
9770
- export class PropertyRegistry {
9771
- private constructor();
9772
- /**
9773
- * @remarks
9774
- * Registers a dynamic property for a particular entity type
9775
- * (e.g., a minecraft:skeleton.).
9776
- *
9777
- * This function can't be called in read-only mode.
9778
- *
9779
- * @throws This function can throw errors.
9780
- */
9781
- registerEntityTypeDynamicProperties(
9782
- propertiesDefinition: DynamicPropertiesDefinition,
9783
- entityTypeOrId: EntityType | string,
9784
- ): void;
9785
- /**
9786
- * @remarks
9787
- * Registers a globally available dynamic property for a world.
9788
- *
9789
- * This function can't be called in read-only mode.
9790
- *
9791
- * @throws This function can throw errors.
9792
- */
9793
- registerWorldDynamicProperties(propertiesDefinition: DynamicPropertiesDefinition): void;
9794
- }
9795
-
9796
10156
  /**
9797
10157
  * @beta
9798
10158
  * Contains objectives and participants for the scoreboard.
@@ -10857,6 +11217,10 @@ export class World {
10857
11217
  * The message.
10858
11218
  */
10859
11219
  broadcastClientMessage(id: string, value: string): void;
11220
+ /**
11221
+ * @beta
11222
+ */
11223
+ clearDynamicProperties(): void;
10860
11224
  /**
10861
11225
  * @beta
10862
11226
  * @remarks
@@ -10972,6 +11336,14 @@ export class World {
10972
11336
  * ```
10973
11337
  */
10974
11338
  getDynamicProperty(identifier: string): boolean | number | string | Vector3 | undefined;
11339
+ /**
11340
+ * @beta
11341
+ */
11342
+ getDynamicPropertyIds(): string[];
11343
+ /**
11344
+ * @beta
11345
+ */
11346
+ getDynamicPropertyTotalByteCount(): number;
10975
11347
  /**
10976
11348
  * @beta
10977
11349
  * @remarks
@@ -11049,7 +11421,7 @@ export class World {
11049
11421
  * players[0].playSound("bucket.fill_water", playerSoundOptions);
11050
11422
  * ```
11051
11423
  */
11052
- playMusic(trackID: string, musicOptions?: MusicOptions): void;
11424
+ playMusic(trackId: string, musicOptions?: MusicOptions): void;
11053
11425
  /**
11054
11426
  * @beta
11055
11427
  * @remarks
@@ -11087,7 +11459,7 @@ export class World {
11087
11459
  * players[0].playSound("bucket.fill_water", playerSoundOptions);
11088
11460
  * ```
11089
11461
  */
11090
- playSound(soundID: string, location: Vector3, soundOptions?: WorldSoundOptions): void;
11462
+ playSound(soundId: string, location: Vector3, soundOptions?: WorldSoundOptions): void;
11091
11463
  /**
11092
11464
  * @beta
11093
11465
  * @remarks
@@ -11101,17 +11473,7 @@ export class World {
11101
11473
  * An error will be thrown if fade is less than 0.0.
11102
11474
  *
11103
11475
  */
11104
- queueMusic(trackID: string, musicOptions?: MusicOptions): void;
11105
- /**
11106
- * @beta
11107
- * @remarks
11108
- * Removes a specified property.
11109
- *
11110
- * This function can't be called in read-only mode.
11111
- *
11112
- * @throws This function can throw errors.
11113
- */
11114
- removeDynamicProperty(identifier: string): boolean;
11476
+ queueMusic(trackId: string, musicOptions?: MusicOptions): void;
11115
11477
  /**
11116
11478
  * @beta
11117
11479
  * @remarks
@@ -11181,8 +11543,6 @@ export class World {
11181
11543
  * @remarks
11182
11544
  * Sets a specified property to a value.
11183
11545
  *
11184
- * This function can't be called in read-only mode.
11185
- *
11186
11546
  * @param identifier
11187
11547
  * The property identifier.
11188
11548
  * @param value
@@ -11243,7 +11603,7 @@ export class World {
11243
11603
  * mc.world.setDynamicProperty("samplelibrary:longerjson", paintStr);
11244
11604
  * ```
11245
11605
  */
11246
- setDynamicProperty(identifier: string, value: boolean | number | string | Vector3): void;
11606
+ setDynamicProperty(identifier: string, value?: boolean | number | string | Vector3): void;
11247
11607
  /**
11248
11608
  * @beta
11249
11609
  * @remarks
@@ -11478,6 +11838,18 @@ export class WorldAfterEvents {
11478
11838
  *
11479
11839
  */
11480
11840
  readonly playerBreakBlock: PlayerBreakBlockAfterEventSignal;
11841
+ /**
11842
+ * @beta
11843
+ */
11844
+ readonly playerDimensionChange: PlayerDimensionChangeAfterEventSignal;
11845
+ /**
11846
+ * @beta
11847
+ */
11848
+ readonly playerInteractWithBlock: PlayerInteractWithBlockAfterEventSignal;
11849
+ /**
11850
+ * @beta
11851
+ */
11852
+ readonly playerInteractWithEntity: PlayerInteractWithEntityAfterEventSignal;
11481
11853
  /**
11482
11854
  * @remarks
11483
11855
  * This event fires when a player joins a world. See also
@@ -11646,6 +12018,18 @@ export class WorldBeforeEvents {
11646
12018
  *
11647
12019
  */
11648
12020
  readonly playerBreakBlock: PlayerBreakBlockBeforeEventSignal;
12021
+ /**
12022
+ * @beta
12023
+ */
12024
+ readonly playerDimensionChange: PlayerDimensionChangeBeforeEventSignal;
12025
+ /**
12026
+ * @beta
12027
+ */
12028
+ readonly playerInteractWithBlock: PlayerInteractWithBlockBeforeEventSignal;
12029
+ /**
12030
+ * @beta
12031
+ */
12032
+ readonly playerInteractWithEntity: PlayerInteractWithEntityBeforeEventSignal;
11649
12033
  /**
11650
12034
  * @beta
11651
12035
  * @remarks
@@ -11665,28 +12049,6 @@ export class WorldBeforeEvents {
11665
12049
  */
11666
12050
  export class WorldInitializeAfterEvent {
11667
12051
  private constructor();
11668
- /**
11669
- * @remarks
11670
- * Contains methods for scripts to initialize and register
11671
- * dynamic properties they may wish to use within a world.
11672
- *
11673
- * @example propertyRegistration.js
11674
- * ```typescript
11675
- * import { DynamicPropertiesDefinition, EntityTypes, world } from '@minecraft/server';
11676
- * import { MinecraftEntityTypes } from '@minecraft/vanilla-data';
11677
- *
11678
- * world.afterEvents.worldInitialize.subscribe(e => {
11679
- * let def = new DynamicPropertiesDefinition();
11680
- *
11681
- * def.defineNumber('rpgStrength');
11682
- * def.defineString('rpgRole', 16);
11683
- * def.defineBoolean('rpgIsHero');
11684
- *
11685
- * e.propertyRegistry.registerEntityTypeDynamicProperties(def, EntityTypes.get(MinecraftEntityTypes.Skeleton));
11686
- * });
11687
- * ```
11688
- */
11689
- readonly propertyRegistry: PropertyRegistry;
11690
12052
  }
11691
12053
 
11692
12054
  /**
@@ -11916,6 +12278,13 @@ export interface BoundingBox {
11916
12278
  min: Vector3;
11917
12279
  }
11918
12280
 
12281
+ /**
12282
+ * @beta
12283
+ */
12284
+ export interface CameraDefaultOptions {
12285
+ easeOptions: CameraEaseOptions;
12286
+ }
12287
+
11919
12288
  /**
11920
12289
  * @beta
11921
12290
  */
@@ -11941,6 +12310,41 @@ export interface CameraFadeTimeOptions {
11941
12310
  holdTime: number;
11942
12311
  }
11943
12312
 
12313
+ /**
12314
+ * @beta
12315
+ */
12316
+ export interface CameraSetFacingOptions {
12317
+ easeOptions?: CameraEaseOptions;
12318
+ facingEntity: Entity;
12319
+ location?: Vector3;
12320
+ }
12321
+
12322
+ /**
12323
+ * @beta
12324
+ */
12325
+ export interface CameraSetLocationOptions {
12326
+ easeOptions?: CameraEaseOptions;
12327
+ location: Vector3;
12328
+ }
12329
+
12330
+ /**
12331
+ * @beta
12332
+ */
12333
+ export interface CameraSetPosOptions {
12334
+ easeOptions?: CameraEaseOptions;
12335
+ facingLocation: Vector3;
12336
+ location?: Vector3;
12337
+ }
12338
+
12339
+ /**
12340
+ * @beta
12341
+ */
12342
+ export interface CameraSetRotOptions {
12343
+ easeOptions?: CameraEaseOptions;
12344
+ location?: Vector3;
12345
+ rotation: Vector2;
12346
+ }
12347
+
11944
12348
  /**
11945
12349
  * @beta
11946
12350
  * This interface defines an entry into the {@link
@@ -12696,48 +13100,6 @@ export interface ScoreboardObjectiveDisplayOptions {
12696
13100
  sortOrder?: ObjectiveSortOrder;
12697
13101
  }
12698
13102
 
12699
- /**
12700
- * @beta
12701
- */
12702
- export interface ScriptCameraDefaultOptions {
12703
- easeOptions: CameraEaseOptions;
12704
- }
12705
-
12706
- /**
12707
- * @beta
12708
- */
12709
- export interface ScriptCameraSetFacingOptions {
12710
- easeOptions?: CameraEaseOptions;
12711
- facingEntity: Entity;
12712
- location?: Vector3;
12713
- }
12714
-
12715
- /**
12716
- * @beta
12717
- */
12718
- export interface ScriptCameraSetLocationOptions {
12719
- easeOptions?: CameraEaseOptions;
12720
- location: Vector3;
12721
- }
12722
-
12723
- /**
12724
- * @beta
12725
- */
12726
- export interface ScriptCameraSetPosOptions {
12727
- easeOptions?: CameraEaseOptions;
12728
- facingLocation: Vector3;
12729
- location?: Vector3;
12730
- }
12731
-
12732
- /**
12733
- * @beta
12734
- */
12735
- export interface ScriptCameraSetRotOptions {
12736
- easeOptions?: CameraEaseOptions;
12737
- location?: Vector3;
12738
- rotation: Vector2;
12739
- }
12740
-
12741
13103
  /**
12742
13104
  * @beta
12743
13105
  * Contains additional options for registering a script event
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minecraft/server",
3
- "version": "1.6.0-beta.1.20.30-preview.24",
3
+ "version": "1.6.0-beta.1.20.40-preview.20",
4
4
  "description": "",
5
5
  "contributors": [
6
6
  {