@minecraft/server 1.9.0-beta.1.20.60-preview.23 → 1.9.0-beta.1.20.60-preview.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.d.ts +487 -74
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -37,11 +37,36 @@ export enum BlockComponentTypes {
37
37
 
38
38
  /**
39
39
  * @beta
40
+ * An enumeration describing the state of a block piston.
40
41
  */
41
42
  export enum BlockPistonState {
43
+ /**
44
+ * @beta
45
+ * @remarks
46
+ * Whether the piston is fully expanded.
47
+ *
48
+ */
42
49
  Expanded = 'Expanded',
50
+ /**
51
+ * @beta
52
+ * @remarks
53
+ * Whether the piston is in the process of expanding.
54
+ *
55
+ */
43
56
  Expanding = 'Expanding',
57
+ /**
58
+ * @beta
59
+ * @remarks
60
+ * Whether the piston is fully retracted.
61
+ *
62
+ */
44
63
  Retracted = 'Retracted',
64
+ /**
65
+ * @beta
66
+ * @remarks
67
+ * Whether the piston is in the process of retracting.
68
+ *
69
+ */
45
70
  Retracting = 'Retracting',
46
71
  }
47
72
 
@@ -861,11 +886,37 @@ export enum GameMode {
861
886
 
862
887
  /**
863
888
  * @beta
889
+ * The types of item components that are accessible via
890
+ * function ItemStack.getComponent.
864
891
  */
865
892
  export enum ItemComponentTypes {
893
+ /**
894
+ * @beta
895
+ * @remarks
896
+ * The minecraft:cooldown component.
897
+ *
898
+ */
866
899
  Cooldown = 'minecraft:cooldown',
900
+ /**
901
+ * @beta
902
+ * @remarks
903
+ * The minecraft:durability component.
904
+ *
905
+ */
867
906
  Durability = 'minecraft:durability',
907
+ /**
908
+ * @beta
909
+ * @remarks
910
+ * The minecraft:enchantable component.
911
+ *
912
+ */
868
913
  Enchantable = 'minecraft:enchantable',
914
+ /**
915
+ * @beta
916
+ * @remarks
917
+ * The minecraft:food component.
918
+ *
919
+ */
869
920
  Food = 'minecraft:food',
870
921
  }
871
922
 
@@ -1325,6 +1376,23 @@ export type ItemComponentTypeMap = {
1325
1376
  'minecraft:food': ItemFoodComponent;
1326
1377
  };
1327
1378
 
1379
+ /**
1380
+ * @beta
1381
+ */
1382
+ export class BiomeType {
1383
+ private constructor();
1384
+ readonly id: string;
1385
+ }
1386
+
1387
+ /**
1388
+ * @beta
1389
+ */
1390
+ export class BiomeTypes {
1391
+ private constructor();
1392
+ static get(typeName: string): BiomeType | undefined;
1393
+ static getAll(): BiomeType[];
1394
+ }
1395
+
1328
1396
  /**
1329
1397
  * Represents a block in a dimension. A block represents a
1330
1398
  * unique X, Y, and Z within a dimension and get/sets the state
@@ -1384,10 +1452,13 @@ export class Block {
1384
1452
  * @remarks
1385
1453
  * Returns or sets whether this block has a liquid on it.
1386
1454
  *
1387
- * This property can't be edited in read-only mode.
1455
+ * @throws This property can throw when used.
1456
+ *
1457
+ * {@link LocationInUnloadedChunkError}
1388
1458
  *
1459
+ * {@link LocationOutOfWorldBoundariesError}
1389
1460
  */
1390
- isWaterlogged: boolean;
1461
+ readonly isWaterlogged: boolean;
1391
1462
  /**
1392
1463
  * @remarks
1393
1464
  * Coordinates of the specified block.
@@ -1640,6 +1711,17 @@ export class Block {
1640
1711
  * True if this block object is still working and valid.
1641
1712
  */
1642
1713
  isValid(): boolean;
1714
+ /**
1715
+ * @beta
1716
+ * @throws This function can throw errors.
1717
+ *
1718
+ * {@link Error}
1719
+ *
1720
+ * {@link LocationInUnloadedChunkError}
1721
+ *
1722
+ * {@link LocationOutOfWorldBoundariesError}
1723
+ */
1724
+ matches(blockName: string, states?: Record<string, boolean | number | string>): boolean;
1643
1725
  /**
1644
1726
  * @remarks
1645
1727
  * Returns the {@link Block} to the north of this block
@@ -1708,6 +1790,20 @@ export class Block {
1708
1790
  * {@link LocationOutOfWorldBoundariesError}
1709
1791
  */
1710
1792
  setType(blockType: BlockType | string): void;
1793
+ /**
1794
+ * @beta
1795
+ * @remarks
1796
+ * This function can't be called in read-only mode.
1797
+ *
1798
+ * @throws This function can throw errors.
1799
+ *
1800
+ * {@link Error}
1801
+ *
1802
+ * {@link LocationInUnloadedChunkError}
1803
+ *
1804
+ * {@link LocationOutOfWorldBoundariesError}
1805
+ */
1806
+ setWaterlogged(isWaterlogged: boolean): void;
1711
1807
  /**
1712
1808
  * @remarks
1713
1809
  * Returns the {@link Block} to the south of this block
@@ -2156,6 +2252,9 @@ export class BlockPistonComponent extends BlockComponent {
2156
2252
  */
2157
2253
  readonly isMoving: boolean;
2158
2254
  /**
2255
+ * @remarks
2256
+ * The current state of the piston.
2257
+ *
2159
2258
  * @throws This property can throw when used.
2160
2259
  */
2161
2260
  readonly state: BlockPistonState;
@@ -2169,6 +2268,10 @@ export class BlockPistonComponent extends BlockComponent {
2169
2268
  */
2170
2269
  getAttachedBlocks(): Block[];
2171
2270
  /**
2271
+ * @remarks
2272
+ * Retrieves a set of block locations that this piston is
2273
+ * connected with.
2274
+ *
2172
2275
  * @throws This function can throw errors.
2173
2276
  */
2174
2277
  getAttachedBlocksLocations(): Vector3[];
@@ -2300,30 +2403,53 @@ export class BlockSignComponent extends BlockComponent {
2300
2403
  * The side of the sign the message will be set on. If not
2301
2404
  * provided, the message will be set on the front side of the
2302
2405
  * sign.
2303
- * @throws This function can throw errors.
2406
+ * @throws
2407
+ * Throws if the provided message is greater than 512
2408
+ * characters in length.
2304
2409
  * @example SetRawMessage.ts
2305
2410
  * ```typescript
2306
- * const helloWorldMessage: RawMessage = { text: 'Hello World' };
2411
+ * const signLocation: Vector3 = { x: 0, y: -60, z: 0 }; // Replace with your sign's coordinates
2412
+ * const block = world.getDimension("overworld").getBlock(signLocation);
2413
+ * if (!block) {
2414
+ * world.sendMessage("Could not find a block at specified location.");
2415
+ * return;
2416
+ * }
2417
+ * const sign = block.getComponent("minecraft:sign") as BlockSignComponent;
2418
+ * const helloWorldMessage: RawMessage = { text: "Hello World" };
2307
2419
  * sign.setText(helloWorldMessage);
2308
2420
  *
2309
2421
  * // Sign text will be saved as a RawText
2310
- * const result: RawText = sign.getRawText();
2311
- * JSON.stringify(result); // { rawtext: [{ text: 'Hello World' }] };
2422
+ * const result = sign.getRawText();
2423
+ * world.sendMessage(JSON.stringify(result)); // { rawtext: [{ text: 'Hello World' }] };
2312
2424
  * ```
2313
2425
  * @example SetRawText.ts
2314
2426
  * ```typescript
2315
- * const helloWorldText: RawText = { rawtext: [{ text: 'Hello World' }] };
2427
+ * const signLocation: Vector3 = { x: 0, y: -60, z: 0 }; // Replace with your sign's coordinates
2428
+ * const block = world.getDimension("overworld").getBlock(signLocation);
2429
+ * if (!block) {
2430
+ * world.sendMessage("Could not find a block at specified location.");
2431
+ * return;
2432
+ * }
2433
+ * const sign = block.getComponent("minecraft:sign") as BlockSignComponent;
2434
+ * const helloWorldText: RawText = { rawtext: [{ text: "Hello World" }] };
2316
2435
  * sign.setText(helloWorldText);
2317
2436
  *
2318
2437
  * // There will be no data transformation unlike calling setText with a RawMessage
2319
- * const result: RawText = sign.getRawText();
2320
- * JSON.stringify(result); // { rawtext: [{ text: 'Hello World' }] };
2438
+ * const result = sign.getRawText();
2439
+ * world.sendMessage(JSON.stringify(result)); // { rawtext: [{ text: 'Hello World' }] };
2321
2440
  * ```
2322
2441
  * @example SetString.ts
2323
2442
  * ```typescript
2443
+ * const signLocation: Vector3 = { x: 0, y: -60, z: 0 }; // Replace with your sign's coordinates
2444
+ * const block = world.getDimension("overworld").getBlock(signLocation);
2445
+ * if (!block) {
2446
+ * world.sendMessage("Could not find a block at specified location.");
2447
+ * return;
2448
+ * }
2449
+ * const sign = block.getComponent("minecraft:sign") as BlockSignComponent;
2324
2450
  * // Set sign to say 'Hello'
2325
- * sign.setText('Hello');
2326
- * sign.getText(); // 'Hello'
2451
+ * sign.setText("Hello World");
2452
+ * world.sendMessage(sign.getText() ?? "undefined"); // 'Hello World'
2327
2453
  * ```
2328
2454
  */
2329
2455
  setText(message: RawMessage | RawText | string, side?: SignSide): void;
@@ -3549,19 +3675,49 @@ export class ContainerSlot {
3549
3675
  */
3550
3676
  readonly typeId?: string;
3551
3677
  /**
3552
- * @throws This function can throw errors.
3678
+ * @remarks
3679
+ * Clears all dynamic properties that have been set on this
3680
+ * item stack.
3681
+ *
3682
+ * @throws
3683
+ * Throws if the slot's container is invalid.
3553
3684
  */
3554
3685
  clearDynamicProperties(): void;
3555
3686
  /**
3556
- * @throws This function can throw errors.
3687
+ * @remarks
3688
+ * Returns a property value.
3689
+ *
3690
+ * @param identifier
3691
+ * The property identifier.
3692
+ * @returns
3693
+ * Returns the value for the property, or undefined if the
3694
+ * property has not been set.
3695
+ * @throws
3696
+ * Throws if the slot's container is invalid.
3557
3697
  */
3558
3698
  getDynamicProperty(identifier: string): boolean | number | string | Vector3 | undefined;
3559
3699
  /**
3560
- * @throws This function can throw errors.
3700
+ * @remarks
3701
+ * Returns the available set of dynamic property identifiers
3702
+ * that have been used on this item stack.
3703
+ *
3704
+ * @returns
3705
+ * A string array of the dynamic properties set on this entity.
3706
+ * @throws
3707
+ * Throws if the slot's container is invalid.
3561
3708
  */
3562
3709
  getDynamicPropertyIds(): string[];
3563
3710
  /**
3564
- * @throws This function can throw errors.
3711
+ * @remarks
3712
+ * Returns the total size, in bytes, of all the dynamic
3713
+ * properties that are currently stored for this entity. This
3714
+ * includes the size of both the key and the value. This can
3715
+ * be useful for diagnosing performance warning signs - if, for
3716
+ * example, an entity has many megabytes of associated dynamic
3717
+ * properties, it may be slow to load on various devices.
3718
+ *
3719
+ * @throws
3720
+ * Throws if the slot's container is invalid.
3565
3721
  */
3566
3722
  getDynamicPropertyTotalByteCount(): number;
3567
3723
  /**
@@ -3572,7 +3728,8 @@ export class ContainerSlot {
3572
3728
  * @returns
3573
3729
  * Returns a copy of the item in the slot. Returns undefined if
3574
3730
  * the slot is empty.
3575
- * @throws This function can throw errors.
3731
+ * @throws
3732
+ * Throws if the slot's container is invalid.
3576
3733
  */
3577
3734
  getItem(): ItemStack | undefined;
3578
3735
  /**
@@ -3594,7 +3751,8 @@ export class ContainerSlot {
3594
3751
  * @returns
3595
3752
  * Returns all tags for the item in the slot. Return an empty
3596
3753
  * array if the the slot is empty.
3597
- * @throws This function can throw errors.
3754
+ * @throws
3755
+ * Throws if the slot's container is invalid.
3598
3756
  */
3599
3757
  getTags(): string[];
3600
3758
  /**
@@ -3606,7 +3764,8 @@ export class ContainerSlot {
3606
3764
  * @returns
3607
3765
  * Returns false when the slot is empty or the item in the slot
3608
3766
  * does not have the given tag.
3609
- * @throws This function can throw errors.
3767
+ * @throws
3768
+ * Throws if the slot's container is invalid.
3610
3769
  */
3611
3770
  hasTag(tag: string): boolean;
3612
3771
  /**
@@ -3666,7 +3825,15 @@ export class ContainerSlot {
3666
3825
  */
3667
3826
  setCanPlaceOn(blockIdentifiers?: string[]): void;
3668
3827
  /**
3669
- * @throws This function can throw errors.
3828
+ * @remarks
3829
+ * Sets a specified property to a value.
3830
+ *
3831
+ * @param identifier
3832
+ * The property identifier.
3833
+ * @param value
3834
+ * Data value of the property to set.
3835
+ * @throws
3836
+ * Throws if the slot's container is invalid.
3670
3837
  */
3671
3838
  setDynamicProperty(identifier: string, value?: boolean | number | string | Vector3): void;
3672
3839
  /**
@@ -3678,7 +3845,8 @@ export class ContainerSlot {
3678
3845
  *
3679
3846
  * @param itemStack
3680
3847
  * The ItemStack to be placed in the slot.
3681
- * @throws This function can throw errors.
3848
+ * @throws
3849
+ * Throws if the slot's container is invalid.
3682
3850
  */
3683
3851
  setItem(itemStack?: ItemStack): void;
3684
3852
  /**
@@ -3934,6 +4102,18 @@ export class Dimension {
3934
4102
  block: BlockPermutation | BlockType | string,
3935
4103
  options?: BlockFillOptions,
3936
4104
  ): number;
4105
+ /**
4106
+ * @beta
4107
+ * @remarks
4108
+ * This function can't be called in read-only mode.
4109
+ *
4110
+ * @throws This function can throw errors.
4111
+ *
4112
+ * {@link minecraftcommon.EngineError}
4113
+ *
4114
+ * {@link Error}
4115
+ */
4116
+ findClosestBiome(pos: Vector3, biomeToFind: BiomeType | string, options?: BiomeSearchOptions): Vector3 | undefined;
3937
4117
  /**
3938
4118
  * @remarks
3939
4119
  * Returns a block instance at the given location.
@@ -4549,7 +4729,8 @@ export class EnchantmentType {
4549
4729
 
4550
4730
  /**
4551
4731
  * @beta
4552
- * Provides a list of enchantment types.
4732
+ * Contains a catalog of Minecraft Enchantment Types that are
4733
+ * available in this world.
4553
4734
  */
4554
4735
  export class EnchantmentTypes {
4555
4736
  private constructor();
@@ -5029,11 +5210,11 @@ export class Entity {
5029
5210
  /**
5030
5211
  * @remarks
5031
5212
  * Returns the total size, in bytes, of all the dynamic
5032
- * properties that are currently stored for this entity. This
5033
- * can be useful for diagnosing performance warning signs - if,
5034
- * for example, an entity has many megabytes of associated
5035
- * dynamic properties, it may be slow to load on various
5036
- * devices.
5213
+ * properties that are currently stored for this entity. This
5214
+ * includes the size of both the key and the value. This can
5215
+ * be useful for diagnosing performance warning signs - if, for
5216
+ * example, an entity has many megabytes of associated dynamic
5217
+ * properties, it may be slow to load on various devices.
5037
5218
  *
5038
5219
  * @throws This function can throw errors.
5039
5220
  */
@@ -5115,8 +5296,10 @@ export class Entity {
5115
5296
  getRotation(): Vector2;
5116
5297
  /**
5117
5298
  * @remarks
5299
+ * Returns all tags associated with the entity.
5300
+ *
5118
5301
  * @returns
5119
- * Returns all tags associated with an entity.
5302
+ * An array containing all tags as strings.
5120
5303
  * @throws This function can throw errors.
5121
5304
  */
5122
5305
  getTags(): string[];
@@ -5220,10 +5403,13 @@ export class Entity {
5220
5403
  * location of the entity for matching if the location is not
5221
5404
  * specified in the passed in EntityQueryOptions.
5222
5405
  *
5406
+ * @param options
5407
+ * The query to perform the match against.
5223
5408
  * @returns
5224
5409
  * Returns true if the entity matches the criteria in the
5225
5410
  * passed in EntityQueryOptions, otherwise it returns false.
5226
- * @throws This function can throw errors.
5411
+ * @throws
5412
+ * Throws if the query options are misconfigured.
5227
5413
  */
5228
5414
  matches(options: EntityQueryOptions): boolean;
5229
5415
  /**
@@ -7079,90 +7265,143 @@ export class EntityOnFireComponent extends EntityComponent {
7079
7265
 
7080
7266
  /**
7081
7267
  * @beta
7268
+ * The projectile component controls the properties of a
7269
+ * projectile entity and allows it to be shot in a given
7270
+ * direction.
7271
+ * This component is present when the entity has the
7272
+ * minecraft:projectile component.
7082
7273
  */
7083
7274
  // @ts-ignore Class inheritance allowed for native defined classes
7084
7275
  export class EntityProjectileComponent extends EntityComponent {
7085
7276
  private constructor();
7086
7277
  /**
7087
7278
  * @remarks
7279
+ * The fraction of the projectile's speed maintained every tick
7280
+ * while traveling through air.
7281
+ *
7088
7282
  * This property can't be edited in read-only mode.
7089
7283
  *
7090
7284
  */
7091
7285
  airInertia: number;
7092
7286
  /**
7093
7287
  * @remarks
7288
+ * If true, the entity will be set on fire when hurt. The
7289
+ * default burn duration is 5 seconds. This duration can be
7290
+ * modified via the onFireTime property. The entity will not
7291
+ * catch fire if immune or if the entity is wet.
7292
+ *
7094
7293
  * This property can't be edited in read-only mode.
7095
7294
  *
7096
7295
  */
7097
7296
  catchFireOnHurt: boolean;
7098
7297
  /**
7099
7298
  * @remarks
7299
+ * If true, the projectile will spawn crit particles when hit
7300
+ * by a player. E.g. Player attacking a Shulker bullet.
7301
+ *
7100
7302
  * This property can't be edited in read-only mode.
7101
7303
  *
7102
7304
  */
7103
7305
  critParticlesOnProjectileHurt: boolean;
7104
7306
  /**
7105
7307
  * @remarks
7308
+ * If true, the projectile will be destroyed when it takes
7309
+ * damage. E.g. Player attacking a Shulker bullet.
7310
+ *
7106
7311
  * This property can't be edited in read-only mode.
7107
7312
  *
7108
7313
  */
7109
7314
  destroyOnProjectileHurt: boolean;
7110
7315
  /**
7111
7316
  * @remarks
7317
+ * The gravity applied to the projectile. When the entity is
7318
+ * not on the ground, subtracts this amount from the
7319
+ * projectile’s change in vertical position every tick. The
7320
+ * higher the value, the faster the projectile falls. If
7321
+ * negative, the entity will rise instead of fall.
7322
+ *
7112
7323
  * This property can't be edited in read-only mode.
7113
7324
  *
7114
7325
  */
7115
7326
  gravity: number;
7116
7327
  /**
7117
7328
  * @remarks
7329
+ * The sound that plays when the projectile hits an entity.
7330
+ *
7118
7331
  * This property can't be edited in read-only mode.
7119
7332
  *
7120
7333
  */
7121
7334
  hitEntitySound?: string;
7122
7335
  /**
7123
7336
  * @remarks
7337
+ * The sound that plays when the projectile hits a block.
7338
+ *
7124
7339
  * This property can't be edited in read-only mode.
7125
7340
  *
7126
7341
  */
7127
7342
  hitGroundSound?: string;
7128
7343
  /**
7129
7344
  * @remarks
7345
+ * The particle that spawns when the projectile hits something.
7346
+ *
7130
7347
  * This property can't be edited in read-only mode.
7131
7348
  *
7132
7349
  */
7133
7350
  hitParticle?: string;
7134
7351
  /**
7135
7352
  * @remarks
7353
+ * If true and the weather is thunder and the entity has line
7354
+ * of sight to the sky, the entity will be struck by lightning
7355
+ * when hit. E.g. A thrown Trident with the Channeling
7356
+ * enchantment.
7357
+ *
7136
7358
  * This property can't be edited in read-only mode.
7137
7359
  *
7138
7360
  */
7139
7361
  lightningStrikeOnHit: boolean;
7140
7362
  /**
7141
7363
  * @remarks
7364
+ * The fraction of the projectile's speed maintained every tick
7365
+ * while traveling through a liquid.
7366
+ *
7142
7367
  * This property can't be edited in read-only mode.
7143
7368
  *
7144
7369
  */
7145
7370
  liquidInertia: number;
7146
7371
  /**
7147
7372
  * @remarks
7373
+ * Duration in seconds that the entity hit will be on fire for
7374
+ * when catchFireOnHurt is set to true.
7375
+ *
7148
7376
  * This property can't be edited in read-only mode.
7149
7377
  *
7150
7378
  */
7151
7379
  onFireTime: number;
7152
7380
  /**
7153
7381
  * @remarks
7382
+ * The owner of the projectile. This is used to determine what
7383
+ * the projectile can collide with and damage. It also
7384
+ * determines which entity is assigned as the attacker.
7385
+ *
7154
7386
  * This property can't be edited in read-only mode.
7155
7387
  *
7156
7388
  */
7157
7389
  owner?: Entity;
7158
7390
  /**
7159
7391
  * @remarks
7392
+ * If true, the projectile will bounce off mobs when no damage
7393
+ * is taken. E.g. A spawning wither.
7394
+ *
7160
7395
  * This property can't be edited in read-only mode.
7161
7396
  *
7162
7397
  */
7163
7398
  shouldBounceOnHit: boolean;
7164
7399
  /**
7165
7400
  * @remarks
7401
+ * If true, the projectile will stop moving when an entity is
7402
+ * hit as thought it had been blocked. E.g. Thrown trident on
7403
+ * hit behavior.
7404
+ *
7166
7405
  * This property can't be edited in read-only mode.
7167
7406
  *
7168
7407
  */
@@ -7170,9 +7409,18 @@ export class EntityProjectileComponent extends EntityComponent {
7170
7409
  static readonly componentId = 'minecraft:projectile';
7171
7410
  /**
7172
7411
  * @remarks
7412
+ * Shoots the projectile with a given velocity. The projectile
7413
+ * will be shot from its current location.
7414
+ *
7173
7415
  * This function can't be called in read-only mode.
7174
7416
  *
7175
- * @throws This function can throw errors.
7417
+ * @param velocity
7418
+ * The velocity to fire the projectile. This controls both the
7419
+ * speed and direction which which the projectile will be shot.
7420
+ * @param options
7421
+ * Optional configuration for the shoot.
7422
+ * @throws
7423
+ * Throws if the component or entity no longer exist.
7176
7424
  */
7177
7425
  shoot(velocity: Vector3, options?: ProjectileShootOptions): void;
7178
7426
  }
@@ -8104,7 +8352,7 @@ export class ItemCooldownComponent extends ItemComponent {
8104
8352
  readonly cooldownCategory: string;
8105
8353
  /**
8106
8354
  * @remarks
8107
- * Amount of time, in ticks, that remain for this item
8355
+ * Amount of time, in ticks, it will take this item to
8108
8356
  * cooldown.
8109
8357
  *
8110
8358
  * @throws This property can throw when used.
@@ -8266,6 +8514,11 @@ export class ItemDurabilityComponent extends ItemComponent {
8266
8514
  getDamageChance(unbreakingEnchantmentLevel?: number): number;
8267
8515
  /**
8268
8516
  * @remarks
8517
+ * Returns the min and max variables used by the damage chance
8518
+ * formula:
8519
+ * chance = (min + ((max - min) / (unbreaking + 1)))
8520
+ *
8521
+ *
8269
8522
  * This function can't be called in read-only mode.
8270
8523
  *
8271
8524
  * @throws This function can throw errors.
@@ -8275,6 +8528,8 @@ export class ItemDurabilityComponent extends ItemComponent {
8275
8528
 
8276
8529
  /**
8277
8530
  * @beta
8531
+ * When present on an item, this item can have enchantments
8532
+ * applied to it.
8278
8533
  */
8279
8534
  // @ts-ignore Class inheritance allowed for native defined classes
8280
8535
  export class ItemEnchantableComponent extends ItemComponent {
@@ -8282,9 +8537,24 @@ export class ItemEnchantableComponent extends ItemComponent {
8282
8537
  static readonly componentId = 'minecraft:enchantable';
8283
8538
  /**
8284
8539
  * @remarks
8540
+ * Adds an enchantment to the item stack.
8541
+ *
8285
8542
  * This function can't be called in read-only mode.
8286
8543
  *
8287
- * @throws This function can throw errors.
8544
+ * @param enchantment
8545
+ * The enchantment interface to be added.
8546
+ * @throws
8547
+ * ScriptItemEnchantmentUnknownIdError: Exception thrown if the
8548
+ * enchantment type does not exist.
8549
+ *
8550
+ * ScriptItemEnchantmentLevelOutOfBoundsError: Exception thrown
8551
+ * if the enchantment level is outside the allowable range for
8552
+ * the given enchantment type.
8553
+ *
8554
+ * ScriptItemEnchantmentTypeNotCompatibleError: Exception
8555
+ * thrown if the enchantment is not compatible with the item
8556
+ * stack.
8557
+ *
8288
8558
  *
8289
8559
  * {@link EnchantmentLevelOutOfBoundsError}
8290
8560
  *
@@ -8297,9 +8567,24 @@ export class ItemEnchantableComponent extends ItemComponent {
8297
8567
  addEnchantment(enchantment: Enchantment): void;
8298
8568
  /**
8299
8569
  * @remarks
8570
+ * Adds a list of enchantments to the item stack.
8571
+ *
8300
8572
  * This function can't be called in read-only mode.
8301
8573
  *
8302
- * @throws This function can throw errors.
8574
+ * @param enchantments
8575
+ * The list of enchantments to be added.
8576
+ * @throws
8577
+ * ScriptItemEnchantmentUnknownIdError: Exception thrown if any
8578
+ * enchantment type does not exist.
8579
+ *
8580
+ * ScriptItemEnchantmentLevelOutOfBoundsError: Exception thrown
8581
+ * if any enchantment level is outside the allowable range for
8582
+ * the given enchantment type.
8583
+ *
8584
+ * ScriptItemEnchantmentTypeNotCompatibleError: Exception
8585
+ * thrown if any enchantment is not compatible with the item
8586
+ * stack.
8587
+ *
8303
8588
  *
8304
8589
  * {@link EnchantmentLevelOutOfBoundsError}
8305
8590
  *
@@ -8311,7 +8596,23 @@ export class ItemEnchantableComponent extends ItemComponent {
8311
8596
  */
8312
8597
  addEnchantments(enchantments: Enchantment[]): void;
8313
8598
  /**
8314
- * @throws This function can throw errors.
8599
+ * @remarks
8600
+ * Checks whether an enchantment can be added to the item
8601
+ * stack.
8602
+ *
8603
+ * @param enchantment
8604
+ * The enchantment interface to be added.
8605
+ * @returns
8606
+ * Returns true if the enchantment can be added to the item
8607
+ * stack.
8608
+ * @throws
8609
+ * ScriptItemEnchantmentUnknownIdError: Exception thrown if the
8610
+ * enchantment type does not exist.
8611
+ *
8612
+ * ScriptItemEnchantmentLevelOutOfBoundsError: Exception thrown
8613
+ * if the enchantment level is outside the allowable range for
8614
+ * the given enchantment type.
8615
+ *
8315
8616
  *
8316
8617
  * {@link EnchantmentLevelOutOfBoundsError}
8317
8618
  *
@@ -8319,23 +8620,50 @@ export class ItemEnchantableComponent extends ItemComponent {
8319
8620
  */
8320
8621
  canAddEnchantment(enchantment: Enchantment): boolean;
8321
8622
  /**
8322
- * @throws This function can throw errors.
8623
+ * @remarks
8624
+ * Gets the enchantment of a given type from the item stack.
8625
+ *
8626
+ * @param enchantmentType
8627
+ * The enchantment type to get.
8628
+ * @returns
8629
+ * Returns the enchantment if it exists on the item stack.
8630
+ * @throws
8631
+ * ScriptItemEnchantmentUnknownIdError: Exception thrown if the
8632
+ * enchantment type does not exist.
8633
+ *
8323
8634
  *
8324
8635
  * {@link EnchantmentTypeUnknownIdError}
8325
8636
  */
8326
8637
  getEnchantment(enchantmentType: EnchantmentType | string): Enchantment | undefined;
8327
8638
  /**
8639
+ * @remarks
8640
+ * Gets all enchantments on the item stack.
8641
+ *
8642
+ * @returns
8643
+ * Returns a list of enchantments on the item stack.
8328
8644
  * @throws This function can throw errors.
8329
8645
  */
8330
8646
  getEnchantments(): Enchantment[];
8331
8647
  /**
8332
- * @throws This function can throw errors.
8648
+ * @remarks
8649
+ * Checks whether an item stack has a given enchantment type.
8650
+ *
8651
+ * @param enchantmentType
8652
+ * The enchantment type to check for.
8653
+ * @returns
8654
+ * Returns true if the item stack has the enchantment type.
8655
+ * @throws
8656
+ * ScriptItemEnchantmentUnknownIdError: Exception thrown if the
8657
+ * enchantment type does not exist.
8658
+ *
8333
8659
  *
8334
8660
  * {@link EnchantmentTypeUnknownIdError}
8335
8661
  */
8336
8662
  hasEnchantment(enchantmentType: EnchantmentType | string): boolean;
8337
8663
  /**
8338
8664
  * @remarks
8665
+ * Removes all enchantments applied to this item stack.
8666
+ *
8339
8667
  * This function can't be called in read-only mode.
8340
8668
  *
8341
8669
  * @throws This function can throw errors.
@@ -8343,9 +8671,16 @@ export class ItemEnchantableComponent extends ItemComponent {
8343
8671
  removeAllEnchantments(): void;
8344
8672
  /**
8345
8673
  * @remarks
8674
+ * Removes an enchantment of the given type.
8675
+ *
8346
8676
  * This function can't be called in read-only mode.
8347
8677
  *
8348
- * @throws This function can throw errors.
8678
+ * @param enchantmentType
8679
+ * The enchantment type to remove.
8680
+ * @throws
8681
+ * ScriptItemEnchantmentUnknownIdError: Exception thrown if the
8682
+ * enchantment type does not exist.
8683
+ *
8349
8684
  *
8350
8685
  * {@link EnchantmentTypeUnknownIdError}
8351
8686
  *
@@ -8550,6 +8885,10 @@ export class ItemStack {
8550
8885
  constructor(itemType: ItemType | string, amount?: number);
8551
8886
  /**
8552
8887
  * @beta
8888
+ * @remarks
8889
+ * Clears all dynamic properties that have been set on this
8890
+ * item stack.
8891
+ *
8553
8892
  */
8554
8893
  clearDynamicProperties(): void;
8555
8894
  /**
@@ -8610,14 +8949,36 @@ export class ItemStack {
8610
8949
  getComponents(): ItemComponent[];
8611
8950
  /**
8612
8951
  * @beta
8952
+ * @remarks
8953
+ * Returns a property value.
8954
+ *
8955
+ * @param identifier
8956
+ * The property identifier.
8957
+ * @returns
8958
+ * Returns the value for the property, or undefined if the
8959
+ * property has not been set.
8613
8960
  */
8614
8961
  getDynamicProperty(identifier: string): boolean | number | string | Vector3 | undefined;
8615
8962
  /**
8616
8963
  * @beta
8964
+ * @remarks
8965
+ * Returns the available set of dynamic property identifiers
8966
+ * that have been used on this entity.
8967
+ *
8968
+ * @returns
8969
+ * A string array of the dynamic properties set on this entity.
8617
8970
  */
8618
8971
  getDynamicPropertyIds(): string[];
8619
8972
  /**
8620
8973
  * @beta
8974
+ * @remarks
8975
+ * Returns the total size, in bytes, of all the dynamic
8976
+ * properties that are currently stored for this entity. This
8977
+ * includes the size of both the key and the value. This can
8978
+ * be useful for diagnosing performance warning signs - if, for
8979
+ * example, an entity has many megabytes of associated dynamic
8980
+ * properties, it may be slow to load on various devices.
8981
+ *
8621
8982
  */
8622
8983
  getDynamicPropertyTotalByteCount(): number;
8623
8984
  /**
@@ -8717,7 +9078,16 @@ export class ItemStack {
8717
9078
  setCanPlaceOn(blockIdentifiers?: string[]): void;
8718
9079
  /**
8719
9080
  * @beta
8720
- * @throws This function can throw errors.
9081
+ * @remarks
9082
+ * Sets a specified property to a value. Note: This function
9083
+ * only works with non-stackable items.
9084
+ *
9085
+ * @param identifier
9086
+ * The property identifier.
9087
+ * @param value
9088
+ * Data value of the property to set.
9089
+ * @throws
9090
+ * Throws if the item stack is stackable.
8721
9091
  */
8722
9092
  setDynamicProperty(identifier: string, value?: boolean | number | string | Vector3): void;
8723
9093
  /**
@@ -9443,52 +9813,45 @@ export class PistonActivateAfterEventSignal {
9443
9813
  *
9444
9814
  * @example pistonAfterEvent.ts
9445
9815
  * ```typescript
9446
- * // set up a couple of piston blocks
9447
- * let piston = overworld.getBlock(targetLocation);
9448
- * let button = overworld.getBlock({ x: targetLocation.x, y: targetLocation.y + 1, z: targetLocation.z });
9816
+ * // set up a couple of piston blocks
9817
+ * let piston = overworld.getBlock(targetLocation);
9818
+ * let button = overworld.getBlock({
9819
+ * x: targetLocation.x,
9820
+ * y: targetLocation.y + 1,
9821
+ * z: targetLocation.z,
9822
+ * });
9449
9823
  *
9450
- * if (piston === undefined || button === undefined) {
9451
- * log("Could not find block at location.");
9452
- * return -1;
9453
- * }
9824
+ * if (piston === undefined || button === undefined) {
9825
+ * log("Could not find block at location.");
9826
+ * return -1;
9827
+ * }
9454
9828
  *
9455
- * piston.setPermutation(mc.BlockPermutation.resolve('piston').withState('facing_direction', 3));
9456
- * button.setPermutation(mc.BlockPermutation.resolve('acacia_button').withState('facing_direction', 1));
9829
+ * piston.setPermutation(
9830
+ * mc.BlockPermutation.resolve("piston").withState("facing_direction", 3)
9831
+ * );
9832
+ * button.setPermutation(
9833
+ * mc.BlockPermutation.resolve("acacia_button").withState("facing_direction", 1)
9834
+ * );
9457
9835
  *
9458
- * mc.world.afterEvents.pistonActivate.subscribe((pistonEvent: mc.PistonActivateAfterEvent) => {
9836
+ * mc.world.afterEvents.pistonActivate.subscribe(
9837
+ * (pistonEvent: mc.PistonActivateAfterEvent) => {
9459
9838
  * let eventLoc = pistonEvent.piston.block.location;
9460
9839
  *
9461
- * if (eventLoc.x === targetLocation.x && eventLoc.y === targetLocation.y && eventLoc.z === targetLocation.z) {
9840
+ * if (
9841
+ * eventLoc.x === targetLocation.x &&
9842
+ * eventLoc.y === targetLocation.y &&
9843
+ * eventLoc.z === targetLocation.z
9844
+ * ) {
9462
9845
  * log(
9463
9846
  * "Piston event at " +
9464
9847
  * mc.system.currentTick +
9465
9848
  * (pistonEvent.piston.isMoving ? " Moving" : "") +
9466
- * (pistonEvent.piston.isExpanding ? " Expanding" : "") +
9467
- * (pistonEvent.piston.isExpanded ? " Expanded" : "") +
9468
- * (pistonEvent.piston.isRetracting ? " Retracting" : "") +
9469
- * (pistonEvent.piston.isRetracted ? " Retracted" : "")
9849
+ * " State: " +
9850
+ * pistonEvent.piston.state
9470
9851
  * );
9471
9852
  * }
9472
- * });
9473
- * ```
9474
- * @example pistonEvent.ts
9475
- * ```typescript
9476
- * let canceled = false;
9477
- *
9478
- * const pistonLoc: mc.Vector3 = {
9479
- * x: Math.floor(targetLocation.x) + 1,
9480
- * y: Math.floor(targetLocation.y) + 2,
9481
- * z: Math.floor(targetLocation.z) + 1,
9482
- * };
9483
- *
9484
- * const pistonCallback = mc.world.beforeEvents.pistonActivate.subscribe((pistonEvent: mc.PistonActivateBeforeEvent) => {
9485
- * if (pistonEvent.piston.location.equals(pistonLoc)) {
9486
- * log("Cancelling piston event");
9487
- * pistonEvent.cancel = true;
9488
- * canceled = true;
9489
9853
  * }
9490
- * });
9491
- *
9854
+ * );
9492
9855
  * ```
9493
9856
  */
9494
9857
  subscribe(callback: (arg: PistonActivateAfterEvent) => void): (arg: PistonActivateAfterEvent) => void;
@@ -9626,9 +9989,15 @@ export class Player extends Entity {
9626
9989
  /**
9627
9990
  * @beta
9628
9991
  * @remarks
9992
+ * Eats an item, providing the item's hunger and saturation
9993
+ * effects to the player. Can only be used on food items.
9994
+ *
9629
9995
  * This function can't be called in read-only mode.
9630
9996
  *
9631
- * @throws This function can throw errors.
9997
+ * @param itemStack
9998
+ * The item to eat.
9999
+ * @throws
10000
+ * Throws if the item is not a food item.
9632
10001
  */
9633
10002
  eatItem(itemStack: ItemStack): void;
9634
10003
  /**
@@ -10441,21 +10810,40 @@ export class PlayerLeaveAfterEventSignal extends IPlayerLeaveAfterEventSignal {
10441
10810
  private constructor();
10442
10811
  }
10443
10812
 
10813
+ /**
10814
+ * Contains information regarding a player that is leaving the
10815
+ * world.
10816
+ */
10444
10817
  export class PlayerLeaveBeforeEvent {
10445
10818
  private constructor();
10819
+ /**
10820
+ * @remarks
10821
+ * The leaving player.
10822
+ *
10823
+ */
10446
10824
  readonly player: Player;
10447
10825
  }
10448
10826
 
10827
+ /**
10828
+ * Manages callbacks that are connected to a player leaving the
10829
+ * world.
10830
+ */
10449
10831
  export class PlayerLeaveBeforeEventSignal {
10450
10832
  private constructor();
10451
10833
  /**
10452
10834
  * @remarks
10835
+ * Adds a callback that will be called when a player leaves the
10836
+ * world.
10837
+ *
10453
10838
  * This function can't be called in read-only mode.
10454
10839
  *
10455
10840
  */
10456
10841
  subscribe(callback: (arg: PlayerLeaveBeforeEvent) => void): (arg: PlayerLeaveBeforeEvent) => void;
10457
10842
  /**
10458
10843
  * @remarks
10844
+ * Removes a callback that will be called when a player leaves
10845
+ * the world.
10846
+ *
10459
10847
  * This function can't be called in read-only mode.
10460
10848
  *
10461
10849
  * @throws This function can throw errors.
@@ -10535,6 +10923,11 @@ export class PlayerPlaceBlockBeforeEvent extends BlockEvent {
10535
10923
  *
10536
10924
  */
10537
10925
  readonly faceLocation: Vector3;
10926
+ /**
10927
+ * @remarks
10928
+ * The block permutation that is being placed.
10929
+ *
10930
+ */
10538
10931
  readonly permutationBeingPlaced: BlockPermutation;
10539
10932
  /**
10540
10933
  * @remarks
@@ -11352,6 +11745,10 @@ export class System {
11352
11745
  *
11353
11746
  */
11354
11747
  readonly currentTick: number;
11748
+ /**
11749
+ * @beta
11750
+ */
11751
+ clearJob(jobId: number): void;
11355
11752
  /**
11356
11753
  * @remarks
11357
11754
  * Cancels the execution of a function run that was previously
@@ -11410,6 +11807,10 @@ export class System {
11410
11807
  * ```
11411
11808
  */
11412
11809
  runInterval(callback: () => void, tickInterval?: number): number;
11810
+ /**
11811
+ * @beta
11812
+ */
11813
+ runJob(generator: Generator<void, void, void>): number;
11413
11814
  /**
11414
11815
  * @remarks
11415
11816
  * Runs a set of code at a future time specified by tickDelay.
@@ -12786,6 +13187,13 @@ export class WorldInitializeAfterEventSignal {
12786
13187
  unsubscribe(callback: (arg: WorldInitializeAfterEvent) => void): void;
12787
13188
  }
12788
13189
 
13190
+ /**
13191
+ * @beta
13192
+ */
13193
+ export interface BiomeSearchOptions {
13194
+ boundingSize?: Vector3;
13195
+ }
13196
+
12789
13197
  /**
12790
13198
  * Contains optional parameters for registering a block event.
12791
13199
  */
@@ -13168,8 +13576,8 @@ export interface DimensionLocation {
13168
13576
 
13169
13577
  /**
13170
13578
  * @beta
13171
- * This class represents a specific leveled enchantment that is
13172
- * applied to an item.
13579
+ * This interface represents a specific leveled enchantment
13580
+ * that is applied to an item.
13173
13581
  */
13174
13582
  export interface Enchantment {
13175
13583
  /**
@@ -13647,6 +14055,11 @@ export interface PlayAnimationOptions {
13647
14055
  *
13648
14056
  */
13649
14057
  nextState?: string;
14058
+ /**
14059
+ * @remarks
14060
+ * A list of players the animation will be visible to.
14061
+ *
14062
+ */
13650
14063
  players?: string[];
13651
14064
  /**
13652
14065
  * @remarks
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minecraft/server",
3
- "version": "1.9.0-beta.1.20.60-preview.23",
3
+ "version": "1.9.0-beta.1.20.60-preview.24",
4
4
  "description": "",
5
5
  "contributors": [
6
6
  {