@minecraft/server 1.4.0-rc.1.20.20-preview.21 → 1.4.0-rc.1.20.20-preview.23

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 (2) hide show
  1. package/index.d.ts +1267 -156
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -16,7 +16,7 @@
16
16
  * ```json
17
17
  * {
18
18
  * "module_name": "@minecraft/server",
19
- * "version": "1.5.0-internal.1.20.20-preview.21"
19
+ * "version": "1.5.0-internal.1.20.20-preview.23"
20
20
  * }
21
21
  * ```
22
22
  *
@@ -70,6 +70,15 @@ export enum Direction {
70
70
  West = 'West',
71
71
  }
72
72
 
73
+ /**
74
+ * @beta
75
+ */
76
+ export enum DisplaySlotId {
77
+ BelowName = 'BelowName',
78
+ List = 'List',
79
+ Sidebar = 'Sidebar',
80
+ }
81
+
73
82
  /**
74
83
  * @beta
75
84
  */
@@ -188,6 +197,60 @@ export enum ItemLockMode {
188
197
  slot = 'slot',
189
198
  }
190
199
 
200
+ /**
201
+ * @beta
202
+ * Used for specifying a sort order for how to display an
203
+ * objective and its list of participants.
204
+ */
205
+ export enum ObjectiveSortOrder {
206
+ /**
207
+ * @beta
208
+ * @remarks
209
+ * Objective participant list is displayed in ascending (e.g.,
210
+ * A-Z) order.
211
+ *
212
+ */
213
+ Ascending = 0,
214
+ /**
215
+ * @beta
216
+ * @remarks
217
+ * Objective participant list is displayed in descending (e.g.,
218
+ * Z-A) order.
219
+ *
220
+ */
221
+ Descending = 1,
222
+ }
223
+
224
+ /**
225
+ * @beta
226
+ * Contains objectives and participants for the scoreboard.
227
+ */
228
+ export enum ScoreboardIdentityType {
229
+ /**
230
+ * @beta
231
+ * @remarks
232
+ * This scoreboard participant is tied to an entity.
233
+ *
234
+ */
235
+ Entity = 'Entity',
236
+ /**
237
+ * @beta
238
+ * @remarks
239
+ * This scoreboard participant is tied to a pseudo player
240
+ * entity - typically this is used to store scores as data or
241
+ * as abstract progress.
242
+ *
243
+ */
244
+ FakePlayer = 'FakePlayer',
245
+ /**
246
+ * @beta
247
+ * @remarks
248
+ * This scoreboard participant is tied to a player.
249
+ *
250
+ */
251
+ Player = 'Player',
252
+ }
253
+
191
254
  /**
192
255
  * @beta
193
256
  * Describes where the script event originated from.
@@ -304,6 +367,17 @@ export class Block {
304
367
  * @throws This function can throw errors.
305
368
  */
306
369
  getComponent(componentName: string): BlockComponent | undefined;
370
+ /**
371
+ * @beta
372
+ * @remarks
373
+ * Returns true if this reference to a block is still valid
374
+ * (for example, if the block is unloaded, references to that
375
+ * block will no longer be valid.)
376
+ *
377
+ * @returns
378
+ * True if this block object is still working and valid.
379
+ */
380
+ isValid(): boolean;
307
381
  /**
308
382
  * @remarks
309
383
  * Sets the block in the dimension to the state of the
@@ -499,6 +573,18 @@ export class Component {
499
573
  *
500
574
  */
501
575
  readonly typeId: string;
576
+ /**
577
+ * @beta
578
+ * @remarks
579
+ * Returns whether the component is valid. A component is
580
+ * considered valid if its owner is valid, in addition to any
581
+ * addition to any additional validation required by the
582
+ * component.
583
+ *
584
+ * @returns
585
+ * Whether the component is valid.
586
+ */
587
+ isValid(): boolean;
502
588
  }
503
589
 
504
590
  /**
@@ -573,6 +659,15 @@ export class Container {
573
659
  * ```
574
660
  */
575
661
  getItem(slot: number): ItemStack | undefined;
662
+ /**
663
+ * @beta
664
+ * @remarks
665
+ * Returns whether a container object (or the entity or block
666
+ * that this container is associated with) is still available
667
+ * for use in this context.
668
+ *
669
+ */
670
+ isValid(): boolean;
576
671
  /**
577
672
  * @remarks
578
673
  * Moves an item from one slot to another, potentially across
@@ -1074,6 +1169,14 @@ export class Entity {
1074
1169
  *
1075
1170
  */
1076
1171
  nameTag: string;
1172
+ /**
1173
+ * @beta
1174
+ * @remarks
1175
+ * Returns a scoreboard identity that represents this entity.
1176
+ *
1177
+ * @throws This property can throw when used.
1178
+ */
1179
+ readonly scoreboardIdentity?: ScoreboardIdentity;
1077
1180
  /**
1078
1181
  * @remarks
1079
1182
  * Unique identifier of the type of the entity - for example,
@@ -1448,6 +1551,17 @@ export class Entity {
1448
1551
  * @throws This function can throw errors.
1449
1552
  */
1450
1553
  hasTag(tag: string): boolean;
