@minecraft/server 2.7.0-rc.1.26.20-preview.20 → 2.8.0-beta.1.26.20-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 (2) hide show
  1. package/index.d.ts +2866 -153
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  Copyright (c) Microsoft Corporation.
8
8
  ***************************************************************************** */
9
9
  /**
10
- * @preview
10
+ * @beta
11
11
  * @packageDocumentation
12
12
  * Contains many types related to manipulating a Minecraft
13
13
  * world, including entities, blocks, dimensions, and more.
@@ -16,7 +16,7 @@
16
16
  * ```json
17
17
  * {
18
18
  * "module_name": "@minecraft/server",
19
- * "version": "2.7.0"
19
+ * "version": "2.8.0-beta"
20
20
  * }
21
21
  * ```
22
22
  *
@@ -230,6 +230,55 @@ export enum CommandPermissionLevel {
230
230
  Owner = 4,
231
231
  }
232
232
 
233
+ /**
234
+ * @beta
235
+ * The Action enum determines how the CompoundBlockVolume
236
+ * considers the associated CompoundBlockVolumeItem when
237
+ * performing inside/outside calculations.
238
+ */
239
+ export enum CompoundBlockVolumeAction {
240
+ /**
241
+ * @remarks
242
+ * The associated BlockVolume is considered a positive space,
243
+ * and any intersection tests are considered hits
244
+ *
245
+ */
246
+ Add = 0,
247
+ /**
248
+ * @remarks
249
+ * The associated BlockVolume is considered a negative or void
250
+ * space, and any intersection tests are considered misses.
251
+ * Using the Subtract action, it is possible to `punch holes`
252
+ * in block volumes so that any intersection tests may pass
253
+ * through such spaces
254
+ *
255
+ */
256
+ Subtract = 1,
257
+ }
258
+
259
+ /**
260
+ * @beta
261
+ * An enum describing the relativity of the
262
+ * CompoundBlockVolumeItem, relative to the parent
263
+ * CompoundVolume.
264
+ */
265
+ export enum CompoundBlockVolumePositionRelativity {
266
+ /**
267
+ * @remarks
268
+ * The locations within the associated BlockVolume are relative
269
+ * to the CompoundBlockVolume to which they were added
270
+ *
271
+ */
272
+ Relative = 0,
273
+ /**
274
+ * @remarks
275
+ * The locations within the associated BlockVolume are in
276
+ * absolute world space
277
+ *
278
+ */
279
+ Absolute = 1,
280
+ }
281
+
233
282
  /**
234
283
  * Reasons that the {@link
235
284
  * @minecraft/server.ContainerRulesError} was thrown.
@@ -332,6 +381,13 @@ export enum CustomCommandErrorReason {
332
381
  *
333
382
  */
334
383
  RegistryReadOnly = 'RegistryReadOnly',
384
+ /**
385
+ * @beta
386
+ * @remarks
387
+ * Non enum type command parameters cannot use enumName.
388
+ *
389
+ */
390
+ UnexpectedEnumName = 'UnexpectedEnumName',
335
391
  }
336
392
 
337
393
  /**
@@ -782,6 +838,13 @@ export enum EntityComponentTypes {
782
838
  */
783
839
  Color2 = 'minecraft:color2',
784
840
  CursorInventory = 'minecraft:cursor_inventory',
841
+ /**
842
+ * @beta
843
+ * @remarks
844
+ * Represents this entity's ender inventory properties.
845
+ *
846
+ */
847
+ EnderInventory = 'minecraft:ender_inventory',
785
848
  /**
786
849
  * @remarks
787
850
  * Provides access to a mob's equipment slots. This component
@@ -1063,6 +1126,14 @@ export enum EntityComponentTypes {
1063
1126
  *
1064
1127
  */
1065
1128
  NavigationWalk = 'minecraft:navigation.walk',
1129
+ /**
1130
+ * @beta
1131
+ * @remarks
1132
+ * Adds NPC capabilities to an entity such as custom skin,
1133
+ * name, and dialogue interactions.
1134
+ *
1135
+ */
1136
+ Npc = 'minecraft:npc',
1066
1137
  /**
1067
1138
  * @remarks
1068
1139
  * When present on an entity, this entity is on fire.
@@ -1541,6 +1612,14 @@ export enum EntitySwingSource {
1541
1612
  * and mainhand slots.
1542
1613
  */
1543
1614
  export enum EquipmentSlot {
1615
+ /**
1616
+ * @beta
1617
+ * @remarks
1618
+ * The body slot. This slot is used to hold armor for
1619
+ * non-humanoid mobs.
1620
+ *
1621
+ */
1622
+ Body = 'Body',
1544
1623
  /**
1545
1624
  * @remarks
1546
1625
  * The chest slot. This slot is used to hold items such as
@@ -1783,6 +1862,10 @@ export enum GameRule {
1783
1862
  *
1784
1863
  */
1785
1864
  KeepInventory = 'keepInventory',
1865
+ /**
1866
+ * @beta
1867
+ */
1868
+ LocatorBar = 'locatorBar',
1786
1869
  /**
1787
1870
  * @remarks
1788
1871
  * The maximum number of chained commands that can execute per
@@ -2254,6 +2337,34 @@ export enum LiquidType {
2254
2337
  Water = 'Water',
2255
2338
  }
2256
2339
 
2340
+ /**
2341
+ * @beta
2342
+ * Enum representing the different reasons why a locator bar
2343
+ * operation may fail.
2344
+ */
2345
+ export enum LocatorBarErrorReason {
2346
+ /**
2347
+ * @remarks
2348
+ * The waypoint already exists in the locator bar and cannot be
2349
+ * added again.
2350
+ *
2351
+ */
2352
+ WaypointAlreadyExists = 'WaypointAlreadyExists',
2353
+ /**
2354
+ * @remarks
2355
+ * The maximum number of waypoints has been reached and no more
2356
+ * can be added.
2357
+ *
2358
+ */
2359
+ WaypointLimitExceeded = 'WaypointLimitExceeded',
2360
+ /**
2361
+ * @remarks
2362
+ * The specified waypoint does not exist in the locator bar.
2363
+ *
2364
+ */
2365
+ WaypointNotFound = 'WaypointNotFound',
2366
+ }
2367
+
2257
2368
  /**
2258
2369
  * Describes the memory of a device.
2259
2370
  */
@@ -2899,6 +3010,61 @@ export enum TintMethod {
2899
3010
  Water = 'Water',
2900
3011
  }
2901
3012
 
3013
+ /**
3014
+ * @beta
3015
+ * An enumeration with the reason that a watchdog is deciding
3016
+ * to terminate execution of a behavior packs' script.
3017
+ */
3018
+ export enum WatchdogTerminateReason {
3019
+ /**
3020
+ * @remarks
3021
+ * Script runtime for a behavior pack is terminated due to
3022
+ * non-responsiveness from script (a hang or infinite loop).
3023
+ *
3024
+ */
3025
+ Hang = 'Hang',
3026
+ /**
3027
+ * @remarks
3028
+ * Script runtime for a behavior pack is terminated due to a
3029
+ * stack overflow (a long, and potentially infinite) chain of
3030
+ * function calls.
3031
+ *
3032
+ */
3033
+ StackOverflow = 'StackOverflow',
3034
+ }
3035
+
3036
+ /**
3037
+ * @beta
3038
+ * Enum representing different texture icons that can be
3039
+ * displayed for waypoints on the locator bar.
3040
+ */
3041
+ export enum WaypointTexture {
3042
+ /**
3043
+ * @remarks
3044
+ * Circle waypoint icon texture.
3045
+ *
3046
+ */
3047
+ Circle = 'minecraft:circle',
3048
+ /**
3049
+ * @remarks
3050
+ * Small square waypoint icon texture.
3051
+ *
3052
+ */
3053
+ SmallSquare = 'minecraft:small_square',
3054
+ /**
3055
+ * @remarks
3056
+ * Small star waypoint icon texture.
3057
+ *
3058
+ */
3059
+ SmallStar = 'minecraft:small_star',
3060
+ /**
3061
+ * @remarks
3062
+ * Square waypoint icon texture.
3063
+ *
3064
+ */
3065
+ Square = 'minecraft:square',
3066
+ }
3067
+
2902
3068
  /**
2903
3069
  * Used to specify the type of weather condition within the
2904
3070
  * world.
@@ -2975,6 +3141,7 @@ export type EntityComponentTypeMap = {
2975
3141
  color: EntityColorComponent;
2976
3142
  color2: EntityColor2Component;
2977
3143
  cursor_inventory: PlayerCursorInventoryComponent;
3144
+ ender_inventory: EntityEnderInventoryComponent;
2978
3145
  equippable: EntityEquippableComponent;
2979
3146
  fire_immune: EntityFireImmuneComponent;
2980
3147
  floats_in_liquid: EntityFloatsInLiquidComponent;
@@ -3009,6 +3176,7 @@ export type EntityComponentTypeMap = {
3009
3176
  'minecraft:color': EntityColorComponent;
3010
3177
  'minecraft:color2': EntityColor2Component;
3011
3178
  'minecraft:cursor_inventory': PlayerCursorInventoryComponent;
3179
+ 'minecraft:ender_inventory': EntityEnderInventoryComponent;
3012
3180
  'minecraft:equippable': EntityEquippableComponent;
3013
3181
  'minecraft:fire_immune': EntityFireImmuneComponent;
3014
3182
  'minecraft:floats_in_liquid': EntityFloatsInLiquidComponent;
@@ -3050,6 +3218,7 @@ export type EntityComponentTypeMap = {
3050
3218
  'minecraft:navigation.generic': EntityNavigationGenericComponent;
3051
3219
  'minecraft:navigation.hover': EntityNavigationHoverComponent;
3052
3220
  'minecraft:navigation.walk': EntityNavigationWalkComponent;
3221
+ 'minecraft:npc': EntityNpcComponent;
3053
3222
  'minecraft:onfire': EntityOnFireComponent;
3054
3223
  'minecraft:player.exhaustion': EntityExhaustionComponent;
3055
3224
  'minecraft:player.hunger': EntityHungerComponent;
@@ -3083,6 +3252,7 @@ export type EntityComponentTypeMap = {
3083
3252
  'navigation.generic': EntityNavigationGenericComponent;
3084
3253
  'navigation.hover': EntityNavigationHoverComponent;
3085
3254
  'navigation.walk': EntityNavigationWalkComponent;
3255
+ npc: EntityNpcComponent;
3086
3256
  onfire: EntityOnFireComponent;
3087
3257
  'player.exhaustion': EntityExhaustionComponent;
3088
3258
  'player.hunger': EntityHungerComponent;
@@ -3102,6 +3272,15 @@ export type EntityComponentTypeMap = {
3102
3272
  wants_jockey: EntityWantsJockeyComponent;
3103
3273
  };
3104
3274
 
3275
+ /**
3276
+ * @beta
3277
+ */
3278
+ export type EntityIdentifierType<T> = [T] extends [never]
3279
+ ? VanillaEntityIdentifier
3280
+ : T extends string
3281
+ ? VanillaEntityIdentifier | T
3282
+ : never;
3283
+
3105
3284
  export type ItemComponentReturnType<T extends string> = T extends keyof ItemComponentTypeMap
3106
3285
  ? ItemComponentTypeMap[T]
3107
3286
  : ItemCustomComponentInstance;
@@ -3127,6 +3306,15 @@ export type ItemComponentTypeMap = {
3127
3306
  potion: ItemPotionComponent;
3128
3307
  };
3129
3308
 
3309
+ /**
3310
+ * @beta
3311
+ */
3312
+ export type VanillaEntityIdentifier =
3313
+ | EntityType
3314
+ | minecraftvanilladata.MinecraftEntityTypes
3315
+ | `${minecraftvanilladata.MinecraftEntityTypes}`
3316
+ | `${minecraftvanilladata.MinecraftEntityTypes}<${string}>`;
3317
+
3130
3318
  /**
3131
3319
  * @rc
3132
3320
  * Handle to an aim-assist category that exists in the
@@ -3286,7 +3474,9 @@ export class AimAssistCategorySettings {
3286
3474
  * A record mapping block Ids to their priority settings.
3287
3475
  * Larger numbers have greater priority.
3288
3476
  */
3289
- setBlockPriorities(blockPriorities: Record<string, number>): void;
3477
+ setBlockPriorities(
3478
+ blockPriorities: Record<keyof typeof minecraftvanilladata.MinecraftBlockTypes | string, number>,
3479
+ ): void;
3290
3480
  /**
3291
3481
  * @remarks
3292
3482
  * Sets the priority settings used for block targeting.
@@ -3305,7 +3495,9 @@ export class AimAssistCategorySettings {
3305
3495
  * A record mapping entity Ids to their priority settings.
3306
3496
  * Larger numbers have greater priority.
3307
3497
  */
3308
- setEntityPriorities(entityPriorities: Record<string, number>): void;
3498
+ setEntityPriorities(
3499
+ entityPriorities: Record<keyof typeof minecraftvanilladata.MinecraftEntityTypes | string, number>,
3500
+ ): void;
3309
3501
  /**
3310
3502
  * @remarks
3311
3503
  * Sets the priority settings used for entity targeting.
@@ -3506,8 +3698,10 @@ export class AimAssistPresetSettings {
3506
3698
  *
3507
3699
  * This function can't be called in restricted-execution mode.
3508
3700
  *
3701
+ * @param targets
3702
+ * An array of block tags.
3509
3703
  */
3510
- setExcludedBlockTagTargets(blockTagTargets?: string[]): void;
3704
+ setExcludedBlockTagTargets(targets?: string[]): void;
3511
3705
  /**
3512
3706
  * @remarks
3513
3707
  * Sets the list of block Ids to exclude from aim assist
@@ -3515,8 +3709,10 @@ export class AimAssistPresetSettings {
3515
3709
  *
3516
3710
  * This function can't be called in restricted-execution mode.
3517
3711
  *
3712
+ * @param targets
3713
+ * An array of block Ids.
3518
3714
  */
3519
- setExcludedBlockTargets(blockTargets?: string[]): void;
3715
+ setExcludedBlockTargets(targets?: (keyof typeof minecraftvanilladata.MinecraftBlockTypes | string)[]): void;
3520
3716
  /**
3521
3717
  * @remarks
3522
3718
  * Sets the list of entity Ids to exclude from aim assist
@@ -3524,8 +3720,10 @@ export class AimAssistPresetSettings {
3524
3720
  *
3525
3721
  * This function can't be called in restricted-execution mode.
3526
3722
  *
3723
+ * @param targets
3724
+ * An array of entity Ids.
3527
3725
  */
3528
- setExcludedEntityTargets(entityTargets?: string[]): void;
3726
+ setExcludedEntityTargets(targets?: (keyof typeof minecraftvanilladata.MinecraftEntityTypes | string)[]): void;
3529
3727
  /**
3530
3728
  * @remarks
3531
3729
  * Sets the list of entity type families to exclude from aim
@@ -3533,8 +3731,10 @@ export class AimAssistPresetSettings {
3533
3731
  *
3534
3732
  * This function can't be called in restricted-execution mode.
3535
3733
  *
3734
+ * @param targets
3735
+ * An array of entity type families.
3536
3736
  */
3537
- setExcludedEntityTypeFamilyTargets(entityTypeFamilyTargets?: string[]): void;
3737
+ setExcludedEntityTypeFamilyTargets(targets?: string[]): void;
3538
3738
  /**
3539
3739
  * @remarks
3540
3740
  * Sets the per-item aim-assist category Ids.
@@ -3545,7 +3745,7 @@ export class AimAssistPresetSettings {
3545
3745
  * A record mapping item Ids to aim-assist category Ids.
3546
3746
  * Category Ids must have a namespace.
3547
3747
  */
3548
- setItemSettings(itemSettings: Record<string, string>): void;
3748
+ setItemSettings(itemSettings: Record<keyof typeof minecraftvanilladata.MinecraftItemTypes | string, string>): void;
3549
3749
  /**
3550
3750
  * @remarks
3551
3751
  * Sets the list of item Ids that will target liquid blocks
@@ -3556,7 +3756,7 @@ export class AimAssistPresetSettings {
3556
3756
  * @param items
3557
3757
  * An array of item Ids.
3558
3758
  */
3559
- setLiquidTargetingItems(items?: string[]): void;
3759
+ setLiquidTargetingItems(items?: (keyof typeof minecraftvanilladata.MinecraftItemTypes | string)[]): void;
3560
3760
  }
3561
3761
 
3562
3762
  /**
@@ -3663,6 +3863,28 @@ export class AimAssistRegistry {
3663
3863
  getPresets(): AimAssistPreset[];
3664
3864
  }
3665
3865
 
3866
+ /**
3867
+ * @beta
3868
+ * Describes a single banner pattern, which includes a colour
3869
+ * and a pattern type.
3870
+ */
3871
+ export class BannerPattern {
3872
+ private constructor();
3873
+ /**
3874
+ * @remarks
3875
+ * The color to apply to this banner pattern.
3876
+ *
3877
+ */
3878
+ readonly color: string;
3879
+ /**
3880
+ * @remarks
3881
+ * The pattern type (e.g. gradient, chevron, cross, etc.) to
3882
+ * apply to the banner.
3883
+ *
3884
+ */
3885
+ readonly pattern: string;
3886
+ }
3887
+
3666
3888
  /**
3667
3889
  * Describes a type of biome.
3668
3890
  */
