@minecraft/server 1.2.0-rc.1.20.0-preview.21 → 1.2.0-rc.1.20.0-preview.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.d.ts +1597 -116
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -16,11 +16,48 @@
16
16
  * ```json
17
17
  * {
18
18
  * "module_name": "@minecraft/server",
19
- * "version": "1.3.0-internal.1.20.0-preview.21"
19
+ * "version": "1.3.0-internal.1.20.0-preview.23"
20
20
  * }
21
21
  * ```
22
22
  *
23
23
  */
24
+ /**
25
+ * @beta
26
+ */
27
+ export enum EntityDamageCause {
28
+ anvil = 'anvil',
29
+ blockExplosion = 'blockExplosion',
30
+ charging = 'charging',
31
+ contact = 'contact',
32
+ drowning = 'drowning',
33
+ entityAttack = 'entityAttack',
34
+ entityExplosion = 'entityExplosion',
35
+ fall = 'fall',
36
+ fallingBlock = 'fallingBlock',
37
+ fire = 'fire',
38
+ fireTick = 'fireTick',
39
+ fireworks = 'fireworks',
40
+ flyIntoWall = 'flyIntoWall',
41
+ freezing = 'freezing',
42
+ lava = 'lava',
43
+ lightning = 'lightning',
44
+ magic = 'magic',
45
+ magma = 'magma',
46
+ none = 'none',
47
+ override = 'override',
48
+ piston = 'piston',
49
+ projectile = 'projectile',
50
+ stalactite = 'stalactite',
51
+ stalagmite = 'stalagmite',
52
+ starve = 'starve',
53
+ suffocation = 'suffocation',
54
+ suicide = 'suicide',
55
+ temperature = 'temperature',
56
+ thorns = 'thorns',
57
+ 'void' = 'void',
58
+ wither = 'wither',
59
+ }
60
+
24
61
  /**
25
62
  * @beta
26
63
  * Represents a game mode for the current world experience.
@@ -60,6 +97,16 @@ export enum GameMode {
60
97
  */
61
98
  survival = 'survival',
62
99
  }
100
+
101
+ /**
102
+ * @beta
103
+ */
104
+ export enum ItemLockMode {
105
+ inventory = 'inventory',
106
+ none = 'none',
107
+ slot = 'slot',
108
+ }
109
+
63
110
  /**
64
111
  * @beta
65
112
  * Represents a block in a dimension. A block represents a
@@ -122,6 +169,30 @@ export class Block {
122
169
  */
123
170
  setPermutation(permutation: BlockPermutation): void;
124
171
  }
172
+
173
+ /**
174
+ * @beta
175
+ * Represents the inventory of a block in the world. Used with
176
+ * blocks like chests.
177
+ */
178
+ export class BlockInventoryComponent {
179
+ protected constructor();
180
+ /**
181
+ * @remarks
182
+ * The container which holds an {@link ItemStack}.
183
+ *
184
+ * @throws This property can throw when used.
185
+ */
186
+ readonly container: Container;
187
+ /**
188
+ * @remarks
189
+ * Identifier of this component. Should always be
190
+ * minecraft:inventory.
191
+ *
192
+ */
193
+ static readonly componentId = 'minecraft:inventory';
194
+ }
195
+
125
196
  /**
126
197
  * @beta
127
198
  * Contains the combination of type {@link BlockType} and
@@ -153,6 +224,7 @@ export class BlockPermutation {
153
224
  */
154
225
  static resolve(blockName: string, states?: Record<string, boolean | number | string>): BlockPermutation;
155
226
  }
227
+
156
228
  /**
157
229
  * Contains return data on the result of a command execution.
158
230
  */
@@ -167,6 +239,192 @@ export class CommandResult {
167
239
  */
168
240
  readonly successCount: number;
169
241
  }
242
+
243
+ /**
244
+ * @beta
245
+ * Base class for downstream Component implementations.
246
+ */
247
+ export class Component {
248
+ protected constructor();
249
+ /**
250
+ * @remarks
251
+ * Identifier of the component.
252
+ *
253
+ */
254
+ readonly typeId: string;
255
+ }
256
+
257
+ /**
258
+ * @beta
259
+ * Represents a container that can hold sets of items. Used
260
+ * with entities such as Players, Chest Minecarts, Llamas, and
261
+ * more.
262
+ */
263
+ export class Container {
264
+ protected constructor();
265
+ /**
266
+ * @remarks
267
+ * Count of the slots in the container that are empty.
268
+ *
269
+ * @throws
270
+ * Throws if the container is invalid.
271
+ */
272
+ readonly emptySlotsCount: number;
273
+ /**
274
+ * @remarks
275
+ * The number of slots in this container. For example, a
276
+ * standard single-block chest has a size of 27. Note, a
277
+ * player's inventory container contains a total of 36 slots, 9
278
+ * hotbar slots plus 27 inventory slots.
279
+ *
280
+ * @throws
281
+ * Throws if the container is invalid.
282
+ */
283
+ readonly size: number;
284
+ /**
285
+ * @remarks
286
+ * Adds an item to the container. The item is placed in the
287
+ * first available slot(s) and can be stacked with existing
288
+ * items of the same type. Note, use {@link Container.setItem}
289
+ * if you wish to set the item in a particular slot.
290
+ *
291
+ * This function can't be called in read-only mode.
292
+ *
293
+ * @param itemStack
294
+ * The stack of items to add.
295
+ * @throws This function can throw errors.
296
+ */
297
+ addItem(itemStack: ItemStack): ItemStack;
298
+ /**
299
+ * @remarks
300
+ * Clears all inventory items in the container.
301
+ *
302
+ * This function can't be called in read-only mode.
303
+ *
304
+ * @throws
305
+ * Throws if the container is invalid.
306
+ */
307
+ clearAll(): void;
308
+ /**
309
+ * @remarks
310
+ * Gets an {@link ItemStack} of the item at the specified slot.
311
+ * If the slot is empty, returns `undefined`. This method does
312
+ * not change or clear the contents of the specified slot. To
313
+ * get a reference to a particular slot, see {@link
314
+ * Container.getSlot}.
315
+ *
316
+ * @param slot
317
+ * Zero-based index of the slot to retrieve items from.
318
+ * @throws
319
+ * Throws if the container is invalid or if the `slot` index is
320
+ * out of bounds.
321
+ * @example getItem.ts
322
+ * ```typescript
323
+ * // Get a copy of the first item in the player's hotbar
324
+ * const inventory = player.getComponent("inventory") as EntityInventoryComponent;
325
+ * const itemStack = inventory.container.getItem(0);
326
+ *
327
+ * ```
328
+ */
329
+ getItem(slot: number): ItemStack | undefined;
330
+ /**
331
+ * @remarks
332
+ * Moves an item from one slot to another, potentially across
333
+ * containers.
334
+ *
335
+ * This function can't be called in read-only mode.
336
+ *
337
+ * @param fromSlot
338
+ * Zero-based index of the slot to transfer an item from, on
339
+ * this container.
340
+ * @param toSlot
341
+ * Zero-based index of the slot to transfer an item to, on
342
+ * `toContainer`.
343
+ * @param toContainer
344
+ * Target container to transfer to. Note this can be the same
345
+ * container as the source.
346
+ * @throws
347
+ * Throws if either this container or `toContainer` are invalid
348
+ * or if the `fromSlot` or `toSlot` indices out of bounds.
349
+ * @example moveItem.ts
350
+ * ```typescript
351
+ * // Move an item from the first slot of fromPlayer's inventory to the fifth slot of toPlayer's inventory
352
+ * const fromInventory = fromPlayer.getComponent('inventory') as EntityInventoryComponent;
353
+ * const toInventory = toPlayer.getComponent('inventory') as EntityInventoryComponent;
354
+ * fromInventory.container.moveItem(0, 4, toInventory.container);
355
+ *
356
+ * ```
357
+ */
358
+ moveItem(fromSlot: number, toSlot: number, toContainer: Container): void;
359
+ /**
360
+ * @remarks
361
+ * Sets an item stack within a particular slot.
362
+ *
363
+ * This function can't be called in read-only mode.
364
+ *
365
+ * @param slot
366
+ * Zero-based index of the slot to set an item at.
367
+ * @param itemStack
368
+ * Stack of items to place within the specified slot. Setting
369
+ * `itemStack` to undefined will clear the slot.
370
+ * @throws
371
+ * Throws if the container is invalid or if the `slot` index is
372
+ * out of bounds.
373
+ */
374
+ setItem(slot: number, itemStack?: ItemStack): void;
375
+ /**
376
+ * @remarks
377
+ * Swaps items between two different slots within containers.
378
+ *
379
+ * This function can't be called in read-only mode.
380
+ *
381
+ * @param slot
382
+ * Zero-based index of the slot to swap from this container.
383
+ * @param otherSlot
384
+ * Zero-based index of the slot to swap with.
385
+ * @param otherContainer
386
+ * Target container to swap with. Note this can be the same
387
+ * container as this source.
388
+ * @throws
389
+ * Throws if either this container or `otherContainer` are
390
+ * invalid or if the `slot` or `otherSlot` are out of bounds.
391
+ * @example swapItems.ts
392
+ * ```typescript
393
+ * // Swaps an item between slots 0 and 4 in the player's inventory
394
+ * const inventory = fromPlayer.getComponent('inventory') as EntityInventoryComponent;
395
+ * inventory.container.swapItems(0, 4, inventory);
396
+ *
397
+ * ```
398
+ */
399
+ swapItems(slot: number, otherSlot: number, otherContainer: Container): void;
400
+ /**
401
+ * @remarks
402
+ * Moves an item from one slot to another container, or to the
403
+ * first available slot in the same container.
404
+ *
405
+ * This function can't be called in read-only mode.
406
+ *
407
+ * @param fromSlot
408
+ * Zero-based index of the slot to transfer an item from, on
409
+ * this container.
410
+ * @param toContainer
411
+ * Target container to transfer to. Note this can be the same
412
+ * container as the source.
413
+ * @throws
414
+ * Throws if either this container or `toContainer` are invalid
415
+ * or if the `fromSlot` or `toSlot` indices out of bounds.
416
+ * @example transferItem.ts
417
+ * ```typescript
418
+ * // Transfer an item from the first slot of fromPlayer's inventory to toPlayer's inventory
419
+ * const fromInventory = fromPlayer.getComponent('inventory') as EntityInventoryComponent;
420
+ * const toInventory = toPlayer.getComponent('inventory') as EntityInventoryComponent;
421
+ * fromInventory.container.transferItem(0, toInventory.container);
422
+ *
423
+ * ```
424
+ */
425
+ transferItem(fromSlot: number, toContainer: Container): ItemStack;
426
+ }
427
+
170
428
  /**
171
429
  * A class that represents a particular dimension (e.g., The
172
430
  * End) within a world.
@@ -183,8 +441,7 @@ export class Dimension {
183
441
  /**
184
442
  * @beta
185
443
  * @remarks
186
- * Returns a block instance at the given location. This method
187
- * was introduced as of version 1.17.10.21.
444
+ * Returns a block instance at the given location.
188
445
  *
189
446
  * @param location
190
447
  * The location at which to return a block.
@@ -192,172 +449,1210 @@ export class Dimension {
192
449
  * Block at the specified location.
193
450
  * @throws This function can throw errors.
194
451
  */
