@minecraft/server 1.9.0-beta.1.20.60-preview.21 → 1.9.0-beta.1.20.60-preview.22

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 +138 -360
  2. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -15,7 +15,7 @@
15
15
  * ```json
16
16
  * {
17
17
  * "module_name": "@minecraft/server",
18
- * "version": "1.6.0"
18
+ * "version": "1.7.0"
19
19
  * }
20
20
  * ```
21
21
  *
@@ -35,6 +35,16 @@ export enum BlockComponentTypes {
35
35
  WaterContainer = 'minecraft:waterContainer',
36
36
  }
37
37
 
38
+ /**
39
+ * @beta
40
+ */
41
+ export enum BlockPistonState {
42
+ Expanded = 'Expanded',
43
+ Expanding = 'Expanding',
44
+ Retracted = 'Retracted',
45
+ Retracting = 'Retracting',
46
+ }
47
+
38
48
  /**
39
49
  * @beta
40
50
  * Description of the resulting intersection test on two
@@ -854,7 +864,7 @@ export enum GameMode {
854
864
  export enum ItemComponentTypes {
855
865
  Cooldown = 'minecraft:cooldown',
856
866
  Durability = 'minecraft:durability',
857
- Enchants = 'minecraft:enchantments',
867
+ Enchantable = 'minecraft:enchantable',
858
868
  Food = 'minecraft:food',
859
869
  }
860
870
 
@@ -1304,11 +1314,11 @@ export type EntityComponentTypeMap = {
1304
1314
  export type ItemComponentTypeMap = {
1305
1315
  cooldown: ItemCooldownComponent;
1306
1316
  durability: ItemDurabilityComponent;
1307
- enchantments: ItemEnchantsComponent;
1317
+ enchantable: ItemEnchantableComponent;
1308
1318
  food: ItemFoodComponent;
1309
1319
  'minecraft:cooldown': ItemCooldownComponent;
1310
1320
  'minecraft:durability': ItemDurabilityComponent;
1311
- 'minecraft:enchantments': ItemEnchantsComponent;
1321
+ 'minecraft:enchantable': ItemEnchantableComponent;
1312
1322
  'minecraft:food': ItemFoodComponent;
1313
1323
  };
1314
1324
 
@@ -1437,7 +1447,6 @@ export class Block {
1437
1447
  */
1438
1448
  readonly z: number;
1439
1449
  /**
1440
- * @beta
1441
1450
  * @remarks
1442
1451
  * Returns the {@link Block} above this block (positive in the
1443
1452
  * Y direction).
@@ -1452,7 +1461,6 @@ export class Block {
1452
1461
  */
1453
1462
  above(steps?: number): Block | undefined;
1454
1463
  /**
1455
- * @beta
1456
1464
  * @remarks
1457
1465
  * Returns the {@link Block} below this block (negative in the
1458
1466
  * Y direction).
@@ -1467,7 +1475,6 @@ export class Block {
1467
1475
  */
1468
1476
  below(steps?: number): Block | undefined;
1469
1477
  /**
1470
- * @beta
1471
1478
  * @remarks
1472
1479
  * Returns the {@link @minecraft/server.Location} of the center
1473
1480
  * of this block on the X and Z axis.
@@ -1499,7 +1506,6 @@ export class Block {
1499
1506
  */
1500
1507
  canPlace(blockToPlace: BlockPermutation | BlockType | string, faceToPlaceOn?: Direction): boolean;
1501
1508
  /**
1502
- * @beta
1503
1509
  * @remarks
1504
1510
  * Returns the {@link @minecraft/server.Location} of the center
1505
1511
  * of this block on the X, Y, and Z axis.
@@ -1507,7 +1513,6 @@ export class Block {
1507
1513
  */
1508
1514
  center(): Vector3;
1509
1515
  /**
1510
- * @beta
1511
1516
  * @remarks
1512
1517
  * Returns the {@link Block} to the east of this block
1513
1518
  * (positive in the X direction).
@@ -1633,7 +1638,6 @@ export class Block {
1633
1638
  */
1634
1639
  isValid(): boolean;
1635
1640
  /**
1636
- * @beta
1637
1641
  * @remarks
1638
1642
  * Returns the {@link Block} to the north of this block
1639
1643
  * (negative in the Z direction).
@@ -1648,7 +1652,6 @@ export class Block {
1648
1652
  */
1649
1653
  north(steps?: number): Block | undefined;
1650
1654
  /**
1651
- * @beta
1652
1655
  * @remarks
1653
1656
  * Returns a block at an offset relative vector to this block.
1654
1657
  *
@@ -1703,7 +1706,6 @@ export class Block {
1703
1706
  */