@@ -3674,6 +3896,49 @@ export class BiomeType {
3674
3896
  *
3675
3897
  */
3676
3898
  readonly id: string;
3899
+ /**
3900
+ * @beta
3901
+ * @remarks
3902
+ * Returns a list of the biome's tags.
3903
+ *
3904
+ */
3905
+ getTags(): string[];
3906
+ /**
3907
+ * @beta
3908
+ * @remarks
3909
+ * Checks if the biome has all of the provided tags.
3910
+ *
3911
+ * @param tags
3912
+ * The list of tags to check against the biome.
3913
+ */
3914
+ hasTags(tags: string[]): boolean;
3915
+ }
3916
+
3917
+ /**
3918
+ * @beta
3919
+ * Supports a catalog of available biome types registered
3920
+ * within Minecraft.
3921
+ */
3922
+ export class BiomeTypes {
3923
+ private constructor();
3924
+ /**
3925
+ * @remarks
3926
+ * Returns a specific biome type.
3927
+ *
3928
+ * @param typeName
3929
+ * Identifier of the biome. Generally, namespaced identifiers
3930
+ * (e.g., minecraft:frozen_peaks) should be used.
3931
+ * @returns
3932
+ * If the biome exists, a BiomeType object is returned. If not,
3933
+ * undefined is returned.
3934
+ */
3935
+ static get(typeName: string): BiomeType | undefined;
3936
+ /**
3937
+ * @remarks
3938
+ * Returns all registered biome types within Minecraft
3939
+ *
3940
+ */
3941
+ static getAll(): BiomeType[];
3677
3942
  }
3678
3943
 
3679
3944
  /**
@@ -3716,6 +3981,20 @@ export class Block {
3716
3981
  * {@link LocationOutOfWorldBoundariesError}
3717
3982
  */
3718
3983
  readonly isLiquid: boolean;
3984
+ /**
3985
+ * @beta
3986
+ * @remarks
3987
+ * Returns true if this block is solid and impassible - (e.g.,
3988
+ * a cobblestone block and a diamond block are solid, while a
3989
+ * ladder block and a fence block are not).
3990
+ *
3991
+ * @throws This property can throw when used.
3992
+ *
3993
+ * {@link LocationInUnloadedChunkError}
3994
+ *
3995
+ * {@link LocationOutOfWorldBoundariesError}
3996
+ */
3997
+ readonly isSolid: boolean;
3719
3998
  /**
3720
3999
  * @remarks
3721
4000
  * Returns true if this reference to a block is still valid
@@ -3881,6 +4160,30 @@ export class Block {
3881
4160
  * {@link LocationOutOfWorldBoundariesError}
3882
4161
  */
3883
4162
  canContainLiquid(liquidType: LiquidType): boolean;
4163
+ /**
4164
+ * @beta
4165
+ * @remarks
4166
+ * Checks to see whether it is valid to place the specified
4167
+ * block type or block permutation, on a specified face on this
4168
+ * block.
4169
+ *
4170
+ * @param blockToPlace
4171
+ * Block type or block permutation to check placement for.
4172
+ * @param faceToPlaceOn
4173
+ * Optional specific face of this block to check placement
4174
+ * against.
4175
+ * @returns
4176
+ * Returns `true` if the block type or permutation can be
4177
+ * placed on this block, else `false`.
4178
+ * @throws This function can throw errors.
4179
+ *
4180
+ * {@link Error}
4181
+ *
4182
+ * {@link LocationInUnloadedChunkError}
4183
+ *
4184
+ * {@link LocationOutOfWorldBoundariesError}
4185
+ */
4186
+ canPlace(blockToPlace: BlockPermutation | BlockType | string, faceToPlaceOn?: Direction): boolean;
3884
4187
  /**
3885
4188
  * @remarks
3886
4189
  * Returns the {@link Vector3} of the center of this block on
@@ -3978,6 +4281,29 @@ export class Block {
3978
4281
  * {@link LocationInUnloadedChunkError}
3979
4282
  */
3980
4283
  getLightLevel(): number;
4284
+ /**
4285
+ * @beta
4286
+ * @throws This function can throw errors.
4287
+ *
4288
+ * {@link LocationInUnloadedChunkError}
4289
+ *
4290
+ * {@link LocationOutOfWorldBoundariesError}
4291
+ */
4292
+ getMapColor(): RGBA;
4293
+ /**
4294
+ * @beta
4295
+ * @remarks
4296
+ * Returns array of all loaded block parts if this block has
4297
+ * the 'minecraft:multi_block' trait. If it does not have the
4298
+ * trait returns undefined
4299
+ *
4300
+ * @throws This function can throw errors.
4301
+ *
4302
+ * {@link LocationInUnloadedChunkError}
4303
+ *
4304
+ * {@link LocationOutOfWorldBoundariesError}
4305
+ */
4306
+ getParts(): Block[] | undefined;
3981
4307
  /**
3982
4308
  * @remarks
3983
4309
  * Returns the net redstone power of this block.
@@ -4246,6 +4572,27 @@ export class Block {
4246
4572
  * {@link LocationOutOfWorldBoundariesError}
4247
4573
  */
4248
4574
  south(steps?: number): Block | undefined;
4575
+ /**
4576
+ * @beta
4577
+ * @remarks
4578
+ * Tries to set the block in the dimension to the state of the
4579
+ * permutation by first checking if the placement is valid.
4580
+ *
4581
+ * This function can't be called in restricted-execution mode.
4582
+ *
4583
+ * @param permutation
4584
+ * Permutation that contains a set of property states for the
4585
+ * Block.
4586
+ * @returns
4587
+ * Returns `true` if the block permutation data was
4588
+ * successfully set, else `false`.
4589
+ * @throws This function can throw errors.
4590
+ *
4591
+ * {@link LocationInUnloadedChunkError}
4592
+ *
4593
+ * {@link LocationOutOfWorldBoundariesError}
4594
+ */
4595
+ trySetPermutation(permutation: BlockPermutation): boolean;
4249
4596
  /**
4250
4597
  * @remarks
4251
4598
  * Returns the {@link Block} to the west of this block
@@ -4264,88 +4611,219 @@ export class Block {
4264
4611
  }
4265
4612
 
4266
4613
  /**
4267
- * Base type for components associated with blocks.
4614
+ * @beta
4615
+ * Bounding Box Utils is a utility class that provides a number
4616
+ * of useful functions for the creation and utility of {@link
4617
+ * BlockBoundingBox} objects
4268
4618
  */