195
- getBlock(location: Vector3): Block;
452
+ getBlock(location: Vector3): Block | undefined;
453
+ /**
454
+ * @beta
455
+ * @remarks
456
+ * Returns a set of entities based on a set of conditions
457
+ * defined via the EntityQueryOptions set of filter criteria.
458
+ *
459
+ * @param options
460
+ * Additional options that can be used to filter the set of
461
+ * entities returned.
462
+ * @returns
463
+ * An entity array.
464
+ * @throws This function can throw errors.
465
+ * @example testThatEntityIsFeatherItem.ts
466
+ * ```typescript
467
+ * const query = {
468
+ * type: "item",
469
+ * location: targetLocation,
470
+ * };
471
+ * const items = overworld.getEntities(query);
472
+ *
473
+ * for (const item of items) {
474
+ * const itemComp = item.getComponent("item") as any;
475
+ *
476
+ * if (itemComp) {
477
+ * if (itemComp.itemStack.id.endsWith("feather")) {
478
+ * console.log("Success! Found a feather", 1);
479
+ * }
480
+ * }
481
+ * }
482
+ *
483
+ * ```
484
+ */
485
+ getEntities(options?: EntityQueryOptions): Entity[];
486
+ /**
487
+ * @beta
488
+ * @remarks
489
+ * Returns a set of entities at a particular location.
490
+ *
491
+ * @param location
492
+ * The location at which to return entities.
493
+ * @returns
494
+ * Zero or more entities at the specified location.
495
+ */
496
+ getEntitiesAtBlockLocation(location: Vector3): Entity[];
497
+ /**
498
+ * @beta
499
+ * @remarks
500
+ * Returns a set of players based on a set of conditions
501
+ * defined via the EntityQueryOptions set of filter criteria.
502
+ *
503
+ * @param options
504
+ * Additional options that can be used to filter the set of
505
+ * players returned.
506
+ * @returns
507
+ * A player array.
508
+ * @throws This function can throw errors.
509
+ */
510
+ getPlayers(options?: EntityQueryOptions): Player[];
511
+ /**
512
+ * @beta
513
+ * @remarks
514
+ * This function can't be called in read-only mode.
515
+ *
516
+ * @throws This function can throw errors.
517
+ */
518
+ runCommand(commandString: string): CommandResult;
519
+ /**
520
+ * @remarks
521
+ * Runs a particular command asynchronously from the context of
522
+ * the broader dimension. Note that there is a maximum queue
523
+ * of 128 asynchronous commands that can be run in a given
524
+ * tick.
525
+ *
526
+ * @param commandString
527
+ * Command to run. Note that command strings should not start
528
+ * with slash.
529
+ * @returns
530
+ * For commands that return data, returns a CommandResult with
531
+ * an indicator of command results.
532
+ * @throws This function can throw errors.
533
+ */
534
+ runCommandAsync(commandString: string): Promise<CommandResult>;
535
+ }
536
+
537
+ /**
538
+ * Represents the state of an entity (a mob, the player, or
539
+ * other moving objects like minecarts) in the world.
540
+ */
541
+ export class Entity {
542
+ protected constructor();
543
+ /**
544
+ * @beta
545
+ * @remarks
546
+ * Dimension that the entity is currently within.
547
+ *
548
+ * @throws This property can throw when used.
549
+ */
550
+ readonly dimension: Dimension;
551
+ /**
552
+ * @remarks
553
+ * Unique identifier of the entity. This identifier is intended
554
+ * to be consistent across loads of a world instance. No
555
+ * meaning should be inferred from the value and structure of
556
+ * this unique identifier - do not parse or interpret it.
557
+ *
558
+ * @throws This property can throw when used.
559
+ */
560
+ readonly id: string;
561
+ /**
562
+ * @beta
563
+ * @remarks
564
+ * Current location of the entity.
565
+ *
566
+ * @throws This property can throw when used.
567
+ */
568
+ readonly location: Vector3;
569
+ /**
570
+ * @beta
571
+ * @remarks
572
+ * Given name of the entity.
573
+ *
574
+ * This property can't be edited in read-only mode.
575
+ *
576
+ */
577
+ nameTag: string;
578
+ /**
579
+ * @remarks
580
+ * Unique identifier of the type of the entity - for example,
581
+ * 'minecraft:skeleton'.
582
+ *
583
+ * @throws This property can throw when used.
584
+ */
585
+ readonly typeId: string;
586
+ /**
587
+ * @beta
588
+ * @remarks
589
+ * Adds a specified tag to an entity.
590
+ *
591
+ * This function can't be called in read-only mode.
592
+ *
593
+ * @param tag
594
+ * Content of the tag to add.
595
+ * @throws This function can throw errors.
596
+ */
597
+ addTag(tag: string): boolean;
598
+ /**
599
+ * @beta
600
+ * @remarks
601
+ * Applies a set of damage to an entity.
602
+ *
603
+ * This function can't be called in read-only mode.
604
+ *
605
+ * @param amount
606
+ * Amount of damage to apply.
607
+ * @param options
608
+ * Additional options about the source of damage, which may add
609
+ * additional effects or spur additional behaviors on this
610
+ * entity.
611
+ * @throws This function can throw errors.
612
+ */
613
+ applyDamage(amount: number, options?: EntityApplyDamageByProjectileOptions | EntityApplyDamageOptions): boolean;
614
+ /**
615
+ * @beta
616
+ * @remarks
617
+ * Applies impulse vector to the current velocity of the
618
+ * entity.
619
+ *
620
+ * This function can't be called in read-only mode.
621
+ *
622
+ * @param vector
623
+ * Impulse vector.
624
+ * @throws This function can throw errors.
625
+ */
626
+ applyImpulse(vector: Vector3): void;
627
+ /**
628
+ * @beta
629
+ * @remarks
630
+ * Applies impulse vector to the current velocity of the
631
+ * entity.
632
+ *
633
+ * This function can't be called in read-only mode.
634
+ *
635
+ * @param directionX
636
+ * X direction in horizontal plane.
637
+ * @param directionZ
638
+ * Z direction in horizontal plane.
639
+ * @param horizontalStrength
640
+ * Knockback strength for the horizontal vector.
641
+ * @param verticalStrength
642
+ * Knockback strength for the vertical vector.
643
+ * @throws This function can throw errors.
644
+ */
645
+ applyKnockback(directionX: number, directionZ: number, horizontalStrength: number, verticalStrength: number): void;
646
+ /**
647
+ * @beta
648
+ * @remarks
649
+ * Sets the current velocity of the Entity to zero. Note that
650
+ * this method may not have an impact on Players.
651
+ *
652
+ * This function can't be called in read-only mode.
653
+ *
654
+ * @throws This function can throw errors.
655
+ */
656
+ clearVelocity(): void;
657
+ /**
658
+ * @beta
659
+ * @remarks
660
+ * Gets a component (that represents additional capabilities)
661
+ * for an entity.
662
+ *
663
+ * @param componentId
664
+ * The identifier of the component (e.g., 'minecraft:rideable')
665
+ * to retrieve. If no namespace prefix is specified,
666
+ * 'minecraft:' is assumed. If the component is not present on
667
+ * the entity, undefined is returned.
668
+ */
669
+ getComponent(componentId: string): EntityComponent | undefined;
670
+ /**
671
+ * @beta
672
+ * @remarks
673
+ * Returns all components that are both present on this entity
674
+ * and supported by the API.
675
+ *
676
+ */
677
+ getComponents(): EntityComponent[];
678
+ /**
679
+ * @beta
680
+ * @remarks
681
+ * Returns the current location of the head component of this
682
+ * entity.
683
+ *
684
+ * @throws This function can throw errors.
685
+ */
686
+ getHeadLocation(): Vector3;
687
+ /**
688
+ * @beta
689
+ * @remarks
690
+ * Returns all tags associated with an entity.
691
+ *
692
+ * @throws This function can throw errors.
693
+ */
694
+ getTags(): string[];
695
+ /**
696
+ * @beta
697
+ * @remarks
698
+ * Returns the current velocity vector of the entity.
699
+ *
700
+ * @throws This function can throw errors.
701
+ */
702
+ getVelocity(): Vector3;
703
+ /**
704
+ * @beta
705
+ * @remarks
706
+ * Returns the current view direction of the entity.
707
+ *
708
+ * @throws This function can throw errors.
709
+ */
710
+ getViewDirection(): Vector3;
711
+ /**
712
+ * @beta
713
+ * @remarks
714
+ * Returns true if the specified component is present on this
715
+ * entity.
716
+ *
717
+ * @param componentId
718
+ * The identifier of the component (e.g., 'minecraft:rideable')
719
+ * to retrieve. If no namespace prefix is specified,
720
+ * 'minecraft:' is assumed.
721
+ */
722
+ hasComponent(componentId: string): boolean;
723
+ /**
724
+ * @beta
725
+ * @remarks
726
+ * Tests whether an entity has a particular tag.
727
+ *
728
+ * @param tag
729
+ * Identifier of the tag to test for.
730
+ * @throws This function can throw errors.
731
+ */
732
+ hasTag(tag: string): boolean;
733
+ /**
734
+ * @beta
735
+ * @remarks
736
+ * Kills this entity. The entity will drop loot as normal.
737
+ *
738
+ * This function can't be called in read-only mode.
739
+ *
740
+ * @returns
741
+ * Returns true if entity can be killed (even if it is already
742
+ * dead), otherwise it returns false.
743
+ * @throws This function can throw errors.
744
+ */
745
+ kill(): boolean;
746
+ /**
747
+ * @beta
748
+ * @remarks
749
+ * Removes a specified tag from an entity.
750
+ *
751
+ * This function can't be called in read-only mode.
752
+ *
753
+ * @param tag
754
+ * Content of the tag to remove.
755
+ * @throws This function can throw errors.
756
+ */
757
+ removeTag(tag: string): boolean;
758
+ /**
759
+ * @beta
760
+ * @remarks
761
+ * Runs a synchronous command on the entity.
762
+ *
763
+ * This function can't be called in read-only mode.
764
+ *
765
+ * @throws This function can throw errors.
766
+ */
767
+ runCommand(commandString: string): CommandResult;
768
+ /**
769
+ * @remarks
770
+ * Runs a particular command asynchronously from the context of
771
+ * this entity. Note that there is a maximum queue of 128
772
+ * asynchronous commands that can be run in a given tick.
773
+ *
774
+ * @param commandString
775
+ * Command to run. Note that command strings should not start
776
+ * with slash.
777
+ * @returns
778
+ * For commands that return data, returns a JSON structure with
779
+ * command response values.
780
+ * @throws This function can throw errors.
781
+ */
782
+ runCommandAsync(commandString: string): Promise<CommandResult>;
783
+ }
784
+
785
+ /**
786
+ * @beta
787
+ * Base class for a family of entity movement events.
788
+ */
789
+ export class EntityBaseMovementComponent extends EntityComponent {
790
+ protected constructor();
791
+ readonly maxTurn: number;
792
+ }
793
+
794
+ /**
795
+ * @beta
796
+ * When added, this component signifies that the entity can
797
+ * climb up ladders.
798
+ */
799
+ export class EntityCanClimbComponent extends EntityComponent {
800
+ protected constructor();
801
+ /**
802
+ * @remarks
803
+ * Identifier of this component. Should always be
804
+ * minecraft:can_climb.
805
+ *
806
+ */
807
+ static readonly componentId = 'minecraft:can_climb';
808
+ }
809
+
810
+ /**
811
+ * @beta
812
+ * When added, this component signifies that the entity can
813
+ * fly, and the pathfinder won't be restricted to paths where a
814
+ * solid block is required underneath it.
815
+ */
816
+ export class EntityCanFlyComponent extends EntityComponent {
817
+ protected constructor();
818
+ /**
819
+ * @remarks
820
+ * Identifier of this component. Should always be
821
+ * minecraft:can_fly.
822
+ *
823
+ */
824
+ static readonly componentId = 'minecraft:can_fly';
825
+ }
826
+
827
+ /**
828
+ * @beta
829
+ * When added, this component signifies that the entity can
830
+ * power jump like the horse does within Minecraft.
831
+ */
832
+ export class EntityCanPowerJumpComponent extends EntityComponent {
833
+ protected constructor();
834
+ /**
835
+ * @remarks
836
+ * Identifier of this component. Should always be
837
+ * minecraft:can_power_jump.
838
+ *
839
+ */
840
+ static readonly componentId = 'minecraft:can_power_jump';
841
+ }
842
+
843
+ /**
844
+ * @beta
845
+ * Defines the entity's color. Only works on certain entities
846
+ * that have predefined color values (sheep, llama, shulker).
847
+ */
848
+ export class EntityColorComponent extends EntityComponent {
849
+ protected constructor();
850
+ /**
851
+ * @remarks
852
+ * This property can't be edited in read-only mode.
853
+ *
854
+ */
855
+ value: number;
856
+ /**
857
+ * @remarks
858
+ * Identifier of this component. Should always be
859
+ * minecraft:color.
860
+ *
861
+ */
862
+ static readonly componentId = 'minecraft:color';
863
+ }
864
+
865
+ /**
866
+ * @beta
867
+ * Base class for downstream entity components.
868
+ */
869
+ export class EntityComponent extends Component {
870
+ protected constructor();
871
+ }
872
+
873
+ /**
874
+ * @beta
875
+ * When added, this component signifies that this entity
876
+ * doesn't take damage from fire.
877
+ */
878
+ export class EntityFireImmuneComponent extends EntityComponent {
879
+ protected constructor();
880
+ /**
881
+ * @remarks
882
+ * Identifier of this component. Should always be
883
+ * minecraft:fire_immune.
884
+ *
885
+ */
886
+ static readonly componentId = 'minecraft:fire_immune';
887
+ }
888
+
889
+ /**
890
+ * @beta
891
+ * When added, this component signifies that this entity can
892
+ * float in liquid blocks.
893
+ */
894
+ export class EntityFloatsInLiquidComponent extends EntityComponent {
895
+ protected constructor();
896
+ /**
897
+ * @remarks
898
+ * Identifier of this component. Should always be
899
+ * minecraft:floats_in_liquid.
900
+ *
901
+ */
902
+ static readonly componentId = 'minecraft:floats_in_liquid';
903
+ }
904
+
905
+ /**
906
+ * @beta
907
+ * Represents the flying speed of an entity.
908
+ */
909
+ export class EntityFlyingSpeedComponent extends EntityComponent {
910
+ protected constructor();
911
+ /**
912
+ * @remarks
913
+ * This property can't be edited in read-only mode.
914
+ *
915
+ */
916
+ value: number;
917
+ /**
918
+ * @remarks
919
+ * Identifier of this component. Should always be
920
+ * minecraft:flying_speed.
921
+ *
922
+ */
923
+ static readonly componentId = 'minecraft:flying_speed';
924
+ }
925
+
926
+ /**
927
+ * @beta
928
+ * Defines how much friction affects this entity.
929
+ */
930
+ export class EntityFrictionModifierComponent extends EntityComponent {
931
+ protected constructor();
932
+ /**
933
+ * @remarks
934
+ * This property can't be edited in read-only mode.
935
+ *
936
+ */
937
+ value: number;
938
+ /**
939
+ * @remarks
940
+ * Identifier of this component. Should always be
941
+ * minecraft:friction_modifier.
942
+ *
943
+ */
944
+ static readonly componentId = 'minecraft:friction_modifier';
945
+ }
946
+
947
+ /**
948
+ * @beta
949
+ * Sets the offset from the ground that the entity is actually
950
+ * at.
951
+ */
952
+ export class EntityGroundOffsetComponent extends EntityComponent {
953
+ protected constructor();
954
+ /**
955
+ * @remarks
956
+ * This property can't be edited in read-only mode.
957
+ *
958
+ */
959
+ value: number;
960
+ /**
961
+ * @remarks
962
+ * Identifier of this component. Should always be
963
+ * minecraft:ground_offset.
964
+ *
965
+ */
966
+ static readonly componentId = 'minecraft:ground_offset';
967
+ }
968
+
969
+ /**
970
+ * @beta
971
+ * Defines this entity's inventory properties.
972
+ */
973
+ export class EntityInventoryComponent extends EntityComponent {
974
+ protected constructor();
975
+ /**
976
+ * @remarks
977
+ * Number of slots that this entity can gain per extra
978
+ * strength.
979
+ *
980
+ * @throws This property can throw when used.
981
+ */
982
+ readonly additionalSlotsPerStrength: number;
983
+ /**
984
+ * @remarks
985
+ * If true, the contents of this inventory can be removed by a
986
+ * hopper.
987
+ *
988
+ * @throws This property can throw when used.
989
+ */
990
+ readonly canBeSiphonedFrom: boolean;
991
+ /**
992
+ * @remarks
993
+ * Defines the container for this entity.
994
+ *
995
+ * @throws This property can throw when used.
996
+ */
997
+ readonly container: Container;
998
+ /**
999
+ * @remarks
1000
+ * Type of container this entity has.
1001
+ *
1002
+ * @throws This property can throw when used.
1003
+ */
1004
+ readonly containerType: string;
1005
+ /**
1006
+ * @remarks
1007
+ * Number of slots the container has.
1008
+ *
1009
+ * @throws This property can throw when used.
1010
+ */
1011
+ readonly inventorySize: number;
1012
+ /**
1013
+ * @remarks
1014
+ * If true, the entity will not drop it's inventory on death.
1015
+ *
1016
+ * @throws This property can throw when used.
1017
+ */
1018
+ readonly 'private': boolean;
1019
+ /**
1020
+ * @remarks
1021
+ * If true, the entity's inventory can only be accessed by its
1022
+ * owner or itself.
1023
+ *
1024
+ * @throws This property can throw when used.
1025
+ */
1026
+ readonly restrictToOwner: boolean;
1027
+ /**
1028
+ * @remarks
1029
+ * Identifier of this component. Should always be
1030
+ * minecraft:inventory.
1031
+ *
1032
+ */
1033
+ static readonly componentId = 'minecraft:inventory';
1034
+ }
1035
+
1036
+ /**
1037
+ * @beta
1038
+ * When added, this component signifies that this entity is a
1039
+ * baby.
1040
+ */
1041
+ export class EntityIsBabyComponent extends EntityComponent {
1042
+ protected constructor();
1043
+ /**
1044
+ * @remarks
1045
+ * Identifier of this component. Should always be
1046
+ * minecraft:is_baby.
1047
+ *
1048
+ */
1049
+ static readonly componentId = 'minecraft:is_baby';
1050
+ }
1051
+
1052
+ /**
1053
+ * @beta
1054
+ * When added, this component signifies that this entity is
1055
+ * charged.
1056
+ */
1057
+ export class EntityIsChargedComponent extends EntityComponent {
1058
+ protected constructor();
1059
+ /**
1060
+ * @remarks
1061
+ * Identifier of this component. Should always be
1062
+ * minecraft:is_charged.
1063
+ *
1064
+ */
1065
+ static readonly componentId = 'minecraft:is_charged';
1066
+ }
1067
+
1068
+ /**
1069
+ * @beta
1070
+ * When added, this component signifies that this entity is
1071
+ * currently carrying a chest.
1072
+ */
1073
+ export class EntityIsChestedComponent extends EntityComponent {
1074
+ protected constructor();
1075
+ /**
1076
+ * @remarks
1077
+ * Identifier of this component. Should always be
1078
+ * minecraft:is_chested.
1079
+ *
1080
+ */
1081
+ static readonly componentId = 'minecraft:is_chested';
1082
+ }
1083
+
1084
+ /**
1085
+ * @beta
1086
+ * When added, this component signifies that dyes can be used
1087
+ * on this entity to change its color.
1088
+ */
1089
+ export class EntityIsDyeableComponent extends EntityComponent {
1090
+ protected constructor();
1091
+ /**
1092
+ * @remarks
1093
+ * Identifier of this component. Should always be
1094
+ * minecraft:is_dyeable.
1095
+ *
1096
+ */
1097
+ static readonly componentId = 'minecraft:is_dyeable';
1098
+ }
1099
+
1100
+ /**
1101
+ * @beta
1102
+ * When added, this component signifies that this entity can
1103
+ * hide from hostile mobs while invisible.
1104
+ */
1105
+ export class EntityIsHiddenWhenInvisibleComponent extends EntityComponent {
1106
+ protected constructor();
1107
+ /**
1108
+ * @remarks
1109
+ * Identifier of this component. Should always be
1110
+ * minecraft:is_hidden_when_invisible.
1111
+ *
1112
+ */
1113
+ static readonly componentId = 'minecraft:is_hidden_when_invisible';
1114
+ }
1115
+
1116
+ /**
1117
+ * @beta
1118
+ * When added, this component signifies that this entity this
1119
+ * currently on fire.
1120
+ */
1121
+ export class EntityIsIgnitedComponent extends EntityComponent {
1122
+ protected constructor();
1123
+ /**
1124
+ * @remarks
1125
+ * Identifier of this component. Should always be
1126
+ * minecraft:is_ignited.
1127
+ *
1128
+ */
1129
+ static readonly componentId = 'minecraft:is_ignited';
1130
+ }
1131
+
1132
+ /**
1133
+ * @beta
1134
+ * When added, this component signifies that this entity is an
1135
+ * illager captain.
1136
+ */
1137
+ export class EntityIsIllagerCaptainComponent extends EntityComponent {
1138
+ protected constructor();
1139
+ /**
1140
+ * @remarks
1141
+ * Identifier of this component. Should always be
1142
+ * minecraft:is_illager_captain.
1143
+ *
1144
+ */
1145
+ static readonly componentId = 'minecraft:is_illager_captain';
1146
+ }
1147
+
1148
+ /**
1149
+ * @beta
1150
+ * When added, this component signifies that this entity is
1151
+ * currently saddled.
1152
+ */
1153
+ export class EntityIsSaddledComponent extends EntityComponent {
1154
+ protected constructor();
1155
+ /**
1156
+ * @remarks
1157
+ * Identifier of this component. Should always be
1158
+ * minecraft:is_saddled.
1159
+ *
1160
+ */
1161
+ static readonly componentId = 'minecraft:is_saddled';
1162
+ }
1163
+
1164
+ /**
1165
+ * @beta
1166
+ * When added, this component signifies that this entity is
1167
+ * currently shaking.
1168
+ */
1169
+ export class EntityIsShakingComponent extends EntityComponent {
1170
+ protected constructor();
1171
+ /**
1172
+ * @remarks
1173
+ * Identifier of this component. Should always be
1174
+ * minecraft:is_shaking.
1175
+ *
1176
+ */
1177
+ static readonly componentId = 'minecraft:is_shaking';
1178
+ }
1179
+
1180
+ /**
1181
+ * @beta
1182
+ * When added, this component signifies that this entity is
1183
+ * currently sheared.
1184
+ */
1185
+ export class EntityIsShearedComponent extends EntityComponent {
1186
+ protected constructor();
1187
+ /**
1188
+ * @remarks
1189
+ * Identifier of this component. Should always be
1190
+ * minecraft:is_sheared.
1191
+ *
1192
+ */
1193
+ static readonly componentId = 'minecraft:is_sheared';
1194
+ }
1195
+
1196
+ /**
1197
+ * @beta
1198
+ * When added, this component signifies that this entity can be
1199
+ * stacked.
1200
+ */
1201
+ export class EntityIsStackableComponent extends EntityComponent {
1202
+ protected constructor();
1203
+ /**
1204
+ * @remarks
1205
+ * Identifier of this component. Should always be
1206
+ * minecraft:is_stackable.
1207
+ *
1208
+ */
1209
+ static readonly componentId = 'minecraft:is_stackable';
1210
+ }
1211
+
1212
+ /**
1213
+ * @beta
1214
+ * When added, this component signifies that this entity is
1215
+ * currently stunned.
1216
+ */
1217
+ export class EntityIsStunnedComponent extends EntityComponent {
1218
+ protected constructor();
1219
+ /**
1220
+ * @remarks
1221
+ * Identifier of this component. Should always be
1222
+ * minecraft:is_stunned.
1223
+ *
1224
+ */
1225
+ static readonly componentId = 'minecraft:is_stunned';
1226
+ }
1227
+
1228
+ /**
1229
+ * @beta
1230
+ * When added, this component signifies that this entity is
1231
+ * currently tamed.
1232
+ */
1233
+ export class EntityIsTamedComponent extends EntityComponent {
1234
+ protected constructor();
1235
+ /**
1236
+ * @remarks
1237
+ * Identifier of this component. Should always be
1238
+ * minecraft:is_tamed.
1239
+ *
1240
+ */
1241
+ static readonly componentId = 'minecraft:is_tamed';
1242
+ }
1243
+
1244
+ /**
1245
+ * @beta
1246
+ * If added onto the entity, this indicates that the entity
1247
+ * represents a free-floating item in the world. Lets you
1248
+ * retrieve the actual item stack contents via the itemStack
1249
+ * property.
1250
+ */
1251
+ export class EntityItemComponent extends EntityComponent {
1252
+ protected constructor();
1253
+ /**
1254
+ * @remarks
1255
+ * Item stack represented by this entity in the world.
1256
+ *
1257
+ * @throws This property can throw when used.
1258
+ */
1259
+ readonly itemStack: ItemStack;
1260
+ /**
1261
+ * @remarks
1262
+ * Identifier of this component.
1263
+ *
1264
+ */
1265
+ static readonly componentId = 'minecraft:item';
1266
+ }
1267
+
1268
+ /**
1269
+ * @beta
1270
+ * Additional variant value. Can be used to further
1271
+ * differentiate variants.
1272
+ */
1273
+ export class EntityMarkVariantComponent extends EntityComponent {
1274
+ protected constructor();
1275
+ /**
1276
+ * @remarks
1277
+ * This property can't be edited in read-only mode.
1278
+ *
1279
+ */
1280
+ value: number;
1281
+ /**
1282
+ * @remarks
1283
+ * Identifier of this component. Should always be
1284
+ * minecraft:mark_variant.
1285
+ *
1286
+ */
1287
+ static readonly componentId = 'minecraft:mark_variant';
1288
+ }
1289
+
1290
+ /**
1291
+ * @beta
1292
+ * When added, this movement control allows the mob to swim in
1293
+ * water and walk on land.
1294
+ */
1295
+ export class EntityMovementAmphibiousComponent extends EntityBaseMovementComponent {
1296
+ protected constructor();
1297
+ /**
1298
+ * @remarks
1299
+ * Identifier of this component. Should always be
1300
+ * minecraft:movement.amphibious.
1301
+ *
1302
+ */
1303
+ static readonly componentId = 'minecraft:movement.amphibious';
1304
+ }
1305
+
1306
+ /**
1307
+ * @beta
1308
+ * This component accents the movement of an entity.
1309
+ */
1310
+ export class EntityMovementBasicComponent extends EntityBaseMovementComponent {
1311
+ protected constructor();
1312
+ /**
1313
+ * @remarks
1314
+ * Identifier of this component. Should always be
1315
+ * minecraft:movement.basic.
1316
+ *
1317
+ */
1318
+ static readonly componentId = 'minecraft:movement.basic';
1319
+ }
1320
+
1321
+ /**
1322
+ * @beta
1323
+ * When added, this move control causes the mob to fly.
1324
+ */
1325
+ export class EntityMovementFlyComponent extends EntityBaseMovementComponent {
1326
+ protected constructor();
1327
+ /**
1328
+ * @remarks
1329
+ * Identifier of this component. Should always be
1330
+ * minecraft:movement.fly.
1331
+ *
1332
+ */
1333
+ static readonly componentId = 'minecraft:movement.fly';
1334
+ }
1335
+
1336
+ /**
1337
+ * @beta
1338
+ * When added, this move control allows a mob to fly, swim,
1339
+ * climb, etc.
1340
+ */
1341
+ export class EntityMovementGenericComponent extends EntityBaseMovementComponent {
1342
+ protected constructor();
1343
+ /**
1344
+ * @remarks
1345
+ * Identifier of this component. Should always be
1346
+ * minecraft:movement.generic.
1347
+ *
1348
+ */
1349
+ static readonly componentId = 'minecraft:movement.generic';
1350
+ }
1351
+
1352
+ /**
1353
+ * @beta
1354
+ * When added, this move control causes the mob to hover.
1355
+ */
1356
+ export class EntityMovementHoverComponent extends EntityBaseMovementComponent {
1357
+ protected constructor();
1358
+ /**
1359
+ * @remarks
1360
+ * Identifier of this component. Should always be
1361
+ * minecraft:movement.hover.
1362
+ *
1363
+ */
1364
+ static readonly componentId = 'minecraft:movement.hover';
1365
+ }
1366
+
1367
+ /**
1368
+ * @beta
1369
+ * Move control that causes the mob to jump as it moves with a
1370
+ * specified delay between jumps.
1371
+ */
1372
+ export class EntityMovementJumpComponent extends EntityBaseMovementComponent {
1373
+ protected constructor();
1374
+ /**
1375
+ * @remarks
1376
+ * Identifier of this component. Should always be
1377
+ * minecraft:movement.jump.
1378
+ *
1379
+ */
1380
+ static readonly componentId = 'minecraft:movement.jump';
1381
+ }
1382
+
1383
+ /**
1384
+ * @beta
1385
+ * When added, this move control causes the mob to hop as it
1386
+ * moves.
1387
+ */
1388
+ export class EntityMovementSkipComponent extends EntityBaseMovementComponent {
1389
+ protected constructor();
1390
+ /**
1391
+ * @remarks
1392
+ * Identifier of this component. Should always be
1393
+ * minecraft:movement.skip.
1394
+ *
1395
+ */
1396
+ static readonly componentId = 'minecraft:movement.skip';
1397
+ }
1398
+
1399
+ /**
1400
+ * @beta
1401
+ * Sets the distance through which the entity can push through.
1402
+ */
1403
+ export class EntityPushThroughComponent extends EntityComponent {
1404
+ protected constructor();
1405
+ /**
1406
+ * @remarks
1407
+ * This property can't be edited in read-only mode.
1408
+ *
1409
+ */
1410
+ value: number;
1411
+ /**
1412
+ * @remarks
1413
+ * Identifier of this component. Should always be
1414
+ * minecraft:push_through.
1415
+ *
1416
+ */
1417
+ static readonly componentId = 'minecraft:push_through';
1418
+ }
1419
+
1420
+ /**
1421
+ * @beta
1422
+ * Sets the entity's visual size.
1423
+ */
1424
+ export class EntityScaleComponent extends EntityComponent {
1425
+ protected constructor();
1426
+ /**
1427
+ * @remarks
1428
+ * This property can't be edited in read-only mode.
1429
+ *
1430
+ */
1431
+ value: number;
1432
+ /**
1433
+ * @remarks
1434
+ * Identifier of this component. Should always be
1435
+ * minecraft:scale.
1436
+ *
1437
+ */
1438
+ static readonly componentId = 'minecraft:scale';
1439
+ }
1440
+
1441
+ /**
1442
+ * @beta
1443
+ * Skin Id value. Can be used to differentiate skins, such as
1444
+ * base skins for villagers.
1445
+ */
1446
+ export class EntitySkinIdComponent extends EntityComponent {
1447
+ protected constructor();
1448
+ /**
1449
+ * @remarks
1450
+ * This property can't be edited in read-only mode.
1451
+ *
1452
+ */
1453
+ value: number;
1454
+ /**
1455
+ * @remarks
1456
+ * Identifier of this component. Should always be
1457
+ * minecraft:skin_id.
1458
+ *
1459
+ */
1460
+ static readonly componentId = 'minecraft:skin_id';
1461
+ }
1462
+
1463
+ /**
1464
+ * @beta
1465
+ * Used to differentiate the component group of a variant of an
1466
+ * entity from others. (e.g. ocelot, villager).
1467
+ */
1468
+ export class EntityVariantComponent extends EntityComponent {
1469
+ protected constructor();
1470
+ readonly value: number;
1471
+ /**
1472
+ * @remarks
1473
+ * Identifier of this component. Should always be
1474
+ * minecraft:variant.
1475
+ *
1476
+ */
1477
+ static readonly componentId = 'minecraft:variant';
1478
+ }
1479
+
1480
+ /**
1481
+ * @beta
1482
+ * When added, this component signifies that this entity wants
1483
+ * to become a jockey.
1484
+ */
1485
+ export class EntityWantsJockeyComponent extends EntityComponent {
1486
+ protected constructor();
1487
+ /**
1488
+ * @remarks
1489
+ * Identifier of this component. Should always be
1490
+ * minecraft:wants_jockey.
1491
+ *
1492
+ */
1493
+ static readonly componentId = 'minecraft:wants_jockey';
1494
+ }
1495
+
1496
+ /**
1497
+ * @beta
1498
+ * Base class for item components.
1499
+ */
1500
+ export class ItemComponent extends Component {
1501
+ protected constructor();
1502
+ }
1503
+
1504
+ /**
1505
+ * @beta
1506
+ * Defines a collection of items.
1507
+ */
1508
+ export class ItemStack {
1509
+ /**
1510
+ * @remarks
1511
+ * Number of the items in the stack. Valid values range between
1512
+ * 1-255. The provided value will be clamped to the item's
1513
+ * maximum stack size.
1514
+ *
1515
+ * @throws
1516
+ * Throws if the value is outside the range of 1-255.
1517
+ */
1518
+ readonly amount: number;
196
1519
  /**
197
- * @beta
198
1520
  * @remarks
199
- * Returns a set of entities based on a set of conditions
200
- * defined via the EntityQueryOptions set of filter criteria.
201
- *
202
- * @param options
203
- * Additional options that can be used to filter the set of
204
- * entities returned.
205
- * @returns
206
- * An entity array.
207
- * @throws This function can throw errors.
208
- * @example testThatEntityIsFeatherItem.ts
209
- * ```typescript
210
- * const query = {
211
- * type: "item",
212
- * location: targetLocation,
213
- * };
214
- * const items = overworld.getEntities(query);
215
- *
216
- * for (const item of items) {
217
- * const itemComp = item.getComponent("item") as any;
218
- *
219
- * if (itemComp) {
220
- * if (itemComp.itemStack.id.endsWith("feather")) {
221
- * console.log("Success! Found a feather", 1);
222
- * }
223
- * }
224
- * }
1521
+ * Returns whether the item is stackable. An item is considered
1522
+ * stackable if the item's maximum stack size is greater than 1
1523
+ * and the item does not contain any custom data or properties.
225
1524
  *
226
- * ```
227
1525
  */
228
- getEntities(options?: EntityQueryOptions): Entity[];
1526
+ readonly isStackable: boolean;
229
1527
  /**
230
- * @beta
231
1528
  * @remarks
232
- * Returns a set of entities at a particular location.
1529
+ * Gets or sets whether the item is kept on death.
233
1530
  *
234
- * @param location
235
- * The location at which to return entities.
236
- * @returns
237
- * Zero or more entities at the specified location.
238
1531
  */
239
- getEntitiesAtBlockLocation(location: Vector3): Entity[];
1532
+ readonly keepOnDeath: boolean;
240
1533
  /**
241
- * @beta
242
1534
  * @remarks
243
- * Returns a set of players based on a set of conditions
244
- * defined via the EntityQueryOptions set of filter criteria.
1535
+ * Gets or sets the item's lock mode. The default value is
1536
+ * `ItemLockMode.none`.
245
1537
  *
246
- * @param options
247
- * Additional options that can be used to filter the set of
248
- * players returned.
249
- * @returns
250
- * A player array.
251
- * @throws This function can throw errors.
252
1538
  */
253
- getPlayers(options?: EntityQueryOptions): Player[];
1539
+ readonly lockMode: ItemLockMode;
254
1540
  /**
255
1541
  * @remarks
256
- * Runs a particular command asynchronously from the context of
257
- * the broader dimension. Note that there is a maximum queue
258
- * of 128 asynchronous commands that can be run in a given
259
- * tick.
1542
+ * The maximum stack size. This value varies depending on the
1543
+ * type of item. For example, torches have a maximum stack size
1544
+ * of 64, while eggs have a maximum stack size of 16.
260
1545
  *
261
- * @param commandString
262
- * Command to run. Note that command strings should not start
263
- * with slash.
264
- * @returns
265
- * For commands that return data, returns a CommandResult with
266
- * an indicator of command results.
267
- * @throws This function can throw errors.
268
1546
  */
269
- runCommandAsync(commandString: string): Promise<CommandResult>;
270
- }
271
- /**
272
- * Represents the state of an entity (a mob, the player, or
273
- * other moving objects like minecarts) in the world.
274
- */
275
- export class Entity {
276
- protected constructor();
1547
+ readonly maxAmount: number;
277
1548
  /**
278
- * @beta
279
1549
  * @remarks
280
- * Dimension that the entity is currently within.
1550
+ * Given name of this stack of items. The name tag is displayed
1551
+ * when hovering over the item. Setting the name tag to an
1552
+ * empty string or `undefined` will remove the name tag.
281
1553
  *
282
- * @throws This property can throw when used.
1554
+ * @throws
1555
+ * Throws if the length exceeds 255 characters.
283
1556
  */
284
- readonly dimension: Dimension;
1557
+ readonly nameTag?: string;
285
1558
  /**
286
1559
  * @remarks
287
- * Unique identifier of the entity. This identifier is intended
288
- * to be consistent across loads of a world instance. No
289
- * meaning should be inferred from the value and structure of
290
- * this unique identifier - do not parse or interpret it.
1560
+ * The type of the item.
291
1561
  *
292
- * @throws This property can throw when used.
293
1562
  */
294
- readonly id: string;
1563
+ readonly 'type': ItemType;
295
1564
  /**
296
- * @beta
297
1565
  * @remarks
298
- * Current location of the entity.
1566
+ * Identifier of the type of items for the stack. If a
1567
+ * namespace is not specified, 'minecraft:' is assumed.
1568
+ * Examples include 'wheat' or 'apple'.
299
1569
  *
300
- * @throws This property can throw when used.
301
1570
  */
302
- readonly location: Vector3;
1571
+ readonly typeId: string;
303
1572
  /**
304
- * @beta
305
1573
  * @remarks
306
- * Given name of the entity.
307
- *
308
- * This property can't be edited in read-only mode.
1574
+ * Creates a new instance of a stack of items for use in the
1575
+ * world.
309
1576
  *
1577
+ * @param itemType
1578
+ * Type of item to create. See the {@link MinecraftItemTypes}
1579
+ * enumeration for a list of standard item types in Minecraft
1580
+ * experiences.
1581
+ * @param amount
1582
+ * Number of items to place in the stack, between 1-255. The
1583
+ * provided value will be clamped to the item's maximum stack
1584
+ * size. Note that certain items can only have one item in the
1585
+ * stack.
1586
+ * @throws
1587
+ * Throws if `itemType` is invalid, or if `amount` is outside
1588
+ * the range of 1-255.
310
1589
  */
311
- nameTag: string;
1590
+ constructor(itemType: ItemType | string, amount?: number);
312
1591
  /**
313
1592
  * @remarks
314
- * Unique identifier of the type of the entity - for example,
315
- * 'minecraft:skeleton'.
1593
+ * Gets a component (that represents additional capabilities)
1594
+ * for an item stack.
316
1595
  *
317
- * @throws This property can throw when used.
1596
+ * @param componentId
1597
+ * The identifier of the component (e.g., 'minecraft:food') to
1598
+ * retrieve. If no namespace prefix is specified, 'minecraft:'
1599
+ * is assumed. If the component is not present on the item
1600
+ * stack, undefined is returned.
1601
+ * @example durability.ts
1602
+ * ```typescript
1603
+ * // Get the maximum durability of a custom sword item
1604
+ * const itemStack = new ItemStack("custom:sword");
1605
+ * const durability = itemStack.getComponent("minecraft:durability") as ItemDurabilityComponent;
1606
+ * const maxDurability = durability.maxDurability;
1607
+ *
1608
+ * ```
318
1609
  */
319
- readonly typeId: string;
1610
+ getComponent(componentId: string): ItemComponent | undefined;
320
1611
  /**
321
- * @beta
322
1612
  * @remarks
323
- * Returns the current location of the head component of this
324
- * entity.
1613
+ * Returns all components that are both present on this item
1614
+ * stack and supported by the API.
325
1615
  *
326
- * @throws This function can throw errors.
327
1616
  */
328
- getHeadLocation(): Vector3;
1617
+ getComponents(): ItemComponent[];
329
1618
  /**
330
- * @beta
331
1619
  * @remarks
332
- * Returns the current velocity vector of the entity.
1620
+ * Returns true if the specified component is present on this
1621
+ * item stack.
333
1622
  *
334
- * @throws This function can throw errors.
1623
+ * @param componentId
1624
+ * The identifier of the component (e.g., 'minecraft:food') to
1625
+ * retrieve. If no namespace prefix is specified, 'minecraft:'
1626
+ * is assumed.
335
1627
  */
336
- getVelocity(): Vector3;
1628
+ hasComponent(componentId: string): boolean;
337
1629
  /**
338
- * @beta
339
1630
  * @remarks
340
- * Returns the current view direction of the entity.
1631
+ * Returns whether this item stack can be stacked with the
1632
+ * given `itemStack`. This is determined by comparing the item
1633
+ * type and any custom data and properties associated with the
1634
+ * item stacks. The amount of each item stack is not taken into
1635
+ * consideration.
341
1636
  *
342
- * @throws This function can throw errors.
343
1637
  */
344
- getViewDirection(): Vector3;
1638
+ isStackableWith(itemStack: ItemStack): boolean;
1639
+ }
1640
+
1641
+ /**
1642
+ * @beta
1643
+ * Represents the type of an item - for example, Wool.
1644
+ */
1645
+ export class ItemType {
1646
+ protected constructor();
345
1647
  /**
346
1648
  * @remarks
347
- * Runs a particular command asynchronously from the context of
348
- * this entity. Note that there is a maximum queue of 128
349
- * asynchronous commands that can be run in a given tick.
1649
+ * Returns the identifier of the item type - for example,
1650
+ * 'minecraft:apple'.
350
1651
  *
351
- * @param commandString
352
- * Command to run. Note that command strings should not start
353
- * with slash.
354
- * @returns
355
- * For commands that return data, returns a JSON structure with
356
- * command response values.
357
- * @throws This function can throw errors.
358
1652
  */
359
- runCommandAsync(commandString: string): Promise<CommandResult>;
1653
+ readonly id: string;
360
1654
  }