1554
+ /**
1555
+ * @beta
1556
+ * @remarks
1557
+ * Returns whether the entity can be manipulated by script. A
1558
+ * Player is considered valid when it's EntityLifetimeState is
1559
+ * set to Loaded.
1560
+ *
1561
+ * @returns
1562
+ * Whether the entity is valid.
1563
+ */
1564
+ isValid(): boolean;
1451
1565
  /**
1452
1566
  * @beta
1453
1567
  * @remarks
@@ -2702,6 +2816,62 @@ export class IPlayerSpawnAfterEventSignal {
2702
2816
  unsubscribe(callback: (arg: PlayerSpawnAfterEvent) => void): void;
2703
2817
  }
2704
2818
 
2819
+ /**
2820
+ * @beta
2821
+ * Contains information related to a chargeable item completing
2822
+ * being charged.
2823
+ */
2824
+ export class ItemCompleteUseAfterEvent {
2825
+ private constructor();
2826
+ /**
2827
+ * @remarks
2828
+ * Returns the item stack that has completed charging.
2829
+ *
2830
+ */
2831
+ readonly itemStack: ItemStack;
2832
+ /**
2833
+ * @remarks
2834
+ * Returns the source entity that triggered this item event.
2835
+ *
2836
+ */
2837
+ readonly source: Player;
2838
+ /**
2839
+ * @remarks
2840
+ * Returns the time, in ticks, for the remaining duration left
2841
+ * before the charge completes its cycle.
2842
+ *
2843
+ */
2844
+ readonly useDuration: number;
2845
+ }
2846
+
2847
+ /**
2848
+ * @beta
2849
+ * Manages callbacks that are connected to the completion of
2850
+ * charging for a chargeable item.
2851
+ */
2852
+ export class ItemCompleteUseAfterEventSignal {
2853
+ private constructor();
2854
+ /**
2855
+ * @remarks
2856
+ * Adds a callback that will be called when a chargeable item
2857
+ * completes charging.
2858
+ *
2859
+ * This function can't be called in read-only mode.
2860
+ *
2861
+ */
2862
+ subscribe(callback: (arg: ItemCompleteUseAfterEvent) => void): (arg: ItemCompleteUseAfterEvent) => void;
2863
+ /**
2864
+ * @remarks
2865
+ * Removes a callback from being called when a chargeable item
2866
+ * completes charging.
2867
+ *
2868
+ * This function can't be called in read-only mode.
2869
+ *
2870
+ * @throws This function can throw errors.
2871
+ */
2872
+ unsubscribe(callback: (arg: ItemCompleteUseAfterEvent) => void): void;
2873
+ }
2874
+
2705
2875
  /**
2706
2876
  * @beta
2707
2877
  * Base class for item components.
@@ -2711,6 +2881,63 @@ export class ItemComponent extends Component {
2711
2881
  private constructor();
2712
2882
  }
2713
2883
 
2884
+ /**
2885
+ * @beta
2886
+ * Contains information related to a chargeable item when the
2887
+ * player has finished using the item and released the build
2888
+ * action.
2889
+ */
2890
+ export class ItemReleaseUseAfterEvent {
2891
+ private constructor();
2892
+ /**
2893
+ * @remarks
2894
+ * Returns the item stack that triggered this item event.
2895
+ *
2896
+ */
2897
+ readonly itemStack: ItemStack;
2898
+ /**
2899
+ * @remarks
2900
+ * Returns the source entity that triggered this item event.
2901
+ *
2902
+ */
2903
+ readonly source: Player;
2904
+ /**
2905
+ * @remarks
2906
+ * Returns the time, in ticks, for the remaining duration left
2907
+ * before the charge completes its cycle.
2908
+ *
2909
+ */
2910
+ readonly useDuration: number;
2911
+ }
2912
+
2913
+ /**
2914
+ * @beta
2915
+ * Manages callbacks that are connected to the releasing of
2916
+ * charging for a chargeable item.
2917
+ */
2918
+ export class ItemReleaseUseAfterEventSignal {
2919
+ private constructor();
2920
+ /**
2921
+ * @remarks
2922
+ * Adds a callback that will be called when a chargeable item
2923
+ * is released from charging.
2924
+ *
2925
+ * This function can't be called in read-only mode.
2926
+ *
2927
+ */
2928
+ subscribe(callback: (arg: ItemReleaseUseAfterEvent) => void): (arg: ItemReleaseUseAfterEvent) => void;
2929
+ /**
2930
+ * @remarks
2931
+ * Removes a callback from being called when a chargeable item
2932
+ * is released from charging.
2933
+ *
2934
+ * This function can't be called in read-only mode.
2935
+ *
2936
+ * @throws This function can throw errors.
2937
+ */
2938
+ unsubscribe(callback: (arg: ItemReleaseUseAfterEvent) => void): void;
2939
+ }
2940
+
2714
2941
  /**
2715
2942
  * @beta
2716
2943
  * Defines a collection of items.
@@ -2863,127 +3090,573 @@ export class ItemStack {
2863
3090
 
2864
3091
  /**
2865
3092
  * @beta
2866
- * Represents the type of an item - for example, Wool.
3093
+ * Contains information related to a chargeable item starting
3094
+ * to be charged.
2867
3095
  */