1704
1707
  setType(blockType: BlockType | string): void;
1705
1708
  /**
1706
- * @beta
1707
1709
  * @remarks
1708
1710
  * Returns the {@link Block} to the south of this block
1709
1711
  * (positive in the Z direction).
@@ -1739,7 +1741,6 @@ export class Block {
1739
1741
  */
1740
1742
  trySetPermutation(permutation: BlockPermutation): boolean;
1741
1743
  /**
1742
- * @beta
1743
1744
  * @remarks
1744
1745
  * Returns the {@link Block} to the west of this block
1745
1746
  * (negative in the X direction).
@@ -2143,20 +2144,6 @@ export class BlockPermutation {
2143
2144
  // @ts-ignore Class inheritance allowed for native defined classes
2144
2145
  export class BlockPistonComponent extends BlockComponent {
2145
2146
  private constructor();
2146
- /**
2147
- * @remarks
2148
- * Whether the piston is fully expanded.
2149
- *
2150
- * @throws This property can throw when used.
2151
- */
2152
- readonly isExpanded: boolean;
2153
- /**
2154
- * @remarks
2155
- * Whether the piston is in the process of expanding.
2156
- *
2157
- * @throws This property can throw when used.
2158
- */
2159
- readonly isExpanding: boolean;
2160
2147
  /**
2161
2148
  * @remarks
2162
2149
  * Whether the piston is in the process of expanding or
@@ -2166,19 +2153,9 @@ export class BlockPistonComponent extends BlockComponent {
2166
2153
  */
2167
2154
  readonly isMoving: boolean;
2168
2155
  /**
2169
- * @remarks
2170
- * Whether the piston is fully retracted.
2171
- *
2172
2156
  * @throws This property can throw when used.
2173
2157
  */
2174
- readonly isRetracted: boolean;
2175
- /**
2176
- * @remarks
2177
- * Whether the piston is in the process of retracting.
2178
- *
2179
- * @throws This property can throw when used.
2180
- */
2181
- readonly isRetracting: boolean;
2158
+ readonly state: BlockPistonState;
2182
2159
  static readonly componentId = 'minecraft:piston';
2183
2160
  /**
2184
2161
  * @remarks
@@ -2187,7 +2164,11 @@ export class BlockPistonComponent extends BlockComponent {
2187
2164
  *
2188
2165
  * @throws This function can throw errors.
2189
2166
  */
2190
- getAttachedBlocks(): Vector3[];
2167
+ getAttachedBlocks(): Block[];
2168
+ /**
2169
+ * @throws This function can throw errors.
2170
+ */
2171
+ getAttachedBlocksLocations(): Vector3[];
2191
2172
  }
2192
2173
 
2193
2174
  /**
@@ -2367,7 +2348,7 @@ export class BlockSignComponent extends BlockComponent {
2367
2348
  *
2368
2349
  * @throws This function can throw errors.
2369
2350
  */
2370
- setWaxed(): void;
2351
+ setWaxed(waxed: boolean): void;
2371
2352
  }
2372
2353
 
2373
2354
  /**
@@ -2436,12 +2417,14 @@ export class BlockStateType {
2436
2417
  export class BlockType {
2437
2418
  private constructor();
2438
2419
  /**
2420
+ * @beta
2439
2421
  * @remarks
2440
2422
  * Represents whether this type of block can be waterlogged.
2441
2423
  *
2442
2424
  */
2443
2425
  readonly canBeWaterlogged: boolean;