1655
+
361
1656
  /**
362
1657
  * A collection of default Minecraft dimension types.
363
1658
  */
@@ -397,6 +1692,7 @@ export class MinecraftDimensionTypes {
397
1692
  */
398
1693
  static readonly theEnd = 'minecraft:the_end';
399
1694
  }
1695
+
400
1696
  /**
401
1697
  * Represents a player within the world.
402
1698
  */
@@ -409,6 +1705,20 @@ export class Player extends Entity {
409
1705
  * @throws This property can throw when used.
410
1706
  */
411
1707
  readonly name: string;
1708
+ /**
1709
+ * @beta
1710
+ * @remarks
1711
+ * Plays a sound that only this particular player can hear.
1712
+ *
1713
+ * This function can't be called in read-only mode.
1714
+ *
1715
+ * @param soundID
1716
+ * Identifier of the sound to play.
1717
+ * @param soundOptions
1718
+ * Additional optional options for the sound.
1719
+ * @throws This function can throw errors.
1720
+ */
1721
+ playSound(soundID: string, soundOptions?: PlayerSoundOptions): void;
412
1722
  /**
413
1723
  * @beta
414
1724
  * @remarks
@@ -453,6 +1763,7 @@ export class Player extends Entity {
453
1763
  */
454
1764
  sendMessage(message: (RawMessage | string)[] | RawMessage | string): void;
455
1765
  }
