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

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 +645 -145
  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.21"
19
+ * "version": "1.6.0-internal.1.20.30-preview.24"
20
20
  * }
21
21
  * ```
22
22
  *
@@ -258,6 +258,45 @@ export enum EntityDamageCause {
258
258
  wither = 'wither',
259
259
  }
260
260
 
261
+ /**
262
+ * @beta
263
+ * An enumeration describing initialization cause of an entity.
264
+ */
265
+ export enum EntityInitializationCause {
266
+ /**
267
+ * @beta
268
+ * @remarks
269
+ * Case when an entity is created as child of other entity or
270
+ * entities, e.g., cows making a cow or slimes making smaller
271
+ * slimes after dying.
272
+ *
273
+ */
274
+ Born = 'Born',
275
+ /**
276
+ * @beta
277
+ * @remarks
278
+ * Case when an entity is created by an event, e.g., Wandering
279
+ * trader spawning llamas.
280
+ *
281
+ */
282
+ Event = 'Event',
283
+ Loaded = 'Loaded',
284
+ /**
285
+ * @beta
286
+ * @remarks
287
+ * Case when an entity is naturally spawned in the world.
288
+ *
289
+ */
290
+ Spawned = 'Spawned',
291
+ /**
292
+ * @beta
293
+ * @remarks
294
+ * Case when an entity is transformed into another entity.
295
+ *
296
+ */
297
+ Transformed = 'Transformed',
298
+ }
299
+
261
300
  /**
262
301
  * @beta
263
302
  * Describes the lifetime state of an Entity. For example,
@@ -296,7 +335,7 @@ export enum EquipmentSlot {
296
335
  * Chestplate or Elytra.
297
336
  *
298
337
  */
299
- chest = 'chest',
338
+ Chest = 'Chest',
300
339
  /**
301
340
  * @beta
302
341
  * @remarks
@@ -304,7 +343,7 @@ export enum EquipmentSlot {
304
343
  * Boots.
305
344
  *
306
345
  */
307
- feet = 'feet',
346
+ Feet = 'Feet',
308
347
  /**
309
348
  * @beta
310
349
  * @remarks
@@ -312,7 +351,7 @@ export enum EquipmentSlot {
312
351
  * Helmets or Carved Pumpkins.
313
352
  *
314
353
  */
315
- head = 'head',
354
+ Head = 'Head',
316
355
  /**
317
356
  * @beta
318
357
  * @remarks
@@ -320,7 +359,7 @@ export enum EquipmentSlot {
320
359
  * Leggings.
321
360
  *
322
361
  */
323
- legs = 'legs',
362
+ Legs = 'Legs',
324
363
  /**
325
364
  * @beta
326
365
  * @remarks
@@ -328,7 +367,7 @@ export enum EquipmentSlot {
328
367
  * the currently active hotbar slot.
329
368
  *
330
369
  */
331
- mainhand = 'mainhand',
370
+ Mainhand = 'Mainhand',
332
371
  /**
333
372
  * @beta
334
373
  * @remarks
@@ -336,7 +375,7 @@ export enum EquipmentSlot {
336
375
  * shields and maps.
337
376
  *
338
377
  */
339
- offhand = 'offhand',
378
+ Offhand = 'Offhand',
340
379
  }
341
380
 
342
381
  /**
@@ -927,57 +966,6 @@ export class BlockAreaSize {
927
966
  equals(other: BlockAreaSize): boolean;
928
967
  }
929
968
 
930
- /**
931
- * @beta
932
- * Contains information regarding an event where a player
933
- * breaks a block.
934
- */
935
- // @ts-ignore Class inheritance allowed for native defined classes
936
- export class BlockBreakAfterEvent extends BlockEvent {
937
- private constructor();
938
- /**
939
- * @remarks
940
- * Returns permutation information about this block before it
941
- * was broken.
942
- *
943
- */
944
- readonly brokenBlockPermutation: BlockPermutation;
945
- /**
946
- * @remarks
947
- * Player that broke the block for this event.
948
- *
949
- */
950
- readonly player: Player;
951
- }
952
-
953
- /**
954
- * @beta
955
- * Manages callbacks that are connected to when a block is
956
- * broken.
957
- */
958
- export class BlockBreakAfterEventSignal {
959
- private constructor();
960
- /**
961
- * @remarks
962
- * Adds a callback that will be called when a block is broken
963
- * by a player.
964
- *
965
- * This function can't be called in read-only mode.
966
- *
967
- */
968
- subscribe(callback: (arg: BlockBreakAfterEvent) => void): (arg: BlockBreakAfterEvent) => void;
969
- /**
970
- * @remarks
971
- * Removes a callback from being called when an block is
972
- * broken.
973
- *
974
- * This function can't be called in read-only mode.
975
- *
976
- * @throws This function can throw errors.
977
- */
978
- unsubscribe(callback: (arg: BlockBreakAfterEvent) => void): void;
979
- }
980
-
981
969
  /**
982
970
  * @beta
983
971
  * Base type for components associated with blocks.
@@ -1379,50 +1367,6 @@ export class BlockPistonComponent extends BlockComponent {
1379
1367
  getAttachedBlocks(): Vector3[];
1380
1368
  }
1381
1369
 
1382
- /**
1383
- * @beta
1384
- * Contains information regarding an event where a player
1385
- * places a block.
1386
- */
1387
- // @ts-ignore Class inheritance allowed for native defined classes
1388
- export class BlockPlaceAfterEvent extends BlockEvent {
1389
- private constructor();
1390
- /**
1391
- * @remarks
1392
- * Player that placed the block for this event.
1393
- *
1394
- */
1395
- readonly player: Player;
1396
- }
1397
-
1398
- /**
1399
- * @beta
1400
- * Manages callbacks that are connected to when a block is
1401
- * placed.
1402
- */
1403
- export class BlockPlaceAfterEventSignal {
1404
- private constructor();
1405
- /**
1406
- * @remarks
1407
- * Adds a callback that will be called when a block is placed
1408
- * by a player.
1409
- *
1410
- * This function can't be called in read-only mode.
1411
- *
1412
- */
1413
- subscribe(callback: (arg: BlockPlaceAfterEvent) => void): (arg: BlockPlaceAfterEvent) => void;
1414
- /**
1415
- * @remarks
1416
- * Removes a callback from being called when an block is
1417
- * placed.
1418
- *
1419
- * This function can't be called in read-only mode.
1420
- *
1421
- * @throws This function can throw errors.
1422
- */
1423
- unsubscribe(callback: (arg: BlockPlaceAfterEvent) => void): void;
1424
- }
1425
-
1426
1370
  /**
1427
1371
  * @beta
1428
1372
  * Represents a fluid container block that currently contains a
@@ -1624,6 +1568,9 @@ export class BlockStates {
1624
1568
  * @remarks
1625
1569
  * Retrieves a specific block state instance.
1626
1570
  *
1571
+ * @returns
1572
+ * Returns the block state instance if it is found. If the
1573
+ * block state instance is not found returns undefined.
1627
1574
  */
1628
1575
  static get(stateName: string): BlockStateType;
1629
1576
  /**
@@ -3083,6 +3030,14 @@ export class DefinitionModifier {
3083
3030
  */
3084
3031
  export class Dimension {
3085
3032
  private constructor();
3033
+ /**
3034
+ * @beta
3035
+ * @remarks
3036
+ * Height range of the dimension.
3037
+ *
3038
+ * @throws This property can throw when used.
3039
+ */
3040
+ readonly heightRange: NumberRange;
3086
3041
  /**
3087
3042
  * @remarks
3088
3043
  * Identifier of the dimension.
@@ -3357,8 +3312,13 @@ export class Dimension {
3357
3312
  *
3358
3313
  * @param weatherType
3359
3314
  * Set the type of weather to apply.
3315
+ * @param duration
3316
+ * Sets the duration of the weather (in ticks). If no duration
3317
+ * is provided, the duration will be set to a random duration
3318
+ * between 300 and 900 seconds.
3319
+ * @throws This function can throw errors.
3360
3320
  */
3361
- setWeather(weatherType: WeatherType): void;
3321
+ setWeather(weatherType: WeatherType, duration?: number): void;
3362
3322
  /**
3363
3323
  * @beta
3364
3324
  * @remarks
@@ -3978,6 +3938,14 @@ export class Entity {
3978
3938
  * @throws This property can throw when used.
3979
3939
  */
3980
3940
  readonly isOnGround: boolean;
3941
+ /**
3942
+ * @beta
3943
+ * @remarks
3944
+ * If true, the entity is currently sleeping.
3945
+ *
3946
+ * @throws This property can throw when used.
3947
+ */
3948
+ readonly isSleeping: boolean;
3981
3949
  /**
3982
3950
  * @beta
3983
3951
  * @remarks
@@ -4038,8 +4006,8 @@ export class Entity {
4038
4006
  * @beta
4039
4007
  * @remarks
4040
4008
  * Returns a scoreboard identity that represents this entity.
4009
+ * Will remain valid when the entity is killed.
4041
4010
  *
4042
- * @throws This property can throw when used.
4043
4011
  */
4044
4012
  readonly scoreboardIdentity?: ScoreboardIdentity;
4045
4013
  /**
@@ -4053,7 +4021,7 @@ export class Entity {
4053
4021
  readonly target: Entity;
4054
4022
  /**
4055
4023
  * @remarks
4056
- * Unique identifier of the type of the entity - for example,
4024
+ * Identifier of the type of the entity - for example,
4057
4025
  * 'minecraft:skeleton'. This property is accessible even if
4058
4026
  * {@link Entity.isValid} is false.
4059
4027
  *
@@ -4417,10 +4385,29 @@ export class Entity {
4417
4385
  /**
4418
4386
  * @beta
4419
4387
  * @remarks
4420
- * Returns the current rotation component of this entity.
4388
+ * Gets an entity Property value. If the property was set using
4389
+ * the setProperty function within the same tick, the updated
4390
+ * value will not be reflected until the subsequent tick.
4421
4391
  *
4392
+ * @param identifier
4393
+ * The entity Property identifier.
4422
4394
  * @returns
4395
+ * Returns the current property value. For enum properties, a
4396
+ * string is returned. For float and int properties, a number
4397
+ * is returned. For undefined properties, undefined is
4398
+ * returned.
4399
+ * @throws
4400
+ * Throws if the entity is invalid.
4401
+ */
4402
+ getProperty(identifier: string): boolean | number | string | undefined;
4403
+ /**
4404
+ * @beta
4405
+ * @remarks
4423
4406
  * Returns the current rotation component of this entity.
4407
+ *
4408
+ * @returns
4409
+ * Returns a Vec2 containing the rotation of this entity (in
4410
+ * degrees).
4424
4411
  * @throws This function can throw errors.
4425
4412
  */
4426
4413
  getRotation(): Vector2;
@@ -4552,6 +4539,10 @@ export class Entity {
4552
4539
  /**
4553
4540
  * @beta
4554
4541
  * @remarks
4542
+ * Immediately removes the entity from the world. The removed
4543
+ * entity will not perform a death animation or drop loot upon
4544
+ * removal.
4545
+ *
4555
4546
  * This function can't be called in read-only mode.
4556
4547
  *
4557
4548
  * @throws This function can throw errors.
@@ -4599,6 +4590,26 @@ export class Entity {
4599
4590
  * @throws This function can throw errors.
4600
4591
  */
4601
4592
  removeTag(tag: string): boolean;
4593
+ /**
4594
+ * @beta
4595
+ * @remarks
4596
+ * Resets an Entity Property back to its default value, as
4597
+ * specified in the Entity's definition. This property change
4598
+ * is not applied until the next tick.
4599
+ *
4600
+ * This function can't be called in read-only mode.
4601
+ *
4602
+ * @param identifier
4603
+ * The Entity Property identifier.
4604
+ * @returns
4605
+ * Returns the default property value. For enum properties, a
4606
+ * string is returned. For float and int properties, a number
4607
+ * is returned. For undefined properties, undefined is
4608
+ * returned.
4609
+ * @throws
4610
+ * Throws if the entity is invalid.
4611
+ */
4612
+ resetProperty(identifier: string): boolean | number | string;
4602
4613
  /**
4603
4614
  * @beta
4604
4615
  * @remarks
@@ -4691,6 +4702,30 @@ export class Entity {
4691
4702
  * ```