2868
- export class ItemType {
3096
+ export class ItemStartUseAfterEvent {
2869
3097
  private constructor();
2870
3098
  /**
2871
3099
  * @remarks
2872
- * Returns the identifier of the item type - for example,
2873
- * 'minecraft:apple'.
3100
+ * The impacted item stack that is starting to be charged.
2874
3101
  *
2875
3102
  */
2876
- readonly id: string;
3103
+ readonly itemStack: ItemStack;
3104
+ /**
3105
+ * @remarks
3106
+ * Returns the source entity that triggered this item event.
3107
+ *
3108
+ */
3109
+ readonly source: Player;
3110
+ /**
3111
+ * @remarks
3112
+ * Returns the time, in ticks, for the remaining duration left
3113
+ * before the charge completes its cycle.
3114
+ *
3115
+ */
3116
+ readonly useDuration: number;
2877
3117
  }
2878
3118
 
2879
3119
  /**
2880
3120
  * @beta
2881
- * Contains information related to changes to a lever
2882
- * activating or deactivating.
3121
+ * Manages callbacks that are connected to the start of
3122
+ * charging for a chargeable item.
2883
3123
  */
2884
- // @ts-ignore Class inheritance allowed for native defined classes
2885
- export class LeverActionAfterEvent extends BlockEvent {
3124
+ export class ItemStartUseAfterEventSignal {
2886
3125
  private constructor();
2887
3126
  /**
2888
3127
  * @remarks
2889
- * True if the lever is activated (that is, transmitting
2890
- * power).
3128
+ * Adds a callback that will be called when a chargeable item
3129
+ * starts charging.
3130
+ *
3131
+ * This function can't be called in read-only mode.
2891
3132
  *
2892
3133
  */
2893
- readonly isPowered: boolean;
3134
+ subscribe(callback: (arg: ItemStartUseAfterEvent) => void): (arg: ItemStartUseAfterEvent) => void;
2894
3135
  /**
2895
3136
  * @remarks
2896
- * Optional player that triggered the lever activation.
3137
+ * Removes a callback from being called when a chargeable item
3138
+ * starts charging.
3139
+ *
3140
+ * This function can't be called in read-only mode.
2897
3141
  *
3142
+ * @throws This function can throw errors.
2898
3143
  */
2899
- readonly player: Player;
3144
+ unsubscribe(callback: (arg: ItemStartUseAfterEvent) => void): void;
2900
3145
  }
2901
3146
 
2902
3147
  /**
2903
3148
  * @beta
2904
- * Manages callbacks that are connected to lever moves
2905
- * (activates or deactivates).
2906
- */
2907
- // @ts-ignore Class inheritance allowed for native defined classes
2908
- export class LeverActionAfterEventSignal extends ILeverActionAfterEventSignal {
3149
+ * Contains information related to an item being used on a
3150
+ * block. This event fires when a player presses the the Use
3151
+ * Item / Place Block button to successfully use an item or
3152
+ * place a block. Fires for the first block that is interacted
3153
+ * with when performing a build action. Note: This event cannot
3154
+ * be used with Hoe or Axe items.
3155
+ */
3156
+ export class ItemStartUseOnAfterEvent {
2909
3157
  private constructor();
3158
+ /**
3159
+ * @remarks
3160
+ * The block that the item is used on.
3161
+ *
3162
+ */
3163
+ readonly block: Block;
3164
+ /**
3165
+ * @remarks
3166
+ * The face of the block that an item is being used on.
3167
+ *
3168
+ */
3169
+ readonly blockFace: Direction;
3170
+ /**
3171
+ * @remarks
3172
+ * The impacted item stack that is starting to be used.
3173
+ *
3174
+ */
3175
+ readonly itemStack: ItemStack;
3176
+ /**
3177
+ * @remarks
3178
+ * Returns the source entity that triggered this item event.
3179
+ *
3180
+ */
3181
+ readonly source: Player;
2910
3182
  }
2911
3183
 
2912
3184
  /**
2913
- * DEPRECATED
2914
- * Use @minecraft/vanilla-data.MinecraftDimensionTypes
2915
- * A collection of default Minecraft dimension types.
3185
+ * @beta
3186
+ * Manages callbacks that are connected to an item starting
3187
+ * being used on a block event.
2916
3188
  */
2917
- export class MinecraftDimensionTypes {
3189
+ export class ItemStartUseOnAfterEventSignal {
2918
3190
  private constructor();
2919
3191
  /**
2920
3192
  * @remarks
2921
- * The Nether is a collection of biomes separate from the
2922
- * Overworld, including Soul Sand Valleys and Crimson forests.
2923
- * Nether fortresses contain exclusive resources. Mobs such as
2924
- * Blaze, Hoglins, Piglins, and Ghasts congregate here.
3193
+ * Adds a callback that will be called when an item is used on
3194
+ * a block.
2925
3195
  *
2926
- */
2927
- static readonly nether = 'minecraft:nether';
2928
- /**
2929
- * @remarks
2930
- * The overworld is a collection of biomes, including forests,
2931
- * plains, jungles, mountains, deserts, taiga, and more. This
2932
- * is the default starter dimension for Minecraft. Mobs such as
2933
- * Axolotl, Cows, Creepers, and Zombies congregate here.
3196
+ * This function can't be called in read-only mode.
2934
3197
  *
2935
3198
  */
2936
- static readonly overworld = 'minecraft:overworld';
3199
+ subscribe(callback: (arg: ItemStartUseOnAfterEvent) => void): (arg: ItemStartUseOnAfterEvent) => void;
2937
3200
  /**
2938
3201
  * @remarks
2939
- * The End is separate from the Overworld and the Nether and is
2940
- * generated whenever you create an End portal. Here, a giant
2941
- * center island is surrounded by several smaller areas and
2942
- * islands. You can find Endermen here. End midlands are larger
2943
- * areas that transition you from the center to the outer edges
2944
- * of the End. They contain Shulkers, Endermen, End gateway
2945
- * portals, and End cities. End gateway portals are commonly
2946
- * found at the outermost edge of the void. You usually find
2947
- * End barrens toward the edges of the main areas or land in
2948
- * the End.
3202
+ * Removes a callback from being called when an item is used on
3203
+ * a block.
3204
+ *
3205
+ * This function can't be called in read-only mode.
2949
3206
  *
3207
+ * @throws This function can throw errors.
2950
3208
  */
2951
- static readonly theEnd = 'minecraft:the_end';
3209
+ unsubscribe(callback: (arg: ItemStartUseOnAfterEvent) => void): void;
2952
3210
  }
2953
3211
 
2954
3212
  /**
2955
- * Represents a player within the world.
3213
+ * @beta
3214
+ * Contains information related to a chargeable item has
3215
+ * finished an items use cycle, or when the player has released
3216
+ * the use action with the item.
2956
3217
  */
2957
- // @ts-ignore Class inheritance allowed for native defined classes
2958
- export class Player extends Entity {
3218
+ export class ItemStopUseAfterEvent {
2959
3219
  private constructor();
2960
3220
  /**
2961
3221
  * @remarks
2962
- * Name of the player.
3222
+ * The impacted item stack that is stopping being charged.
2963
3223
  *
2964
- * @throws This property can throw when used.
2965
3224
  */
2966
- readonly name: string;
3225
+ readonly itemStack: ItemStack;
2967
3226
  /**
2968
- * @beta
2969
3227
  * @remarks
2970
- * Contains methods for manipulating the on-screen display of a
2971
- * Player.
3228
+ * Returns the source entity that triggered this item event.
2972
3229
  *
2973
- * @throws This property can throw when used.
2974
3230
  */
2975
- readonly onScreenDisplay: ScreenDisplay;
3231
+ readonly source: Player;
2976
3232
  /**
2977
- * @beta
2978
3233
  * @remarks
2979
- * Plays a sound that only this particular player can hear.
2980
- *
2981
- * This function can't be called in read-only mode.
3234
+ * Returns the time, in ticks, for the remaining duration left
3235
+ * before the charge completes its cycle.
2982
3236
  *
2983
- * @param soundID
2984
- * Identifier of the sound to play.
2985
- * @param soundOptions
2986
- * Additional optional options for the sound.
3237
+ */
3238
+ readonly useDuration: number;
3239
+ }
3240
+
3241
+ /**
3242
+ * @beta
3243
+ * Manages callbacks that are connected to the stopping of
3244
+ * charging for an item that has a registered
3245
+ * minecraft:chargeable component.
3246
+ */
3247
+ export class ItemStopUseAfterEventSignal {
3248
+ private constructor();
3249
+ /**
3250
+ * @remarks
3251
+ * Adds a callback that will be called when a chargeable item
3252
+ * stops charging.
3253
+ *
3254
+ * This function can't be called in read-only mode.
3255
+ *
3256
+ */
3257
+ subscribe(callback: (arg: ItemStopUseAfterEvent) => void): (arg: ItemStopUseAfterEvent) => void;
3258
+ /**
3259
+ * @remarks
3260
+ * Removes a callback from being called when a chargeable item
3261
+ * stops charging.
3262
+ *
3263
+ * This function can't be called in read-only mode.
3264
+ *
3265
+ * @throws This function can throw errors.
3266
+ */
3267
+ unsubscribe(callback: (arg: ItemStopUseAfterEvent) => void): void;
3268
+ }
3269
+
3270
+ /**
3271
+ * @beta
3272
+ * Contains information related to an item that has stopped
3273
+ * being used on a block. This event fires when a player
3274
+ * successfully uses an item or places a block by pressing the
3275
+ * Use Item / Place Block button. If multiple blocks are
3276
+ * placed, this event will only occur once at the beginning of
3277
+ * the block placement. Note: This event cannot be used with
3278
+ * Hoe or Axe items.
3279
+ */
3280
+ export class ItemStopUseOnAfterEvent {
3281
+ private constructor();
3282
+ /**
3283
+ * @remarks
3284
+ * The block that the item is used on.
3285
+ *
3286
+ */
3287
+ readonly block: Block;
3288
+ /**
3289
+ * @remarks
3290
+ * The impacted item stack that is being used on a block.
3291
+ *
3292
+ */
3293
+ readonly itemStack?: ItemStack;
3294
+ /**
3295
+ * @remarks
3296
+ * Returns the source entity that triggered this item event.
3297
+ *
3298
+ */
3299
+ readonly source: Player;
3300
+ }
3301
+
3302
+ /**
3303
+ * @beta
3304
+ * Manages callbacks that are connected to an item stops used
3305
+ * on a block event.
3306
+ */
3307
+ export class ItemStopUseOnAfterEventSignal {
3308
+ private constructor();
3309
+ /**
3310
+ * @remarks
3311
+ * Adds a callback that will be called when an item stops being
3312
+ * used on a block.
3313
+ *
3314
+ * This function can't be called in read-only mode.
3315
+ *
3316
+ */
3317
+ subscribe(callback: (arg: ItemStopUseOnAfterEvent) => void): (arg: ItemStopUseOnAfterEvent) => void;
3318
+ /**
3319
+ * @remarks
3320
+ * Removes a callback from being called when an item is used on
3321
+ * a block.
3322
+ *
3323
+ * This function can't be called in read-only mode.
3324
+ *
3325
+ * @throws This function can throw errors.
3326
+ */
3327
+ unsubscribe(callback: (arg: ItemStopUseOnAfterEvent) => void): void;
3328
+ }
3329
+
3330
+ /**
3331
+ * @beta
3332
+ * Represents the type of an item - for example, Wool.
3333
+ */
3334
+ export class ItemType {
3335
+ private constructor();
3336
+ /**
3337
+ * @remarks
3338
+ * Returns the identifier of the item type - for example,
3339
+ * 'minecraft:apple'.
3340
+ *
3341
+ */
3342
+ readonly id: string;
3343
+ }
3344
+
3345
+ /**
3346
+ * @beta
3347
+ * Contains information related to an item being used. This
3348
+ * event fires when an item is successfully used by a player.
3349
+ */
3350
+ export class ItemUseAfterEvent {
3351
+ private constructor();
3352
+ /**
3353
+ * @remarks
3354
+ * The impacted item stack that is being used.
3355
+ *
3356
+ */
3357
+ itemStack: ItemStack;
3358
+ /**
3359
+ * @remarks
3360
+ * Returns the source entity that triggered this item event.
3361
+ *
3362
+ */
3363
+ readonly source: Player;
3364
+ }
3365
+
3366
+ /**
3367
+ * @beta
3368
+ * Manages callbacks that are connected to an item use event.
3369
+ */
3370
+ export class ItemUseAfterEventSignal {
3371
+ private constructor();
3372
+ /**
3373
+ * @remarks
3374
+ * Adds a callback that will be called when an item is used.
3375
+ *
3376
+ * This function can't be called in read-only mode.
3377
+ *
3378
+ */
3379
+ subscribe(callback: (arg: ItemUseAfterEvent) => void): (arg: ItemUseAfterEvent) => void;
3380
+ /**
3381
+ * @remarks
3382
+ * Removes a callback from being called when an item is used.
3383
+ *
3384
+ * This function can't be called in read-only mode.
3385
+ *
3386
+ * @throws This function can throw errors.
3387
+ */
3388
+ unsubscribe(callback: (arg: ItemUseAfterEvent) => void): void;
3389
+ }
3390
+
3391
+ /**
3392
+ * @beta
3393
+ * Contains information related to an item being used.
3394
+ */
3395
+ // @ts-ignore Class inheritance allowed for native defined classes
3396
+ export class ItemUseBeforeEvent extends ItemUseAfterEvent {
3397
+ private constructor();
3398
+ /**
3399
+ * @remarks
3400
+ * If set to true, this will cancel the item use behavior.
3401
+ *
3402
+ */
3403
+ cancel: boolean;
3404
+ }
3405
+
3406
+ /**
3407
+ * @beta
3408
+ * Manages callbacks that fire before an item is used.
3409
+ */
3410
+ export class ItemUseBeforeEventSignal {
3411
+ private constructor();
3412
+ /**
3413
+ * @remarks
3414
+ * Adds a callback that will be called before an item is used.
3415
+ *
3416
+ * This function can't be called in read-only mode.
3417
+ *
3418
+ */
3419
+ subscribe(callback: (arg: ItemUseBeforeEvent) => void): (arg: ItemUseBeforeEvent) => void;
3420
+ /**
3421
+ * @remarks
3422
+ * Removes a callback from being called before an item is used.
3423
+ *
3424
+ * This function can't be called in read-only mode.
3425
+ *
3426
+ * @throws This function can throw errors.
3427
+ */
3428
+ unsubscribe(callback: (arg: ItemUseBeforeEvent) => void): void;
3429
+ }
3430
+
3431
+ /**
3432
+ * @beta
3433
+ * Contains information related to an item being used on a
3434
+ * block. This event fires when an item is successfully used on
3435
+ * a block by a player.
3436
+ */
3437
+ export class ItemUseOnAfterEvent {
3438
+ private constructor();
3439
+ /**
3440
+ * @remarks
3441
+ * The block that the item is used on.
3442
+ *
3443
+ */
3444
+ readonly block: Block;
3445
+ /**
3446
+ * @remarks
3447
+ * The face of the block that an item is being used on.
3448
+ *
3449
+ */
3450
+ readonly blockFace: Direction;
3451
+ /**
3452
+ * @remarks
3453
+ * Location relative to the bottom north-west corner of the
3454
+ * block where the item is placed.
3455
+ *
3456
+ */
3457
+ readonly faceLocation: Vector3;
3458
+ /**
3459
+ * @remarks
3460
+ * The impacted item stack that is being used on a block.
3461
+ *
3462
+ */
3463
+ readonly itemStack: ItemStack;
3464
+ /**
3465
+ * @remarks
3466
+ * Returns the source entity that triggered this item event.
3467
+ *
3468
+ */
3469
+ readonly source: Player;
3470
+ }
3471
+
3472
+ /**
3473
+ * @beta
3474
+ * Manages callbacks that are connected to an item being used
3475
+ * on a block event.
3476
+ */
3477
+ export class ItemUseOnAfterEventSignal {
3478
+ private constructor();
3479
+ /**
3480
+ * @remarks
3481
+ * Adds a callback that will be called when an item is used on
3482
+ * a block.
3483
+ *
3484
+ * This function can't be called in read-only mode.
3485
+ *
3486
+ */
3487
+ subscribe(callback: (arg: ItemUseOnAfterEvent) => void): (arg: ItemUseOnAfterEvent) => void;
3488
+ /**
3489
+ * @remarks
3490
+ * Removes a callback from being called when an item is used on
3491
+ * a block.
3492
+ *
3493
+ * This function can't be called in read-only mode.
3494
+ *
3495
+ * @throws This function can throw errors.
3496
+ */
3497
+ unsubscribe(callback: (arg: ItemUseOnAfterEvent) => void): void;
3498
+ }
3499
+
3500
+ /**
3501
+ * @beta
3502
+ * Contains information related to an item being used on a
3503
+ * block.
3504
+ */
3505
+ // @ts-ignore Class inheritance allowed for native defined classes
3506
+ export class ItemUseOnBeforeEvent extends ItemUseOnAfterEvent {
3507
+ private constructor();
3508
+ /**
3509
+ * @remarks
3510
+ * If set to true, this will cancel the item use behavior.
3511
+ *
3512
+ */
3513
+ cancel: boolean;
3514
+ }
3515
+
3516
+ /**
3517
+ * @beta
3518
+ * Manages callbacks that fire before an item being used on a
3519
+ * block event.
3520
+ */
3521
+ export class ItemUseOnBeforeEventSignal {
3522
+ private constructor();
3523
+ /**
3524
+ * @remarks
3525
+ * Adds a callback that will be called before an item is used
3526
+ * on a block.
3527
+ *
3528
+ * This function can't be called in read-only mode.
3529
+ *
3530
+ */
3531
+ subscribe(callback: (arg: ItemUseOnBeforeEvent) => void): (arg: ItemUseOnBeforeEvent) => void;
3532
+ /**
3533
+ * @remarks
3534
+ * Removes a callback from being called before an item is used
3535
+ * on a block.
3536
+ *
3537
+ * This function can't be called in read-only mode.
3538
+ *
3539
+ * @throws This function can throw errors.
3540
+ */
3541
+ unsubscribe(callback: (arg: ItemUseOnBeforeEvent) => void): void;
3542
+ }
3543
+
3544
+ /**
3545
+ * @beta
3546
+ * Contains information related to changes to a lever
3547
+ * activating or deactivating.
3548
+ */
3549
+ // @ts-ignore Class inheritance allowed for native defined classes
3550
+ export class LeverActionAfterEvent extends BlockEvent {
3551
+ private constructor();
3552
+ /**
3553
+ * @remarks
3554
+ * True if the lever is activated (that is, transmitting
3555
+ * power).
3556
+ *
3557
+ */
3558
+ readonly isPowered: boolean;
3559
+ /**
3560
+ * @remarks
3561
+ * Optional player that triggered the lever activation.
3562
+ *
3563
+ */
3564
+ readonly player: Player;
3565
+ }
3566
+
3567
+ /**
3568
+ * @beta
3569
+ * Manages callbacks that are connected to lever moves
3570
+ * (activates or deactivates).
3571
+ */
3572
+ // @ts-ignore Class inheritance allowed for native defined classes
3573
+ export class LeverActionAfterEventSignal extends ILeverActionAfterEventSignal {
3574
+ private constructor();
3575
+ }
3576
+
3577
+ /**
3578
+ * DEPRECATED
3579
+ * Use @minecraft/vanilla-data.MinecraftDimensionTypes
3580
+ * A collection of default Minecraft dimension types.
3581
+ */
3582
+ export class MinecraftDimensionTypes {
3583
+ private constructor();
3584
+ /**
3585
+ * @remarks
3586
+ * The Nether is a collection of biomes separate from the
3587
+ * Overworld, including Soul Sand Valleys and Crimson forests.
3588
+ * Nether fortresses contain exclusive resources. Mobs such as
3589
+ * Blaze, Hoglins, Piglins, and Ghasts congregate here.
3590
+ *
3591
+ */
3592
+ static readonly nether = 'minecraft:nether';
3593
+ /**
3594
+ * @remarks
3595
+ * The overworld is a collection of biomes, including forests,
3596
+ * plains, jungles, mountains, deserts, taiga, and more. This
3597
+ * is the default starter dimension for Minecraft. Mobs such as
3598
+ * Axolotl, Cows, Creepers, and Zombies congregate here.
3599
+ *
3600
+ */
3601
+ static readonly overworld = 'minecraft:overworld';
3602
+ /**
3603
+ * @remarks
3604
+ * The End is separate from the Overworld and the Nether and is
3605
+ * generated whenever you create an End portal. Here, a giant
3606
+ * center island is surrounded by several smaller areas and
3607
+ * islands. You can find Endermen here. End midlands are larger
3608
+ * areas that transition you from the center to the outer edges
3609
+ * of the End. They contain Shulkers, Endermen, End gateway
3610
+ * portals, and End cities. End gateway portals are commonly
3611
+ * found at the outermost edge of the void. You usually find
3612
+ * End barrens toward the edges of the main areas or land in
3613
+ * the End.
3614
+ *
3615
+ */
3616
+ static readonly theEnd = 'minecraft:the_end';
3617
+ }
3618
+
3619
+ /**
3620
+ * Represents a player within the world.
3621
+ */
3622
+ // @ts-ignore Class inheritance allowed for native defined classes
3623
+ export class Player extends Entity {
3624
+ private constructor();
3625
+ /**
3626
+ * @remarks
3627
+ * Name of the player.
3628
+ *
3629
+ * @throws This property can throw when used.
3630
+ */
3631
+ readonly name: string;
3632
+ /**
3633
+ * @beta
3634
+ * @remarks
3635
+ * Contains methods for manipulating the on-screen display of a
3636
+ * Player.
3637
+ *
3638
+ * @throws This property can throw when used.
3639
+ */
3640
+ readonly onScreenDisplay: ScreenDisplay;
3641
+ /**
3642
+ * @beta
3643
+ * @remarks
3644
+ * Gets the current spawn point of the player.
3645
+ *
3646
+ * @throws This function can throw errors.
3647
+ */
3648
+ getSpawnPoint(): DimensionLocation | undefined;
3649
+ /**
3650
+ * @beta
3651
+ * @remarks
3652
+ * Plays a sound that only this particular player can hear.
3653
+ *
3654
+ * This function can't be called in read-only mode.
3655
+ *
3656
+ * @param soundID
3657
+ * Identifier of the sound to play.
3658
+ * @param soundOptions
3659
+ * Additional optional options for the sound.
2987
3660
  * @throws This function can throw errors.
2988
3661
  * @example playMusicAndSound.ts
2989
3662
  * ```typescript
@@ -3062,6 +3735,17 @@ export class Player extends Entity {
3062
3735
  * ```
3063
3736
  */
3064
3737
  sendMessage(message: (RawMessage | string)[] | RawMessage | string): void;
3738
+ /**
3739
+ * @beta
3740
+ * @remarks
3741
+ * Sets the current starting spawn point for this particular
3742
+ * player.
3743
+ *
3744
+ * This function can't be called in read-only mode.
3745
+ *
3746
+ * @throws This function can throw errors.
3747
+ */
3748
+ setSpawnPoint(spawnPoint?: DimensionLocation): void;
3065
3749
  }
3066
3750
 
3067
3751
  /**
@@ -3116,163 +3800,385 @@ export class PlayerLeaveAfterEvent {
3116
3800
  * Player that has left the world.
3117
3801
  *
3118
3802
  */
3119
- readonly playerName: string;
3120
- }
3121
-
3122
- /**
3123
- * @beta
3124
- * Manages callbacks that are connected to a player leaving the
3125
- * world.
3126
- */
3127
- // @ts-ignore Class inheritance allowed for native defined classes
3128
- export class PlayerLeaveAfterEventSignal extends IPlayerLeaveAfterEventSignal {
3129
- private constructor();
3803
+ readonly playerName: string;
3804
+ }
3805
+
3806
+ /**
3807
+ * @beta
3808
+ * Manages callbacks that are connected to a player leaving the
3809
+ * world.
3810
+ */
3811
+ // @ts-ignore Class inheritance allowed for native defined classes
3812
+ export class PlayerLeaveAfterEventSignal extends IPlayerLeaveAfterEventSignal {
3813
+ private constructor();
3814
+ }
3815
+
3816
+ /**
3817
+ * @beta
3818
+ * An event that contains more information about a player
3819
+ * spawning.
3820
+ */
3821
+ export class PlayerSpawnAfterEvent {
3822
+ private constructor();
3823
+ /**
3824
+ * @remarks
3825
+ * If true, this is the initial spawn of a player after joining
3826
+ * the game.
3827
+ *
3828
+ * This property can't be edited in read-only mode.
3829
+ *
3830
+ */
3831
+ initialSpawn: boolean;
3832
+ /**
3833
+ * @remarks
3834
+ * Object that represents the player that joined the game.
3835
+ *
3836
+ * This property can't be edited in read-only mode.
3837
+ *
3838
+ */
3839
+ player: Player;
3840
+ }
3841
+
3842
+ /**
3843
+ * @beta
3844
+ * Registers an event when a player is spawned (or re-spawned
3845
+ * after death) and fully ready within the world.
3846
+ */
3847
+ // @ts-ignore Class inheritance allowed for native defined classes
3848
+ export class PlayerSpawnAfterEventSignal extends IPlayerSpawnAfterEventSignal {
3849
+ private constructor();
3850
+ }
3851
+
3852
+ /**
3853
+ * @beta
3854
+ * Contains information related to changes to a pressure plate
3855
+ * pop.
3856
+ */
3857
+ // @ts-ignore Class inheritance allowed for native defined classes
3858
+ export class PressurePlatePopAfterEvent extends BlockEvent {
3859
+ private constructor();
3860
+ /**
3861
+ * @remarks
3862
+ * The redstone power of the pressure plate before it was
3863
+ * popped.
3864
+ *
3865
+ */
3866
+ readonly previousRedstonePower: number;
3867
+ /**
3868
+ * @remarks
3869
+ * The redstone power of the pressure plate at the time of the
3870
+ * pop.
3871
+ *
3872
+ */
3873
+ readonly redstonePower: number;
3874
+ }
3875
+
3876
+ /**
3877
+ * @beta
3878
+ * Manages callbacks that are connected to when a pressure
3879
+ * plate is popped.
3880
+ */
3881
+ export class PressurePlatePopAfterEventSignal {
3882
+ private constructor();
3883
+ /**
3884
+ * @remarks
3885
+ * Adds a callback that will be called when a pressure plate is
3886
+ * popped.
3887
+ *
3888
+ * This function can't be called in read-only mode.
3889
+ *
3890
+ */
3891
+ subscribe(callback: (arg: PressurePlatePopAfterEvent) => void): (arg: PressurePlatePopAfterEvent) => void;
3892
+ /**
3893
+ * @remarks
3894
+ * Removes a callback from being called when a pressure plate
3895
+ * is popped.
3896
+ *
3897
+ * This function can't be called in read-only mode.
3898
+ *
3899
+ * @throws This function can throw errors.
3900
+ */
3901
+ unsubscribe(callback: (arg: PressurePlatePopAfterEvent) => void): void;
3902
+ }
3903
+
3904
+ /**
3905
+ * @beta
3906
+ * Contains information related to changes to a pressure plate
3907
+ * push.
3908
+ */
3909
+ // @ts-ignore Class inheritance allowed for native defined classes
3910
+ export class PressurePlatePushAfterEvent extends BlockEvent {
3911
+ private constructor();
3912
+ /**
3913
+ * @remarks
3914
+ * The redstone power of the pressure plate before it was
3915
+ * pushed.
3916
+ *
3917
+ */
3918
+ readonly previousRedstonePower: number;
3919
+ /**
3920
+ * @remarks
3921
+ * The redstone power of the pressure plate at the time of the
3922
+ * push.
3923
+ *
3924
+ */
3925
+ readonly redstonePower: number;
3926
+ /**
3927
+ * @remarks
3928
+ * Source that triggered the pressure plate push.
3929
+ *
3930
+ */
3931
+ readonly source: Entity;
3932
+ }
3933
+
3934
+ /**
3935
+ * @beta
3936
+ * Manages callbacks that are connected to when a pressure
3937
+ * plate is pushed.
3938
+ */
3939
+ export class PressurePlatePushAfterEventSignal {
3940
+ private constructor();
3941
+ /**
3942
+ * @remarks
3943
+ * Adds a callback that will be called when a pressure plate is
3944
+ * pushed.
3945
+ *
3946
+ * This function can't be called in read-only mode.
3947
+ *
3948
+ */
3949
+ subscribe(callback: (arg: PressurePlatePushAfterEvent) => void): (arg: PressurePlatePushAfterEvent) => void;
3950
+ /**
3951
+ * @remarks
3952
+ * Removes a callback from being called when a pressure plate
3953
+ * is pushed.
3954
+ *
3955
+ * This function can't be called in read-only mode.
3956
+ *
3957
+ * @throws This function can throw errors.
3958
+ */
3959
+ unsubscribe(callback: (arg: PressurePlatePushAfterEvent) => void): void;
3960
+ }
3961
+
3962
+ /**
3963
+ * @beta
3964
+ * Contains objectives and participants for the scoreboard.
3965
+ */
3966
+ export class Scoreboard {
3967
+ private constructor();
3968
+ /**
3969
+ * @remarks
3970
+ * Adds a new objective to the scoreboard.
3971
+ *
3972
+ * This function can't be called in read-only mode.
3973
+ *
3974
+ * @throws This function can throw errors.
3975
+ */
3976
+ addObjective(objectiveId: string, displayName: string): ScoreboardObjective;
3977
+ /**
3978
+ * @remarks
3979
+ * Clears the objective that occupies a display slot.
3980
+ *
3981
+ * This function can't be called in read-only mode.
3982
+ *
3983
+ */
3984
+ clearObjectiveAtDisplaySlot(displaySlotId: DisplaySlotId): ScoreboardObjective | undefined;
3985
+ /**
3986
+ * @remarks
3987
+ * Returns a specific objective (by id).
3988
+ *
3989
+ * @param objectiveId
3990
+ * Identifier of the objective.
3991
+ */
3992
+ getObjective(objectiveId: string): ScoreboardObjective | undefined;
3993
+ /**
3994
+ * @remarks
3995
+ * Returns an objective that occupies the specified display
3996
+ * slot.
3997
+ *
3998
+ */
3999
+ getObjectiveAtDisplaySlot(displaySlotId: DisplaySlotId): ScoreboardObjectiveDisplayOptions | undefined;
4000
+ /**
4001
+ * @remarks
4002
+ * Returns all defined objectives.
4003
+ *
4004
+ */
4005
+ getObjectives(): ScoreboardObjective[];
4006
+ /**
4007
+ * @remarks
4008
+ * Returns all defined scoreboard identities.
4009
+ *
4010
+ */
4011
+ getParticipants(): ScoreboardIdentity[];
4012
+ /**
4013
+ * @remarks
4014
+ * Removes an objective from the scoreboard.
4015
+ *
4016
+ * This function can't be called in read-only mode.
4017
+ *
4018
+ * @throws This function can throw errors.
4019
+ */
4020
+ removeObjective(objectiveId: ScoreboardObjective | string): boolean;
4021
+ /**
4022
+ * @remarks
4023
+ * Sets an objective into a display slot with specified
4024
+ * additional display settings.
4025
+ *
4026
+ * This function can't be called in read-only mode.
4027
+ *
4028
+ * @throws This function can throw errors.
4029
+ */
4030
+ setObjectiveAtDisplaySlot(
4031
+ displaySlotId: DisplaySlotId,
4032
+ objectiveDisplaySetting: ScoreboardObjectiveDisplayOptions,
4033
+ ): ScoreboardObjective;
3130
4034
  }
3131
4035
 
3132
4036
  /**
3133
4037
  * @beta
3134
- * An event that contains more information about a player
3135
- * spawning.
4038
+ * Contains an identity of the scoreboard item.
3136
4039
  */
3137
- export class PlayerSpawnAfterEvent {
4040
+ export class ScoreboardIdentity {
3138
4041
  private constructor();
3139
4042
  /**
3140
4043
  * @remarks
3141
- * If true, this is the initial spawn of a player after joining
3142
- * the game.
4044
+ * Returns the player-visible name of this identity.
3143
4045
  *
3144
- * This property can't be edited in read-only mode.
4046
+ */
4047
+ readonly displayName: string;
4048
+ /**
4049
+ * @remarks
4050
+ * Identifier of the scoreboard identity.
3145
4051
  *
3146
4052
  */
3147
- initialSpawn: boolean;
4053
+ readonly id: number;
3148
4054
  /**
3149
4055
  * @remarks
3150
- * Object that represents the player that joined the game.
4056
+ * Type of the scoreboard identity.
3151
4057
  *
3152
- * This property can't be edited in read-only mode.
4058
+ */
4059
+ readonly 'type': ScoreboardIdentityType;
4060
+ /**
4061
+ * @remarks
4062
+ * If the scoreboard identity is an entity or player, returns
4063
+ * the entity that this scoreboard item corresponds to.
3153
4064
  *
4065
+ * @throws This function can throw errors.
3154
4066
  */
3155
- player: Player;
3156
- }
3157
-
3158
- /**
3159
- * @beta
3160
- * Registers an event when a player is spawned (or re-spawned
3161
- * after death) and fully ready within the world.
3162
- */
3163
- // @ts-ignore Class inheritance allowed for native defined classes
3164
- export class PlayerSpawnAfterEventSignal extends IPlayerSpawnAfterEventSignal {
3165
- private constructor();
4067
+ getEntity(): Entity;
4068
+ isValid(): boolean;
3166
4069
  }
3167
4070
 
3168
4071
  /**
3169
4072
  * @beta
3170
- * Contains information related to changes to a pressure plate
3171
- * pop.
4073
+ * Contains objectives and participants for the scoreboard.
3172
4074
  */
3173
- // @ts-ignore Class inheritance allowed for native defined classes
3174
- export class PressurePlatePopAfterEvent extends BlockEvent {
4075
+ export class ScoreboardObjective {
3175
4076
  private constructor();
3176
4077
  /**
3177
4078
  * @remarks
3178
- * The redstone power of the pressure plate before it was
3179
- * popped.
4079
+ * Returns the player-visible name of this scoreboard
4080
+ * objective.
3180
4081
  *
4082
+ * @throws This property can throw when used.
3181
4083
  */
3182
- readonly previousRedstonePower: number;
4084
+ readonly displayName: string;
3183
4085
  /**
3184
4086
  * @remarks
3185
- * The redstone power of the pressure plate at the time of the
3186
- * pop.
4087
+ * Identifier of the scoreboard objective.
3187
4088
  *
4089
+ * @throws This property can throw when used.
3188
4090
  */
3189
- readonly redstonePower: number;
3190
- }
3191
-
3192
- /**
3193
- * @beta
3194
- * Manages callbacks that are connected to when a pressure
3195
- * plate is popped.
3196
- */
3197
- export class PressurePlatePopAfterEventSignal {
3198
- private constructor();
4091
+ readonly id: string;
3199
4092
  /**
3200
4093
  * @remarks
3201
- * Adds a callback that will be called when a pressure plate is
3202
- * popped.
4094
+ * Adds a score to the given participant and objective.
3203
4095
  *
3204
4096
  * This function can't be called in read-only mode.
3205
4097
  *
4098
+ * @param participant
4099
+ * Participant to apply the scoreboard value addition to.
4100
+ * @throws This function can throw errors.
3206
4101
  */
3207
- subscribe(callback: (arg: PressurePlatePopAfterEvent) => void): (arg: PressurePlatePopAfterEvent) => void;
4102
+ addScore(participant: Entity | ScoreboardIdentity | string, scoreToAdd: number): number;
3208
4103
  /**
3209
4104
  * @remarks
3210
- * Removes a callback from being called when a pressure plate
3211
- * is popped.
4105
+ * Returns all objective participant identities.
3212
4106
  *
3213
- * This function can't be called in read-only mode.
4107
+ * @throws This function can throw errors.
4108
+ */
4109
+ getParticipants(): ScoreboardIdentity[];
4110
+ /**
4111
+ * @remarks
4112
+ * Returns a specific score for a participant.
3214
4113
  *
4114
+ * @param participant
4115
+ * Identifier of the participant to retrieve a score for.
3215
4116
  * @throws This function can throw errors.
3216
4117
  */
3217
- unsubscribe(callback: (arg: PressurePlatePopAfterEvent) => void): void;
3218
- }
3219
-
3220
- /**
3221
- * @beta
3222
- * Contains information related to changes to a pressure plate
3223
- * push.
3224
- */
3225
- // @ts-ignore Class inheritance allowed for native defined classes
3226
- export class PressurePlatePushAfterEvent extends BlockEvent {
3227
- private constructor();
4118
+ getScore(participant: Entity | ScoreboardIdentity | string): number | undefined;
3228
4119
  /**
3229
4120
  * @remarks
3230
- * The redstone power of the pressure plate before it was
3231
- * pushed.
4121
+ * Returns specific scores for this objective for all
4122
+ * participants.
3232
4123
  *
4124
+ * @throws This function can throw errors.
3233
4125
  */
3234
- readonly previousRedstonePower: number;
4126
+ getScores(): ScoreboardScoreInfo[];
3235
4127
  /**
3236
4128
  * @remarks
3237
- * The redstone power of the pressure plate at the time of the
3238
- * push.
4129
+ * Returns if the specified identity is a participant of the
4130
+ * scoreboard objective.
3239
4131
  *
4132
+ * @throws This function can throw errors.
3240
4133
  */
3241
- readonly redstonePower: number;
4134
+ hasParticipant(participant: Entity | ScoreboardIdentity | string): boolean;
4135
+ isValid(): boolean;
3242
4136
  /**
3243
4137
  * @remarks
3244
- * Source that triggered the pressure plate push.
4138
+ * Removes a participant from this scoreboard objective.
4139
+ *
4140
+ * This function can't be called in read-only mode.
3245
4141
  *
4142
+ * @param participant
4143
+ * Participant to remove from being tracked with this
4144
+ * objective.
4145
+ * @throws This function can throw errors.
3246
4146
  */
3247
- readonly source: Entity;
4147
+ removeParticipant(participant: Entity | ScoreboardIdentity | string): boolean;
4148
+ /**
4149
+ * @remarks
4150
+ * Sets a score for a participant.
4151
+ *
4152
+ * This function can't be called in read-only mode.
4153
+ *
4154
+ * @param participant
4155
+ * Identity of the participant.
4156
+ * @param score
4157
+ * New value of the score.
4158
+ * @throws This function can throw errors.
4159
+ */
4160
+ setScore(participant: Entity | ScoreboardIdentity | string, score: number): void;
3248
4161
  }
3249
4162
 
3250
4163
  /**
3251
4164
  * @beta
3252
- * Manages callbacks that are connected to when a pressure
3253
- * plate is pushed.
4165
+ * Contains a pair of a scoreboard participant and its
4166
+ * respective score.
3254
4167
  */
3255
- export class PressurePlatePushAfterEventSignal {
4168
+ export class ScoreboardScoreInfo {
3256
4169
  private constructor();
3257
4170
  /**
3258
4171
  * @remarks
3259
- * Adds a callback that will be called when a pressure plate is
3260
- * pushed.
3261
- *
3262
- * This function can't be called in read-only mode.
4172
+ * This scoreboard participant for this score.
3263
4173
  *
3264
4174
  */
3265
- subscribe(callback: (arg: PressurePlatePushAfterEvent) => void): (arg: PressurePlatePushAfterEvent) => void;
4175
+ readonly participant: ScoreboardIdentity;
3266
4176
  /**
3267
4177
  * @remarks
3268
- * Removes a callback from being called when a pressure plate
3269
- * is pushed.
3270
- *
3271
- * This function can't be called in read-only mode.
4178
+ * Score value of the identity for this objective.
3272
4179
  *
3273
- * @throws This function can throw errors.
3274
4180
  */
3275
- unsubscribe(callback: (arg: PressurePlatePushAfterEvent) => void): void;
4181
+ readonly score: number;
3276
4182
  }
3277
4183
 
3278
4184
  /**
@@ -3673,6 +4579,32 @@ export class TripWireTripAfterEventSignal {
3673
4579
  */
3674
4580
  export class World {
3675
4581
  private constructor();
4582
+ /**
4583
+ * @beta
4584
+ * @remarks
4585
+ * Contains a set of events that are applicable to the entirety
4586
+ * of the world. Event callbacks are called in a deferred
4587
+ * manner. Event callbacks are executed in read-write mode.
4588
+ *
4589
+ */
4590
+ readonly afterEvents: WorldAfterEvents;
4591
+ /**
4592
+ * @beta
4593
+ * @remarks
4594
+ * Contains a set of events that are applicable to the entirety
4595
+ * of the world. Event callbacks are called immediately. Event
4596
+ * callbacks are executed in read-only mode.
4597
+ *
4598
+ */
4599
+ readonly beforeEvents: WorldBeforeEvents;
4600
+ /**
4601
+ * @beta
4602
+ * @remarks
4603
+ * Returns the general global scoreboard that applies to the
4604
+ * world.
4605
+ *
4606
+ */
4607
+ readonly scoreboard: Scoreboard;
3676
4608
  /**
3677
4609
  * @beta
3678
4610
  * @remarks
@@ -3697,6 +4629,17 @@ export class World {
3697
4629
  * number of ticks per day. New worlds start at day 0.
3698
4630
  */
3699
4631
  getDay(): number;
4632
+ /**
4633
+ * @beta
4634
+ * @remarks
4635
+ * Returns the default Overworld spawn location.
4636
+ *
4637
+ * @returns
4638
+ * The default Overworld spawn location. By default, the Y
4639
+ * coordinate is 32767, indicating a player's spawn height is
4640
+ * not fixed and will be determined by surrounding blocks.
4641
+ */
4642
+ getDefaultSpawnLocation(): Vector3;
3700
4643
  /**
3701
4644
  * @remarks
3702
4645
  * Returns a dimension object.
@@ -3870,6 +4813,20 @@ export class World {
3870
4813
  * The world time, in ticks.
3871
4814
  */
3872
4815
  setAbsoluteTime(absoluteTime: number): void;
4816
+ /**
4817
+ * @beta
4818
+ * @remarks
4819
+ * Sets a default spawn location for all players.
4820
+ *
4821
+ * This function can't be called in read-only mode.
4822
+ *
4823
+ * @param spawnLocation
4824
+ * Location of the spawn point. Note that this is assumed to be
4825
+ * within the overworld dimension.
4826
+ * @throws
4827
+ * Throws if the provided spawn location is out of bounds.
4828
+ */
4829
+ setDefaultSpawnLocation(spawnLocation: Vector3): void;
3873
4830
  /**
3874
4831
  * @beta
3875
4832
  * @remarks
@@ -3934,6 +4891,58 @@ export class WorldAfterEvents {
3934
4891
  *
3935
4892
  */
3936
4893
  readonly entityHurt: EntityHurtAfterEventSignal;
4894
+ /**
4895
+ * @beta
4896
+ */
4897
+ readonly itemCompleteUse: ItemCompleteUseAfterEventSignal;
4898
+ /**
4899
+ * @beta
4900
+ */
4901
+ readonly itemReleaseUse: ItemReleaseUseAfterEventSignal;
4902
+ /**
4903
+ * @beta
4904
+ */
4905
+ readonly itemStartUse: ItemStartUseAfterEventSignal;
4906
+ /**
4907
+ * @beta
4908
+ * @remarks
4909
+ * This event fires when a player successfully uses an item or
4910
+ * places a block by pressing the Use Item / Place Block
4911
+ * button. If multiple blocks are placed, this event will only
4912
+ * occur once at the beginning of the block placement. Note:
4913
+ * This event cannot be used with Hoe or Axe items.
4914
+ *
4915
+ */
4916
+ readonly itemStartUseOn: ItemStartUseOnAfterEventSignal;
4917
+ /**
4918
+ * @beta
4919
+ */
4920
+ readonly itemStopUse: ItemStopUseAfterEventSignal;
4921
+ /**
4922
+ * @beta
4923
+ * @remarks
4924
+ * This event fires when a player releases the Use Item / Place
4925
+ * Block button after successfully using an item. Note: This
4926
+ * event cannot be used with Hoe or Axe items.
4927
+ *
4928
+ */
4929
+ readonly itemStopUseOn: ItemStopUseOnAfterEventSignal;
4930
+ /**
4931
+ * @beta
4932
+ * @remarks
4933
+ * This event fires when an item is successfully used by a
4934
+ * player.
4935
+ *
4936
+ */
4937
+ readonly itemUse: ItemUseAfterEventSignal;
4938
+ /**
4939
+ * @beta
4940
+ * @remarks
4941
+ * This event fires when an item is used on a block by a
4942
+ * player.
4943
+ *
4944
+ */
4945
+ readonly itemUseOn: ItemUseOnAfterEventSignal;
3937
4946
  readonly leverAction: LeverActionAfterEventSignal;
3938
4947
  /**
3939
4948
  * @remarks
@@ -3975,6 +4984,32 @@ export class WorldAfterEvents {
3975
4984
  readonly tripWireTrip: TripWireTripAfterEventSignal;
3976
4985
  }
3977
4986
 
4987
+ /**
4988
+ * @beta
4989
+ * A set of events that fire before an actual action occurs. In
4990
+ * most cases, you can potentially cancel or modify the
4991
+ * impending event. Note that in before events any APIs that
4992
+ * modify gameplay state will not function and will throw an
4993
+ * error. (e.g., dimension.spawnEntity)
4994
+ */
4995
+ export class WorldBeforeEvents {
4996
+ private constructor();
4997
+ /**
4998
+ * @remarks
4999
+ * This event fires when an item is successfully used by a
5000
+ * player.
5001
+ *
5002
+ */
5003
+ readonly itemUse: ItemUseBeforeEventSignal;
5004
+ /**
5005
+ * @remarks
5006
+ * This event fires when an item is used on a block by a
5007
+ * player.
5008
+ *
5009
+ */
5010
+ readonly itemUseOn: ItemUseOnBeforeEventSignal;
5011
+ }
5012
+
3978
5013
  /**
3979
5014
  * @beta
3980
5015
  * Contains information for block raycast hit results.
@@ -4029,6 +5064,38 @@ export interface BlockRaycastOptions {
4029
5064
  maxDistance?: number;
4030
5065
  }
4031
5066
 
5067
+ /**
5068
+ * @beta
5069
+ * An exact coordinate within the world, including its
5070
+ * dimension and location.
5071
+ */
5072
+ export interface DimensionLocation {
5073
+ /**
5074
+ * @remarks
5075
+ * The dimension.
5076
+ *
5077
+ */
5078
+ dimension: Dimension;
5079
+ /**
5080
+ * @remarks
5081
+ * The x coordinate.
5082
+ *
5083
+ */
5084
+ x: number;
5085
+ /**
5086
+ * @remarks
5087
+ * The y coordinate.
5088
+ *
5089
+ */
5090
+ y: number;
5091
+ /**
5092
+ * @remarks
5093
+ * The z coordinate.
5094
+ *
5095
+ */
5096
+ z: number;
5097
+ }
5098
+
4032
5099
  /**
4033
5100
  * @beta
4034
5101
  * Additional options for when damage has been applied via a
@@ -4467,6 +5534,26 @@ export interface RawMessageScore {
4467
5534
  objective?: string;
4468
5535
  }
4469
5536
 
5537
+ /**
5538
+ * @beta
5539
+ * Contains additional options for how a scoreboard should be
5540
+ * displayed within its display slot.
5541
+ */
5542
+ export interface ScoreboardObjectiveDisplayOptions {
5543
+ /**
5544
+ * @remarks
5545
+ * Objective to be displayed.
5546
+ *
5547
+ */
5548
+ objective: ScoreboardObjective;
5549
+ /**
5550
+ * @remarks
5551
+ * The sort order to display the objective items within.
5552
+ *
5553
+ */
5554
+ sortOrder?: ObjectiveSortOrder;
5555
+ }
5556
+
4470
5557
  /**
4471
5558
  * @beta
4472
5559
  * Contains additional options for registering a script event
@@ -4625,6 +5712,30 @@ export interface WorldSoundOptions {
4625
5712
  volume?: number;
4626
5713
  }
4627
5714
 
5715
+ /**
5716
+ * @beta
5717
+ */
5718
+ // @ts-ignore Class inheritance allowed for native defined classes
5719
+ export class CommandError extends Error {
5720
+ private constructor();
5721
+ }
5722
+
5723
+ /**
5724
+ * @beta
5725
+ */
5726
+ // @ts-ignore Class inheritance allowed for native defined classes
5727
+ export class LocationInUnloadedChunkError extends Error {
5728
+ private constructor();
5729
+ }
5730
+
5731
+ /**
5732
+ * @beta
5733
+ */
5734
+ // @ts-ignore Class inheritance allowed for native defined classes
5735
+ export class LocationOutOfWorldBoundariesError extends Error {
5736
+ private constructor();
5737
+ }
5738
+
4628
5739
  /**
4629
5740
  * @remarks
4630
5741
  * A class that provides system-level events and functions.