1766
+
456
1767
  /**
457
1768
  * A class that provides system-level events and functions.
458
1769
  */
@@ -518,6 +1829,7 @@ export class System {
518
1829
  */
519
1830
  runTimeout(callback: () => void, tickDelay?: number): number;
520
1831
  }
1832
+
521
1833
  /**
522
1834
  * A class that wraps the state of a world - a set of
523
1835
  * dimensions and the environment of Minecraft.
@@ -555,6 +1867,37 @@ export class World {
555
1867
  * @throws This function can throw errors.
556
1868
  */
557
1869
  getPlayers(options?: EntityQueryOptions): Player[];
1870
+ /**
1871
+ * @beta
1872
+ * @remarks
1873
+ * Plays a particular music track for all players.
1874
+ *
1875
+ * This function can't be called in read-only mode.
1876
+ *
1877
+ * @throws This function can throw errors.
1878
+ */
1879
+ playMusic(trackID: string, musicOptions?: MusicOptions): void;
1880
+ /**
1881
+ * @beta
1882
+ * @remarks
1883
+ * Plays a sound for all players.
1884
+ *
1885
+ * This function can't be called in read-only mode.
1886
+ *
1887
+ * @throws This function can throw errors.
1888
+ */
1889
+ playSound(soundID: string, location: Vector3, soundOptions?: WorldSoundOptions): void;
1890
+ /**
1891
+ * @beta
1892
+ * @remarks
1893
+ * Queues an additional music track for players. If a track is
1894
+ * not playing, a music track will play.
1895
+ *
1896
+ * This function can't be called in read-only mode.
1897
+ *
1898
+ * @throws This function can throw errors.
1899
+ */
1900
+ queueMusic(trackID: string, musicOptions?: MusicOptions): void;
558
1901
  /**
559
1902
  * @beta
560
1903
  * @remarks
@@ -598,7 +1941,56 @@ export class World {
598
1941
  * ```
599
1942
  */