4692
4703
  */
4693
4704
  setOnFire(seconds: number, useEffects?: boolean): boolean;
4705
+ /**
4706
+ * @beta
4707
+ * @remarks
4708
+ * Sets an Entity Property to the provided value. This property
4709
+ * change is not applied until the next tick.
4710
+ *
4711
+ * This function can't be called in read-only mode.
4712
+ *
4713
+ * @param identifier
4714
+ * The Entity Property identifier.
4715
+ * @param value
4716
+ * The property value. The provided type must be compatible
4717
+ * with the type specified in the entity's definition.
4718
+ * @throws
4719
+ * Throws if the entity is invalid.
4720
+ * Throws if an invalid identifier is provided.
4721
+ * Throws if the provided value type does not match the
4722
+ * property type.
4723
+ * Throws if the provided value is outside the expected range
4724
+ * (int, float properties).
4725
+ * Throws if the provided string value does not match the set
4726
+ * of accepted enum values (enum properties
4727
+ */
4728
+ setProperty(identifier: string, value: boolean | number | string): void;
4694
4729
  /**
4695
4730
  * @beta
4696
4731
  * @remarks
@@ -4699,9 +4734,9 @@ export class Entity {
4699
4734
  * This function can't be called in read-only mode.
4700
4735
  *
4701
4736
  * @param rotation
4702
- * The x and y rotation of the entity. For most mobs, the x
4703
- * rotation controls the head tilt and the y rotation controls
4704
- * the body rotation.
4737
+ * The x and y rotation of the entity (in degrees). For most
4738
+ * mobs, the x rotation controls the head tilt and the y
4739
+ * rotation controls the body rotation.
4705
4740
  * @throws This function can throw errors.
4706
4741
  */