2444
2426
  /**
2427
+ * @beta
2445
2428
  * @remarks
2446
2429
  * Block type name - for example, `minecraft:acacia_stairs`.
2447
2430
  *
@@ -3835,7 +3818,6 @@ export class DataDrivenEntityTriggerBeforeEventSignal {
3835
3818
  export class Dimension {
3836
3819
  private constructor();
3837
3820
  /**
3838
- * @beta
3839
3821
  * @remarks
3840
3822
  * Height range of the dimension.
3841
3823
  *
@@ -4522,150 +4504,6 @@ export class EffectTypes {
4522
4504
  static getAll(): EffectType[];
4523
4505
  }
4524
4506
 
4525
- /**
4526
- * @beta
4527
- * This class represents a specific leveled enchantment that is
4528
- * applied to an item.
4529
- */
4530
- export class Enchantment {
4531
- /**
4532
- * @remarks
4533
- * The level of this enchantment instance.
4534
- *
4535
- * This property can't be edited in read-only mode.
4536
- *
4537
- */
4538
- level: number;
4539
- /**
4540
- * @remarks
4541
- * The enchantment type of this instance.
4542
- *
4543
- */
4544
- readonly 'type': EnchantmentType;
4545
- /**
4546
- * @remarks
4547
- * Creates a new particular type of enchantment configuration.
4548
- *
4549
- * @param enchantmentType
4550
- * Type of the enchantment.
4551
- * @param level
4552
- * Level of the enchantment.
4553
- * @throws This function can throw errors.
4554
- */
4555
- constructor(enchantmentType: EnchantmentType | string, level?: number);
4556
- }
4557
-
4558
- /**
4559
- * @beta
4560
- * This class represents a collection of enchantments that can
4561
- * be applied to an item.
4562
- */
4563
- export class EnchantmentList implements Iterable<Enchantment> {
4564
- /**
4565
- * @remarks
4566
- * The item slot/type that this collection is applied to.
4567
- *
4568
- */
4569
- readonly slot: number;
4570
- /**
4571
- * @remarks
4572
- * Creates a new EnchantmentList.
4573
- *
4574
- */
4575
- constructor(enchantmentSlot: number);
4576
- /**
4577
- * @remarks
4578
- * This function can't be called in read-only mode.
4579
- *
4580
- */
4581
- [Symbol.iterator](): Iterator<Enchantment>;
4582
- /**
4583
- * @remarks
4584
- * Attempts to add the enchantment to this collection. Returns
4585
- * true if successful.
4586
- *
4587
- * This function can't be called in read-only mode.
4588
- *
4589
- */
4590
- addEnchantment(enchantment: Enchantment): boolean;
4591
- /**
4592
- * @remarks
4593
- * Returns whether or not the provided EnchantmentInstance can
4594
- * be added to this collection.
4595
- *
4596
- * This function can't be called in read-only mode.
4597
- *
4598
- */
4599
- canAddEnchantment(enchantment: Enchantment): boolean;
4600
- /**
4601
- * @remarks
4602
- * Returns an enchantment associated with a type.
4603
- *
4604
- * This function can't be called in read-only mode.
4605
- *
4606
- * @throws This function can throw errors.
4607
- */
4608
- getEnchantment(enchantmentType: EnchantmentType | string): Enchantment | undefined;
4609
- /**
4610
- * @remarks
4611
- * If this collection has an EnchantmentInstance with type,
4612
- * returns the level of the enchantment. Returns 0 if not
4613
- * present.
4614
- *
4615
- * @throws This function can throw errors.
4616
- */
4617
- hasEnchantment(enchantmentType: EnchantmentType | string): number;
4618
- /**
4619
- * @remarks
4620
- * This function can't be called in read-only mode.
4621
- *
4622
- */
4623
- next(): IteratorResult<Enchantment>;
4624
- /**
4625
- * @remarks
4626
- * Removes an EnchantmentInstance with type from this
4627
- * collection if present.
4628
- *
4629
- * This function can't be called in read-only mode.
4630
- *
4631
- * @throws This function can throw errors.
4632
- */
4633
- removeEnchantment(enchantmentType: EnchantmentType | string): void;
4634
- }
4635
-
4636
- /**
4637
- * @beta
4638
- * This enum represents the item slot or type that an
4639
- * enchantment can be applied to.
4640
- */
4641
- export class EnchantmentSlot {
4642
- private constructor();
4643
- static readonly all = -1;
4644
- static readonly armorFeet = 4;
4645
- static readonly armorHead = 1;
4646
- static readonly armorLegs = 8;
4647
- static readonly armorTorso = 2;
4648
- static readonly axe = 512;
4649
- static readonly bow = 32;
4650
- static readonly carrotStick = 8192;
4651
- static readonly cosmeticHead = 262144;
4652
- static readonly crossbow = 65536;
4653
- static readonly elytra = 16384;
4654
- static readonly fishingRod = 4096;
4655
- static readonly flintsteel = 256;
4656
- static readonly gArmor = 15;
4657
- static readonly gDigging = 3648;
4658
- static readonly gTool = 131520;
4659
- static readonly hoe = 64;
4660
- static readonly none = 0;
4661
- static readonly pickaxe = 1024;
4662
- static readonly shears = 128;
4663
- static readonly shield = 131072;
4664
- static readonly shovel = 2048;
4665
- static readonly spear = 32768;
4666
- static readonly sword = 16;
4667
- }
4668
-
4669
4507
  /**
4670
4508
  * @beta
4671
4509
  * Contains information on a type of enchantment.
@@ -5035,7 +4873,6 @@ export class Entity {
5035
4873
  */