600
1943
  sendMessage(message: (RawMessage | string)[] | RawMessage | string): void;
1944
+ /**
1945
+ * @beta
1946
+ * @remarks
1947
+ * Stops any music tracks from playing.
1948
+ *
1949
+ * This function can't be called in read-only mode.
1950
+ *
1951
+ */
1952
+ stopMusic(): void;
1953
+ }
1954
+
1955
+ /**
1956
+ * @beta
1957
+ * Additional options for when damage has been applied via a
1958
+ * projectile.
1959
+ */
1960
+ export interface EntityApplyDamageByProjectileOptions {
1961
+ /**
1962
+ * @remarks
1963
+ * Optional entity that fired the projectile.
1964
+ *
1965
+ */
1966
+ damagingEntity?: Entity;
1967
+ /**
1968
+ * @remarks
1969
+ * Projectile that caused damage.
1970
+ *
1971
+ */
1972
+ damagingProjectile: Entity;
1973
+ }
1974
+
1975
+ /**
1976
+ * @beta
1977
+ * Additional descriptions and metadata for a damage event.
1978
+ */
1979
+ export interface EntityApplyDamageOptions {
1980
+ /**
1981
+ * @remarks
1982
+ * Underlying cause of the damage.
1983
+ *
1984
+ */
1985
+ cause: EntityDamageCause;
1986
+ /**
1987
+ * @remarks
1988
+ * Optional entity that caused the damage.
1989
+ *
1990
+ */
1991
+ damagingEntity?: Entity;
601
1992
  }