4707
4742
  setRotation(rotation: Vector2): void;
@@ -5198,6 +5233,8 @@ export class EntityDieAfterEventSignal {
5198
5233
 
5199
5234
  /**
5200
5235
  * @beta
5236
+ * Provides access to a mob's equipment slots. This component
5237
+ * exists for all mob entities.
5201
5238
  */
5202
5239
  // @ts-ignore Class inheritance allowed for native defined classes
5203
5240
  export class EntityEquippableComponent extends EntityComponent {
@@ -5205,22 +5242,44 @@ export class EntityEquippableComponent extends EntityComponent {
5205
5242
  static readonly componentId = 'minecraft:equippable';
5206
5243
  /**
5207
5244
  * @remarks
5245
+ * Gets the equipped item for the given EquipmentSlot.
5246
+ *
5208
5247
  * This function can't be called in read-only mode.
5209
5248
  *
5249
+ * @param equipmentSlot
5250
+ * The equipment slot. e.g. "head", "chest", "offhand"
5251
+ * @returns
5252
+ * Returns the item equipped to the given EquipmentSlot. If
5253
+ * empty, returns undefined.
5210
5254
  * @throws This function can throw errors.
5211
5255
  */
5212
5256
  getEquipment(equipmentSlot: EquipmentSlot): ItemStack | undefined;
5213
5257
  /**
5258
+ * @beta
5214
5259
  * @remarks
5260
+ * Gets the ContainerSlot corresponding to the given
5261
+ * EquipmentSlot.
5262
+ *
5215
5263
  * This function can't be called in read-only mode.
5216
5264
  *
5265
+ * @param equipmentSlot
5266
+ * The equipment slot. e.g. "head", "chest", "offhand".
5267
+ * @returns
5268
+ * Returns the ContainerSlot corresponding to the given
5269
+ * EquipmentSlot.
5217
5270
  * @throws This function can throw errors.
5218
5271
  */
5219
5272
  getEquipmentSlot(equipmentSlot: EquipmentSlot): ContainerSlot;
5220
5273
  /**
5221
5274
  * @remarks
5275
+ * Replaces the item in the given EquipmentSlot.
5276
+ *
5222
5277
  * This function can't be called in read-only mode.
5223
5278
  *
5279
+ * @param equipmentSlot
5280
+ * The equipment slot. e.g. "head", "chest", "offhand".
5281
+ * @param itemStack
5282
+ * The item to equip. If undefined, clears the slot.
5224
5283
  * @throws This function can throw errors.
5225
5284
  */
5226
5285
  setEquipment(equipmentSlot: EquipmentSlot, itemStack?: ItemStack): boolean;
@@ -5875,6 +5934,57 @@ export class EntityLeashableComponent extends EntityComponent {
5875
5934
  unleash(): void;
5876
5935
  }
5877
5936
 
5937
+ /**
5938
+ * @beta
5939
+ * Contains data related to an entity loaded within the world.
5940
+ * This could happen when an unloaded chunk is reloaded, or
5941
+ * when an entity changes dimensions.
5942
+ */
5943
+ export class EntityLoadAfterEvent {
5944
+ private constructor();
5945
+ /**
5946
+ * @remarks
5947
+ * Entity that was loaded.
5948
+ *
5949
+ * This property can't be edited in read-only mode.
5950
+ *
5951
+ */
5952
+ entity: Entity;
5953
+ }
5954
+
5955
+ /**
5956
+ * @beta
5957
+ * Registers a script-based event handler for handling what
5958
+ * happens when an entity loads.
5959
+ */
5960
+ export class EntityLoadAfterEventSignal {
5961
+ private constructor();
5962
+ /**
5963
+ * @remarks
5964
+ * Method to register an event handler for what happens when an
5965
+ * entity loads.
5966
+ *
5967
+ * This function can't be called in read-only mode.
5968
+ *
5969
+ * @param callback
5970
+ * Function that handles the load event.
5971
+ */
5972
+ subscribe(callback: (arg: EntityLoadAfterEvent) => void): (arg: EntityLoadAfterEvent) => void;
5973
+ /**
5974
+ * @remarks
5975
+ * Unregisters a method that was previously subscribed to the
5976
+ * subscription event.
5977
+ *
5978
+ * This function can't be called in read-only mode.
5979
+ *
5980
+ * @param callback
5981
+ * Original function that was passed into the subscribe event,
5982
+ * that is to be unregistered.
5983
+ * @throws This function can throw errors.
5984
+ */
5985
+ unsubscribe(callback: (arg: EntityLoadAfterEvent) => void): void;
5986
+ }
5987
+
5878
5988
  /**
5879
5989
  * @beta
5880
5990
  * Additional variant value. Can be used to further
@@ -6315,14 +6425,21 @@ export class EntityPushThroughComponent extends EntityComponent {
6315
6425
  * from the world (for example, the entity is unloaded because
6316
6426
  * it is not close to players.)
6317
6427
  */
6318
- export class EntityRemovedAfterEvent {
6428
+ export class EntityRemoveAfterEvent {
6319
6429
  private constructor();
6320
6430
  /**
6321
6431
  * @remarks
6322
- * Reference to an entity that was removed.
6432
+ * Id of the entity that was removed.
6433
+ *
6434
+ */
6435
+ readonly removedEntityId: string;
6436
+ /**
6437
+ * @remarks
6438
+ * Identifier of the type of the entity removed - for example,
6439
+ * 'minecraft:skeleton'.
6323
6440
  *
6324
6441
  */
6325
- readonly removedEntity: string;
6442
+ readonly typeId: string;
6326
6443
  }
6327
6444
 
6328
6445
  /**
@@ -6331,7 +6448,7 @@ export class EntityRemovedAfterEvent {
6331
6448
  * is removed from the game (for example, unloaded, or a few
6332
6449
  * seconds after they are dead.)
6333
6450
  */
6334
- export class EntityRemovedAfterEventSignal {
6451
+ export class EntityRemoveAfterEventSignal {
6335
6452
  private constructor();
6336
6453
  /**
6337
6454
  * @remarks
@@ -6349,9 +6466,9 @@ export class EntityRemovedAfterEventSignal {
6349
6466
  * operations.
6350
6467
  */
6351
6468
  subscribe(
6352
- callback: (arg: EntityRemovedAfterEvent) => void,
6469
+ callback: (arg: EntityRemoveAfterEvent) => void,
6353
6470
  options?: EntityEventOptions,
6354
- ): (arg: EntityRemovedAfterEvent) => void;
6471
+ ): (arg: EntityRemoveAfterEvent) => void;
6355
6472
  /**
6356
6473
  * @remarks
6357
6474
  * Unsubscribes your function from subsequent calls when an
@@ -6361,7 +6478,57 @@ export class EntityRemovedAfterEventSignal {
6361
6478
  *
6362
6479
  * @throws This function can throw errors.
6363
6480
  */
6364
- unsubscribe(callback: (arg: EntityRemovedAfterEvent) => void): void;
6481
+ unsubscribe(callback: (arg: EntityRemoveAfterEvent) => void): void;
6482
+ }
6483
+
6484
+ /**
6485
+ * @beta
6486
+ * Data for an event that happens when an entity is being
6487
+ * removed from the world (for example, the entity is unloaded
6488
+ * because it is not close to players.)
6489
+ */
6490
+ export class EntityRemoveBeforeEvent {
6491
+ private constructor();
6492
+ /**
6493
+ * @remarks
6494
+ * Reference to an entity that is being removed.
6495
+ *
6496
+ */
6497
+ readonly removedEntity: Entity;
6498
+ }
6499
+
6500
+ /**
6501
+ * @beta
6502
+ * Allows registration for an event that fires when an entity
6503
+ * is being removed from the game (for example, unloaded, or a
6504
+ * few seconds after they are dead.)
6505
+ */
6506
+ export class EntityRemoveBeforeEventSignal {
6507
+ private constructor();
6508
+ /**
6509
+ * @remarks
6510
+ * Will call your function every time an entity is being
6511
+ * removed from the game.
6512
+ *
6513
+ * This function can't be called in read-only mode.
6514
+ *
6515
+ * @param callback
6516
+ * Function to call.
6517
+ * @returns
6518
+ * Returns a closure that can be used in subsequent unsubscribe
6519
+ * operations.
6520
+ */
6521
+ subscribe(callback: (arg: EntityRemoveBeforeEvent) => void): (arg: EntityRemoveBeforeEvent) => void;
6522
+ /**
6523
+ * @remarks
6524
+ * Unsubscribes your function from subsequent calls when an
6525
+ * entity is being removed.
6526
+ *
6527
+ * This function can't be called in read-only mode.
6528
+ *
6529
+ * @throws This function can throw errors.
6530
+ */
6531
+ unsubscribe(callback: (arg: EntityRemoveBeforeEvent) => void): void;
6365
6532
  }
6366
6533
 
6367
6534
  /**
@@ -6542,6 +6709,12 @@ export class EntitySkinIdComponent extends EntityComponent {
6542
6709
  */
6543
6710
  export class EntitySpawnAfterEvent {
6544
6711
  private constructor();
6712
+ /**
6713
+ * @remarks
6714
+ * Initialization cause (Spawned, Born ...).
6715
+ *
6716
+ */
6717
+ readonly cause: EntityInitializationCause;
6545
6718
  /**
6546
6719
  * @remarks
6547
6720
  * Entity that was spawned.
@@ -7578,15 +7751,35 @@ export class ItemStack {
7578
7751
  */
7579
7752
  clone(): ItemStack;
7580
7753
  /**
7754
+ * @beta
7581
7755
  * @remarks
7582
- * Gets a component (that represents additional capabilities)
7583
- * for an item stack.
7756
+ * Get the list of block types this item can break in Adventure
7757
+ * mode.
7584
7758
  *
7585
- * @param componentId
7586
- * The identifier of the component (e.g., 'minecraft:food') to
7587
- * retrieve. If no namespace prefix is specified, 'minecraft:'
7588
- * is assumed. If the component is not present on the item
7589
- * stack or doesn't exist, undefined is returned.
7759
+ * This function can't be called in read-only mode.
7760
+ *
7761
+ */
7762
+ getCanDestroy(): string[];
7763
+ /**
7764
+ * @beta
7765
+ * @remarks
7766
+ * Get the list of block types this item can be placed on in
7767
+ * Adventure mode.
7768
+ *
7769
+ * This function can't be called in read-only mode.
7770
+ *
7771
+ */
7772
+ getCanPlaceOn(): string[];
7773
+ /**
7774
+ * @remarks
7775
+ * Gets a component (that represents additional capabilities)
7776
+ * for an item stack.
7777
+ *
7778
+ * @param componentId
7779
+ * The identifier of the component (e.g., 'minecraft:food') to
7780
+ * retrieve. If no namespace prefix is specified, 'minecraft:'
7781
+ * is assumed. If the component is not present on the item
7782
+ * stack or doesn't exist, undefined is returned.
7590
7783
  * @example durability.ts
7591
7784
  * ```typescript
7592
7785
  * // Get the maximum durability of a custom sword item
@@ -8624,9 +8817,20 @@ export class Player extends Entity {
8624
8817
  private constructor();
8625
8818
  /**
8626
8819
  * @beta
8820
+ * @remarks
8821
+ * The player's Camera.
8822
+ *
8627
8823
  * @throws This property can throw when used.
8628
8824
  */
8629
8825
  readonly camera: Camera;
8826
+ /**
8827
+ * @beta
8828
+ * @remarks
8829
+ * If true, the player is currently emoting.
8830
+ *
8831
+ * @throws This property can throw when used.
8832
+ */
8833
+ readonly isEmoting: boolean;
8630
8834
  /**
8631
8835
  * @beta
8632
8836
  * @remarks
@@ -8921,6 +9125,134 @@ export class Player extends Entity {
8921
9125
  startItemCooldown(itemCategory: string, tickDuration: number): void;
8922
9126
  }
8923
9127
 
9128
+ /**
9129
+ * @beta
9130
+ * Contains information regarding an event after a player
9131
+ * breaks a block.
9132
+ */
9133
+ // @ts-ignore Class inheritance allowed for native defined classes
9134
+ export class PlayerBreakBlockAfterEvent extends BlockEvent {
9135
+ private constructor();
9136
+ /**
9137
+ * @remarks
9138
+ * Returns permutation information about this block before it
9139
+ * was broken.
9140
+ *
9141
+ */
9142
+ readonly brokenBlockPermutation: BlockPermutation;
9143
+ /**
9144
+ * @remarks
9145
+ * The item stack that was used to break the block after the
9146
+ * block was broken, or undefined if empty hand.
9147
+ *
9148
+ */
9149
+ readonly itemStackAfterBreak?: ItemStack;
9150
+ /**
9151
+ * @remarks
9152
+ * The item stack that was used to break the block before the
9153
+ * block was broken, or undefined if empty hand.
9154
+ *
9155
+ */
9156
+ readonly itemStackBeforeBreak?: ItemStack;
9157
+ /**
9158
+ * @remarks
9159
+ * Player that broke the block for this event.
9160
+ *
9161
+ */
9162
+ readonly player: Player;
9163
+ }
9164
+
9165
+ /**
9166
+ * @beta
9167
+ * Manages callbacks that are connected to when a player breaks
9168
+ * a block.
9169
+ */
9170
+ export class PlayerBreakBlockAfterEventSignal {
9171
+ private constructor();
9172
+ /**
9173
+ * @remarks
9174
+ * Adds a callback that will be called when a block is broken
9175
+ * by a player.
9176
+ *
9177
+ * This function can't be called in read-only mode.
9178
+ *
9179
+ */
9180
+ subscribe(
9181
+ callback: (arg: PlayerBreakBlockAfterEvent) => void,
9182
+ options?: BlockEventOptions,
9183
+ ): (arg: PlayerBreakBlockAfterEvent) => void;
9184
+ /**
9185
+ * @remarks
9186
+ * Removes a callback from being called when a player breaks a
9187
+ * block.
9188
+ *
9189
+ * This function can't be called in read-only mode.
9190
+ *
9191
+ * @throws This function can throw errors.
9192
+ */
9193
+ unsubscribe(callback: (arg: PlayerBreakBlockAfterEvent) => void): void;
9194
+ }
9195
+
9196
+ /**
9197
+ * @beta
9198
+ * Contains information regarding an event before a player
9199
+ * breaks a block.
9200
+ */
9201
+ // @ts-ignore Class inheritance allowed for native defined classes
9202
+ export class PlayerBreakBlockBeforeEvent extends BlockEvent {
9203
+ private constructor();
9204
+ /**
9205
+ * @remarks
9206
+ * If set to true, cancels the block break event.
9207
+ *
9208
+ */
9209
+ cancel: boolean;
9210
+ /**
9211
+ * @remarks
9212
+ * The item stack that is being used to break the block, or
9213
+ * undefined if empty hand.
9214
+ *
9215
+ */
9216
+ itemStack?: ItemStack;
9217
+ /**
9218
+ * @remarks
9219
+ * Player breaking the block for this event.
9220
+ *
9221
+ */
9222
+ readonly player: Player;
9223
+ }
9224
+
9225
+ /**
9226
+ * @beta
9227
+ * Manages callbacks that are connected to before a player
9228
+ * breaks a block.
9229
+ */
9230
+ export class PlayerBreakBlockBeforeEventSignal {
9231
+ private constructor();
9232
+ /**
9233
+ * @remarks
9234
+ * Adds a callback that will be called before a block is broken
9235
+ * by a player.
9236
+ *
9237
+ * This function can't be called in read-only mode.
9238
+ *
9239
+ */
9240
+ subscribe(
9241
+ callback: (arg: PlayerBreakBlockBeforeEvent) => void,
9242
+ options?: BlockEventOptions,
9243
+ ): (arg: PlayerBreakBlockBeforeEvent) => void;
9244
+ /**
9245
+ * @remarks
9246
+ * Removes a callback from being called before a player breaks
9247
+ * a block.
9248
+ *
9249
+ * This function can't be called in read-only mode.
9250
+ *
9251
+ * @throws This function can throw errors.
9252
+ */
9253
+ unsubscribe(callback: (arg: PlayerBreakBlockBeforeEvent) => void): void;
9254
+ }
9255
+
8924
9256
  /**
8925
9257
  * @beta
8926
9258
  * This type is usable for iterating over a set of players.
@@ -9012,6 +9344,125 @@ export class PlayerLeaveAfterEventSignal extends IPlayerLeaveAfterEventSignal {
9012
9344
  private constructor();
9013
9345
  }
9014
9346
 
9347
+ /**
9348
+ * @beta
9349
+ * Contains information regarding an event where a player
9350
+ * places a block.
9351
+ */
9352
+ // @ts-ignore Class inheritance allowed for native defined classes
9353
+ export class PlayerPlaceBlockAfterEvent extends BlockEvent {
9354
+ private constructor();
9355
+ /**
9356
+ * @remarks
9357
+ * Player that placed the block for this event.
9358
+ *
9359
+ */
9360
+ readonly player: Player;
9361
+ }
9362
+
9363
+ /**
9364
+ * @beta
9365
+ * Manages callbacks that are connected to when a block is
9366
+ * placed by a player.
9367
+ */
9368
+ export class PlayerPlaceBlockAfterEventSignal {
9369
+ private constructor();
9370
+ /**
9371
+ * @remarks
9372
+ * Adds a callback that will be called when a block is placed
9373
+ * by a player.
9374
+ *
9375
+ * This function can't be called in read-only mode.
9376
+ *
9377
+ */
9378
+ subscribe(
9379
+ callback: (arg: PlayerPlaceBlockAfterEvent) => void,
9380
+ options?: BlockEventOptions,
9381
+ ): (arg: PlayerPlaceBlockAfterEvent) => void;
9382
+ /**
9383
+ * @remarks
9384
+ * Removes a callback from being called when an block is placed
9385
+ * by a player.
9386
+ *
9387
+ * This function can't be called in read-only mode.
9388
+ *
9389
+ * @throws This function can throw errors.
9390
+ */
9391
+ unsubscribe(callback: (arg: PlayerPlaceBlockAfterEvent) => void): void;
9392
+ }
9393
+
9394
+ /**
9395
+ * @beta
9396
+ * Contains information regarding an event before a player
9397
+ * places a block.
9398
+ */
9399
+ // @ts-ignore Class inheritance allowed for native defined classes
9400
+ export class PlayerPlaceBlockBeforeEvent extends BlockEvent {
9401
+ private constructor();
9402
+ /**
9403
+ * @remarks
9404
+ * If set to true, cancels the block place event.
9405
+ *
9406
+ */
9407
+ cancel: boolean;
9408
+ /**
9409
+ * @remarks
9410
+ * The face of the block that the new block is being placed on.
9411
+ *
9412
+ */
9413
+ readonly face: Direction;
9414
+ /**
9415
+ * @remarks
9416
+ * Location relative to the bottom north-west corner of the
9417
+ * block where the new block is being placed onto.
9418
+ *
9419
+ */
9420
+ readonly faceLocation: Vector3;
9421
+ /**
9422
+ * @remarks
9423
+ * The item being used to place the block.
9424
+ *
9425
+ */
9426
+ itemStack: ItemStack;
9427
+ /**
9428
+ * @remarks
9429
+ * Player that is placing the block for this event.
9430
+ *
9431
+ */
9432
+ readonly player: Player;
9433
+ }
9434
+
9435
+ /**
9436
+ * @beta
9437
+ * Manages callbacks that are connected to before a block is
9438
+ * placed by a player.
9439
+ */
9440
+ export class PlayerPlaceBlockBeforeEventSignal {
9441
+ private constructor();
9442
+ /**
9443
+ * @remarks
9444
+ * Adds a callback that will be called before a block is placed
9445
+ * by a player.
9446
+ *
9447
+ * This function can't be called in read-only mode.
9448
+ *
9449
+ */
9450
+ subscribe(
9451
+ callback: (arg: PlayerPlaceBlockBeforeEvent) => void,
9452
+ options?: BlockEventOptions,
9453
+ ): (arg: PlayerPlaceBlockBeforeEvent) => void;
9454
+ /**
9455
+ * @remarks
9456
+ * Removes a callback from being called before an block is
9457
+ * placed by a player.
9458
+ *
9459
+ * This function can't be called in read-only mode.
9460
+ *
9461
+ * @throws This function can throw errors.
9462
+ */
9463
+ unsubscribe(callback: (arg: PlayerPlaceBlockBeforeEvent) => void): void;
9464
+ }
9465
+
9015
9466
  /**
9016
9467
  * @beta
9017
9468
  * An event that contains more information about a player
@@ -9408,12 +9859,16 @@ export class Scoreboard {
9408
9859
  *
9409
9860
  * This function can't be called in read-only mode.
9410
9861
  *
9862
+ * @returns
9863
+ * Returns the previous `ScoreboardObjective` set at the
9864
+ * display slot, if no objective was previously set it returns
9865
+ * `undefined`.
9411
9866
  * @throws This function can throw errors.
9412
9867
  */
9413
9868
  setObjectiveAtDisplaySlot(
9414
9869
  displaySlotId: DisplaySlotId,
9415
9870
  objectiveDisplaySetting: ScoreboardObjectiveDisplayOptions,
9416
- ): ScoreboardObjective;
9871
+ ): ScoreboardObjective | undefined;
9417
9872
  }
9418
9873
 
9419
9874
  /**
@@ -9447,7 +9902,7 @@ export class ScoreboardIdentity {
9447
9902
  *
9448
9903
  * @throws This function can throw errors.
9449
9904
  */
9450
- getEntity(): Entity;
9905
+ getEntity(): Entity | undefined;
9451
9906
  isValid(): boolean;
9452
9907
  }
9453
9908
 
@@ -10821,13 +11276,6 @@ export class World {
10821
11276
  */
10822
11277
  export class WorldAfterEvents {
10823
11278
  private constructor();
10824
- /**
10825
- * @beta
10826
- * @remarks
10827
- * This event fires for a block that is broken by a player.
10828
- *
10829
- */
10830
- readonly blockBreak: BlockBreakAfterEventSignal;
10831
11279
  /**
10832
11280
  * @beta
10833
11281
  * @remarks
@@ -10837,13 +11285,6 @@ export class WorldAfterEvents {
10837
11285
  *
10838
11286
  */
10839
11287
  readonly blockExplode: BlockExplodeAfterEventSignal;
10840
- /**
10841
- * @beta
10842
- * @remarks
10843
- * This event fires for a block that is placed by a player.
10844
- *
10845
- */
10846
- readonly blockPlace: BlockPlaceAfterEventSignal;
10847
11288
  /**
10848
11289
  * @remarks
10849
11290
  * This event fires when a button is pushed.
@@ -10914,13 +11355,12 @@ export class WorldAfterEvents {
10914
11355
  readonly entityHurt: EntityHurtAfterEventSignal;
10915
11356
  /**
10916
11357
  * @beta
10917
- * @remarks
10918
- * This event fires when an entity is removed from the game
10919
- * (e.g., is unloaded when it goes out of range; or a few
10920
- * seconds after the death of an entity.)
10921
- *
10922
11358
  */
10923
- readonly entityRemoved: EntityRemovedAfterEventSignal;
11359
+ readonly entityLoad: EntityLoadAfterEventSignal;
11360
+ /**
11361
+ * @beta
11362
+ */
11363
+ readonly entityRemove: EntityRemoveAfterEventSignal;
10924
11364
  /**
10925
11365
  * @beta
10926
11366
  * @remarks
@@ -11031,6 +11471,13 @@ export class WorldAfterEvents {
11031
11471
  *
11032
11472
  */
11033
11473
  readonly pistonActivate: PistonActivateAfterEventSignal;
11474
+ /**
11475
+ * @beta
11476
+ * @remarks
11477
+ * This event fires for a block that is broken by a player.
11478
+ *
11479
+ */
11480
+ readonly playerBreakBlock: PlayerBreakBlockAfterEventSignal;
11034
11481
  /**
11035
11482
  * @remarks
11036
11483
  * This event fires when a player joins a world. See also
@@ -11045,6 +11492,13 @@ export class WorldAfterEvents {
11045
11492
  *
11046
11493
  */
11047
11494
  readonly playerLeave: PlayerLeaveAfterEventSignal;
11495
+ /**
11496
+ * @beta
11497
+ * @remarks
11498
+ * This event fires for a block that is placed by a player.
11499
+ *
11500
+ */
11501
+ readonly playerPlaceBlock: PlayerPlaceBlockAfterEventSignal;
11048
11502
  /**
11049
11503
  * @remarks
11050
11504
  * This event fires when a player spawns or respawns. Note that
@@ -11143,6 +11597,10 @@ export class WorldBeforeEvents {
11143
11597
  *
11144
11598
  */
11145
11599
  readonly dataDrivenEntityTriggerEvent: DataDrivenEntityTriggerBeforeEventSignal;
11600
+ /**
11601
+ * @beta
11602
+ */
11603
+ readonly entityRemove: EntityRemoveBeforeEventSignal;
11146
11604
  /**
11147
11605
  * @beta
11148
11606
  * @remarks
@@ -11181,6 +11639,20 @@ export class WorldBeforeEvents {
11181
11639
  *
11182
11640
  */
11183
11641
  readonly pistonActivate: PistonActivateBeforeEventSignal;
11642
+ /**
11643
+ * @beta
11644
+ * @remarks
11645
+ * This event fires before a block is broken by a player.
11646
+ *
11647
+ */
11648
+ readonly playerBreakBlock: PlayerBreakBlockBeforeEventSignal;
11649
+ /**
11650
+ * @beta
11651
+ * @remarks
11652
+ * This event fires before a block is placed by a player.
11653
+ *
11654
+ */
11655
+ readonly playerPlaceBlock: PlayerPlaceBlockBeforeEventSignal;
11184
11656
  }
11185
11657
 
11186
11658
  /**
@@ -11247,6 +11719,27 @@ export class WorldInitializeAfterEventSignal {
11247
11719
  unsubscribe(callback: (arg: WorldInitializeAfterEvent) => void): void;
11248
11720
  }
11249
11721
 
11722
+ /**
11723
+ * @beta
11724
+ * Contains optional parameters for registering a block event.
11725
+ */
11726
+ export interface BlockEventOptions {
11727
+ /**
11728
+ * @remarks
11729
+ * If this value is set, this event will only fire if the
11730
+ * impacted block's type matches this parameter.
11731
+ *
11732
+ */
11733
+ blockTypes?: string[];
11734
+ /**
11735
+ * @remarks
11736
+ * If this value is set, this event will only fire if the
11737
+ * impacted block's permutation matches this parameter.
11738
+ *
11739
+ */
11740
+ permutations?: BlockPermutation[];
11741
+ }
11742
+
11250
11743
  /**
11251
11744
  * @beta
11252
11745
  * Contains additional options for a block fill operation.
@@ -12073,6 +12566,13 @@ export interface RawMessage {
12073
12566
  *
12074
12567
  */
12075
12568
  translate?: string;
12569
+ /**
12570
+ * @remarks
12571
+ * Arguments for the translation token. Can be either an array
12572
+ * of strings or RawMessage containing an array of raw text
12573
+ * objects.
12574
+ *
12575
+ */
12076
12576
  with?: string[] | RawMessage;
12077
12577
  }
12078
12578
 
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.21",
3
+ "version": "1.6.0-beta.1.20.30-preview.24",
4
4
  "description": "",
5
5
  "contributors": [
6
6
  {