5036
4874
  applyKnockback(directionX: number, directionZ: number, horizontalStrength: number, verticalStrength: number): void;
5037
4875
  /**
5038
- * @beta
5039
4876
  * @remarks
5040
4877
  * Clears all dynamic properties that have been set on this
5041
4878
  * entity.
@@ -5145,7 +4982,6 @@ export class Entity {
5145
4982
  */
5146
4983
  getComponents(): EntityComponent[];
5147
4984
  /**
5148
- * @beta
5149
4985
  * @remarks
5150
4986
  * Returns a property value.
5151
4987
  *
@@ -5158,7 +4994,6 @@ export class Entity {
5158
4994
  */
5159
4995
  getDynamicProperty(identifier: string): boolean | number | string | Vector3 | undefined;
5160
4996
  /**
5161
- * @beta
5162
4997
  * @remarks
5163
4998
  * Returns the available set of dynamic property identifiers
5164
4999
  * that have been used on this entity.
@@ -5169,7 +5004,6 @@ export class Entity {
5169
5004
  */
5170
5005
  getDynamicPropertyIds(): string[];
5171
5006
  /**
5172
- * @beta
5173
5007
  * @remarks
5174
5008
  * Returns the total size, in bytes, of all the dynamic
5175
5009
  * properties that are currently stored for this entity. This
@@ -5358,7 +5192,6 @@ export class Entity {
5358
5192
  */
5359
5193
  kill(): boolean;
5360
5194
  /**
5361
- * @beta
5362
5195
  * @remarks
5363
5196
  * Matches the entity against the passed in options. Uses the
5364
5197
  * location of the entity for matching if the location is not
@@ -5386,7 +5219,6 @@ export class Entity {
5386
5219
  */
5387
5220
  playAnimation(animationName: string, options?: PlayAnimationOptions): void;
5388
5221
  /**
5389
- * @beta
5390
5222
  * @remarks
5391
5223
  * Immediately removes the entity from the world. The removed
5392
5224
  * entity will not perform a death animation or drop loot upon
@@ -5483,7 +5315,6 @@ export class Entity {
5483
5315
  */
5484
5316
  runCommandAsync(commandString: string): Promise<CommandResult>;
5485
5317
  /**
5486
- * @beta
5487
5318
  * @remarks
5488
5319
  * Sets a specified property to a value.
5489
5320
  *
@@ -7744,7 +7575,6 @@ export class EntityWantsJockeyComponent extends EntityComponent {
7744
7575
  }
7745
7576
 
7746
7577
  /**
7747
- * @beta
7748
7578
  * Contains information regarding an explosion that has
7749
7579
  * happened.
7750
7580
  */
@@ -7771,7 +7601,6 @@ export class ExplosionAfterEvent {
7771
7601
  }
7772
7602
 
7773
7603
  /**
7774
- * @beta
7775
7604
  * Manages callbacks that are connected to when an explosion
7776
7605
  * occurs.
7777
7606
  */
@@ -7799,7 +7628,6 @@ export class ExplosionAfterEventSignal {
7799
7628
  }
7800
7629
 
7801
7630
  /**
7802
- * @beta
7803
7631
  * Contains information regarding an explosion that has
7804
7632
  * happened.
7805
7633
  */
@@ -7824,7 +7652,6 @@ export class ExplosionBeforeEvent extends ExplosionAfterEvent {
7824
7652
  }
7825
7653
 
7826
7654
  /**
7827
- * @beta
7828
7655
  * Manages callbacks that are connected to before an explosion
7829
7656
  * occurs.
7830
7657
  */