1993
+
602
1994
  /**
603
1995
  * @beta
604
1996
  * Contains options for selecting entities within an area.
@@ -761,6 +2153,7 @@ export interface EntityQueryOptions {
761
2153
  */
762
2154
  type?: string;
763
2155
  }
2156
+
764
2157
  /**
765
2158
  * @beta
766
2159
  * Contains additional options for filtering players based on
@@ -795,6 +2188,59 @@ export interface EntityQueryScoreOptions {
795
2188
  */
796
2189
  objective?: string;
797
2190
  }
2191
+
2192
+ /**
2193
+ * @beta
2194
+ * Additional configuration options for {@link
2195
+ * World.playMusic}/{@link World.queueMusic} methods.
2196
+ */
2197
+ export interface MusicOptions {
2198
+ /**
2199
+ * @remarks
2200
+ * Specifies a fade overlap for music at the end of play.
2201
+ *
2202
+ */
2203
+ fade?: number;
2204
+ /**
2205
+ * @remarks
2206
+ * If set to true, this music track will play repeatedly.
2207
+ *
2208
+ */
2209
+ loop?: boolean;
2210
+ /**
2211
+ * @remarks
2212
+ * Relative volume level of the music.
2213
+ *
2214
+ */
2215
+ volume?: number;
2216
+ }
2217
+
2218
+ /**
2219
+ * @beta
2220
+ * Additional options for how a sound plays for a player.
2221
+ */
2222
+ export interface PlayerSoundOptions {
2223
+ /**
2224
+ * @remarks
2225
+ * Location of the sound; if not specified, the sound is played
2226
+ * near a player.
2227
+ *
2228
+ */
2229
+ location?: Vector3;
2230
+ /**
2231
+ * @remarks
2232
+ * Optional pitch of the sound.
2233
+ *
2234
+ */
2235
+ pitch?: number;
2236
+ /**
2237
+ * @remarks
2238
+ * Optional volume of the sound.
2239
+ *
2240
+ */
2241
+ volume?: number;
2242
+ }
2243
+
798
2244
  /**
799
2245
  * @beta
800
2246
  */