4269
- // @ts-ignore Class inheritance allowed for native defined classes
4270
- export class BlockComponent extends Component {
4619
+ export class BlockBoundingBoxUtils {
4271
4620
  private constructor();
4272
4621
  /**
4273
4622
  * @remarks
4274
- * Block instance that this component pertains to.
4623
+ * Create a validated instance of a {@link BlockBoundingBox}
4624
+ * where the min and max components are guaranteed to be (min
4625
+ * <= max)
4626
+ *
4627
+ * This function can't be called in restricted-execution mode.
4275
4628
  *
4629
+ * @param min
4630
+ * A corner world location
4631
+ * @param max
4632
+ * A corner world location diametrically opposite
4276
4633
  */
4277
- readonly block: Block;
4278
- }
4279
-
4280
- /**
4281
- * Contains information regarding a specific block being
4282
- * broken.
4283
- */
4284
- // @ts-ignore Class inheritance allowed for native defined classes
4285
- export class BlockComponentBlockBreakEvent extends BlockEvent {
4286
- private constructor();
4634
+ static createValid(min: Vector3, max: Vector3): BlockBoundingBox;
4287
4635
  /**
4288
4636
  * @remarks
4289
- * The block that caused destruction.
4637
+ * Expand a {@link BlockBoundingBox} by a given amount along
4638
+ * each axis.
4639
+ * Sizes can be negative to perform contraction.
4640
+ * Note: corners can be inverted if the contraction size is
4641
+ * greater than the span, but the min/max relationship will
4642
+ * remain correct
4643
+ *
4644
+ * This function can't be called in restricted-execution mode.
4290
4645
  *
4646
+ * @returns
4647
+ * Return a new {@link BlockBoundingBox} object representing
4648
+ * the changes
4291
4649
  */
4292
- readonly blockDestructionSource?: Block;
4650
+ static dilate(box: BlockBoundingBox, size: Vector3): BlockBoundingBox;
4293
4651
  /**
4294
4652
  * @remarks
4295
- * Returns permutation information about this block before it
4296
- * was broken.
4653
+ * Check if two {@link BlockBoundingBox} objects are identical
4654
+ *
4655
+ * This function can't be called in restricted-execution mode.
4297
4656
  *
4298
4657
  */
4299
- readonly brokenBlockPermutation: BlockPermutation;
4658
+ static equals(box: BlockBoundingBox, other: BlockBoundingBox): boolean;
4300
4659
  /**
4301
4660
  * @remarks
4302
- * The Actor that caused destruction.
4661
+ * Expand the initial box object bounds to include the 2nd box
4662
+ * argument. The resultant {@link BlockBoundingBox} object
4663
+ * will be a BlockBoundingBox which exactly encompasses the two
4664
+ * boxes.
4665
+ *
4666
+ * This function can't be called in restricted-execution mode.
4303
4667
  *
4668
+ * @returns
4669
+ * A new {@link BlockBoundingBox} instance representing the
4670
+ * smallest possible bounding box which can encompass both
4304
4671
  */
4305
- readonly entitySource?: Entity;
4306
- }
4307
-
4308
- /**
4309
- * @rc
4310
- * Contains information regarding an event sent by an entity to
4311
- * this block in the world.
4312
- */
4313
- // @ts-ignore Class inheritance allowed for native defined classes
4314
- export class BlockComponentEntityEvent extends BlockEvent {
4315
- private constructor();
4672
+ static expand(box: BlockBoundingBox, other: BlockBoundingBox): BlockBoundingBox;
4316
4673
  /**
4317
4674
  * @remarks
4318
- * Returns permutation information about the block receiving
4319
- * the event.
4675
+ * Calculate the center block of a given {@link
4676
+ * BlockBoundingBox} object.
4677
+ *
4678
+ * This function can't be called in restricted-execution mode.
4320
4679
  *
4680
+ * @returns
4681
+ * Note that {@link BlockBoundingBox} objects represent whole
4682
+ * blocks, so the center of boxes which have odd numbered
4683
+ * bounds are not mathematically centered...
4684
+ * i.e. a BlockBoundingBox( 0,0,0 -> 3,3,3 ) would have a
4685
+ * center of (1,1,1) (not (1.5, 1.5, 1.5) as expected)
4321
4686
  */
4322
- readonly blockPermutation: BlockPermutation;
4687
+ static getCenter(box: BlockBoundingBox): Vector3;
4323
4688
  /**
4324
4689
  * @remarks
4325
- * The entity that sent the event.
4690
+ * Calculate the BlockBoundingBox which represents the union
4691
+ * area of two intersecting BlockBoundingBoxes
4692
+ *
4693
+ * This function can't be called in restricted-execution mode.
4326
4694
  *
4327
4695
  */
4328
- readonly entitySource: Entity;
4696
+ static getIntersection(box: BlockBoundingBox, other: BlockBoundingBox): BlockBoundingBox | undefined;
4329
4697
  /**
4330
4698
  * @remarks
4331
- * Name of the event fired by the entity.
4699
+ * Get the Span of each of the BlockBoundingBox Axis components
4700
+ *
4701
+ * This function can't be called in restricted-execution mode.
4332
4702
  *
4333
4703
  */
4334
- readonly name: string;
4335
- }
4336
-
4337
- /**
4338
- * Contains information regarding an entity falling onto a
4339
- * specific block.
4340
- */
4341
- // @ts-ignore Class inheritance allowed for native defined classes
4342
- export class BlockComponentEntityFallOnEvent extends BlockEvent {
4343
- private constructor();
4704
+ static getSpan(box: BlockBoundingBox): Vector3;
4344
4705
  /**
4345
4706
  * @remarks
4346
- * The entity that fell onto the block.
4707
+ * Check to see if two BlockBoundingBox objects intersect
4347
4708
  *
4348
- */
4709
+ * This function can't be called in restricted-execution mode.
4710
+ *
4711
+ */
4712
+ static intersects(box: BlockBoundingBox, other: BlockBoundingBox): boolean;
4713
+ /**
4714
+ * @remarks
4715
+ * Check to see if a given coordinate is inside a
4716
+ * BlockBoundingBox
4717
+ *
4718
+ * This function can't be called in restricted-execution mode.
4719
+ *
4720
+ */
4721
+ static isInside(box: BlockBoundingBox, pos: Vector3): boolean;
4722
+ /**
4723
+ * @remarks
4724
+ * Check to see if a BlockBoundingBox is valid (i.e. (min <=
4725
+ * max))
4726
+ *
4727
+ * This function can't be called in restricted-execution mode.
4728
+ *
4729
+ */
4730
+ static isValid(box: BlockBoundingBox): boolean;
4731
+ /**
4732
+ * @remarks
4733
+ * Move a BlockBoundingBox by a given amount
4734
+ *
4735
+ * This function can't be called in restricted-execution mode.
4736
+ *
4737
+ * @returns
4738
+ * Return a new BlockBoundingBox object which represents the
4739
+ * change
4740
+ */
4741
+ static translate(box: BlockBoundingBox, delta: Vector3): BlockBoundingBox;
4742
+ }
4743
+
4744
+ /**
4745
+ * Base type for components associated with blocks.
4746
+ */
4747
+ // @ts-ignore Class inheritance allowed for native defined classes
4748
+ export class BlockComponent extends Component {
4749
+ private constructor();
4750
+ /**
4751
+ * @remarks
4752
+ * Block instance that this component pertains to.
4753
+ *
4754
+ */
4755
+ readonly block: Block;
4756
+ }
4757
+
4758
+ /**
4759
+ * Contains information regarding a specific block being
4760
+ * broken.
4761
+ */
4762
+ // @ts-ignore Class inheritance allowed for native defined classes
4763
+ export class BlockComponentBlockBreakEvent extends BlockEvent {
4764
+ private constructor();
4765
+ /**
4766
+ * @remarks
4767
+ * The block that caused destruction.
4768
+ *
4769
+ */
4770
+ readonly blockDestructionSource?: Block;
4771
+ /**
4772
+ * @remarks
4773
+ * Returns permutation information about this block before it
4774
+ * was broken.
4775
+ *
4776
+ */
4777
+ readonly brokenBlockPermutation: BlockPermutation;
4778
+ /**
4779
+ * @remarks
4780
+ * The Actor that caused destruction.
4781
+ *
4782
+ */
4783
+ readonly entitySource?: Entity;
4784
+ }
4785
+
4786
+ /**
4787
+ * @rc
4788
+ * Contains information regarding an event sent by an entity to
4789
+ * this block in the world.
4790
+ */
4791
+ // @ts-ignore Class inheritance allowed for native defined classes
4792
+ export class BlockComponentEntityEvent extends BlockEvent {
4793
+ private constructor();
4794
+ /**
4795
+ * @remarks
4796
+ * Returns permutation information about the block receiving
4797
+ * the event.
4798
+ *
4799
+ */
4800
+ readonly blockPermutation: BlockPermutation;
4801
+ /**
4802
+ * @remarks
4803
+ * The entity that sent the event.
4804
+ *
4805
+ */
4806
+ readonly entitySource: Entity;
4807
+ /**
4808
+ * @remarks
4809
+ * Name of the event fired by the entity.
4810
+ *
4811
+ */
4812
+ readonly name: string;
4813
+ }
4814
+
4815
+ /**
4816
+ * Contains information regarding an entity falling onto a
4817
+ * specific block.
4818
+ */
4819
+ // @ts-ignore Class inheritance allowed for native defined classes
4820
+ export class BlockComponentEntityFallOnEvent extends BlockEvent {
4821
+ private constructor();
4822
+ /**
4823
+ * @remarks
4824
+ * The entity that fell onto the block.
4825
+ *
4826
+ */
4349
4827
  readonly entity?: Entity;
4350
4828
  /**
4351
4829
  * @remarks
@@ -4554,6 +5032,110 @@ export class BlockComponentTickEvent extends BlockEvent {
4554
5032
  private constructor();
4555
5033
  }
4556
5034
 
5035
+ /**
5036
+ * @beta
5037
+ * Contains information regarding a specific container block
5038
+ * being closed.
5039
+ */
5040
+ // @ts-ignore Class inheritance allowed for native defined classes
5041
+ export class BlockContainerClosedAfterEvent extends BlockEvent {
5042
+ private constructor();
5043
+ /**
5044
+ * @remarks
5045
+ * The source of the block container being closed.
5046
+ *
5047
+ * This property can't be edited in restricted-execution mode.
5048
+ *
5049
+ */
5050
+ closeSource: ContainerAccessSource;
5051
+ }
5052
+
5053
+ /**
5054
+ * @beta
5055
+ * Manages callbacks that are connected to when a block
5056
+ * container is closed.
5057
+ */
5058
+ export class BlockContainerClosedAfterEventSignal {
5059
+ private constructor();
5060
+ /**
5061
+ * @remarks
5062
+ * Adds a callback that will be called when a block container
5063
+ * is closed.
5064
+ *
5065
+ * This function can't be called in restricted-execution mode.
5066
+ *
5067
+ * This function can be called in early-execution mode.
5068
+ *
5069
+ */
5070
+ subscribe(
5071
+ callback: (arg0: BlockContainerClosedAfterEvent) => void,
5072
+ options?: BlockContainerAccessEventOptions,
5073
+ ): (arg0: BlockContainerClosedAfterEvent) => void;
5074
+ /**
5075
+ * @remarks
5076
+ * Removes a callback from being called when a block container
5077
+ * is closed.
5078
+ *
5079
+ * This function can't be called in restricted-execution mode.
5080
+ *
5081
+ * This function can be called in early-execution mode.
5082
+ *
5083
+ */
5084
+ unsubscribe(callback: (arg0: BlockContainerClosedAfterEvent) => void): void;
5085
+ }
5086
+
5087
+ /**
5088
+ * @beta
5089
+ * Contains information regarding a specific container block
5090
+ * being opened.
5091
+ */
5092
+ // @ts-ignore Class inheritance allowed for native defined classes
5093
+ export class BlockContainerOpenedAfterEvent extends BlockEvent {
5094
+ private constructor();
5095
+ /**
5096
+ * @remarks
5097
+ * The source of the block container being opened.
5098
+ *
5099
+ * This property can't be edited in restricted-execution mode.
5100
+ *
5101
+ */
5102
+ openSource: ContainerAccessSource;
5103
+ }
5104
+
5105
+ /**
5106
+ * @beta
5107
+ * Manages callbacks that are connected to when a block
5108
+ * container is opened.
5109
+ */
5110
+ export class BlockContainerOpenedAfterEventSignal {
5111
+ private constructor();
5112
+ /**
5113
+ * @remarks
5114
+ * Adds a callback that will be called when a block container
5115
+ * is opened.
5116
+ *
5117
+ * This function can't be called in restricted-execution mode.
5118
+ *
5119
+ * This function can be called in early-execution mode.
5120
+ *
5121
+ */
5122
+ subscribe(
5123
+ callback: (arg0: BlockContainerOpenedAfterEvent) => void,
5124
+ options?: BlockContainerAccessEventOptions,
5125
+ ): (arg0: BlockContainerOpenedAfterEvent) => void;
5126
+ /**
5127
+ * @remarks
5128
+ * Removes a callback from being called when a block container
5129
+ * is opened.
5130
+ *
5131
+ * This function can't be called in restricted-execution mode.
5132
+ *
5133
+ * This function can be called in early-execution mode.
5134
+ *
5135
+ */
5136
+ unsubscribe(callback: (arg0: BlockContainerOpenedAfterEvent) => void): void;
5137
+ }
5138
+
4557
5139
  /**
4558
5140
  * An instance of a custom component on a block.
4559
5141
  */
@@ -4772,6 +5354,18 @@ export class BlockLocationIterator implements Iterable<Vector3> {
4772
5354
  *
4773
5355
  */
4774
5356
  [Symbol.iterator](): Iterator<Vector3>;
5357
+ /**
5358
+ * @beta
5359
+ * @remarks
5360
+ * Checks if the underlining block volume has been invalidated.
5361
+ * Will return false if the block volume was modified between
5362
+ * creating the iterator and iterating it, and true otherwise.
5363
+ *
5364
+ * @throws This function can throw errors.
5365
+ *
5366
+ * {@link minecraftcommon.EngineError}
5367
+ */
5368
+ isValid(): boolean;
4775
5369
  /**
4776
5370
  * @remarks
4777
5371
  * This function can't be called in restricted-execution mode.
@@ -5669,6 +6263,15 @@ export class BlockVolumeBase {
5669
6263
  *
5670
6264
  */
5671
6265
  getBlockLocationIterator(): BlockLocationIterator;
6266
+ /**
6267
+ * @beta
6268
+ * @remarks
6269
+ * Return a {@link BlockBoundingBox} object which represents
6270
+ * the validated min and max coordinates of the volume
6271
+ *
6272
+ * @throws This function can throw errors.
6273
+ */
6274
+ getBoundingBox(): BlockBoundingBox;
5672
6275
  /**
5673
6276
  * @remarks
5674
6277
  * Return the capacity (volume) of the BlockVolume (W*D*H)
@@ -5901,6 +6504,23 @@ export class Camera {
5901
6504
  | CameraSetRotOptions
5902
6505
  | CameraTargetOptions,
5903
6506
  ): void;
6507
+ /**
6508
+ * @beta
6509
+ * @remarks
6510
+ * Sets the current active camera with easing.
6511
+ *
6512
+ * This function can't be called in restricted-execution mode.
6513
+ *
6514
+ * @param cameraPreset
6515
+ * Identifier of a camera preset file defined within JSON.
6516
+ * @param easeOptions
6517
+ * Options to ease the camera from the previous camera to the
6518
+ * current one.
6519
+ * @throws
6520
+ * Throws when easing to minecraft:first_person presets
6521
+ * currently without the experimental cameras toggle enabled.
6522
+ */
6523
+ setCameraWithEase(cameraPreset: string, easeOptions: EaseOptions): void;
5904
6524
  /**
5905
6525
  * @remarks
5906
6526
  * Sets the current active camera for the specified player and
@@ -5942,74 +6562,484 @@ export class CatmullRomSpline {
5942
6562
  }
5943
6563
 
5944
6564
  /**
5945
- * Contains the device information for a client instance.
6565
+ * @beta
6566
+ * An event that fires as players enter chat messages.
5946
6567
  */
5947
- // @ts-ignore Class inheritance allowed for native defined classes
5948
- export class ClientSystemInfo extends SystemInfo {
6568
+ export class ChatSendAfterEvent {
5949
6569
  private constructor();
5950
6570
  /**
5951
6571
  * @remarks
5952
- * The max render distance for the device in chunks.
6572
+ * Message that is being broadcast.
5953
6573
  *
5954
6574
  */
5955
- readonly maxRenderDistance: number;
6575
+ readonly message: string;
5956
6576
  /**
5957
6577
  * @remarks
5958
- * The platform type of the device.
6578
+ * Player that sent the chat message.
5959
6579
  *
5960
6580
  */
5961
- readonly platformType: PlatformType;
6581
+ readonly sender: Player;
6582
+ /**
6583
+ * @remarks
6584
+ * Optional list of players that will receive this message. If
6585
+ * defined, this message is directly targeted to one or more
6586
+ * players (i.e., is not broadcast.)
6587
+ *
6588
+ */
6589
+ readonly targets?: Player[];
5962
6590
  }
5963
6591
 
5964
6592
  /**
5965
- * Contains return data on the result of a command execution.
6593
+ * @beta
6594
+ * Manages callbacks that are connected to chat messages being
6595
+ * sent.
5966
6596
  */
5967
- export class CommandResult {
6597
+ export class ChatSendAfterEventSignal {
5968
6598
  private constructor();
5969
6599
  /**
5970
6600
  * @remarks
5971
- * If the command operates against a number of entities,
5972
- * blocks, or items, this returns the number of successful
5973
- * applications of this command.
6601
+ * Adds a callback that will be called when new chat messages
6602
+ * are sent.
6603
+ *
6604
+ * This function can't be called in restricted-execution mode.
6605
+ *
6606
+ * This function can be called in early-execution mode.
5974
6607
  *
5975
6608
  */
5976
- readonly successCount: number;
6609
+ subscribe(callback: (arg0: ChatSendAfterEvent) => void): (arg0: ChatSendAfterEvent) => void;
6610
+ /**
6611
+ * @remarks
6612
+ * Removes a callback from being called when new chat messages
6613
+ * are sent.
6614
+ *
6615
+ * This function can't be called in restricted-execution mode.
6616
+ *
6617
+ * This function can be called in early-execution mode.
6618
+ *
6619
+ */
6620
+ unsubscribe(callback: (arg0: ChatSendAfterEvent) => void): void;
5977
6621
  }
5978
6622
 
5979
6623
  /**
5980
- * Base class for downstream Component implementations.
6624
+ * @beta
6625
+ * An event that fires as players enter chat messages.
5981
6626
  */
5982
- export class Component {
6627
+ export class ChatSendBeforeEvent {
5983
6628
  private constructor();
5984
6629
  /**
5985
6630
  * @remarks
5986
- * Returns whether the component is valid. A component is
5987
- * considered valid if its owner is valid, in addition to any
5988
- * addition to any additional validation required by the
5989
- * component.
6631
+ * If set to true in a beforeChat event handler, this message
6632
+ * is not broadcast out.
5990
6633
  *
5991
6634
  */
5992
- readonly isValid: boolean;
6635
+ cancel: boolean;
5993
6636
  /**
5994
6637
  * @remarks
5995
- * Identifier of the component.
6638
+ * Message that is being broadcast.
5996
6639
  *
5997
6640
  */
5998
- readonly typeId: string;
6641
+ readonly message: string;
6642
+ /**
6643
+ * @remarks
6644
+ * Player that sent the chat message.
6645
+ *
6646
+ */
6647
+ readonly sender: Player;
6648
+ /**
6649
+ * @remarks
6650
+ * Optional list of players that will receive this message. If
6651
+ * defined, this message is directly targeted to one or more
6652
+ * players (i.e., is not broadcast.)
6653
+ *
6654
+ */
6655
+ readonly targets?: Player[];
5999
6656
  }
6000
6657
 
6001
6658
  /**
6002
- * Represents a container that can hold sets of items. Used
6003
- * with entities such as Players, Chest Minecarts, Llamas, and
6004
- * more.
6005
- * @example containers.ts
6659
+ * @beta
6660
+ * Manages callbacks that are connected to an event that fires
6661
+ * before chat messages are sent.
6662
+ * @example customCommand.ts
6006
6663
  * ```typescript
6007
- * import { ItemStack, EntityInventoryComponent, BlockInventoryComponent, DimensionLocation } from "@minecraft/server";
6008
- * import { MinecraftBlockTypes, MinecraftItemTypes, MinecraftEntityTypes } from "@minecraft/vanilla-data";
6664
+ * import { world, DimensionLocation } from "@minecraft/server";
6009
6665
  *
6010
- * function containers(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
6011
- * const xLocation = targetLocation; // left chest location
6012
- * const xPlusTwoLocation = { x: targetLocation.x + 2, y: targetLocation.y, z: targetLocation.z }; // right chest
6666
+ * function customCommand(targetLocation: DimensionLocation) {
6667
+ * const chatCallback = world.beforeEvents.chatSend.subscribe((eventData) => {
6668
+ * if (eventData.message.includes("cancel")) {
6669
+ * // Cancel event if the message contains "cancel"
6670
+ * eventData.cancel = true;
6671
+ * } else {
6672
+ * const args = eventData.message.split(" ");
6673
+ *
6674
+ * if (args.length > 0) {
6675
+ * switch (args[0].toLowerCase()) {
6676
+ * case "echo":
6677
+ * // Send a modified version of chat message
6678
+ * world.sendMessage(`Echo '${eventData.message.substring(4).trim()}'`);
6679
+ * break;
6680
+ * case "help":
6681
+ * world.sendMessage(`Available commands: echo <message>`);
6682
+ * break;
6683
+ * }
6684
+ * }
6685
+ * }
6686
+ * });
6687
+ * }
6688
+ * ```
6689
+ */
6690
+ export class ChatSendBeforeEventSignal {
6691
+ private constructor();
6692
+ /**
6693
+ * @remarks
6694
+ * Adds a callback that will be called before new chat messages
6695
+ * are sent.
6696
+ *
6697
+ * This function can't be called in restricted-execution mode.
6698
+ *
6699
+ * This function can be called in early-execution mode.
6700
+ *
6701
+ * @param callback
6702
+ * This closure is called with restricted-execution privilege.
6703
+ * @returns
6704
+ * Closure that is called with restricted-execution privilege.
6705
+ */
6706
+ subscribe(callback: (arg0: ChatSendBeforeEvent) => void): (arg0: ChatSendBeforeEvent) => void;
6707
+ /**
6708
+ * @remarks
6709
+ * Removes a callback from being called before new chat
6710
+ * messages are sent.
6711
+ *
6712
+ * This function can't be called in restricted-execution mode.
6713
+ *
6714
+ * This function can be called in early-execution mode.
6715
+ *
6716
+ * @param callback
6717
+ * This closure is called with restricted-execution privilege.
6718
+ */
6719
+ unsubscribe(callback: (arg0: ChatSendBeforeEvent) => void): void;
6720
+ }
6721
+
6722
+ /**
6723
+ * Contains the device information for a client instance.
6724
+ */
6725
+ // @ts-ignore Class inheritance allowed for native defined classes
6726
+ export class ClientSystemInfo extends SystemInfo {
6727
+ private constructor();
6728
+ /**
6729
+ * @remarks
6730
+ * The max render distance for the device in chunks.
6731
+ *
6732
+ */
6733
+ readonly maxRenderDistance: number;
6734
+ /**
6735
+ * @remarks
6736
+ * The platform type of the device.
6737
+ *
6738
+ */
6739
+ readonly platformType: PlatformType;
6740
+ }
6741
+
6742
+ /**
6743
+ * Contains return data on the result of a command execution.
6744
+ */
6745
+ export class CommandResult {
6746
+ private constructor();
6747
+ /**
6748
+ * @remarks
6749
+ * If the command operates against a number of entities,
6750
+ * blocks, or items, this returns the number of successful
6751
+ * applications of this command.
6752
+ *
6753
+ */
6754
+ readonly successCount: number;
6755
+ }
6756
+
6757
+ /**
6758
+ * Base class for downstream Component implementations.
6759
+ */
6760
+ export class Component {
6761
+ private constructor();
6762
+ /**
6763
+ * @remarks
6764
+ * Returns whether the component is valid. A component is
6765
+ * considered valid if its owner is valid, in addition to any
6766
+ * addition to any additional validation required by the
6767
+ * component.
6768
+ *
6769
+ */
6770
+ readonly isValid: boolean;
6771
+ /**
6772
+ * @remarks
6773
+ * Identifier of the component.
6774
+ *
6775
+ */
6776
+ readonly typeId: string;
6777
+ }
6778
+
6779
+ /**
6780
+ * @beta
6781
+ * The Compound Block Volume is a collection of individual
6782
+ * block volume definitions which, as a collection, define a
6783
+ * larger volume of (sometimes non-contiguous) irregular
6784
+ * shapes.
6785
+ * This class is loosely based on the concept of CSG
6786
+ * (Computational Solid Geometry) and allows a user to create
6787
+ * complex volumes by building a stack of volumes and voids to
6788
+ * make a larger single volume.
6789
+ * For example - normally a creator would create a hollow cube
6790
+ * by creating 6 "wall" surfaces for each face.
6791
+ * With a Compound Block Volume, a creator can define a hollow
6792
+ * cube by creating a single outer solid cube, and then
6793
+ * defining a further single 'void' cube inside the larger one.
6794
+ * Similarly, the Compound Block Volume can represent irregular
6795
+ * shaped volumes (e.g. a tree consists of a trunk and lots of
6796
+ * leaf cubes which are not necessarily contiguously placed).
6797
+ * Each of the volumes added to the CompoundBlockVolume are (by
6798
+ * default) relative to the origin set (either at construction
6799
+ * or via one of the set functions).
6800
+ * However, it is also possible to push volumes to the compound
6801
+ * collection which are absolute in nature and are not affected
6802
+ * by origin changes.
6803
+ */
6804
+ export class CompoundBlockVolume {
6805
+ /**
6806
+ * @remarks
6807
+ * Return the 'capacity' of the bounding rectangle which
6808
+ * represents the collection of volumes in the stack
6809
+ *
6810
+ */
6811
+ readonly capacity: number;
6812
+ readonly items: CompoundBlockVolumeItem[];
6813
+ readonly itemsAbsolute: CompoundBlockVolumeItem[];
6814
+ /**
6815
+ * @remarks
6816
+ * Return the number of volumes (positive and negative) in the
6817
+ * volume stack
6818
+ *
6819
+ */
6820
+ readonly volumeCount: number;
6821
+ /**
6822
+ * @remarks
6823
+ * Create a CompoundBlockVolume object
6824
+ *
6825
+ * @param origin
6826
+ * An optional world space origin on which to center the
6827
+ * compound volume.
6828
+ * If not specified, the origin is set to (0,0,0)
6829
+ */
6830
+ constructor(origin?: Vector3);
6831
+ /**
6832
+ * @remarks
6833
+ * Clear the contents of the volume stack
6834
+ *
6835
+ * This function can't be called in restricted-execution mode.
6836
+ *
6837
+ */
6838
+ clear(): void;
6839
+ /**
6840
+ * @remarks
6841
+ * Fetch a Block Location Iterator for the Compound Block
6842
+ * Volume. This iterator will allow a creator to iterate
6843
+ * across all of the selected volumes within the larger
6844
+ * bounding area.
6845
+ * Areas of a volume which have been overridden by a
6846
+ * subtractive volume will not be included in the iterator
6847
+ * step.
6848
+ * (i.e. if you push a cube to the stack, and then push a
6849
+ * subtractive volume to the same location, then the iterator
6850
+ * will step over the initial volume because it is considered
6851
+ * negative space)
6852
+ * Note that the Block Locations returned by this iterator are
6853
+ * in absolute world space (irrespective of whether the
6854
+ * compound volume items pushed are absolute or relative)
6855
+ *
6856
+ * This function can't be called in restricted-execution mode.
6857
+ *
6858
+ */
6859
+ getBlockLocationIterator(): BlockLocationIterator;
6860
+ /**
6861
+ * @remarks
6862
+ * Get the largest bounding box that represents a container for
6863
+ * all of the volumes on the stack
6864
+ * Note that the bounding box returned is represented in
6865
+ * absolute world space (irrespective of whether the compound
6866
+ * volume items pushed are absolute or relative)
6867
+ *
6868
+ * This function can't be called in restricted-execution mode.
6869
+ *
6870
+ */
6871
+ getBoundingBox(): BlockBoundingBox;
6872
+ /**
6873
+ * @remarks
6874
+ * Get the max block location of the outermost bounding
6875
+ * rectangle which represents the volumes on the stack.
6876
+ * Note that the max location returned is in absolute world
6877
+ * space (irrespective of whether the compound volume items
6878
+ * pushed are absolute or relative)
6879
+ *
6880
+ * This function can't be called in restricted-execution mode.
6881
+ *
6882
+ */
6883
+ getMax(): Vector3;
6884
+ /**
6885
+ * @remarks
6886
+ * Get the min block location of the outermost bounding
6887
+ * rectangle which represents the volumes on the stack.
6888
+ * Note that the min location returned is in absolute world
6889
+ * space (irrespective of whether the compound volume items
6890
+ * pushed are absolute or relative)
6891
+ *
6892
+ * This function can't be called in restricted-execution mode.
6893
+ *
6894
+ */
6895
+ getMin(): Vector3;
6896
+ /**
6897
+ * @remarks
6898
+ * Fetch the origin in world space of the compound volume
6899
+ *
6900
+ * This function can't be called in restricted-execution mode.
6901
+ *
6902
+ */
6903
+ getOrigin(): Vector3;
6904
+ /**
6905
+ * @remarks
6906
+ * Return a boolean which signals if there are any volume items
6907
+ * pushed to the volume
6908
+ *
6909
+ * This function can't be called in restricted-execution mode.
6910
+ *
6911
+ */
6912
+ isEmpty(): boolean;
6913
+ /**
6914
+ * @remarks
6915
+ * Return a boolean representing whether or not a given
6916
+ * absolute world space block location is inside a positive
6917
+ * block volume.
6918
+ * E.g. if the stack contains a large cube followed by a
6919
+ * slightly smaller negative cube, and the test location is
6920
+ * within the negative cube - the function will return false
6921
+ * because it's not 'inside' a volume (it IS inside the
6922
+ * bounding rectangle, but it is not inside a positively
6923
+ * defined location)
6924
+ *
6925
+ * This function can't be called in restricted-execution mode.
6926
+ *
6927
+ */
6928
+ isInside(worldLocation: Vector3): boolean;
6929
+ /**
6930
+ * @remarks
6931
+ * Inspect the last entry pushed to the volume stack without
6932
+ * affecting the stack contents.
6933
+ *
6934
+ * This function can't be called in restricted-execution mode.
6935
+ *
6936
+ * @param forceRelativity
6937
+ * Determine whether the function returns a
6938
+ * CompoundBlockVolumeItem which is forced into either relative
6939
+ * or absolute coordinate system.
6940
+ * `true` = force returned item to be relative to volume origin
6941
+ * `false` = force returned item to be absolute world space
6942
+ * location
6943
+ *
6944
+ * If no flag is specified, the item returned retains whatever
6945
+ * relativity it had when it was pushed
6946
+ * @returns
6947
+ * Returns undefined if the stack is empty
6948
+ */
6949
+ peekLastVolume(forceRelativity?: CompoundBlockVolumePositionRelativity): CompoundBlockVolumeItem | undefined;
6950
+ /**
6951
+ * @remarks
6952
+ * Remove the last entry from the volume stack. This will
6953
+ * reduce the stack size by one
6954
+ *
6955
+ * This function can't be called in restricted-execution mode.
6956
+ *
6957
+ */
6958
+ popVolume(): boolean;
6959
+ /**
6960
+ * @remarks
6961
+ * Push a volume item to the stack. The volume item contains
6962
+ * an 'action' parameter which determines whether this volume
6963
+ * is a positive or negative space.
6964
+ * The item also contains a `locationRelativity` which
6965
+ * determines whether it is relative or absolute to the
6966
+ * compound volume origin
6967
+ *
6968
+ * This function can't be called in restricted-execution mode.
6969
+ *
6970
+ * @param item
6971
+ * Item to push to the end of the stack
6972
+ */
6973
+ pushVolume(item: CompoundBlockVolumeItem): void;
6974
+ /**
6975
+ * @remarks
6976
+ * If the volume stack is empty, this function will push the
6977
+ * specified item to the stack.
6978
+ * If the volume stack is NOT empty, this function will replace
6979
+ * the last item on the stack with the new item.
6980
+ *
6981
+ * This function can't be called in restricted-execution mode.
6982
+ *
6983
+ * @param item
6984
+ * Item to add or replace
6985
+ */
6986
+ replaceOrAddLastVolume(item: CompoundBlockVolumeItem): boolean;
6987
+ /**
6988
+ * @remarks
6989
+ * Set the origin of the compound volume to an absolute world
6990
+ * space location
6991
+ *
6992
+ * This function can't be called in restricted-execution mode.
6993
+ *
6994
+ * @param preserveExistingVolumes
6995
+ * This optional boolean flag determines whether the relative
6996
+ * `CompoundBlockVolumeItem`'s are frozen in place, or are
6997
+ * affected by the new origin.
6998
+ * Imagine a scenario where you have a series of relative
6999
+ * locations around an origin which make up a sphere; all of
7000
+ * these locations are in the range of -2 to 2.
7001
+ * Push each of these locations to the compound volume as
7002
+ * relative items.
7003
+ * Now, move the origin and all of the locations representing
7004
+ * the sphere move accordingly.
7005
+ * However, let's say you want to add a 2nd sphere next to the
7006
+ * 1st.
7007
+ * In this case, set the new origin a few locations over, but
7008
+ * 'preserveExistingVolumes' = true.
7009
+ * This will set a new origin, but the existing sphere
7010
+ * locations will remain relative to the original origin.
7011
+ * Now, you can push the relative sphere locations again (this
7012
+ * time they will be relative to the new origin) - resulting in
7013
+ * 2 spheres next to each other.
7014
+ */
7015
+ setOrigin(position: Vector3, preserveExistingVolumes?: boolean): void;
7016
+ /**
7017
+ * @remarks
7018
+ * Similar to {@link CompoundBlockVolume.setOrigin} - this
7019
+ * function will translate the origin by a given delta to a new
7020
+ * position
7021
+ *
7022
+ * This function can't be called in restricted-execution mode.
7023
+ *
7024
+ * @param preserveExistingVolumes
7025
+ * See the description for the arguments to {@link
7026
+ * CompoundBlockVolume.setOrigin}
7027
+ */
7028
+ translateOrigin(delta: Vector3, preserveExistingVolumes?: boolean): void;
7029
+ }
7030
+
7031
+ /**
7032
+ * Represents a container that can hold sets of items. Used
7033
+ * with entities such as Players, Chest Minecarts, Llamas, and
7034
+ * more.
7035
+ * @example containers.ts
7036
+ * ```typescript
7037
+ * import { ItemStack, EntityInventoryComponent, BlockInventoryComponent, DimensionLocation } from "@minecraft/server";
7038
+ * import { MinecraftBlockTypes, MinecraftItemTypes, MinecraftEntityTypes } from "@minecraft/vanilla-data";
7039
+ *
7040
+ * function containers(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
7041
+ * const xLocation = targetLocation; // left chest location
7042
+ * const xPlusTwoLocation = { x: targetLocation.x + 2, y: targetLocation.y, z: targetLocation.z }; // right chest
6013
7043
  *
6014
7044
  * const chestCart = targetLocation.dimension.spawnEntity(MinecraftEntityTypes.ChestMinecart, {
6015
7045
  * x: targetLocation.x + 4,
@@ -6135,7 +7165,9 @@ export class Container {
6135
7165
  *
6136
7166
  * @param itemStack
6137
7167
  * The stack of items to add.
6138
- * @throws This function can throw errors.
7168
+ * @throws
7169
+ * Won't throw {@link ContainerRules} error for over weight
7170
+ * limit but will instead add items up to the weight limit.
6139
7171
  *
6140
7172
  * {@link ContainerRulesError}
6141
7173
  *
@@ -6375,6 +7407,8 @@ export class Container {
6375
7407
  * @throws
6376
7408
  * Throws if either this container or `toContainer` are invalid
6377
7409
  * or if the `fromSlot` or `toSlot` indices out of bounds.
7410
+ * Won't throw {@link ContainerRules} error for over weight
7411
+ * limit but will instead add items up to the weight limit.
6378
7412
  *
6379
7413
  * {@link ContainerRulesError}
6380
7414
  *
@@ -7163,6 +8197,30 @@ export class Dimension {
7163
8197
  block: BlockPermutation | BlockType | string,
7164
8198
  options?: BlockFillOptions,
7165
8199
  ): ListBlockVolume;
8200
+ /**
8201
+ * @beta
8202
+ * @remarks
8203
+ * Finds the location of the closest biome of a particular
8204
+ * type. Note that the findClosestBiome operation can take some
8205
+ * time to complete, so avoid using many of these calls within
8206
+ * a particular tick.
8207
+ *
8208
+ * @param pos
8209
+ * Starting location to look for a biome to find.
8210
+ * @param biomeToFind
8211
+ * Identifier of the biome to look for.
8212
+ * @param options
8213
+ * Additional selection criteria for a biome search.
8214
+ * @returns
8215
+ * Returns a location of the biome, or undefined if a biome
8216
+ * could not be found.
8217
+ * @throws This function can throw errors.
8218
+ *
8219
+ * {@link minecraftcommon.EngineError}
8220
+ *
8221
+ * {@link Error}
8222
+ */
8223
+ findClosestBiome(pos: Vector3, biomeToFind: BiomeType | string, options?: BiomeSearchOptions): Vector3 | undefined;
7166
8224
  /**
7167
8225
  * @remarks
7168
8226
  * Returns the biome type at the specified location.
@@ -7382,6 +8440,26 @@ export class Dimension {
7382
8440
  * {@link minecraftcommon.UnsupportedFunctionalityError}
7383
8441
  */
7384
8442
  getEntitiesFromRay(location: Vector3, direction: Vector3, options?: EntityRaycastOptions): EntityRaycastHit[];
8443
+ /**
8444
+ * @beta
8445
+ * @remarks
8446
+ * Returns a vector of generated structures that contain the
8447
+ * specified location (ex: Pillager Outpost, Mineshaft, etc.).
8448
+ * The vector will be empty if no structures are found.
8449
+ *
8450
+ * @param location
8451
+ * Location at which to check for structures.
8452
+ * @throws
8453
+ * An error will be thrown if the location is out of world
8454
+ * bounds.
8455
+ * An error will be thrown if the location is in an unloaded
8456
+ * chunk.
8457
+ *
8458
+ * {@link LocationInUnloadedChunkError}
8459
+ *
8460
+ * {@link LocationOutOfWorldBoundariesError}
8461
+ */
8462
+ getGeneratedStructures(location: Vector3): (minecraftvanilladata.MinecraftFeatureTypes | string)[];
7385
8463
  /**
7386
8464
  * @remarks
7387
8465
  * Returns the total brightness level of light shining on a
@@ -7443,6 +8521,16 @@ export class Dimension {
7443
8521
  * @throws This function can throw errors.
7444
8522
  */
7445
8523
  getTopmostBlock(locationXZ: VectorXZ, minHeight?: number): Block | undefined;
8524
+ /**
8525
+ * @beta
8526
+ * @remarks
8527
+ * Returns the current weather.
8528
+ *
8529
+ * @returns
8530
+ * Returns a WeatherType that explains the broad category of
8531
+ * weather that is currently going on.
8532
+ */
8533
+ getWeather(): WeatherType;
7446
8534
  /**
7447
8535
  * @remarks
7448
8536
  * Returns true if the chunk at the given location is loaded
@@ -7686,7 +8774,11 @@ export class Dimension {
7686
8774
  * }
7687
8775
  * ```
7688
8776
  */
7689
- spawnEntity(identifier: EntityType | string, location: Vector3, options?: SpawnEntityOptions): Entity;
8777
+ spawnEntity<T = never>(
8778
+ identifier: EntityIdentifierType<NoInfer<T>>,
8779
+ location: Vector3,
8780
+ options?: SpawnEntityOptions,
8781
+ ): Entity;
7690
8782
  /**
7691
8783
  * @remarks
7692
8784
  * Creates a new item stack as an entity at the specified
@@ -7781,6 +8873,26 @@ export class Dimension {
7781
8873
  * ```
7782
8874
  */
7783
8875
  spawnParticle(effectName: string, location: Vector3, molangVariables?: MolangVariableMap): void;
8876
+ /**
8877
+ * @beta
8878
+ * @remarks
8879
+ * Stops all sounds from playing for all players.
8880
+ *
8881
+ * This function can't be called in restricted-execution mode.
8882
+ *
8883
+ */
8884
+ stopAllSounds(): void;
8885
+ /**
8886
+ * @beta
8887
+ * @remarks
8888
+ * Stops a sound from playing for all players.
8889
+ *
8890
+ * This function can't be called in restricted-execution mode.
8891
+ *
8892
+ * @param soundId
8893
+ * Identifier of the sound.
8894
+ */
8895
+ stopSound(soundId: string): void;
7784
8896
  }
7785
8897
 
7786
8898
  /**
@@ -8305,6 +9417,18 @@ export class Entity {
8305
9417
  *
8306
9418
  */
8307
9419
  readonly scoreboardIdentity?: ScoreboardIdentity;
9420
+ /**
9421
+ * @beta
9422
+ * @remarks
9423
+ * Retrieves or sets an entity that is used as the target of
9424
+ * AI-related behaviors, like attacking. If the entity
9425
+ * currently has no target returns undefined.
9426
+ *
9427
+ * @throws This property can throw when used.
9428
+ *
9429
+ * {@link InvalidEntityError}
9430
+ */
9431
+ readonly target?: Entity;
8308
9432
  /**
8309
9433
  * @remarks
8310
9434
  * Identifier of the type of the entity - for example,
@@ -8387,6 +9511,27 @@ export class Entity {
8387
9511
  * ```
8388
9512
  */
8389
9513
  addEffect(effectType: EffectType | string, duration: number, options?: EntityEffectOptions): Effect | undefined;
9514
+ /**
9515
+ * @beta
9516
+ * @remarks
9517
+ * Adds an item to the entity's inventory.
9518
+ *
9519
+ * This function can't be called in restricted-execution mode.
9520
+ *
9521
+ * @returns
9522
+ * Returns undefined if the item was fully added or returns an
9523
+ * ItemStack with the remaining count.
9524
+ * @throws This function can throw errors.
9525
+ *
9526
+ * {@link ContainerRulesError}
9527
+ *
9528
+ * {@link Error}
9529
+ *
9530
+ * {@link InvalidEntityComponentError}
9531
+ *
9532
+ * {@link InvalidEntityError}
9533
+ */
9534
+ addItem(itemStack: ItemStack): ItemStack | undefined;
8390
9535
  /**
8391
9536
  * @remarks
8392
9537
  * Adds a specified tag to an entity.
@@ -9533,6 +10678,18 @@ export class EntityBaseMovementComponent extends EntityComponent {
9533
10678
  // @ts-ignore Class inheritance allowed for native defined classes
9534
10679
  export class EntityBreathableComponent extends EntityComponent {
9535
10680
  private constructor();
10681
+ /**
10682
+ * @beta
10683
+ * @remarks
10684
+ * The current air supply of the entity.
10685
+ *
10686
+ * This property can't be edited in restricted-execution mode.
10687
+ *
10688
+ * @throws
10689
+ * Will throw an error if the air supply is out of bounds
10690
+ * [suffocationTime, maxAirSupply].
10691
+ */
10692
+ airSupply: number;
9536
10693
  /**
9537
10694
  * @remarks
9538
10695
  * If true, this entity can breathe in air.
@@ -9561,6 +10718,14 @@ export class EntityBreathableComponent extends EntityComponent {
9561
10718
  * @throws This property can throw when used.
9562
10719
  */
9563
10720
  readonly breathesWater: boolean;
10721
+ /**
10722
+ * @beta
10723
+ * @remarks
10724
+ * If true, the entity is able to breathe.
10725
+ *
10726
+ * @throws This property can throw when used.
10727
+ */
10728
+ readonly canBreathe: boolean;
9564
10729
  /**
9565
10730
  * @remarks
9566
10731
  * If true, this entity will have visible bubbles while in
@@ -9694,6 +10859,106 @@ export class EntityComponent extends Component {
9694
10859
  readonly entity: Entity;
9695
10860
  }
9696
10861
 
10862
+ /**
10863
+ * @beta
10864
+ * Contains information regarding a specific entity container
10865
+ * being closed.
10866
+ */
10867
+ export class EntityContainerClosedAfterEvent {
10868
+ private constructor();
10869
+ /**
10870
+ * @remarks
10871
+ * The source of the entity container being closed.
10872
+ *
10873
+ */
10874
+ readonly closeSource: ContainerAccessSource;
10875
+ readonly entity: Entity;
10876
+ }
10877
+
10878
+ /**
10879
+ * @beta
10880
+ * Manages callbacks that are connected to when an entity
10881
+ * container is closed.
10882
+ */
10883
+ export class EntityContainerClosedAfterEventSignal {
10884
+ private constructor();
10885
+ /**
10886
+ * @remarks
10887
+ * Adds a callback that will be called when an entity container
10888
+ * is closed.
10889
+ *
10890
+ * This function can't be called in restricted-execution mode.
10891
+ *
10892
+ * This function can be called in early-execution mode.
10893
+ *
10894
+ */
10895
+ subscribe(
10896
+ callback: (arg0: EntityContainerClosedAfterEvent) => void,
10897
+ options?: EntityContainerAccessEventOptions,
10898
+ ): (arg0: EntityContainerClosedAfterEvent) => void;
10899
+ /**
10900
+ * @remarks
10901
+ * Removes a callback from being called when an entity
10902
+ * container is closed.
10903
+ *
10904
+ * This function can't be called in restricted-execution mode.
10905
+ *
10906
+ * This function can be called in early-execution mode.
10907
+ *
10908
+ */
10909
+ unsubscribe(callback: (arg0: EntityContainerClosedAfterEvent) => void): void;
10910
+ }
10911
+
10912
+ /**
10913
+ * @beta
10914
+ * Contains information regarding a specific entity container
10915
+ * being opened.
10916
+ */
10917
+ export class EntityContainerOpenedAfterEvent {
10918
+ private constructor();
10919
+ readonly entity: Entity;
10920
+ /**
10921
+ * @remarks
10922
+ * The source of the entity container being opened.
10923
+ *
10924
+ */
10925
+ readonly openSource: ContainerAccessSource;
10926
+ }
10927
+
10928
+ /**
10929
+ * @beta
10930
+ * Manages callbacks that are connected to when an entity
10931
+ * container is opened.
10932
+ */
10933
+ export class EntityContainerOpenedAfterEventSignal {
10934
+ private constructor();
10935
+ /**
10936
+ * @remarks
10937
+ * Adds a callback that will be called when an entity container
10938
+ * is opened.
10939
+ *
10940
+ * This function can't be called in restricted-execution mode.
10941
+ *
10942
+ * This function can be called in early-execution mode.
10943
+ *
10944
+ */
10945
+ subscribe(
10946
+ callback: (arg0: EntityContainerOpenedAfterEvent) => void,
10947
+ options?: EntityContainerAccessEventOptions,
10948
+ ): (arg0: EntityContainerOpenedAfterEvent) => void;
10949
+ /**
10950
+ * @remarks
10951
+ * Removes a callback from being called when an entity
10952
+ * container is opened.
10953
+ *
10954
+ * This function can't be called in restricted-execution mode.
10955
+ *
10956
+ * This function can be called in early-execution mode.
10957
+ *
10958
+ */
10959
+ unsubscribe(callback: (arg0: EntityContainerOpenedAfterEvent) => void): void;
10960
+ }
10961
+
9697
10962
  /**
9698
10963
  * As part of the Ageable component, represents a set of items
9699
10964
  * that can be fed to an entity and the rate at which that
@@ -9788,6 +11053,29 @@ export class EntityDieAfterEventSignal {
9788
11053
  unsubscribe(callback: (arg0: EntityDieAfterEvent) => void): void;
9789
11054
  }
9790
11055
 
11056
+ /**
11057
+ * @beta
11058
+ * Represents this entity's ender inventory properties. This
11059
+ * component is always present on players and any items in its
11060
+ * container will display for the player when they access an
11061
+ * ender chest.
11062
+ */
11063
+ // @ts-ignore Class inheritance allowed for native defined classes
11064
+ export class EntityEnderInventoryComponent extends EntityComponent {
11065
+ private constructor();
11066
+ /**
11067
+ * @remarks
11068
+ * Defines the ender inventory container for this entity. The
11069
+ * container will be undefined if the entity has been removed.
11070
+ *
11071
+ * @throws This property can throw when used.
11072
+ *
11073
+ * {@link InvalidEntityError}
11074
+ */
11075
+ readonly container: Container;
11076
+ static readonly componentId = 'minecraft:ender_inventory';
11077
+ }
11078
+
9791
11079
  /**
9792
11080
  * Provides access to a mob's equipment slots. This component
9793
11081
  * exists on player entities.
@@ -11411,6 +12699,42 @@ export class EntityNavigationWalkComponent extends EntityNavigationComponent {
11411
12699
  static readonly componentId = 'minecraft:navigation.walk';
11412
12700
  }
11413
12701
 
12702
+ /**
12703
+ * @beta
12704
+ * Adds NPC capabilities to an entity such as custom skin,
12705
+ * name, and dialogue interactions.
12706
+ */
12707
+ // @ts-ignore Class inheritance allowed for native defined classes
12708
+ export class EntityNpcComponent extends EntityComponent {
12709
+ private constructor();
12710
+ /**
12711
+ * @remarks
12712
+ * The DialogueScene that is opened when players first interact
12713
+ * with the NPC.
12714
+ *
12715
+ * This property can't be edited in restricted-execution mode.
12716
+ *
12717
+ */
12718
+ defaultScene: string;
12719
+ /**
12720
+ * @remarks
12721
+ * The name of the NPC as it is displayed to players.
12722
+ *
12723
+ * This property can't be edited in restricted-execution mode.
12724
+ *
12725
+ */
12726
+ name: string;
12727
+ /**
12728
+ * @remarks
12729
+ * The index of the skin the NPC will use.
12730
+ *
12731
+ * This property can't be edited in restricted-execution mode.
12732
+ *
12733
+ */
12734
+ skinIndex: number;
12735
+ static readonly componentId = 'minecraft:npc';
12736
+ }
12737
+
11414
12738
  /**
11415
12739
  * When present on an entity, this entity is on fire.
11416
12740
  * @example setOnFire.ts
@@ -12289,7 +13613,7 @@ export class EntityTypes {
12289
13613
  * Retrieves an entity type using a string-based identifier.
12290
13614
  *
12291
13615
  */
12292
- static get(identifier: string): EntityType | undefined;
13616
+ static get<T = never>(identifier: EntityIdentifierType<NoInfer<T>>): EntityType | undefined;
12293
13617
  /**
12294
13618
  * @remarks
12295
13619
  * Retrieves a set of all entity types within this world.
@@ -12336,6 +13660,51 @@ export class EntityWantsJockeyComponent extends EntityComponent {
12336
13660
  static readonly componentId = 'minecraft:wants_jockey';
12337
13661
  }
12338
13662
 
13663
+ /**
13664
+ * @beta
13665
+ * Waypoint that tracks an entity's position. The waypoint
13666
+ * automatically updates as the entity moves and becomes
13667
+ * invalid when the entity is removed.
13668
+ */
13669
+ // @ts-ignore Class inheritance allowed for native defined classes
13670
+ export class EntityWaypoint extends Waypoint {
13671
+ /**
13672
+ * @remarks
13673
+ * The entity being tracked by this waypoint.
13674
+ *
13675
+ * @throws This property can throw when used.
13676
+ *
13677
+ * {@link InvalidWaypointError}
13678
+ *
13679
+ * {@link InvalidWaypointTextureSelectorError}
13680
+ */
13681
+ readonly entity: Entity;
13682
+ /**
13683
+ * @remarks
13684
+ * The visibility rules that control when the waypoint is shown
13685
+ * based on the entity's state (e.g., sneaking, invisible,
13686
+ * dead).
13687
+ *
13688
+ * @throws This property can throw when used.
13689
+ *
13690
+ * {@link InvalidWaypointError}
13691
+ *
13692
+ * {@link InvalidWaypointTextureSelectorError}
13693
+ */
13694
+ readonly entityRules: EntityVisibilityRules;
13695
+ /**
13696
+ * @throws This function can throw errors.
13697
+ *
13698
+ * {@link InvalidWaypointTextureSelectorError}
13699
+ */
13700
+ constructor(
13701
+ entity: Entity,
13702
+ textureSelector: WaypointTextureSelector,
13703
+ entityRules: EntityVisibilityRules,
13704
+ color?: RGB,
13705
+ );
13706
+ }
13707
+
12339
13708
  /**
12340
13709
  * Loot item function that modifies a dropped treasure map to
12341
13710
  * mark a location.
@@ -12756,6 +14125,13 @@ export class GameRules {
12756
14125
  *
12757
14126
  */
12758
14127
  keepInventory: boolean;
14128
+ /**
14129
+ * @beta
14130
+ * @remarks
14131
+ * This property can't be edited in restricted-execution mode.
14132
+ *
14133
+ */
14134
+ locatorBar: boolean;
12759
14135
  /**
12760
14136
  * @remarks
12761
14137
  * This property can't be edited in restricted-execution mode.
@@ -15080,6 +16456,175 @@ export class ListBlockVolume extends BlockVolumeBase {
15080
16456
  remove(locations: Vector3[]): void;
15081
16457
  }
15082
16458
 
16459
+ /**
16460
+ * @beta
16461
+ * Waypoint that points to a fixed location in the world.
16462
+ * Unlike entity waypoints, location waypoints always remain
16463
+ * valid and their position can be updated.
16464
+ */
16465
+ // @ts-ignore Class inheritance allowed for native defined classes
16466
+ export class LocationWaypoint extends Waypoint {
16467
+ /**
16468
+ * @throws This function can throw errors.
16469
+ *
16470
+ * {@link InvalidWaypointTextureSelectorError}
16471
+ */
16472
+ constructor(dimensionLocation: DimensionLocation, textureSelector: WaypointTextureSelector, color?: RGB);
16473
+ /**
16474
+ * @remarks
16475
+ * Updates the dimension and location that this waypoint points
16476
+ * to.
16477
+ *
16478
+ * This function can't be called in restricted-execution mode.
16479
+ *
16480
+ * @param dimensionLocation
16481
+ * The new {@link DimensionLocation} (dimension and
16482
+ * coordinates) for the waypoint.
16483
+ */
16484
+ setDimensionLocation(dimensionLocation: DimensionLocation): void;
16485
+ }
16486
+
16487
+ /**
16488
+ * @beta
16489
+ * Manages the collection of waypoints displayed on a player's
16490
+ * locator bar. Allows adding, removing, and querying waypoints
16491
+ * with a maximum capacity limit.
16492
+ *
16493
+ * Invalid waypoints in the locator bar will be automatically
16494
+ * removed in the next tick. This includes waypoints tied to
16495
+ * entities that have been removed from the world.
16496
+ *
16497
+ * Note: You can control whether vanilla player waypoints are
16498
+ * automatically added to the locator bar using the
16499
+ * `locatorbar` {@link GameRule}. This game rule is currently
16500
+ * named `locatorbar` but will likely be renamed in a future
16501
+ * update to be more descriptive.
16502
+ *
16503
+ * Note: You can only modify, remove, or query waypoints that
16504
+ * were added by this pack.
16505
+ * @example sharedWaypoint.ts
16506
+ * ```typescript
16507
+ * /\*
16508
+ * import { world, LocationWaypoint, WaypointTextureSelector, WaypointTexture } from "@minecraft/server"
16509
+ *
16510
+ * function sharedWaypoint() {
16511
+ * const players = world.getAllPlayers();
16512
+ *
16513
+ * if (players.length < 2) {
16514
+ * console.warn("Need at least 2 players for this example.");
16515
+ * return;
16516
+ * }
16517
+ *
16518
+ * const playerA = players[0];
16519
+ * const playerB = players[1];
16520
+ *
16521
+ * // Create a single waypoint at a specific location
16522
+ * const textureSelector: WaypointTextureSelector = {
16523
+ * textureBoundsList: [
16524
+ * { lowerBound: 0, texture: WaypointTexture.Circle }
16525
+ * ]
16526
+ * };
16527
+ *
16528
+ * const waypoint = new LocationWaypoint(
16529
+ * { dimension: playerA.dimension, x: 100, y: 64, z: 100 },
16530
+ * textureSelector,
16531
+ * { red: 1, green: 0, blue: 0 } // Initially red
16532
+ * );
16533
+ *
16534
+ * // Add the same waypoint to both players' locator bars
16535
+ * playerA.locatorBar.addWaypoint(waypoint);
16536
+ * playerB.locatorBar.addWaypoint(waypoint);
16537
+ *
16538
+ * // Change the color - this affects both players
16539
+ * waypoint.color = { red: 0, green: 1, blue: 0 }; // Now green for both players
16540
+ * }
16541
+ * *\/
16542
+ * ```
16543
+ */
16544
+ export class LocatorBar {
16545
+ private constructor();
16546
+ /**
16547
+ * @remarks
16548
+ * The current number of waypoints in the locator bar.
16549
+ *
16550
+ */
16551
+ readonly count: number;
16552
+ /**
16553
+ * @remarks
16554
+ * The maximum number of waypoints that can be added to the
16555
+ * locator bar.
16556
+ *
16557
+ */
16558
+ readonly maxCount: number;
16559
+ /**
16560
+ * @remarks
16561
+ * Adds a waypoint to the locator bar. Throws an error if the
16562
+ * waypoint already exists, the maximum waypoint limit has been
16563
+ * reached, or the waypoint is invalid.
16564
+ *
16565
+ * This function can't be called in restricted-execution mode.
16566
+ *
16567
+ * @param waypoint
16568
+ * The {@link Waypoint} to add to the locator bar.
16569
+ * @throws This function can throw errors.
16570
+ *
16571
+ * {@link minecraftcommon.EngineError}
16572
+ *
16573
+ * {@link InvalidWaypointError}
16574
+ *
16575
+ * {@link LocatorBarError}
16576
+ */
16577
+ addWaypoint(waypoint: Waypoint): void;
16578
+ /**
16579
+ * @remarks
16580
+ * Returns an array of all waypoints currently in the locator
16581
+ * bar.
16582
+ *
16583
+ * This function can't be called in restricted-execution mode.
16584
+ *
16585
+ */
16586
+ getAllWaypoints(): Waypoint[];
16587
+ /**
16588
+ * @remarks
16589
+ * Checks whether the specified waypoint exists in the locator
16590
+ * bar.
16591
+ *
16592
+ * This function can't be called in restricted-execution mode.
16593
+ *
16594
+ * @param waypoint
16595
+ * The {@link Waypoint} to check for.
16596
+ */
16597
+ hasWaypoint(waypoint: Waypoint): boolean;
16598
+ /**
16599
+ * @remarks
16600
+ * Removes all waypoints from the locator bar, clearing it
16601
+ * completely.
16602
+ *
16603
+ * This function can't be called in restricted-execution mode.
16604
+ *
16605
+ * @throws This function can throw errors.
16606
+ *
16607
+ * {@link minecraftcommon.EngineError}
16608
+ */
16609
+ removeAllWaypoints(): void;
16610
+ /**
16611
+ * @remarks
16612
+ * Removes a specific waypoint from the locator bar. Returns an
16613
+ * error if the waypoint does not exist in the locator bar.
16614
+ *
16615
+ * This function can't be called in restricted-execution mode.
16616
+ *
16617
+ * @param waypoint
16618
+ * The {@link Waypoint} to remove from the locator bar.
16619
+ * @throws This function can throw errors.
16620
+ *
16621
+ * {@link minecraftcommon.EngineError}
16622
+ *
16623
+ * {@link LocatorBarError}
16624
+ */
16625
+ removeWaypoint(waypoint: Waypoint): void;
16626
+ }
16627
+
15083
16628
  /**
15084
16629
  * Loot item function that drops extra items if the provided
15085
16630
  * tool has the looting enchant.
@@ -15458,6 +17003,33 @@ export class MatchToolCondition extends LootItemCondition {
15458
17003
  readonly itemTagsNone: string[];
15459
17004
  }
15460
17005
 
17006
+ /**
17007
+ * @beta
17008
+ * A specific currently-internal event used for passing
17009
+ * messages from client to server.
17010
+ */
17011
+ export class MessageReceiveAfterEvent {
17012
+ private constructor();
17013
+ /**
17014
+ * @remarks
17015
+ * The message identifier.
17016
+ *
17017
+ */
17018
+ readonly id: string;
17019
+ /**
17020
+ * @remarks
17021
+ * The message.
17022
+ *
17023
+ */
17024
+ readonly message: string;
17025
+ /**
17026
+ * @remarks
17027
+ * The player who sent the message.
17028
+ *
17029
+ */
17030
+ readonly player: Player;
17031
+ }
17032
+
15461
17033
  /**
15462
17034
  * Contains a set of additional variable values for further
15463
17035
  * defining how rendering and animations function.
@@ -15526,6 +17098,49 @@ export class MolangVariableMap {
15526
17098
  setVector3(variableName: string, vector: Vector3): void;
15527
17099
  }
15528
17100
 
17101
+ /**
17102
+ * @beta
17103
+ * Pack setting name and value that changed.
17104
+ */
17105
+ export class PackSettingChangeAfterEvent {
17106
+ private constructor();
17107
+ /**
17108
+ * @remarks
17109
+ * The name of the setting.
17110
+ *
17111
+ */
17112
+ readonly settingName: string;
17113
+ /**
17114
+ * @remarks
17115
+ * The value of the setting.
17116
+ *
17117
+ */
17118
+ readonly settingValue: boolean | number | string;
17119
+ }
17120
+
17121
+ /**
17122
+ * @beta
17123
+ */
17124
+ export class PackSettingChangeAfterEventSignal {
17125
+ private constructor();
17126
+ /**
17127
+ * @remarks
17128
+ * This function can't be called in restricted-execution mode.
17129
+ *
17130
+ * This function can be called in early-execution mode.
17131
+ *
17132
+ */
17133
+ subscribe(callback: (arg0: PackSettingChangeAfterEvent) => void): (arg0: PackSettingChangeAfterEvent) => void;
17134
+ /**
17135
+ * @remarks
17136
+ * This function can't be called in restricted-execution mode.
17137
+ *
17138
+ * This function can be called in early-execution mode.
17139
+ *
17140
+ */
17141
+ unsubscribe(callback: (arg0: PackSettingChangeAfterEvent) => void): void;
17142
+ }
17143
+
15529
17144
  /**
15530
17145
  * Loot item condition that checks whether the looting entity
15531
17146
  * is currently a passenger of a specific type of entity.
@@ -15753,6 +17368,14 @@ export class Player extends Entity {
15753
17368
  * @throws This property can throw when used.
15754
17369
  */
15755
17370
  readonly level: number;
17371
+ /**
17372
+ * @beta
17373
+ * @remarks
17374
+ * The player's Locator Bar. This property is used for managing
17375
+ * waypoints displayed on the HUD.
17376
+ *
17377
+ */
17378
+ readonly locatorBar: LocatorBar;
15756
17379
  /**
15757
17380
  * @remarks
15758
17381
  * Name of the player.
@@ -15768,6 +17391,13 @@ export class Player extends Entity {
15768
17391
  * @throws This property can throw when used.
15769
17392
  */
15770
17393
  readonly onScreenDisplay: ScreenDisplay;
17394
+ /**
17395
+ * @beta
17396
+ * @throws This property can throw when used.
17397
+ *
17398
+ * {@link InvalidEntityError}
17399
+ */
17400
+ readonly partyId?: string;
15771
17401
  /**
15772
17402
  * @throws This property can throw when used.
15773
17403
  *
@@ -15841,6 +17471,20 @@ export class Player extends Entity {
15841
17471
  * Throws if the Entity or Entity ID is invalid.
15842
17472
  */
15843
17473
  clearPropertyOverridesForEntity(targetEntity: Entity | string): void;
17474
+ /**
17475
+ * @beta
17476
+ * @remarks
17477
+ * Eats an item, providing the item's hunger and saturation
17478
+ * effects to the player. Can only be used on food items.
17479
+ *
17480
+ * This function can't be called in restricted-execution mode.
17481
+ *
17482
+ * @param itemStack
17483
+ * The item to eat.
17484
+ * @throws
17485
+ * Throws if the item is not a food item.
17486
+ */
17487
+ eatItem(itemStack: ItemStack): void;
15844
17488
  /**
15845
17489
  * @rc
15846
17490
  * @remarks
@@ -15942,6 +17586,17 @@ export class Player extends Entity {
15942
17586
  * ```
15943
17587
  */
15944
17588
  playSound(soundId: string, soundOptions?: PlayerSoundOptions): void;
17589
+ /**
17590
+ * @beta
17591
+ * @remarks
17592
+ * This is an internal-facing method for posting a system
17593
+ * message to downstream clients.
17594
+ *
17595
+ * This function can't be called in restricted-execution mode.
17596
+ *
17597
+ * @throws This function can throw errors.
17598
+ */
17599
+ postClientMessage(id: string, value: string): void;
15945
17600
  /**
15946
17601
  * @remarks
15947
17602
  * Queues an additional music track that only this particular
@@ -16219,6 +17874,18 @@ export class Player extends Entity {
16219
17874
  * @throws This function can throw errors.
16220
17875
  */
16221
17876
  startItemCooldown(cooldownCategory: string, tickDuration: number): void;
17877
+ /**
17878
+ * @beta
17879
+ * @remarks
17880
+ * Stops all sounds from playing for this particular player.
17881
+ *
17882
+ * This function can't be called in restricted-execution mode.
17883
+ *
17884
+ * @throws This function can throw errors.
17885
+ *
17886
+ * {@link InvalidEntityError}
17887
+ */
17888
+ stopAllSounds(): void;
16222
17889
  /**
16223
17890
  * @remarks
16224
17891
  * Stops any music tracks from playing for this particular
@@ -16229,6 +17896,20 @@ export class Player extends Entity {
16229
17896
  * @throws This function can throw errors.
16230
17897
  */
16231
17898
  stopMusic(): void;
17899
+ /**
17900
+ * @beta
17901
+ * @remarks
17902
+ * Stops a sound from playing for this particular player.
17903
+ *
17904
+ * This function can't be called in restricted-execution mode.
17905
+ *
17906
+ * @param soundId
17907
+ * Identifier of the sound.
17908
+ * @throws This function can throw errors.
17909
+ *
17910
+ * {@link InvalidEntityError}
17911
+ */
17912
+ stopSound(soundId: string): void;
16232
17913
  }
16233
17914
 
16234
17915
  /**
@@ -17514,6 +19195,88 @@ export class PlayerPlaceBlockAfterEventSignal {
17514
19195
  unsubscribe(callback: (arg0: PlayerPlaceBlockAfterEvent) => void): void;
17515
19196
  }
17516
19197
 
19198
+ /**
19199
+ * @beta
19200
+ * Contains information regarding an event before a player
19201
+ * places a block.
19202
+ */
19203
+ // @ts-ignore Class inheritance allowed for native defined classes
19204
+ export class PlayerPlaceBlockBeforeEvent extends BlockEvent {
19205
+ private constructor();
19206
+ /**
19207
+ * @remarks
19208
+ * If set to true, cancels the block place event.
19209
+ *
19210
+ */
19211
+ cancel: boolean;
19212
+ /**
19213
+ * @remarks
19214
+ * The face of the block that the new block is being placed on.
19215
+ *
19216
+ */
19217
+ readonly face: Direction;
19218
+ /**
19219
+ * @remarks
19220
+ * Location relative to the bottom north-west corner of the
19221
+ * block where the new block is being placed onto.
19222
+ *
19223
+ */
19224
+ readonly faceLocation: Vector3;
19225
+ /**
19226
+ * @remarks
19227
+ * The block permutation that will be placed if the event is
19228
+ * not cancelled.
19229
+ *
19230
+ */
19231
+ readonly permutationToPlace: BlockPermutation;
19232
+ /**
19233
+ * @remarks
19234
+ * Player that is placing the block for this event.
19235
+ *
19236
+ */
19237
+ readonly player: Player;
19238
+ }
19239
+
19240
+ /**
19241
+ * @beta
19242
+ * Manages callbacks that are connected to before a block is
19243
+ * placed by a player.
19244
+ */
19245
+ export class PlayerPlaceBlockBeforeEventSignal {
19246
+ private constructor();
19247
+ /**
19248
+ * @remarks
19249
+ * Adds a callback that will be called before a block is placed
19250
+ * by a player.
19251
+ *
19252
+ * This function can't be called in restricted-execution mode.
19253
+ *
19254
+ * This function can be called in early-execution mode.
19255
+ *
19256
+ * @param callback
19257
+ * This closure is called with restricted-execution privilege.
19258
+ * @returns
19259
+ * Closure that is called with restricted-execution privilege.
19260
+ */
19261
+ subscribe(
19262
+ callback: (arg0: PlayerPlaceBlockBeforeEvent) => void,
19263
+ options?: BlockEventOptions,
19264
+ ): (arg0: PlayerPlaceBlockBeforeEvent) => void;
19265
+ /**
19266
+ * @remarks
19267
+ * Removes a callback from being called before an block is
19268
+ * placed by a player.
19269
+ *
19270
+ * This function can't be called in restricted-execution mode.
19271
+ *
19272
+ * This function can be called in early-execution mode.
19273
+ *
19274
+ * @param callback
19275
+ * This closure is called with restricted-execution privilege.
19276
+ */
19277
+ unsubscribe(callback: (arg0: PlayerPlaceBlockBeforeEvent) => void): void;
19278
+ }
19279
+
17517
19280
  /**
17518
19281
  * An event that contains more information about a player
17519
19282
  * spawning.
@@ -17632,6 +19395,114 @@ export class PlayerSwingStartAfterEventSignal {
17632
19395
  unsubscribe(callback: (arg0: PlayerSwingStartAfterEvent) => void): void;
17633
19396
  }
17634
19397
 
19398
+ /**
19399
+ * @beta
19400
+ * Contains information related to when a player successfully
19401
+ * names an Entity with a named Name Tag item.
19402
+ */
19403
+ export class PlayerUseNameTagAfterEvent {
19404
+ private constructor();
19405
+ /**
19406
+ * @remarks
19407
+ * The entity that was named by the player.
19408
+ *
19409
+ * This property can't be edited in restricted-execution mode.
19410
+ *
19411
+ */
19412
+ entityNamed: Entity;
19413
+ /**
19414
+ * @remarks
19415
+ * The new name that the player has given to the entity.
19416
+ *
19417
+ * This property can't be edited in restricted-execution mode.
19418
+ *
19419
+ */
19420
+ newName: string;
19421
+ /**
19422
+ * @remarks
19423
+ * Handle to the player that used the name tag.
19424
+ *
19425
+ * This property can't be edited in restricted-execution mode.
19426
+ *
19427
+ */
19428
+ player: Player;
19429
+ /**
19430
+ * @remarks
19431
+ * The previous name of the entity before the player used the
19432
+ * name tag. This will be undefined if the entity was not
19433
+ * previously named.
19434
+ *
19435
+ * This property can't be edited in restricted-execution mode.
19436
+ *
19437
+ */
19438
+ previousName?: string;
19439
+ }
19440
+
19441
+ /**
19442
+ * @beta
19443
+ * Manages callbacks that are connected to when a player
19444
+ * successfully names an Entity with a named Name Tag item.
19445
+ */
19446
+ export class PlayerUseNameTagAfterEventSignal {
19447
+ private constructor();
19448
+ /**
19449
+ * @remarks
19450
+ * Subscribes the specified callback to a player use name tag
19451
+ * after event.
19452
+ *
19453
+ * This function can't be called in restricted-execution mode.
19454
+ *
19455
+ * This function can be called in early-execution mode.
19456
+ *
19457
+ */
19458
+ subscribe(callback: (arg0: PlayerUseNameTagAfterEvent) => void): (arg0: PlayerUseNameTagAfterEvent) => void;
19459
+ /**
19460
+ * @remarks
19461
+ * Removes the specified callback from a player use name tag
19462
+ * after event.
19463
+ *
19464
+ * This function can't be called in restricted-execution mode.
19465
+ *
19466
+ * This function can be called in early-execution mode.
19467
+ *
19468
+ */
19469
+ unsubscribe(callback: (arg0: PlayerUseNameTagAfterEvent) => void): void;
19470
+ }
19471
+
19472
+ /**
19473
+ * @beta
19474
+ * Waypoint that tracks a player's position. Extends {@link
19475
+ * EntityWaypoint} with additional player-specific visibility
19476
+ * rules such as hidden state and spectator mode.
19477
+ */
19478
+ // @ts-ignore Class inheritance allowed for native defined classes
19479
+ export class PlayerWaypoint extends EntityWaypoint {
19480
+ /**
19481
+ * @remarks
19482
+ * The {@link PlayerVisibilityRules} that control when the
19483
+ * waypoint is shown based on the player's state (e.g., hidden,
19484
+ * spectator mode, spectator viewing another spectator).
19485
+ *
19486
+ * @throws This property can throw when used.
19487
+ *
19488
+ * {@link InvalidWaypointError}
19489
+ *
19490
+ * {@link InvalidWaypointTextureSelectorError}
19491
+ */
19492
+ readonly playerRules: PlayerVisibilityRules;
19493
+ /**
19494
+ * @throws This function can throw errors.
19495
+ *
19496
+ * {@link InvalidWaypointTextureSelectorError}
19497
+ */
19498
+ constructor(
19499
+ player: Player,
19500
+ textureSelector: WaypointTextureSelector,
19501
+ playerRules: PlayerVisibilityRules,
19502
+ color?: RGB,
19503
+ );
19504
+ }
19505
+
17635
19506
  /**
17636
19507
  * Represents how the potion effect is delivered.
17637
19508
  */
@@ -17714,10 +19585,10 @@ export class Potions {
17714
19585
  *
17715
19586
  * {@link InvalidPotionEffectTypeError}
17716
19587
  */
17717
- static resolve(
17718
- potionEffectType: PotionEffectType | string,
17719
- potionDeliveryType: PotionDeliveryType | string,
17720
- ): ItemStack;
19588
+ static resolve<
19589
+ T extends string = minecraftvanilladata.MinecraftPotionEffectTypes,
19590
+ U extends string = minecraftvanilladata.MinecraftPotionDeliveryTypes,
19591
+ >(potionEffectType: PotionEffectType | T, potionDeliveryType: PotionDeliveryType | U): ItemStack;
17721
19592
  }
17722
19593
 
17723
19594
  /**
@@ -17751,85 +19622,208 @@ export class PressurePlatePopAfterEventSignal {
17751
19622
  private constructor();
17752
19623
  /**
17753
19624
  * @remarks
17754
- * Adds a callback that will be called when a pressure plate is
17755
- * popped.
17756
- *
17757
- * This function can't be called in restricted-execution mode.
17758
- *
17759
- * This function can be called in early-execution mode.
19625
+ * Adds a callback that will be called when a pressure plate is
19626
+ * popped.
19627
+ *
19628
+ * This function can't be called in restricted-execution mode.
19629
+ *
19630
+ * This function can be called in early-execution mode.
19631
+ *
19632
+ */
19633
+ subscribe(callback: (arg0: PressurePlatePopAfterEvent) => void): (arg0: PressurePlatePopAfterEvent) => void;
19634
+ /**
19635
+ * @remarks
19636
+ * Removes a callback from being called when a pressure plate
19637
+ * is popped.
19638
+ *
19639
+ * This function can't be called in restricted-execution mode.
19640
+ *
19641
+ * This function can be called in early-execution mode.
19642
+ *
19643
+ */
19644
+ unsubscribe(callback: (arg0: PressurePlatePopAfterEvent) => void): void;
19645
+ }
19646
+
19647
+ /**
19648
+ * Contains information related to changes to a pressure plate
19649
+ * push.
19650
+ */
19651
+ // @ts-ignore Class inheritance allowed for native defined classes
19652
+ export class PressurePlatePushAfterEvent extends BlockEvent {
19653
+ private constructor();
19654
+ /**
19655
+ * @remarks
19656
+ * The redstone power of the pressure plate before it was
19657
+ * pushed.
19658
+ *
19659
+ */
19660
+ readonly previousRedstonePower: number;
19661
+ /**
19662
+ * @remarks
19663
+ * The redstone power of the pressure plate at the time of the
19664
+ * push.
19665
+ *
19666
+ */
19667
+ readonly redstonePower: number;
19668
+ /**
19669
+ * @remarks
19670
+ * Source that triggered the pressure plate push.
19671
+ *
19672
+ */
19673
+ readonly source: Entity;
19674
+ }
19675
+
19676
+ /**
19677
+ * Manages callbacks that are connected to when a pressure
19678
+ * plate is pushed.
19679
+ */
19680
+ export class PressurePlatePushAfterEventSignal {
19681
+ private constructor();
19682
+ /**
19683
+ * @remarks
19684
+ * Adds a callback that will be called when a pressure plate is
19685
+ * pushed.
19686
+ *
19687
+ * This function can't be called in restricted-execution mode.
19688
+ *
19689
+ * This function can be called in early-execution mode.
19690
+ *
19691
+ */
19692
+ subscribe(callback: (arg0: PressurePlatePushAfterEvent) => void): (arg0: PressurePlatePushAfterEvent) => void;
19693
+ /**
19694
+ * @remarks
19695
+ * Removes a callback from being called when a pressure plate
19696
+ * is pushed.
19697
+ *
19698
+ * This function can't be called in restricted-execution mode.
19699
+ *
19700
+ * This function can be called in early-execution mode.
19701
+ *
19702
+ */
19703
+ unsubscribe(callback: (arg0: PressurePlatePushAfterEvent) => void): void;
19704
+ }
19705
+
19706
+ /**
19707
+ * @beta
19708
+ * The base class for a text primitive. Represents an object in
19709
+ * the world and its base properties.
19710
+ */
19711
+ export class PrimitiveShape {
19712
+ private constructor();
19713
+ /**
19714
+ * @remarks
19715
+ * The entity this shape is attached to. When set, this shape
19716
+ * will copy the root location of the attached entity and the
19717
+ * shape's position will be used as an offset.
19718
+ *
19719
+ */
19720
+ attachedTo?: Entity;
19721
+ /**
19722
+ * @remarks
19723
+ * The color of the shape.
19724
+ *
19725
+ */
19726
+ color: RGBA;
19727
+ /**
19728
+ * @remarks
19729
+ * The dimension the shape is visible within. If the dimension
19730
+ * is undefined, it will display in all dimensions.
19731
+ *
19732
+ */
19733
+ readonly dimension: Dimension;
19734
+ /**
19735
+ * @remarks
19736
+ * Returns true if the shape has a limited time span before
19737
+ * being removed.
19738
+ *
19739
+ */
19740
+ readonly hasDuration: boolean;
19741
+ /**
19742
+ * @remarks
19743
+ * The location of the shape.
19744
+ *
19745
+ */
19746
+ readonly location: Vector3;
19747
+ /**
19748
+ * @remarks
19749
+ * The rotation of the shape (Euler angles - [Pitch, Yaw,
19750
+ * Roll]).
17760
19751
  *
17761
19752
  */
17762
- subscribe(callback: (arg0: PressurePlatePopAfterEvent) => void): (arg0: PressurePlatePopAfterEvent) => void;
19753
+ rotation: Vector3;
17763
19754
  /**
17764
19755
  * @remarks
17765
- * Removes a callback from being called when a pressure plate
17766
- * is popped.
19756
+ * The scale of the shape.
17767
19757
  *
17768
- * This function can't be called in restricted-execution mode.
19758
+ */
19759
+ scale: number;
19760
+ /**
19761
+ * @remarks
19762
+ * The time left (in seconds) until this shape is automatically
19763
+ * removed. Returns undefined if the shape does not have a
19764
+ * limited life-span.
17769
19765
  *
17770
- * This function can be called in early-execution mode.
19766
+ */
19767
+ timeLeft?: number;
19768
+ /**
19769
+ * @remarks
19770
+ * The total initial time-span (in seconds) until this shape is
19771
+ * automatically removed. Returns undefined if the shape does
19772
+ * not have a limited life-span.
17771
19773
  *
17772
19774
  */
17773
- unsubscribe(callback: (arg0: PressurePlatePopAfterEvent) => void): void;
17774
- }
17775
-
17776
- /**
17777
- * Contains information related to changes to a pressure plate
17778
- * push.
17779
- */
17780
- // @ts-ignore Class inheritance allowed for native defined classes
17781
- export class PressurePlatePushAfterEvent extends BlockEvent {
17782
- private constructor();
19775
+ readonly totalTimeLeft?: number;
17783
19776
  /**
17784
19777
  * @remarks
17785
- * The redstone power of the pressure plate before it was
17786
- * pushed.
19778
+ * The list of players that this shape will be visible to. If
19779
+ * left empty, the shape will be visible to all players.
17787
19780
  *
17788
19781
  */
17789
- readonly previousRedstonePower: number;
19782
+ visibleTo: Player[];
17790
19783
  /**
17791
19784
  * @remarks
17792
- * The redstone power of the pressure plate at the time of the
17793
- * push.
19785
+ * Removes this shape from the world. The shape can be re-added
19786
+ * via the PrimitiveShapesManager's addText method.
17794
19787
  *
17795
19788
  */
17796
- readonly redstonePower: number;
19789
+ remove(): void;
17797
19790
  /**
17798
19791
  * @remarks
17799
- * Source that triggered the pressure plate push.
19792
+ * Set the location and dimension of the shape. If the
19793
+ * dimension is undefined, it will display in all dimensions.
17800
19794
  *
17801
19795
  */
17802
- readonly source: Entity;
19796
+ setLocation(location: DimensionLocation | Vector3): void;
17803
19797
  }
17804
19798
 
17805
19799
  /**
17806
- * Manages callbacks that are connected to when a pressure
17807
- * plate is pushed.
19800
+ * @beta
19801
+ * Primitive Shapes class used to allow adding and removing
19802
+ * text primitives to the world.
17808
19803
  */
17809
- export class PressurePlatePushAfterEventSignal {
19804
+ export class PrimitiveShapesManager {
17810
19805
  private constructor();
17811
19806
  /**
17812
19807
  * @remarks
17813
- * Adds a callback that will be called when a pressure plate is
17814
- * pushed.
17815
- *
17816
- * This function can't be called in restricted-execution mode.
17817
- *
17818
- * This function can be called in early-execution mode.
19808
+ * Adds a new text primitive to the world.
17819
19809
  *
19810
+ * @param text
19811
+ * The text primitive to be added.
17820
19812
  */
17821
- subscribe(callback: (arg0: PressurePlatePushAfterEvent) => void): (arg0: PressurePlatePushAfterEvent) => void;
19813
+ addText(text: TextPrimitive, dimension?: Dimension): void;
17822
19814
  /**
17823
19815
  * @remarks
17824
- * Removes a callback from being called when a pressure plate
17825
- * is pushed.
17826
- *
17827
- * This function can't be called in restricted-execution mode.
19816
+ * Removes all text primitives from the world.
17828
19817
  *
17829
- * This function can be called in early-execution mode.
19818
+ */
19819
+ removeAll(): void;
19820
+ /**
19821
+ * @remarks
19822
+ * Removes an instance of a text primitive from the world. This
19823
+ * is equivalent to calling remove on the text itself.
17830
19824
  *
17831
19825
  */
17832
- unsubscribe(callback: (arg0: PressurePlatePushAfterEvent) => void): void;
19826
+ removeText(text: TextPrimitive): void;
17833
19827
  }
17834
19828
 
17835
19829
  /**
@@ -18785,6 +20779,38 @@ export class Seat {
18785
20779
  readonly seatRotation: number;
18786
20780
  }
18787
20781
 
20782
+ /**
20783
+ * @beta
20784
+ * Manages callbacks that are message passing to a server. This
20785
+ * event is not currently fully implemented, and should not be
20786
+ * used.
20787
+ */
20788
+ export class ServerMessageAfterEventSignal {
20789
+ private constructor();
20790
+ /**
20791
+ * @remarks
20792
+ * Adds a callback that will be called when an internal message
20793
+ * is passed.
20794
+ *
20795
+ * This function can't be called in restricted-execution mode.
20796
+ *
20797
+ * This function can be called in early-execution mode.
20798
+ *
20799
+ */
20800
+ subscribe(callback: (arg0: MessageReceiveAfterEvent) => void): (arg0: MessageReceiveAfterEvent) => void;
20801
+ /**
20802
+ * @remarks
20803
+ * Removes a callback from being called when an internal
20804
+ * message is passed.
20805
+ *
20806
+ * This function can't be called in restricted-execution mode.
20807
+ *
20808
+ * This function can be called in early-execution mode.
20809
+ *
20810
+ */
20811
+ unsubscribe(callback: (arg0: MessageReceiveAfterEvent) => void): void;
20812
+ }
20813
+
18788
20814
  /**
18789
20815
  * Loot item function that modifies the trim on a dropped armor
18790
20816
  * item.
@@ -18813,6 +20839,21 @@ export class SetArmorTrimFunction extends LootItemFunction {
18813
20839
  // @ts-ignore Class inheritance allowed for native defined classes
18814
20840
  export class SetBannerDetailsFunction extends LootItemFunction {
18815
20841
  private constructor();
20842
+ /**
20843
+ * @beta
20844
+ * @remarks
20845
+ * The base color for the dropped banner.
20846
+ *
20847
+ */
20848
+ readonly baseColor: string;
20849
+ /**
20850
+ * @beta
20851
+ * @remarks
20852
+ * An array of {@link BannerPattern} objects used to decorate
20853
+ * the banner, including color and pattern type.
20854
+ *
20855
+ */
20856
+ readonly patterns: BannerPattern[];
18816
20857
  /**
18817
20858
  * @remarks
18818
20859
  * The type of banner to drop.
@@ -19355,6 +21396,19 @@ export class StructureManager {
19355
21396
  * Returns a Structure if it exists, otherwise undefined.
19356
21397
  */
19357
21398
  get(identifier: string): Structure | undefined;
21399
+ /**
21400
+ * @beta
21401
+ * @remarks
21402
+ * Returns a list of all structures contained in behavior
21403
+ * packs. Does not include structures saved to the world or in
21404
+ * memory.
21405
+ *
21406
+ * This function can't be called in restricted-execution mode.
21407
+ *
21408
+ * @returns
21409
+ * The list of structure identifiers.
21410
+ */
21411
+ getPackStructureIds(): string[];
19358
21412
  /**
19359
21413
  * @remarks
19360
21414
  * Returns a list of all structures saved to the world and to
@@ -19751,6 +21805,19 @@ export class SystemBeforeEvents {
19751
21805
  *
19752
21806
  */
19753
21807
  readonly startup: StartupBeforeEventSignal;
21808
+ /**
21809
+ * @beta
21810
+ * @remarks
21811
+ * Fires when the scripting watchdog shuts down the server. The
21812
+ * can be due to using too much memory, or by causing
21813
+ * significant slowdown or hang.
21814
+ * To prevent shutdown, set the event's cancel property to
21815
+ * true.
21816
+ *
21817
+ * This property can be read in early-execution mode.
21818
+ *
21819
+ */
21820
+ readonly watchdogTerminate: WatchdogTerminateBeforeEventSignal;
19754
21821
  }
19755
21822
 
19756
21823
  /**
@@ -19829,6 +21896,55 @@ export class TargetBlockHitAfterEventSignal {
19829
21896
  unsubscribe(callback: (arg0: TargetBlockHitAfterEvent) => void): void;
19830
21897
  }
19831
21898
 
21899
+ /**
21900
+ * @beta
21901
+ * A primitive shape class that represents a text label in the
21902
+ * world with a background.
21903
+ */
21904
+ // @ts-ignore Class inheritance allowed for native defined classes
21905
+ export class TextPrimitive extends PrimitiveShape {
21906
+ /**
21907
+ * @remarks
21908
+ * The color of the background plate of the text. If set to
21909
+ * undefined, it will use the default color.
21910
+ *
21911
+ */
21912
+ backgroundColorOverride?: RGBA;
21913
+ /**
21914
+ * @remarks
21915
+ * If set to true, the text will be hidden behind blocks or
21916
+ * entities. By default this is set to false (will always
21917
+ * render).
21918
+ *
21919
+ */
21920
+ depthTest: boolean;
21921
+ /**
21922
+ * @remarks
21923
+ * Get the text of the debug text shape. Returns the RawText of
21924
+ * the debug text if `setText` was called with a RawMessage or
21925
+ * a RawText object, otherwise returns a string.
21926
+ *
21927
+ */
21928
+ readonly text: RawMessage | string;
21929
+ /**
21930
+ * @remarks
21931
+ * If set to true, the text will not face the camera and
21932
+ * instead will use the rotation from the shape.
21933
+ *
21934
+ */
21935
+ useRotation: boolean;
21936
+ constructor(location: DimensionLocation | Vector3, text: RawMessage | string);
21937
+ /**
21938
+ * @remarks
21939
+ * Sets the text to display.
21940
+ *
21941
+ * @throws This function can throw errors.
21942
+ *
21943
+ * {@link RawMessageError}
21944
+ */
21945
+ setText(text: RawMessage | string): void;
21946
+ }
21947
+
19832
21948
  /**
19833
21949
  * @rc
19834
21950
  * This manager is used to add, remove or query temporary
@@ -20071,6 +22187,151 @@ export class TripWireTripAfterEventSignal {
20071
22187
  unsubscribe(callback: (arg0: TripWireTripAfterEvent) => void): void;
20072
22188
  }
20073
22189
 
22190
+ /**
22191
+ * @beta
22192
+ * Contains information related to a script watchdog
22193
+ * termination.
22194
+ */
22195
+ export class WatchdogTerminateBeforeEvent {
22196
+ private constructor();
22197
+ /**
22198
+ * @remarks
22199
+ * If set to true, cancels the termination of the script
22200
+ * runtime. Note that depending on server configuration
22201
+ * settings, cancellation of the termination may not be
22202
+ * allowed.
22203
+ *
22204
+ */
22205
+ cancel: boolean;
22206
+ /**
22207
+ * @remarks
22208
+ * Contains the reason why a script runtime is to be
22209
+ * terminated.
22210
+ *
22211
+ */
22212
+ readonly terminateReason: WatchdogTerminateReason;
22213
+ }
22214
+
22215
+ /**
22216
+ * @beta
22217
+ * Manages callbacks that are connected to a callback that will
22218
+ * be called when a script runtime is being terminated due to a
22219
+ * violation of the performance watchdog system.
22220
+ */
22221
+ export class WatchdogTerminateBeforeEventSignal {
22222
+ private constructor();
22223
+ /**
22224
+ * @remarks
22225
+ * Adds a callback that will be called when a script runtime is
22226
+ * being terminated due to a violation of the performance
22227
+ * watchdog system.
22228
+ *
22229
+ * This function can't be called in restricted-execution mode.
22230
+ *
22231
+ * This function can be called in early-execution mode.
22232
+ *
22233
+ * @param callback
22234
+ * This closure is called with restricted-execution privilege.
22235
+ * @returns
22236
+ * Closure that is called with restricted-execution privilege.
22237
+ */
22238
+ subscribe(callback: (arg0: WatchdogTerminateBeforeEvent) => void): (arg0: WatchdogTerminateBeforeEvent) => void;
22239
+ /**
22240
+ * @remarks
22241
+ * Removes a callback from being called when a script runtime
22242
+ * is being terminated due to a violation of the performance
22243
+ * watchdog system.
22244
+ *
22245
+ * This function can't be called in restricted-execution mode.
22246
+ *
22247
+ * This function can be called in early-execution mode.
22248
+ *
22249
+ * @param callback
22250
+ * This closure is called with restricted-execution privilege.
22251
+ */
22252
+ unsubscribe(callback: (arg0: WatchdogTerminateBeforeEvent) => void): void;
22253
+ }
22254
+
22255
+ /**
22256
+ * @beta
22257
+ * Base class for waypoints displayed on the player's locator
22258
+ * bar. Waypoints can track locations or entities and are
22259
+ * rendered with customizable textures and colors.
22260
+ *
22261
+ * Waypoints act as shared handles that can be added to
22262
+ * multiple players' locator bars. When you modify a waypoint's
22263
+ * properties (such as color, texture, or enabled state), the
22264
+ * changes are reflected for all players who have that waypoint
22265
+ * in their locator bar. This allows you to efficiently manage
22266
+ * waypoints across multiple players without creating separate
22267
+ * instances for each player.
22268
+ */
22269
+ export class Waypoint {
22270
+ private constructor();
22271
+ /**
22272
+ * @remarks
22273
+ * Optional {@link RGB} color tint applied to the waypoint
22274
+ * icon. If not specified, the waypoint uses its default color.
22275
+ *
22276
+ * This property can't be edited in restricted-execution mode.
22277
+ *
22278
+ */
22279
+ color?: RGB;
22280
+ /**
22281
+ * @remarks
22282
+ * Controls whether the waypoint is currently displayed on the
22283
+ * player's screen. When disabled, the waypoint is hidden but
22284
+ * remains valid.
22285
+ *
22286
+ * This property can't be edited in restricted-execution mode.
22287
+ *
22288
+ */
22289
+ isEnabled: boolean;
22290
+ /**
22291
+ * @remarks
22292
+ * Returns whether the waypoint is currently valid. A waypoint
22293
+ * becomes invalid when its tracked entity is no longer valid.
22294
+ *
22295
+ */
22296
+ readonly isValid: boolean;
22297
+ /**
22298
+ * @remarks
22299
+ * The {@link WaypointTextureSelector} that determines which
22300
+ * icon texture is displayed for the waypoint based on distance
22301
+ * or other criteria.
22302
+ *
22303
+ * This property can't be edited in restricted-execution mode.
22304
+ *
22305
+ */
22306
+ textureSelector: WaypointTextureSelector;
22307
+ /**
22308
+ * @remarks
22309
+ * Gets the current {@link DimensionLocation} of the waypoint.
22310
+ * For entity waypoints, this returns the entity's current
22311
+ * position. For location waypoints, this returns the stored
22312
+ * location.
22313
+ *
22314
+ * This function can't be called in restricted-execution mode.
22315
+ *
22316
+ * @throws This function can throw errors.
22317
+ *
22318
+ * {@link InvalidWaypointError}
22319
+ *
22320
+ * {@link InvalidWaypointTextureSelectorError}
22321
+ */
22322
+ getDimensionLocation(): DimensionLocation;
22323
+ /**
22324
+ * @remarks
22325
+ * Removes the waypoint from all locator bars it has been added
22326
+ * to. This affects all players who have this waypoint in their
22327
+ * locator bar.
22328
+ *
22329
+ * This function can't be called in restricted-execution mode.
22330
+ *
22331
+ */
22332
+ remove(): void;
22333
+ }
22334
+
20074
22335
  /**
20075
22336
  * Contains information related to changes in weather in the
20076
22337
  * environment.
@@ -20251,6 +22512,14 @@ export class World {
20251
22512
  */
20252
22513
  readonly gameRules: GameRules;
20253
22514
  readonly isHardcore: boolean;
22515
+ /**
22516
+ * @beta
22517
+ * @remarks
22518
+ * Manager for adding and removing primitive text objects in
22519
+ * the world.
22520
+ *
22521
+ */
22522
+ readonly primitiveShapesManager: PrimitiveShapesManager;
20254
22523
  /**
20255
22524
  * @remarks
20256
22525
  * Returns the general global scoreboard that applies to the
@@ -20279,6 +22548,20 @@ export class World {
20279
22548
  *
20280
22549
  */
20281
22550
  readonly tickingAreaManager: TickingAreaManager;
22551
+ /**
22552
+ * @beta
22553
+ * @remarks
22554
+ * A method that is internal-only, used for broadcasting
22555
+ * specific messages between client and server.
22556
+ *
22557
+ * This function can't be called in restricted-execution mode.
22558
+ *
22559
+ * @param id
22560
+ * The message identifier.
22561
+ * @param value
22562
+ * The message.
22563
+ */
22564
+ broadcastClientMessage(id: string, value: string): void;
20282
22565
  /**
20283
22566
  * @remarks
20284
22567
  * Clears the set of dynamic properties declared for this
@@ -20476,6 +22759,15 @@ export class World {
20476
22759
  *
20477
22760
  */
20478
22761
  getMoonPhase(): MoonPhase;
22762
+ /**
22763
+ * @beta
22764
+ * @remarks
22765
+ * Returns a map of pack setting name and value pairs.
22766
+ *
22767
+ * This function can be called in early-execution mode.
22768
+ *
22769
+ */
22770
+ getPackSettings(): Record<string, boolean | number | string>;
20479
22771
  /**
20480
22772
  * @remarks
20481
22773
  * Returns a set of players based on a set of conditions
@@ -20724,15 +23016,33 @@ export class World {
20724
23016
  * This function can't be called in restricted-execution mode.
20725
23017
  *
20726
23018
  */
20727
- stopMusic(): void;
20728
- }
20729
-
20730
- /**
20731
- * Contains a set of events that are available across the scope
20732
- * of the World.
20733
- */
20734
- export class WorldAfterEvents {
20735
- private constructor();
23019
+ stopMusic(): void;
23020
+ }
23021
+
23022
+ /**
23023
+ * Contains a set of events that are available across the scope
23024
+ * of the World.
23025
+ */
23026
+ export class WorldAfterEvents {
23027
+ private constructor();
23028
+ /**
23029
+ * @beta
23030
+ * @remarks
23031
+ * This event fires when a block container is closed.
23032
+ *
23033
+ * This property can be read in early-execution mode.
23034
+ *
23035
+ */
23036
+ readonly blockContainerClosed: BlockContainerClosedAfterEventSignal;
23037
+ /**
23038
+ * @beta
23039
+ * @remarks
23040
+ * This event fires when a block container is opened.
23041
+ *
23042
+ * This property can be read in early-execution mode.
23043
+ *
23044
+ */
23045
+ readonly blockContainerOpened: BlockContainerOpenedAfterEventSignal;
20736
23046
  /**
20737
23047
  * @remarks
20738
23048
  * This event fires for each BlockLocation destroyed by an
@@ -20751,6 +23061,16 @@ export class WorldAfterEvents {
20751
23061
  *
20752
23062
  */
20753
23063
  readonly buttonPush: ButtonPushAfterEventSignal;
23064
+ /**
23065
+ * @beta
23066
+ * @remarks
23067
+ * This event is triggered after a chat message has been
23068
+ * broadcast or sent to players.
23069
+ *
23070
+ * This property can be read in early-execution mode.
23071
+ *
23072
+ */
23073
+ readonly chatSend: ChatSendAfterEventSignal;
20754
23074
  /**
20755
23075
  * @remarks
20756
23076
  * This event is fired when an entity event has been triggered
@@ -20770,6 +23090,24 @@ export class WorldAfterEvents {
20770
23090
  *
20771
23091
  */
20772
23092
  readonly effectAdd: EffectAddAfterEventSignal;
23093
+ /**
23094
+ * @beta
23095
+ * @remarks
23096
+ * This event fires when an entity container is closed.
23097
+ *
23098
+ * This property can be read in early-execution mode.
23099
+ *
23100
+ */
23101
+ readonly entityContainerClosed: EntityContainerClosedAfterEventSignal;
23102
+ /**
23103
+ * @beta
23104
+ * @remarks
23105
+ * This event fires when an entity container is opened.
23106
+ *
23107
+ * This property can be read in early-execution mode.
23108
+ *
23109
+ */
23110
+ readonly entityContainerOpened: EntityContainerOpenedAfterEventSignal;
20773
23111
  /**
20774
23112
  * @remarks
20775
23113
  * This event fires when an entity dies.
@@ -20952,6 +23290,25 @@ export class WorldAfterEvents {
20952
23290
  *
20953
23291
  */
20954
23292
  readonly leverAction: LeverActionAfterEventSignal;
23293
+ /**
23294
+ * @beta
23295
+ * @remarks
23296
+ * This event is an internal implementation detail, and is
23297
+ * otherwise not currently functional.
23298
+ *
23299
+ * This property can be read in early-execution mode.
23300
+ *
23301
+ */
23302
+ readonly messageReceive: ServerMessageAfterEventSignal;
23303
+ /**
23304
+ * @beta
23305
+ * @remarks
23306
+ * This event is triggered when a pack setting is changed.
23307
+ *
23308
+ * This property can be read in early-execution mode.
23309
+ *
23310
+ */
23311
+ readonly packSettingChange: PackSettingChangeAfterEventSignal;
20955
23312
  /**
20956
23313
  * @remarks
20957
23314
  * This event fires when a piston expands or retracts.
@@ -21088,6 +23445,16 @@ export class WorldAfterEvents {
21088
23445
  *
21089
23446
  */
21090
23447
  readonly playerSwingStart: PlayerSwingStartAfterEventSignal;
23448
+ /**
23449
+ * @beta
23450
+ * @remarks
23451
+ * An event for when a player uses a named name tag on an
23452
+ * entity.
23453
+ *
23454
+ * This property can be read in early-execution mode.
23455
+ *
23456
+ */
23457
+ readonly playerUseNameTag: PlayerUseNameTagAfterEventSignal;
21091
23458
  /**
21092
23459
  * @remarks
21093
23460
  * A pressure plate has popped back up (i.e., there are no
@@ -21164,6 +23531,43 @@ export class WorldAfterEvents {
21164
23531
  */
21165
23532
  export class WorldBeforeEvents {
21166
23533
  private constructor();
23534
+ /**
23535
+ * @beta
23536
+ * @remarks
23537
+ * This event is triggered after a chat message has been
23538
+ * broadcast or sent to players.
23539
+ *
23540
+ * This property can be read in early-execution mode.
23541
+ *
23542
+ * @example customCommand.ts
23543
+ * ```typescript
23544
+ * import { world, DimensionLocation } from "@minecraft/server";
23545
+ *
23546
+ * function customCommand(targetLocation: DimensionLocation) {
23547
+ * const chatCallback = world.beforeEvents.chatSend.subscribe((eventData) => {
23548
+ * if (eventData.message.includes("cancel")) {
23549
+ * // Cancel event if the message contains "cancel"
23550
+ * eventData.cancel = true;
23551
+ * } else {
23552
+ * const args = eventData.message.split(" ");
23553
+ *
23554
+ * if (args.length > 0) {
23555
+ * switch (args[0].toLowerCase()) {
23556
+ * case "echo":
23557
+ * // Send a modified version of chat message
23558
+ * world.sendMessage(`Echo '${eventData.message.substring(4).trim()}'`);
23559
+ * break;
23560
+ * case "help":
23561
+ * world.sendMessage(`Available commands: echo <message>`);
23562
+ * break;
23563
+ * }
23564
+ * }
23565
+ * }
23566
+ * });
23567
+ * }
23568
+ * ```
23569
+ */
23570
+ readonly chatSend: ChatSendBeforeEventSignal;
21167
23571
  /**
21168
23572
  * @remarks
21169
23573
  * This event is triggered after an event has been added to an
@@ -21260,6 +23664,15 @@ export class WorldBeforeEvents {
21260
23664
  *
21261
23665
  */
21262
23666
  readonly playerLeave: PlayerLeaveBeforeEventSignal;
23667
+ /**
23668
+ * @beta
23669
+ * @remarks
23670
+ * This event fires before a block is placed by a player.
23671
+ *
23672
+ * This property can be read in early-execution mode.
23673
+ *
23674
+ */
23675
+ readonly playerPlaceBlock: PlayerPlaceBlockBeforeEventSignal;
21263
23676
  /**
21264
23677
  * @remarks
21265
23678
  * This property can be read in early-execution mode.
@@ -21341,13 +23754,27 @@ export interface BiomeFilter {
21341
23754
  includeTags?: string[];
21342
23755
  }
21343
23756
 
23757
+ /**
23758
+ * @beta
23759
+ * Contains additional options for searches for the
23760
+ * dimension.findNearestBiome API.
23761
+ */
23762
+ export interface BiomeSearchOptions {
23763
+ /**
23764
+ * @remarks
23765
+ * Bounding volume size to look within.
23766
+ *
23767
+ */
23768
+ boundingSize?: Vector3;
23769
+ }
23770
+
21344
23771
  /**
21345
23772
  * A BlockBoundingBox is an interface to an object which
21346
23773
  * represents an AABB aligned rectangle.
21347
23774
  * The BlockBoundingBox assumes that it was created in a valid
21348
23775
  * state (min <= max) but cannot guarantee it (unless it was
21349
- * created using the associated {@link
21350
- * @minecraft/server.BlockBoundingBoxUtils} utility functions.
23776
+ * created using the associated {@link BlockBoundingBoxUtils}
23777
+ * utility functions.
21351
23778
  * The min/max coordinates represent the diametrically opposite
21352
23779
  * corners of the rectangle.
21353
23780
  * The BlockBoundingBox is not a representation of blocks - it
@@ -21374,6 +23801,27 @@ export interface BlockBoundingBox {
21374
23801
  min: Vector3;
21375
23802
  }
21376
23803
 
23804
+ /**
23805
+ * @beta
23806
+ * Options used to filter block container access events.
23807
+ */
23808
+ export interface BlockContainerAccessEventOptions {
23809
+ /**
23810
+ * @remarks
23811
+ * If present will filter which container access sources can
23812
+ * trigger the event.
23813
+ *
23814
+ */
23815
+ accessSourceFilter?: ContainerAccessSourceFilter;
23816
+ /**
23817
+ * @remarks
23818
+ * If present will filter which container blocks can trigger
23819
+ * the event.
23820
+ *
23821
+ */
23822
+ blockFilter?: BlockFilter;
23823
+ }
23824
+
21377
23825
  /**
21378
23826
  * Contains a set of events that will be raised for a block.
21379
23827
  * This object must be bound using the BlockRegistry.
@@ -21775,6 +24223,67 @@ export interface CameraTargetOptions {
21775
24223
  targetEntity: Entity;
21776
24224
  }
21777
24225
 
24226
+ /**
24227
+ * @beta
24228
+ * This interface defines an entry into the {@link
24229
+ * CompoundBlockVolume} which represents a volume of positive
24230
+ * or negative space.
24231
+ *
24232
+ */
24233
+ export interface CompoundBlockVolumeItem {
24234
+ /**
24235
+ * @remarks
24236
+ * The 'action' defines how the block volume is represented in
24237
+ * the compound block volume stack.
24238
+ * 'Add' creates a block volume which is positively selected
24239
+ * 'Subtract' creates a block volume which represents a hole or
24240
+ * negative space in the overall compound block volume.
24241
+ *
24242
+ */
24243
+ action?: CompoundBlockVolumeAction;
24244
+ /**
24245
+ * @remarks
24246
+ * The relativity enumeration determines whether the
24247
+ * BlockVolume specified is positioned relative to the parent
24248
+ * compound block volume origin, or in absolute world space.
24249
+ *
24250
+ */
24251
+ locationRelativity?: CompoundBlockVolumePositionRelativity;
24252
+ /**
24253
+ * @remarks
24254
+ * The volume of space
24255
+ *
24256
+ */
24257
+ volume: BlockVolume;
24258
+ }
24259
+
24260
+ /**
24261
+ * @beta
24262
+ * Represents the source of a container access.
24263
+ */
24264
+ export interface ContainerAccessSource {
24265
+ /**
24266
+ * @remarks
24267
+ * The entity that triggered the container access.
24268
+ *
24269
+ */
24270
+ entity?: Entity;
24271
+ }
24272
+
24273
+ /**
24274
+ * @beta
24275
+ * Options for use when filtering container access sources.
24276
+ */
24277
+ export interface ContainerAccessSourceFilter {
24278
+ /**
24279
+ * @remarks
24280
+ * Filter options for the source entity accessing the
24281
+ * container.
24282
+ *
24283
+ */
24284
+ entityFilter?: EntityFilter;
24285
+ }
24286
+
21778
24287
  /**
21779
24288
  * Rules that if broken on container operations will throw an
21780
24289
  * error.
@@ -21859,6 +24368,15 @@ export interface CustomCommand {
21859
24368
  * command.
21860
24369
  */
21861
24370
  export interface CustomCommandParameter {
24371
+ /**
24372
+ * @beta
24373
+ * @remarks
24374
+ * Can be used to reference the enum name when {@link
24375
+ * CustomCommandParamType} is 'Enum'. Allows the parameter name
24376
+ * to be different from the enum name.
24377
+ *
24378
+ */
24379
+ enumName?: string;
21862
24380
  /**
21863
24381
  * @remarks
21864
24382
  * The name of parameter as it appears on the command line.
@@ -21911,6 +24429,14 @@ export interface DefinitionModifier {
21911
24429
  *
21912
24430
  */
21913
24431
  removedComponentGroups: string[];
24432
+ /**
24433
+ * @beta
24434
+ * @remarks
24435
+ * The list of entity definition events that will be fired via
24436
+ * this update.
24437
+ *
24438
+ */
24439
+ triggers: Trigger[];
21914
24440
  }
21915
24441
 
21916
24442
  /**
@@ -22019,6 +24545,27 @@ export interface EntityApplyDamageOptions {
22019
24545
  damagingEntity?: Entity;
22020
24546
  }
22021
24547
 
24548
+ /**
24549
+ * @beta
24550
+ * Options used to filter entity container access events.
24551
+ */
24552
+ export interface EntityContainerAccessEventOptions {
24553
+ /**
24554
+ * @remarks
24555
+ * If present will filter which container access sources can
24556
+ * trigger the event.
24557
+ *
24558
+ */
24559
+ accessSourceFilter?: ContainerAccessSourceFilter;
24560
+ /**
24561
+ * @remarks
24562
+ * If present will filter which entity containers can trigger
24563
+ * the event.
24564
+ *
24565
+ */
24566
+ entityFilter?: EntityFilter;
24567
+ }
24568
+
22022
24569
  /**
22023
24570
  * Provides information about how damage has been applied to an
22024
24571
  * entity.
@@ -22703,6 +25250,37 @@ export interface EntityRaycastOptions extends EntityFilter {
22703
25250
  maxDistance?: number;
22704
25251
  }
22705
25252
 
25253
+ /**
25254
+ * @beta
25255
+ * Controls when a waypoint is visible based on the state of
25256
+ * the entity it tracks. These rules allow filtering waypoint
25257
+ * visibility by entity conditions like sneaking, invisibility,
25258
+ * and death state.
25259
+ */
25260
+ export interface EntityVisibilityRules {
25261
+ /**
25262
+ * @remarks
25263
+ * Controls whether the waypoint is shown when the tracked
25264
+ * entity is dead. If undefined, defaults to true.
25265
+ *
25266
+ */
25267
+ showDead?: boolean;
25268
+ /**
25269
+ * @remarks
25270
+ * Controls whether the waypoint is shown when the tracked
25271
+ * entity is invisible. If undefined, defaults to true.
25272
+ *
25273
+ */
25274
+ showInvisible?: boolean;
25275
+ /**
25276
+ * @remarks
25277
+ * Controls whether the waypoint is shown when the tracked
25278
+ * entity is sneaking. If undefined, defaults to true.
25279
+ *
25280
+ */
25281
+ showSneaking?: boolean;
25282
+ }
25283
+
22706
25284
  /**
22707
25285
  * Equal to operator.
22708
25286
  */
@@ -23234,6 +25812,39 @@ export interface PlayerSwingEventOptions {
23234
25812
  swingSource?: EntitySwingSource;
23235
25813
  }
23236
25814
 
25815
+ /**
25816
+ * @beta
25817
+ * Controls when a waypoint is visible based on player-specific
25818
+ * states. Extends {@link EntityVisibilityRules} with
25819
+ * additional rules for player-only states like hidden mode and
25820
+ * spectator mode.
25821
+ */
25822
+ // @ts-ignore Class inheritance allowed for native defined classes
25823
+ export interface PlayerVisibilityRules extends EntityVisibilityRules {
25824
+ /**
25825
+ * @remarks
25826
+ * Controls whether the waypoint is shown when the tracked
25827
+ * player is hidden. If undefined, defaults to true.
25828
+ *
25829
+ */
25830
+ showHidden?: boolean;
25831
+ /**
25832
+ * @remarks
25833
+ * Controls whether the waypoint is shown when the tracked
25834
+ * player is in spectator mode. If undefined, defaults to true.
25835
+ *
25836
+ */
25837
+ showSpectator?: boolean;
25838
+ /**
25839
+ * @remarks
25840
+ * Controls whether the waypoint is shown when a spectator is
25841
+ * viewing another spectator player. If undefined, defaults to
25842
+ * true.
25843
+ *
25844
+ */
25845
+ showSpectatorToSpectator?: boolean;
25846
+ }
25847
+
23237
25848
  /**
23238
25849
  * @rc
23239
25850
  * Key frame that holds the progress of the camera animation.
@@ -23938,6 +26549,60 @@ export interface VectorXZ {
23938
26549
  z: number;
23939
26550
  }
23940
26551
 
26552
+ /**
26553
+ * @beta
26554
+ * Defines a texture and the distance range in which it should
26555
+ * be displayed. Used within a {@link WaypointTextureSelector}
26556
+ * to create distance-based texture switching.
26557
+ */
26558
+ export interface WaypointTextureBounds {
26559
+ /**
26560
+ * @remarks
26561
+ * The lower distance bound for this texture. The texture is
26562
+ * displayed when the distance to the waypoint is greater than
26563
+ * this value. Value must be greater than or equal to 0.
26564
+ *
26565
+ * Minimum Value: 0
26566
+ */
26567
+ lowerBound: number;
26568
+ /**
26569
+ * @remarks
26570
+ * The {@link WaypointTexture} to display within this distance
26571
+ * range.
26572
+ *
26573
+ */
26574
+ texture: WaypointTexture;
26575
+ /**
26576
+ * @remarks
26577
+ * The upper distance bound for this texture. The texture is
26578
+ * displayed when the distance to the waypoint is less than or
26579
+ * equal to this value. If undefined, there is no upper limit.
26580
+ * Value must be greater than or equal to 0.
26581
+ *
26582
+ * Minimum Value: 0
26583
+ */
26584
+ upperBound?: number;
26585
+ }
26586
+
26587
+ /**
26588
+ * @beta
26589
+ * Defines how waypoint textures change based on distance.
26590
+ * Contains a list of texture bounds that determine which
26591
+ * texture is displayed at different distance ranges.
26592
+ */
26593
+ export interface WaypointTextureSelector {
26594
+ /**
26595
+ * @remarks
26596
+ * An array of {@link WaypointTextureBounds} that define which
26597
+ * textures are displayed at different distance ranges. The
26598
+ * system evaluates these bounds to determine the appropriate
26599
+ * texture based on the current distance to the waypoint. The
26600
+ * list has a maximum size limit of 16.
26601
+ *
26602
+ */
26603
+ textureBoundsList: WaypointTextureBounds[];
26604
+ }
26605
+
23941
26606
  /**
23942
26607
  * Contains additional options for a playSound occurrence.
23943
26608
  */
@@ -24121,6 +26786,16 @@ export class InvalidContainerSlotError extends Error {
24121
26786
  private constructor();
24122
26787
  }
24123
26788
 
26789
+ /**
26790
+ * @beta
26791
+ * This error can occur when accessing components on an entity
26792
+ * that doesn't have them.
26793
+ */
26794
+ // @ts-ignore Class inheritance allowed for native defined classes
26795
+ export class InvalidEntityComponentError extends Error {
26796
+ private constructor();
26797
+ }
26798
+
24124
26799
  /**
24125
26800
  * The error called when an entity is invalid. This can occur
24126
26801
  * when accessing components on a removed entity.
@@ -24187,6 +26862,25 @@ export class InvalidStructureError extends Error {
24187
26862
  private constructor();
24188
26863
  }
24189
26864
 
26865
+ /**
26866
+ * @beta
26867
+ * Error thrown when attempting to perform operations on an
26868
+ * invalid waypoint. A waypoint becomes invalid when it is
26869
+ * removed or when the entity it tracks is no longer valid.
26870
+ */
26871
+ // @ts-ignore Class inheritance allowed for native defined classes
26872
+ export class InvalidWaypointError extends Error {
26873
+ private constructor();
26874
+ }
26875
+
26876
+ /**
26877
+ * @beta
26878
+ */
26879
+ // @ts-ignore Class inheritance allowed for native defined classes
26880
+ export class InvalidWaypointTextureSelectorError extends Error {
26881
+ private constructor();
26882
+ }
26883
+
24190
26884
  /**
24191
26885
  * Thrown when trying to register an item custom component with
24192
26886
  * a name that has already been registered.
@@ -24243,6 +26937,25 @@ export class LocationOutOfWorldBoundariesError extends Error {
24243
26937
  private constructor();
24244
26938
  }
24245
26939
 
26940
+ /**
26941
+ * @beta
26942
+ * Error thrown when a locator bar operation fails. Contains a
26943
+ * reason code indicating the specific cause of the error.
26944
+ */
26945
+ // @ts-ignore Class inheritance allowed for native defined classes
26946
+ export class LocatorBarError extends Error {
26947
+ private constructor();
26948
+ /**
26949
+ * @remarks
26950
+ * The {@link LocatorBarErrorReason} code that indicates why
26951
+ * the locator bar operation failed.
26952
+ *
26953
+ * This property can be read in early-execution mode.
26954
+ *
26955
+ */
26956
+ readonly reason: LocatorBarErrorReason;
26957
+ }
26958
+
24246
26959
  /**
24247
26960
  * Thrown when a name requires a namespace and an error occurs
24248
26961
  * when validating that namespace