@@ -8325,32 +8152,83 @@ export class ItemDurabilityComponent extends ItemComponent {
8325
8152
 
8326
8153
  /**
8327
8154
  * @beta
8328
- * When present on an item, this item has applied enchantment
8329
- * effects. Note that this component only applies to
8330
- * data-driven items.
8331
8155
  */
8332
8156
  // @ts-ignore Class inheritance allowed for native defined classes
8333
- export class ItemEnchantsComponent extends ItemComponent {
8157
+ export class ItemEnchantableComponent extends ItemComponent {
8334
8158
  private constructor();
8159
+ static readonly componentId = 'minecraft:enchantable';
8335
8160
  /**
8336
8161
  * @remarks
8337
- * Returns a collection of the enchantments applied to this
8338
- * item stack.
8162
+ * This function can't be called in read-only mode.
8339
8163
  *
8340
- * This property can't be edited in read-only mode.
8164
+ * @throws This function can throw errors.
8341
8165
  *
8166
+ * {@link EnchantmentLevelOutOfBoundsError}
8167
+ *
8168
+ * {@link EnchantmentTypeNotCompatibleError}
8169
+ *
8170
+ * {@link EnchantmentTypeUnknownIdError}
8171
+ *
8172
+ * {@link Error}
8342
8173
  */
8343
- enchantments: EnchantmentList;
8344
- static readonly componentId = 'minecraft:enchantments';
8174
+ addEnchantment(enchantment: Enchantment): void;
8345
8175
  /**
8346
8176
  * @remarks
8347
- * Removes all enchantments applied to this item stack.
8177
+ * This function can't be called in read-only mode.
8348
8178
  *
8179
+ * @throws This function can throw errors.
8180
+ *
8181
+ * {@link EnchantmentLevelOutOfBoundsError}
8182
+ *
8183
+ * {@link EnchantmentTypeNotCompatibleError}
8184
+ *
8185
+ * {@link EnchantmentTypeUnknownIdError}
8186
+ *
8187
+ * {@link Error}
8188
+ */
8189
+ addEnchantments(enchantments: Enchantment[]): void;
8190
+ /**
8191
+ * @throws This function can throw errors.
8192
+ *
8193
+ * {@link EnchantmentLevelOutOfBoundsError}
8194
+ *
8195
+ * {@link EnchantmentTypeUnknownIdError}
8196
+ */
8197
+ canAddEnchantment(enchantment: Enchantment): boolean;
8198
+ /**
8199
+ * @throws This function can throw errors.
8200
+ *
8201
+ * {@link EnchantmentTypeUnknownIdError}
8202
+ */
8203
+ getEnchantment(enchantmentType: EnchantmentType | string): Enchantment | undefined;
8204
+ /**
8205
+ * @throws This function can throw errors.
8206
+ */
8207
+ getEnchantments(): Enchantment[];
8208
+ /**
8209
+ * @throws This function can throw errors.
8210
+ *
8211
+ * {@link EnchantmentTypeUnknownIdError}
8212
+ */
8213
+ hasEnchantment(enchantmentType: EnchantmentType | string): boolean;
8214
+ /**
8215
+ * @remarks
8349
8216
  * This function can't be called in read-only mode.
8350
8217
  *
8351
8218
  * @throws This function can throw errors.
8352
8219
  */
8353
8220
  removeAllEnchantments(): void;
8221
+ /**
8222
+ * @remarks
8223
+ * This function can't be called in read-only mode.
8224
+ *
8225
+ * @throws This function can throw errors.
8226
+ *
8227
+ * {@link EnchantmentTypeUnknownIdError}
8228
+ *
8229
+ * {@link Error}
8230
+ */
8231
+ removeEnchantment(enchantmentType: EnchantmentType | string): void;
8354
8232
  }
8355
8233
 
8356
8234
  /**
@@ -9384,29 +9262,6 @@ export class MolangVariableMap {
9384
9262
  setVector3(variableName: string, vector: Vector3): void;
9385
9263
  }
9386
9264
 
9387
- /**
9388
- * @beta
9389
- * Contains data resulting from a navigation operation,
9390
- * including whether the navigation is possible and the path of
9391
- * navigation.
9392
- */
9393
- export class NavigationResult {
9394
- private constructor();
9395
- /**
9396
- * @remarks
9397
- * Whether the navigation result contains a full path,
9398
- * including to the requested destination.
9399
- *
9400
- */
9401
- readonly isFullPath: boolean;
9402
- /**
9403
- * @remarks
9404
- * A set of block locations that comprise the navigation route.
9405
- *
9406
- */
9407
- getPath(): Vector3[];
9408
- }
9409
-
9410
9265
  /**
9411
9266
  * @beta
9412
9267
  * Contains information related to changes to a piston
@@ -9505,107 +9360,6 @@ export class PistonActivateAfterEventSignal {
9505
9360
  unsubscribe(callback: (arg: PistonActivateAfterEvent) => void): void;
9506
9361
  }
9507
9362
 
9508
- /**
9509
- * @beta
9510
- * Contains information related to changes before a piston
9511
- * expands or retracts.
9512
- */
9513
- // @ts-ignore Class inheritance allowed for native defined classes
9514
- export class PistonActivateBeforeEvent extends BlockEvent {
9515
- private constructor();
9516
- /**
9517
- * @remarks
9518
- * If this is set to true within an event handler, the piston
9519
- * activation is canceled.
9520
- *
9521
- */
9522
- cancel: boolean;
9523
- /**
9524
- * @remarks
9525
- * True if the piston is the process of expanding.
9526
- *
9527
- */
9528
- readonly isExpanding: boolean;
9529
- /**
9530
- * @remarks
9531
- * Contains additional properties and details of the piston.
9532
- *
9533
- */
9534
- readonly piston: BlockPistonComponent;
9535
- }
9536
-
9537
- /**
9538
- * @beta
9539
- * Manages callbacks that are connected to an event that fires
9540
- * before a piston is activated.
9541
- */
9542
- export class PistonActivateBeforeEventSignal {
9543
- private constructor();
9544
- /**
9545
- * @remarks
9546
- * Adds a callback that will be called before a piston expands
9547
- * or retracts.
9548
- *
9549
- * This function can't be called in read-only mode.
9550
- *
9551
- * @example pistonBeforeEvent.ts
9552
- * ```typescript
9553
- * // set up a couple of piston blocks
9554
- * let piston = overworld.getBlock(targetLocation);
9555
- * let button = overworld.getBlock({ x: targetLocation.x, y: targetLocation.y + 1, z: targetLocation.z });
9556
- *
9557
- * if (piston === undefined || button === undefined) {
9558
- * log("Could not find block at location.");
9559
- * return -1;
9560
- * }
9561
- *
9562
- * piston.setPermutation(mc.BlockPermutation.resolve('piston').withState('facing_direction', 3));
9563
- * button.setPermutation(mc.BlockPermutation.resolve('acacia_button').withState('facing_direction', 1));
9564
- *
9565
- * const uncanceledPistonLoc = {
9566
- * x: Math.floor(targetLocation.x) + 2,
9567
- * y: Math.floor(targetLocation.y),
9568
- * z: Math.floor(targetLocation.z) + 2,
9569
- * };
9570
- *
9571
- * // this is our control.
9572
- * let uncanceledPiston = overworld.getBlock(uncanceledPistonLoc);
9573
- * let uncanceledButton = overworld.getBlock({
9574
- * x: uncanceledPistonLoc.x,
9575
- * y: uncanceledPistonLoc.y + 1,
9576
- * z: uncanceledPistonLoc.z,
9577
- * });
9578
- *
9579
- * if (uncanceledPiston === undefined || uncanceledButton === undefined) {
9580
- * log("Could not find block at location.");
9581
- * return -1;
9582
- * }
9583
- *
9584
- * uncanceledPiston.setPermutation(mc.BlockPermutation.resolve('piston').withState('facing_direction', 3));
9585
- * uncanceledButton.setPermutation(mc.BlockPermutation.resolve('acacia_button').withState('facing_direction', 1));
9586
- *
9587
- * mc.world.beforeEvents.pistonActivate.subscribe((pistonEvent: mc.PistonActivateBeforeEvent) => {
9588
- * let eventLoc = pistonEvent.piston.block.location;
9589
- * if (eventLoc.x === targetLocation.x && eventLoc.y === targetLocation.y && eventLoc.z === targetLocation.z) {
9590
- * log("Cancelling piston event");
9591
- * pistonEvent.cancel = true;
9592
- * }
9593
- * });
9594
- * ```
9595
- */
9596
- subscribe(callback: (arg: PistonActivateBeforeEvent) => void): (arg: PistonActivateBeforeEvent) => void;
9597
- /**
9598
- * @remarks
9599
- * Removes a callback from being called before a piston expands
9600
- * or retracts.
9601
- *
9602
- * This function can't be called in read-only mode.
9603
- *
9604
- * @throws This function can throw errors.
9605
- */
9606
- unsubscribe(callback: (arg: PistonActivateBeforeEvent) => void): void;
9607
- }
9608
-
9609
9363
  /**
9610
9364
  * Represents a player within the world.
9611
9365
  */
@@ -9725,6 +9479,14 @@ export class Player extends Entity {
9725
9479
  * @throws This function can throw errors.
9726
9480
  */
9727
9481
  addLevels(amount: number): number;
9482
+ /**
9483
+ * @beta
9484
+ * @remarks
9485
+ * This function can't be called in read-only mode.
9486
+ *
9487
+ * @throws This function can throw errors.
9488
+ */
9489
+ eatItem(itemStack: ItemStack): void;
9728
9490
  /**
9729
9491
  * @beta
9730
9492
  * @remarks
@@ -10187,7 +9949,6 @@ export class PlayerDimensionChangeAfterEventSignal {
10187
9949
  }
10188
9950
 
10189
9951
  /**
10190
- * @beta
10191
9952
  * Contains information regarding an event after a player
10192
9953
  * interacts with a block.
10193
9954
  */
@@ -10228,7 +9989,6 @@ export class PlayerInteractWithBlockAfterEvent {
10228
9989
  }
10229
9990
 
10230
9991
  /**
10231
- * @beta
10232
9992
  * Manages callbacks that are connected to after a player
10233
9993
  * interacts with a block.
10234
9994
  */
@@ -10258,7 +10018,6 @@ export class PlayerInteractWithBlockAfterEventSignal {
10258
10018
  }
10259
10019
 
10260
10020
  /**
10261
- * @beta
10262
10021
  * Contains information regarding an event before a player
10263
10022
  * interacts with a block.
10264
10023
  */
@@ -10305,7 +10064,6 @@ export class PlayerInteractWithBlockBeforeEvent {
10305
10064
  }
10306
10065
 
10307
10066
  /**
10308
- * @beta
10309
10067
  * Manages callbacks that are connected to before a player
10310
10068
  * interacts with a block.
10311
10069
  */
@@ -10335,7 +10093,6 @@ export class PlayerInteractWithBlockBeforeEventSignal {
10335
10093
  }
10336
10094
 
10337
10095
  /**
10338
- * @beta
10339
10096
  * Contains information regarding an event after a player
10340
10097
  * interacts with an entity.
10341
10098
  */
@@ -10363,7 +10120,6 @@ export class PlayerInteractWithEntityAfterEvent {
10363
10120
  }
10364
10121
 
10365
10122
  /**
10366
- * @beta
10367
10123
  * Manages callbacks that are connected to after a player
10368
10124
  * interacts with an entity.
10369
10125
  */
@@ -10393,7 +10149,6 @@ export class PlayerInteractWithEntityAfterEventSignal {
10393
10149
  }
10394
10150
 
10395
10151
  /**
10396
- * @beta
10397
10152
  * Contains information regarding an event before a player
10398
10153
  * interacts with an entity.
10399
10154
  */
@@ -10427,7 +10182,6 @@ export class PlayerInteractWithEntityBeforeEvent {
10427
10182
  }
10428
10183
 
10429
10184
  /**
10430
- * @beta
10431
10185
  * Manages callbacks that are connected to before a player
10432
10186
  * interacts with an entity.
10433
10187
  */
@@ -10543,17 +10297,11 @@ export class PlayerLeaveAfterEventSignal extends IPlayerLeaveAfterEventSignal {
10543
10297
  private constructor();
10544
10298
  }
10545
10299
 
10546
- /**
10547
- * @beta
10548
- */
10549
10300
  export class PlayerLeaveBeforeEvent {
10550
10301
  private constructor();
10551
10302
  readonly player: Player;
10552
10303
  }
10553
10304
 
10554
- /**
10555
- * @beta
10556
- */
10557
10305
  export class PlayerLeaveBeforeEventSignal {
10558
10306
  private constructor();
10559
10307
  /**
@@ -10984,7 +10732,7 @@ export class Scoreboard {
10984
10732
  *
10985
10733
  * @throws This function can throw errors.
10986
10734
  */
10987
- addObjective(objectiveId: string, displayName: string): ScoreboardObjective;
10735
+ addObjective(objectiveId: string, displayName?: string): ScoreboardObjective;
10988
10736
  /**
10989
10737
  * @remarks
10990
10738
  * Clears the objective that occupies a display slot.
@@ -12028,7 +11776,6 @@ export class World {
12028
11776
  */
12029
11777
  broadcastClientMessage(id: string, value: string): void;
12030
11778
  /**
12031
- * @beta
12032
11779
  * @remarks
12033
11780
  * Clears the set of dynamic properties declared for this
12034
11781
  * behavior pack within the world.
@@ -12081,7 +11828,6 @@ export class World {
12081
11828
  */
12082
11829
  getDimension(dimensionId: string): Dimension;
12083
11830
  /**
12084
- * @beta
12085
11831
  * @remarks
12086
11832
  * Returns a property value.
12087
11833
  *
@@ -12148,7 +11894,6 @@ export class World {
12148
11894
  */
12149
11895
  getDynamicProperty(identifier: string): boolean | number | string | Vector3 | undefined;
12150
11896
  /**
12151
- * @beta
12152
11897
  * @remarks
12153
11898
  * Gets a set of dynamic property identifiers that have been
12154
11899
  * set in this world.
@@ -12158,7 +11903,6 @@ export class World {
12158
11903
  */
12159
11904
  getDynamicPropertyIds(): string[];
12160
11905
  /**
12161
- * @beta
12162
11906
  * @remarks
12163
11907
  * Gets the total byte count of dynamic properties. This could
12164
11908
  * potentially be used for your own analytics to ensure you're
@@ -12167,7 +11911,6 @@ export class World {
12167
11911
  */
12168
11912
  getDynamicPropertyTotalByteCount(): number;
12169
11913
  /**
12170
- * @beta
12171
11914
  * @remarks
12172
11915
  * Returns an entity based on the provided id.
12173
11916
  *
@@ -12360,7 +12103,6 @@ export class World {
12360
12103
  */
12361
12104
  setDefaultSpawnLocation(spawnLocation: Vector3): void;
12362
12105
  /**
12363
- * @beta
12364
12106
  * @remarks
12365
12107
  * Sets a specified property to a value.
12366
12108
  *
@@ -12823,13 +12565,6 @@ export class WorldBeforeEvents {
12823
12565
  *
12824
12566
  */
12825
12567
  readonly itemUseOn: ItemUseOnBeforeEventSignal;
12826
- /**
12827
- * @beta
12828
- * @remarks
12829
- * This event fires when a piston expands or retracts.
12830
- *
12831
- */
12832
- readonly pistonActivate: PistonActivateBeforeEventSignal;
12833
12568
  /**
12834
12569
  * @remarks
12835
12570
  * This event fires before a block is broken by a player.
@@ -12851,7 +12586,6 @@ export class WorldBeforeEvents {
12851
12586
  */
12852
12587
  readonly playerInteractWithEntity: PlayerInteractWithEntityBeforeEventSignal;
12853
12588
  /**
12854
- * @beta
12855
12589
  * @remarks
12856
12590
  * Fires when a player leaves the game.
12857
12591
  *
@@ -13288,6 +13022,26 @@ export interface DimensionLocation {
13288
13022
  z: number;
13289
13023
  }
13290
13024
 
13025
+ /**
13026
+ * @beta
13027
+ * This class represents a specific leveled enchantment that is
13028
+ * applied to an item.
13029
+ */
13030
+ export interface Enchantment {
13031
+ /**
13032
+ * @remarks
13033
+ * The level of this enchantment instance.
13034
+ *
13035
+ */
13036
+ level: number;
13037
+ /**
13038
+ * @remarks
13039
+ * The enchantment type of this instance.
13040
+ *
13041
+ */
13042
+ type: EnchantmentType | string;
13043
+ }
13044
+
13291
13045
  /**
13292
13046
  * Additional options for when damage has been applied via a
13293
13047
  * projectile.
@@ -13749,6 +13503,7 @@ export interface PlayAnimationOptions {
13749
13503
  *
13750
13504
  */
13751
13505
  nextState?: string;
13506
+ players?: string[];
13752
13507
  /**
13753
13508
  * @remarks
13754
13509
  * Specifies a Molang expression for when this animation should
@@ -14077,6 +13832,30 @@ export class CommandError extends Error {
14077
13832
  private constructor();
14078
13833
  }
14079
13834
 
13835
+ /**
13836
+ * @beta
13837
+ */
13838
+ // @ts-ignore Class inheritance allowed for native defined classes
13839
+ export class EnchantmentLevelOutOfBoundsError extends Error {
13840
+ private constructor();
13841
+ }
13842
+
13843
+ /**
13844
+ * @beta
13845
+ */
13846
+ // @ts-ignore Class inheritance allowed for native defined classes
13847
+ export class EnchantmentTypeNotCompatibleError extends Error {
13848
+ private constructor();
13849
+ }
13850
+
13851
+ /**
13852
+ * @beta
13853
+ */
13854
+ // @ts-ignore Class inheritance allowed for native defined classes
13855
+ export class EnchantmentTypeUnknownIdError extends Error {
13856
+ private constructor();
13857
+ }
13858
+
14080
13859
  // @ts-ignore Class inheritance allowed for native defined classes
14081
13860
  export class LocationInUnloadedChunkError extends Error {
14082
13861
  private constructor();
@@ -14098,7 +13877,6 @@ export const MoonPhaseCount = 8;
14098
13877
  */
14099
13878
  export const TicksPerDay = 24000;
14100
13879
  /**
14101
- * @beta
14102
13880
  * @remarks
14103
13881
  * How many times the server ticks per second of real time.
14104
13882
  *
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.21",
3
+ "version": "1.9.0-beta.1.20.60-preview.22",
4
4
  "description": "",
5
5
  "contributors": [
6
6
  {
@@ -13,7 +13,7 @@
13
13
  }
14
14
  ],
15
15
  "dependencies": {
16
- "@minecraft/common": "^1.1.0-rc.1.20.60-preview.21"
16
+ "@minecraft/common": "^1.1.0"
17
17
  },
18
18
  "license": "MIT"
19
19
  }