@@ -805,13 +2251,27 @@ export interface RawMessage {
805
2251
  translate?: string;
806
2252
  with?: string[] | RawMessage;
807
2253
  }
2254
+
808
2255
  /**
809
2256
  * @beta
2257
+ * Provides a description of a score token to use within a raw
2258
+ * message.
810
2259
  */
811
2260
  export interface RawMessageScore {
2261
+ /**
2262
+ * @remarks
2263
+ * Name of the score value to match.
2264
+ *
2265
+ */
812
2266
  name?: string;
2267
+ /**
2268
+ * @remarks
2269
+ * Name of the score value to match.
2270
+ *
2271
+ */
813
2272
  objective?: string;
814
2273
  }
2274
+
815
2275
  /**
816
2276
  * @beta
817
2277
  * Contains a description of a vector.
@@ -836,6 +2296,27 @@ export interface Vector3 {
836
2296
  */
837
2297
  z: number;
838
2298
  }
2299
+
2300
+ /**
2301
+ * @beta
2302
+ * Contains additional options for a world-level playSound
2303
+ * occurrence.
2304
+ */
2305
+ export interface WorldSoundOptions {
2306
+ /**
2307
+ * @remarks
2308
+ * Pitch of the sound played at the world level.
2309
+ *
2310
+ */
2311
+ pitch?: number;
2312
+ /**
2313
+ * @remarks
2314
+ * Relative volume and space by which this sound is heard.
2315
+ *
2316
+ */
2317
+ volume?: number;
2318
+ }
2319
+
839
2320
  /**
840
2321
  * @remarks
841
2322
  * A class that provides system-level events and functions.