@minecraft/server 1.1.0-beta.1.19.70-preview.23 → 1.1.0-beta.1.19.70-preview.26
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.
- package/index.d.ts +334 -357
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* ```json
|
|
17
17
|
* {
|
|
18
18
|
* "module_name": "@minecraft/server",
|
|
19
|
-
* "version": "1.1.0-internal.1.19.70-preview.
|
|
19
|
+
* "version": "1.1.0-internal.1.19.70-preview.26"
|
|
20
20
|
* }
|
|
21
21
|
* ```
|
|
22
22
|
*
|
|
@@ -996,117 +996,17 @@ export class BlockInventoryComponent extends BlockComponent {
|
|
|
996
996
|
*/
|
|
997
997
|
static readonly componentId = 'minecraft:inventory';
|
|
998
998
|
}
|
|
999
|
-
/**
|
|
1000
|
-
* @beta
|
|
1001
|
-
* Represents the inventory of a {@link Block} in the world.
|
|
1002
|
-
* Used with blocks like chests.
|
|
1003
|
-
*/
|
|
1004
999
|
export class BlockInventoryComponentContainer extends Container {
|
|
1005
1000
|
protected constructor();
|
|
1006
|
-
/**
|
|
1007
|
-
* Contains a count of the slots in the container that are
|
|
1008
|
-
* empty.
|
|
1009
|
-
* @throws This property can throw when used.
|
|
1010
|
-
*/
|
|
1011
1001
|
readonly emptySlotsCount: number;
|
|
1012
|
-
/**
|
|
1013
|
-
* Returns the size capacity of the inventory container on this
|
|
1014
|
-
* block.
|
|
1015
|
-
* @throws This property can throw when used.
|
|
1016
|
-
*/
|
|
1017
1002
|
readonly size: number;
|
|
1018
|
-
/**
|
|
1019
|
-
* @remarks
|
|
1020
|
-
* Adds an item to the specified container. Item will be placed
|
|
1021
|
-
* in the first available empty slot. (use .setItem if you wish
|
|
1022
|
-
* to set items in a particular slot.)
|
|
1023
|
-
* @param itemStack
|
|
1024
|
-
* The stack of items to add.
|
|
1025
|
-
* @throws This function can throw errors.
|
|
1026
|
-
*/
|
|
1027
1003
|
addItem(itemStack: ItemStack): void;
|
|
1028
|
-
/**
|
|
1029
|
-
* @remarks
|
|
1030
|
-
* Clears the entirety of the inventory of this block (i.e.,
|
|
1031
|
-
* chest)
|
|
1032
|
-
* @throws This function can throw errors.
|
|
1033
|
-
*/
|
|
1034
1004
|
clearAll(): void;
|
|
1035
|
-
/**
|
|
1036
|
-
* @remarks
|
|
1037
|
-
* Clears a specific item within the chest.
|
|
1038
|
-
* @param slot
|
|
1039
|
-
* @throws This function can throw errors.
|
|
1040
|
-
*/
|
|
1041
1005
|
clearItem(slot: number): void;
|
|
1042
|
-
/**
|
|
1043
|
-
* @remarks
|
|
1044
|
-
* Gets the item stack for the set of items at the specified
|
|
1045
|
-
* slot. If the slot is empty, returns undefined. This method
|
|
1046
|
-
* does not change or clear the contents of the specified slot.
|
|
1047
|
-
* @param slot
|
|
1048
|
-
* Zero-based index of the slot to retrieve items from.
|
|
1049
|
-
* @throws This function can throw errors.
|
|
1050
|
-
* @example getItem.js
|
|
1051
|
-
* ```typescript
|
|
1052
|
-
* const itemStack = rightChestContainer.getItem(0);
|
|
1053
|
-
* test.assert(itemStack.id === "apple", "Expected apple");
|
|
1054
|
-
* test.assert(itemStack.amount === 10, "Expected 10 apples");
|
|
1055
|
-
* ```
|
|
1056
|
-
*/
|
|
1057
1006
|
getItem(slot: number): ItemStack;
|
|
1058
|
-
/**
|
|
1059
|
-
* @remarks
|
|
1060
|
-
* Gets a container slot within the chest.
|
|
1061
|
-
* @param slot
|
|
1062
|
-
* @throws This function can throw errors.
|
|
1063
|
-
*/
|
|
1064
1007
|
getSlot(slot: number): ContainerSlot;
|
|
1065
|
-
/**
|
|
1066
|
-
* @remarks
|
|
1067
|
-
* Sets an item stack within a particular slot.
|
|
1068
|
-
* @param slot
|
|
1069
|
-
* Zero-based index of the slot to set an item at.
|
|
1070
|
-
* @param itemStack
|
|
1071
|
-
* Stack of items to place within the specified slot.
|
|
1072
|
-
* @throws This function can throw errors.
|
|
1073
|
-
*/
|
|
1074
1008
|
setItem(slot: number, itemStack?: ItemStack): void;
|
|
1075
|
-
/**
|
|
1076
|
-
* @remarks
|
|
1077
|
-
* Swaps items between two different slots within containers.
|
|
1078
|
-
* @param slot
|
|
1079
|
-
* Zero-based index of the slot to swap from this container.
|
|
1080
|
-
* @param otherSlot
|
|
1081
|
-
* Zero-based index of the slot to swap with.
|
|
1082
|
-
* @param otherContainer
|
|
1083
|
-
* Target container to swap with. Note this can be the same
|
|
1084
|
-
* container as this source.
|
|
1085
|
-
* @throws This function can throw errors.
|
|
1086
|
-
* @example swapItems.js
|
|
1087
|
-
* ```typescript
|
|
1088
|
-
* rightChestContainer.swapItems(1, 0, leftChestContainer); // swap item in slot 1 of rightChestContainer with item in slot 0 of leftChestContainer
|
|
1089
|
-
*
|
|
1090
|
-
* ```
|
|
1091
|
-
*/
|
|
1092
1009
|
swapItems(slot: number, otherSlot: number, otherContainer: Container): boolean;
|
|
1093
|
-
/**
|
|
1094
|
-
* @remarks
|
|
1095
|
-
* Moves an item from one slot to another, potentially across
|
|
1096
|
-
* containers.
|
|
1097
|
-
* @param fromSlot
|
|
1098
|
-
* @param toSlot
|
|
1099
|
-
* Zero-based index of the slot to move to.
|
|
1100
|
-
* @param toContainer
|
|
1101
|
-
* Target container to transfer to. Note this can be the same
|
|
1102
|
-
* container as the source.
|
|
1103
|
-
* @throws This function can throw errors.
|
|
1104
|
-
* @example transferItem.js
|
|
1105
|
-
* ```typescript
|
|
1106
|
-
* rightChestContainer.transferItem(0, 4, chestCartContainer); // transfer the apple from the right chest to a chest cart
|
|
1107
|
-
*
|
|
1108
|
-
* ```
|
|
1109
|
-
*/
|
|
1110
1010
|
transferItem(fromSlot: number, toSlot: number, toContainer: Container): boolean;
|
|
1111
1011
|
}
|
|
1112
1012
|
/**
|
|
@@ -1378,10 +1278,6 @@ export class BlockRecordPlayerComponent extends BlockComponent {
|
|
|
1378
1278
|
*/
|
|
1379
1279
|
export class BlockSignComponent extends BlockComponent {
|
|
1380
1280
|
protected constructor();
|
|
1381
|
-
/**
|
|
1382
|
-
* Text of the sign
|
|
1383
|
-
* @throws This property can throw when used.
|
|
1384
|
-
*/
|
|
1385
1281
|
readonly text: string;
|
|
1386
1282
|
/**
|
|
1387
1283
|
* Identifier of this component. Should always be
|
|
@@ -1591,23 +1487,26 @@ export class CommandResult {
|
|
|
1591
1487
|
export class Container {
|
|
1592
1488
|
protected constructor();
|
|
1593
1489
|
/**
|
|
1594
|
-
*
|
|
1595
|
-
*
|
|
1596
|
-
*
|
|
1490
|
+
* Count of the slots in the container that are empty.
|
|
1491
|
+
* @throws
|
|
1492
|
+
* Throws if the container is invalid.
|
|
1597
1493
|
*/
|
|
1598
1494
|
readonly emptySlotsCount: number;
|
|
1599
1495
|
/**
|
|
1600
|
-
*
|
|
1601
|
-
* standard single-block chest has a size of 27,
|
|
1602
|
-
*
|
|
1603
|
-
*
|
|
1496
|
+
* The number of slots in this container. For example, a
|
|
1497
|
+
* standard single-block chest has a size of 27. Note, a
|
|
1498
|
+
* player's inventory container contains a total of 36 slots, 9
|
|
1499
|
+
* hotbar slots plus 27 inventory slots.
|
|
1500
|
+
* @throws
|
|
1501
|
+
* Throws if the container is invalid.
|
|
1604
1502
|
*/
|
|
1605
1503
|
readonly size: number;
|
|
1606
1504
|
/**
|
|
1607
1505
|
* @remarks
|
|
1608
|
-
* Adds an item to the
|
|
1609
|
-
*
|
|
1610
|
-
*
|
|
1506
|
+
* Adds an item to the container. The item is placed in the
|
|
1507
|
+
* first available slot(s) and can be stacked with existing
|
|
1508
|
+
* items of the same type. Note, use {@link Container.setItem}
|
|
1509
|
+
* if you wish to set the item in a particular slot.
|
|
1611
1510
|
* @param itemStack
|
|
1612
1511
|
* The stack of items to add.
|
|
1613
1512
|
* @throws This function can throw errors.
|
|
@@ -1616,41 +1515,49 @@ export class Container {
|
|
|
1616
1515
|
/**
|
|
1617
1516
|
* @remarks
|
|
1618
1517
|
* Clears all inventory items in the container.
|
|
1619
|
-
* @throws
|
|
1518
|
+
* @throws
|
|
1519
|
+
* Throws if the container is invalid.
|
|
1620
1520
|
*/
|
|
1621
1521
|
clearAll(): void;
|
|
1622
1522
|
/**
|
|
1623
1523
|
* @remarks
|
|
1624
1524
|
* Clears a specific item at a slot within the container.
|
|
1625
1525
|
* @param slot
|
|
1626
|
-
* @throws
|
|
1526
|
+
* @throws
|
|
1527
|
+
* Throws if the container is invalid.
|
|
1627
1528
|
*/
|
|
1628
1529
|
clearItem(slot: number): void;
|
|
1629
1530
|
/**
|
|
1630
1531
|
* @remarks
|
|
1631
|
-
* Gets
|
|
1632
|
-
*
|
|
1633
|
-
*
|
|
1532
|
+
* Gets an {@link ItemStack} of the item at the specified slot.
|
|
1533
|
+
* If the slot is empty, returns `undefined`. This method does
|
|
1534
|
+
* not change or clear the contents of the specified slot. To
|
|
1535
|
+
* get a reference to a particular slot, see {@link
|
|
1536
|
+
* Container.getSlot}.
|
|
1634
1537
|
* @param slot
|
|
1635
1538
|
* Zero-based index of the slot to retrieve items from.
|
|
1636
|
-
* @throws
|
|
1637
|
-
*
|
|
1539
|
+
* @throws
|
|
1540
|
+
* Throws if the container is invalid or if the `slot` index is
|
|
1541
|
+
* out of bounds.
|
|
1542
|
+
* @example getItem.ts
|
|
1638
1543
|
* ```typescript
|
|
1639
|
-
*
|
|
1640
|
-
* const
|
|
1544
|
+
* // Get a copy of the first item in the player's hotbar
|
|
1545
|
+
* const inventory = player.getComponent("inventory") as EntityInventoryComponent;
|
|
1546
|
+
* const itemStack = inventory.container.getItem(0);
|
|
1641
1547
|
*
|
|
1642
|
-
* const itemStack = rightChestContainer.getItem(0);
|
|
1643
|
-
*
|
|
1644
|
-
* test.assert(itemStack.id === "apple", "Expected apple");
|
|
1645
|
-
* test.assert(itemStack.amount === 10, "Expected 10 apples");
|
|
1646
1548
|
* ```
|
|
1647
1549
|
*/
|
|
1648
1550
|
getItem(slot: number): ItemStack;
|
|
1649
1551
|
/**
|
|
1650
1552
|
* @remarks
|
|
1651
|
-
* Returns a container slot
|
|
1553
|
+
* Returns a container slot. This acts as a reference to a slot
|
|
1554
|
+
* at the given index for this container.
|
|
1652
1555
|
* @param slot
|
|
1653
|
-
*
|
|
1556
|
+
* The index of the slot to return. This index must be within
|
|
1557
|
+
* the bounds of the container.
|
|
1558
|
+
* @throws
|
|
1559
|
+
* Throws if the container is invalid or if the `slot` index is
|
|
1560
|
+
* out of bounds.
|
|
1654
1561
|
*/
|
|
1655
1562
|
getSlot(slot: number): ContainerSlot;
|
|
1656
1563
|
/**
|
|
@@ -1659,8 +1566,11 @@ export class Container {
|
|
|
1659
1566
|
* @param slot
|
|
1660
1567
|
* Zero-based index of the slot to set an item at.
|
|
1661
1568
|
* @param itemStack
|
|
1662
|
-
* Stack of items to place within the specified slot.
|
|
1663
|
-
*
|
|
1569
|
+
* Stack of items to place within the specified slot. Setting
|
|
1570
|
+
* `itemStack` to undefined will clear the slot.
|
|
1571
|
+
* @throws
|
|
1572
|
+
* Throws if the container is invalid or if the `slot` index is
|
|
1573
|
+
* out of bounds.
|
|
1664
1574
|
*/
|
|
1665
1575
|
setItem(slot: number, itemStack?: ItemStack): void;
|
|
1666
1576
|
/**
|
|
@@ -1673,28 +1583,38 @@ export class Container {
|
|
|
1673
1583
|
* @param otherContainer
|
|
1674
1584
|
* Target container to swap with. Note this can be the same
|
|
1675
1585
|
* container as this source.
|
|
1676
|
-
* @throws
|
|
1677
|
-
*
|
|
1586
|
+
* @throws
|
|
1587
|
+
* Throws if either this container or `otherContainer` are
|
|
1588
|
+
* invalid or if the `slot` or `otherSlot` are out of bounds.
|
|
1589
|
+
* @example swapItems.ts
|
|
1678
1590
|
* ```typescript
|
|
1679
|
-
*
|
|
1591
|
+
* // Swaps an item between slots 0 and 4 in the player's inventory
|
|
1592
|
+
* const inventory = fromPlayer.getComponent('inventory') as EntityInventoryComponent;
|
|
1593
|
+
* inventory.container.swapItems(0, 4, inventory);
|
|
1680
1594
|
*
|
|
1681
1595
|
* ```
|
|
1682
1596
|
*/
|
|
1683
1597
|
swapItems(slot: number, otherSlot: number, otherContainer: Container): boolean;
|
|
1684
1598
|
/**
|
|
1685
1599
|
* @remarks
|
|
1686
|
-
* Moves an item from one slot to another,
|
|
1687
|
-
*
|
|
1600
|
+
* Moves an item from one slot to another container, or to the
|
|
1601
|
+
* first available slot in the same container.
|
|
1688
1602
|
* @param fromSlot
|
|
1603
|
+
* Zero-based index of the slot to transfer an item from, on
|
|
1604
|
+
* this container.
|
|
1689
1605
|
* @param toSlot
|
|
1690
|
-
* Zero-based index of the slot to move to.
|
|
1691
1606
|
* @param toContainer
|
|
1692
1607
|
* Target container to transfer to. Note this can be the same
|
|
1693
1608
|
* container as the source.
|
|
1694
|
-
* @throws
|
|
1695
|
-
*
|
|
1609
|
+
* @throws
|
|
1610
|
+
* Throws if either this container or `toContainer` are invalid
|
|
1611
|
+
* or if the `fromSlot` or `toSlot` indices out of bounds.
|
|
1612
|
+
* @example transferItem.ts
|
|
1696
1613
|
* ```typescript
|
|
1697
|
-
*
|
|
1614
|
+
* // Transfer an item from the first slot of fromPlayer's inventory to toPlayer's inventory
|
|
1615
|
+
* const fromInventory = fromPlayer.getComponent('inventory') as EntityInventoryComponent;
|
|
1616
|
+
* const toInventory = toPlayer.getComponent('inventory') as EntityInventoryComponent;
|
|
1617
|
+
* fromInventory.container.transferItem(0, toInventory.container);
|
|
1698
1618
|
*
|
|
1699
1619
|
* ```
|
|
1700
1620
|
*/
|
|
@@ -1708,65 +1628,130 @@ export class Container {
|
|
|
1708
1628
|
export class ContainerSlot {
|
|
1709
1629
|
protected constructor();
|
|
1710
1630
|
/**
|
|
1711
|
-
*
|
|
1631
|
+
* Number of the items in the stack. Valid values range between
|
|
1632
|
+
* 1-255. The provided value will be clamped to the item's
|
|
1633
|
+
* maximum stack size.
|
|
1634
|
+
* @throws
|
|
1635
|
+
* Throws if the value is outside the range of 1-255.
|
|
1712
1636
|
*/
|
|
1713
1637
|
amount: number;
|
|
1638
|
+
data: number;
|
|
1714
1639
|
/**
|
|
1715
|
-
*
|
|
1640
|
+
* Returns whether the item is stackable. An item is considered
|
|
1641
|
+
* stackable if the item's maximum stack size is greater than 1
|
|
1642
|
+
* and the item does not contain any custom data or properties.
|
|
1643
|
+
* @throws
|
|
1644
|
+
* Throws if the slot's container is invalid.
|
|
1716
1645
|
*/
|
|
1717
|
-
data: number;
|
|
1718
1646
|
readonly isStackable: boolean;
|
|
1647
|
+
readonly isValid: boolean;
|
|
1719
1648
|
/**
|
|
1720
|
-
*
|
|
1721
|
-
*
|
|
1722
|
-
* slot
|
|
1649
|
+
* Gets or sets whether the item is kept on death.
|
|
1650
|
+
* @throws
|
|
1651
|
+
* Throws if the slot's container is invalid.
|
|
1723
1652
|
*/
|
|
1724
|
-
readonly isValid: boolean;
|
|
1725
1653
|
keepOnDeath: boolean;
|
|
1654
|
+
/**
|
|
1655
|
+
* Gets or sets the item's lock mode. The default value is
|
|
1656
|
+
* `ItemLockMode.none`.
|
|
1657
|
+
* @throws
|
|
1658
|
+
* Throws if the slot's container is invalid.
|
|
1659
|
+
*/
|
|
1726
1660
|
lockMode: ItemLockMode;
|
|
1661
|
+
/**
|
|
1662
|
+
* The maximum stack size. This value varies depending on the
|
|
1663
|
+
* type of item. For example, torches have a maximum stack size
|
|
1664
|
+
* of 64, while eggs have a maximum stack size of 16.
|
|
1665
|
+
* @throws
|
|
1666
|
+
* Throws if the slot's container is invalid.
|
|
1667
|
+
*/
|
|
1727
1668
|
readonly maxAmount: number;
|
|
1728
1669
|
/**
|
|
1729
|
-
*
|
|
1670
|
+
* Given name of this stack of items. The name tag is displayed
|
|
1671
|
+
* when hovering over the item. Setting the name tag to an
|
|
1672
|
+
* empty string or `undefined` will remove the name tag.
|
|
1673
|
+
* @throws
|
|
1674
|
+
* Throws if the slot's container is invalid. Also throws if
|
|
1675
|
+
* the length exceeds 255 characters.
|
|
1730
1676
|
*/
|
|
1731
1677
|
nameTag?: string;
|
|
1678
|
+
/**
|
|
1679
|
+
* The type of the item.
|
|
1680
|
+
* @throws
|
|
1681
|
+
* Throws if the slot's container is invalid.
|
|
1682
|
+
*/
|
|
1732
1683
|
readonly 'type': ItemType;
|
|
1733
1684
|
/**
|
|
1734
|
-
*
|
|
1735
|
-
*
|
|
1736
|
-
*
|
|
1685
|
+
* Identifier of the type of items for the stack. If a
|
|
1686
|
+
* namespace is not specified, 'minecraft:' is assumed.
|
|
1687
|
+
* Examples include 'wheat' or 'apple'.
|
|
1688
|
+
* @throws
|
|
1689
|
+
* Throws if the slot's container is invalid.
|
|
1737
1690
|
*/
|
|
1738
1691
|
readonly typeId?: string;
|
|
1739
|
-
clone(): ItemStack;
|
|
1740
1692
|
/**
|
|
1741
1693
|
* @remarks
|
|
1742
|
-
*
|
|
1743
|
-
*
|
|
1694
|
+
* Creates an exact copy of the item stack, including any
|
|
1695
|
+
* custom data or properties.
|
|
1696
|
+
* @throws
|
|
1697
|
+
* Throws if the slot's container is invalid.
|
|
1744
1698
|
*/
|
|
1699
|
+
clone(): ItemStack;
|
|
1745
1700
|
getItem(): ItemStack;
|
|
1746
1701
|
/**
|
|
1747
1702
|
* @remarks
|
|
1748
|
-
* Returns the lore value
|
|
1749
|
-
*
|
|
1750
|
-
* @
|
|
1703
|
+
* Returns the lore value - a secondary display string - for an
|
|
1704
|
+
* ItemStack.
|
|
1705
|
+
* @returns
|
|
1706
|
+
* An array of lore strings. If the item does not have lore,
|
|
1707
|
+
* returns an empty array.
|
|
1708
|
+
* @throws
|
|
1709
|
+
* Throws if the slot's container is invalid.
|
|
1751
1710
|
*/
|
|
1752
1711
|
getLore(): string[];
|
|
1712
|
+
/**
|
|
1713
|
+
* @remarks
|
|
1714
|
+
* Returns whether this item stack can be stacked with the
|
|
1715
|
+
* given `itemStack`. This is determined by comparing the item
|
|
1716
|
+
* type and any custom data and properties associated with the
|
|
1717
|
+
* item stacks. The amount of each item stack is not taken into
|
|
1718
|
+
* consideration.
|
|
1719
|
+
* @param itemStack
|
|
1720
|
+
* @throws
|
|
1721
|
+
* Throws if the slot's container is invalid.
|
|
1722
|
+
*/
|
|
1753
1723
|
isStackableWith(itemStack: ItemStack): boolean;
|
|
1724
|
+
/**
|
|
1725
|
+
* @remarks
|
|
1726
|
+
* The list of block types this item can break in Adventure
|
|
1727
|
+
* mode. The block names are displayed in the item's tooltip.
|
|
1728
|
+
* Setting the value to undefined will clear the list.
|
|
1729
|
+
* @param blockIdentifiers
|
|
1730
|
+
* @throws
|
|
1731
|
+
* Throws if the slot's container is invalid. Also throws if
|
|
1732
|
+
* any of the provided block identifiers are invalid.
|
|
1733
|
+
*/
|
|
1754
1734
|
setCanDestroy(blockIdentifiers?: string[]): void;
|
|
1755
|
-
setCanPlaceOn(blockIdentifiers?: string[]): void;
|
|
1756
1735
|
/**
|
|
1757
1736
|
* @remarks
|
|
1758
|
-
*
|
|
1759
|
-
*
|
|
1760
|
-
*
|
|
1761
|
-
*
|
|
1737
|
+
* The list of block types this item can be placed on in
|
|
1738
|
+
* Adventure mode. This is only applicable to block items. The
|
|
1739
|
+
* block names are displayed in the item's tooltip. Setting the
|
|
1740
|
+
* value to undefined will clear the list.
|
|
1741
|
+
* @param blockIdentifiers
|
|
1742
|
+
* @throws
|
|
1743
|
+
* Throws if the slot's container is invalid. Also throws if
|
|
1744
|
+
* any of the provided block identifiers are invalid.
|
|
1762
1745
|
*/
|
|
1746
|
+
setCanPlaceOn(blockIdentifiers?: string[]): void;
|
|
1763
1747
|
setItem(itemStack?: ItemStack): void;
|
|
1764
1748
|
/**
|
|
1765
1749
|
* @remarks
|
|
1766
|
-
* Sets the lore
|
|
1750
|
+
* Sets the lore value - a secondary display string - for an
|
|
1751
|
+
* ItemStack.
|
|
1767
1752
|
* @param loreList
|
|
1768
|
-
*
|
|
1769
|
-
*
|
|
1753
|
+
* @throws
|
|
1754
|
+
* Throws if the slot's container is invalid.
|
|
1770
1755
|
*/
|
|
1771
1756
|
setLore(loreList?: string[]): void;
|
|
1772
1757
|
}
|
|
@@ -5437,119 +5422,17 @@ export class IEntityComponent {
|
|
|
5437
5422
|
*/
|
|
5438
5423
|
readonly typeId: string;
|
|
5439
5424
|
}
|
|
5440
|
-
/**
|
|
5441
|
-
* @beta
|
|
5442
|
-
* Represents a container that can hold stacks of items. Used
|
|
5443
|
-
* for entities like players, chest minecarts, llamas, and
|
|
5444
|
-
* more.
|
|
5445
|
-
*/
|
|
5446
5425
|
export class InventoryComponentContainer extends Container {
|
|
5447
5426
|
protected constructor();
|
|
5448
|
-
/**
|
|
5449
|
-
* The number of empty slots in the container.
|
|
5450
|
-
* @throws This property can throw when used.
|
|
5451
|
-
*/
|
|
5452
5427
|
readonly emptySlotsCount: number;
|
|
5453
|
-
/**
|
|
5454
|
-
* Represents the size of the container. For example, a
|
|
5455
|
-
* standard single-block chest has a size of 27, for the 27
|
|
5456
|
-
* slots in their inventory.
|
|
5457
|
-
* @throws This property can throw when used.
|
|
5458
|
-
*/
|
|
5459
5428
|
readonly size: number;
|
|
5460
|
-
/**
|
|
5461
|
-
* @remarks
|
|
5462
|
-
* Adds an item to the specified container. Items will be
|
|
5463
|
-
* placed in the first available empty slot. (Use {@link
|
|
5464
|
-
* InventoryComponentContainer.setItem} if you wish to set
|
|
5465
|
-
* items in a particular slot.)
|
|
5466
|
-
* @param itemStack
|
|
5467
|
-
* The stack of items to add.
|
|
5468
|
-
* @throws This function can throw errors.
|
|
5469
|
-
*/
|
|
5470
5429
|
addItem(itemStack: ItemStack): void;
|
|
5471
|
-
/**
|
|
5472
|
-
* @remarks
|
|
5473
|
-
* Empties all items in this entities' inventory.
|
|
5474
|
-
* @throws This function can throw errors.
|
|
5475
|
-
*/
|
|
5476
5430
|
clearAll(): void;
|
|
5477
|
-
/**
|
|
5478
|
-
* @remarks
|
|
5479
|
-
* Clears out a specific item at the specified slot index.
|
|
5480
|
-
* @param slot
|
|
5481
|
-
* @throws This function can throw errors.
|
|
5482
|
-
*/
|
|
5483
5431
|
clearItem(slot: number): void;
|
|
5484
|
-
/**
|
|
5485
|
-
* @remarks
|
|
5486
|
-
* Gets the item stack for the set of items at the specified
|
|
5487
|
-
* slot. If the slot is empty, returns undefined. This method
|
|
5488
|
-
* does not change or clear the contents of the specified slot.
|
|
5489
|
-
* @param slot
|
|
5490
|
-
* Zero-based index of the slot to retrieve items from.
|
|
5491
|
-
* @throws This function can throw errors.
|
|
5492
|
-
* @example getItem.js
|
|
5493
|
-
* ```typescript
|
|
5494
|
-
* const itemStack = rightChestContainer.getItem(0);
|
|
5495
|
-
* test.assert(itemStack.id === "apple", "Expected apple");
|
|
5496
|
-
* test.assert(itemStack.amount === 10, "Expected 10 apples");
|
|
5497
|
-
* ```
|
|
5498
|
-
*/
|
|
5499
5432
|
getItem(slot: number): ItemStack;
|
|
5500
|
-
/**
|
|
5501
|
-
* @remarks
|
|
5502
|
-
* Returns a slot object for specifically managing a slot
|
|
5503
|
-
* within a broader inventory.
|
|
5504
|
-
* @param slot
|
|
5505
|
-
* @throws This function can throw errors.
|
|
5506
|
-
*/
|
|
5507
5433
|
getSlot(slot: number): ContainerSlot;
|
|
5508
|
-
/**
|
|
5509
|
-
* @remarks
|
|
5510
|
-
* Sets an item stack within a particular slot.
|
|
5511
|
-
* @param slot
|
|
5512
|
-
* Zero-based index of the slot to set an item at.
|
|
5513
|
-
* @param itemStack
|
|
5514
|
-
* Stack of items to place within the specified slot.
|
|
5515
|
-
* @throws This function can throw errors.
|
|
5516
|
-
*/
|
|
5517
5434
|
setItem(slot: number, itemStack?: ItemStack): void;
|
|
5518
|
-
/**
|
|
5519
|
-
* @remarks
|
|
5520
|
-
* Swaps items between two different slots within containers.
|
|
5521
|
-
* @param slot
|
|
5522
|
-
* Zero-based index of the slot to swap from this container.
|
|
5523
|
-
* @param otherSlot
|
|
5524
|
-
* Zero-based index of the slot to swap with.
|
|
5525
|
-
* @param otherContainer
|
|
5526
|
-
* Target container to swap with. Note this can be the same
|
|
5527
|
-
* container as this source.
|
|
5528
|
-
* @throws This function can throw errors.
|
|
5529
|
-
* @example swapItems.js
|
|
5530
|
-
* ```typescript
|
|
5531
|
-
* rightChestContainer.swapItems(1, 0, leftChestContainer); // swap the cake and emerald
|
|
5532
|
-
*
|
|
5533
|
-
* ```
|
|
5534
|
-
*/
|
|
5535
5435
|
swapItems(slot: number, otherSlot: number, otherContainer: Container): boolean;
|
|
5536
|
-
/**
|
|
5537
|
-
* @remarks
|
|
5538
|
-
* Moves an item from one slot to another, potentially across
|
|
5539
|
-
* containers.
|
|
5540
|
-
* @param fromSlot
|
|
5541
|
-
* @param toSlot
|
|
5542
|
-
* Zero-based index of the slot to move to.
|
|
5543
|
-
* @param toContainer
|
|
5544
|
-
* Target container to transfer to. Note this can be the same
|
|
5545
|
-
* container as the source.
|
|
5546
|
-
* @throws This function can throw errors.
|
|
5547
|
-
* @example transferItem.js
|
|
5548
|
-
* ```typescript
|
|
5549
|
-
* rightChestContainer.transferItem(0, 4, chestCartContainer); // transfer the apple from the right chest to a chest cart
|
|
5550
|
-
*
|
|
5551
|
-
* ```
|
|
5552
|
-
*/
|
|
5553
5436
|
transferItem(fromSlot: number, toSlot: number, toContainer: Container): boolean;
|
|
5554
5437
|
}
|
|
5555
5438
|
/**
|
|
@@ -5839,17 +5722,44 @@ export class Items {
|
|
|
5839
5722
|
export class ItemStack {
|
|
5840
5723
|
/**
|
|
5841
5724
|
* Number of the items in the stack. Valid values range between
|
|
5842
|
-
*
|
|
5725
|
+
* 1-255. The provided value will be clamped to the item's
|
|
5726
|
+
* maximum stack size.
|
|
5727
|
+
* @throws
|
|
5728
|
+
* Throws if the value is outside the range of 1-255.
|
|
5843
5729
|
*/
|
|
5844
5730
|
amount: number;
|
|
5731
|
+
/**
|
|
5732
|
+
* Returns whether the item is stackable. An item is considered
|
|
5733
|
+
* stackable if the item's maximum stack size is greater than 1
|
|
5734
|
+
* and the item does not contain any custom data or properties.
|
|
5735
|
+
*/
|
|
5845
5736
|
readonly isStackable: boolean;
|
|
5737
|
+
/**
|
|
5738
|
+
* Gets or sets whether the item is kept on death.
|
|
5739
|
+
*/
|
|
5846
5740
|
keepOnDeath: boolean;
|
|
5741
|
+
/**
|
|
5742
|
+
* Gets or sets the item's lock mode. The default value is
|
|
5743
|
+
* `ItemLockMode.none`.
|
|
5744
|
+
*/
|
|
5847
5745
|
lockMode: ItemLockMode;
|
|
5746
|
+
/**
|
|
5747
|
+
* The maximum stack size. This value varies depending on the
|
|
5748
|
+
* type of item. For example, torches have a maximum stack size
|
|
5749
|
+
* of 64, while eggs have a maximum stack size of 16.
|
|
5750
|
+
*/
|
|
5848
5751
|
readonly maxAmount: number;
|
|
5849
5752
|
/**
|
|
5850
|
-
* Given name of this stack of items.
|
|
5753
|
+
* Given name of this stack of items. The name tag is displayed
|
|
5754
|
+
* when hovering over the item. Setting the name tag to an
|
|
5755
|
+
* empty string or `undefined` will remove the name tag.
|
|
5756
|
+
* @throws
|
|
5757
|
+
* Throws if the length exceeds 255 characters.
|
|
5851
5758
|
*/
|
|
5852
5759
|
nameTag?: string;
|
|
5760
|
+
/**
|
|
5761
|
+
* The type of the item.
|
|
5762
|
+
*/
|
|
5853
5763
|
readonly 'type': ItemType;
|
|
5854
5764
|
/**
|
|
5855
5765
|
* Identifier of the type of items for the stack. If a
|
|
@@ -5866,11 +5776,20 @@ export class ItemStack {
|
|
|
5866
5776
|
* enumeration for a list of standard item types in Minecraft
|
|
5867
5777
|
* experiences.
|
|
5868
5778
|
* @param amount
|
|
5869
|
-
* Number of items to place in the stack, between 1
|
|
5870
|
-
*
|
|
5871
|
-
*
|
|
5779
|
+
* Number of items to place in the stack, between 1-255. The
|
|
5780
|
+
* provided value will be clamped to the item's maximum stack
|
|
5781
|
+
* size. Note that certain items can only have one item in the
|
|
5782
|
+
* stack.
|
|
5783
|
+
* @throws
|
|
5784
|
+
* Throws if `itemType` is invalid, or if `amount` is outside
|
|
5785
|
+
* the range of 1-255.
|
|
5872
5786
|
*/
|
|
5873
5787
|
constructor(itemType: ItemType | string, amount?: number);
|
|
5788
|
+
/**
|
|
5789
|
+
* @remarks
|
|
5790
|
+
* Creates an exact copy of the item stack, including any
|
|
5791
|
+
* custom data or properties.
|
|
5792
|
+
*/
|
|
5874
5793
|
clone(): ItemStack;
|
|
5875
5794
|
/**
|
|
5876
5795
|
* @remarks
|
|
@@ -5881,6 +5800,14 @@ export class ItemStack {
|
|
|
5881
5800
|
* retrieve. If no namespace prefix is specified, 'minecraft:'
|
|
5882
5801
|
* is assumed. If the component is not present on the item
|
|
5883
5802
|
* stack, undefined is returned.
|
|
5803
|
+
* @example durability.ts
|
|
5804
|
+
* ```typescript
|
|
5805
|
+
* // Get the maximum durability of a custom sword item
|
|
5806
|
+
* const itemStack = new ItemStack("custom:sword");
|
|
5807
|
+
* const durability = itemStack.getComponent("minecraft:durability") as ItemDurabilityComponent;
|
|
5808
|
+
* const maxDurability = durability.maxDurability;
|
|
5809
|
+
*
|
|
5810
|
+
* ```
|
|
5884
5811
|
*/
|
|
5885
5812
|
getComponent(componentId: string): any;
|
|
5886
5813
|
/**
|
|
@@ -5893,6 +5820,9 @@ export class ItemStack {
|
|
|
5893
5820
|
* @remarks
|
|
5894
5821
|
* Returns the lore value - a secondary display string - for an
|
|
5895
5822
|
* ItemStack.
|
|
5823
|
+
* @returns
|
|
5824
|
+
* An array of lore strings. If the item does not have lore,
|
|
5825
|
+
* returns an empty array.
|
|
5896
5826
|
*/
|
|
5897
5827
|
getLore(): string[];
|
|
5898
5828
|
/**
|
|
@@ -5905,14 +5835,63 @@ export class ItemStack {
|
|
|
5905
5835
|
* is assumed.
|
|
5906
5836
|
*/
|
|
5907
5837
|
hasComponent(componentId: string): boolean;
|
|
5838
|
+
/**
|
|
5839
|
+
* @remarks
|
|
5840
|
+
* Returns whether this item stack can be stacked with the
|
|
5841
|
+
* given `itemStack`. This is determined by comparing the item
|
|
5842
|
+
* type and any custom data and properties associated with the
|
|
5843
|
+
* item stacks. The amount of each item stack is not taken into
|
|
5844
|
+
* consideration.
|
|
5845
|
+
* @param itemStack
|
|
5846
|
+
*/
|
|
5908
5847
|
isStackableWith(itemStack: ItemStack): boolean;
|
|
5848
|
+
/**
|
|
5849
|
+
* @remarks
|
|
5850
|
+
* The list of block types this item can break in Adventure
|
|
5851
|
+
* mode. The block names are displayed in the item's tooltip.
|
|
5852
|
+
* Setting the value to undefined will clear the list.
|
|
5853
|
+
* @param blockIdentifiers
|
|
5854
|
+
* @throws
|
|
5855
|
+
* Throws if any of the provided block identifiers are invalid.
|
|
5856
|
+
* @example example.ts
|
|
5857
|
+
* ```typescript
|
|
5858
|
+
* // Creates a diamond pickaxe that can destroy cobblestone and obsidian
|
|
5859
|
+
* const specialPickaxe = new ItemStack("minecraft:diamond_pickaxe");
|
|
5860
|
+
* specialPickaxe.setCanDestroy(["minecraft:cobblestone", "minecraft:obsidian"]);
|
|
5861
|
+
*
|
|
5862
|
+
* ```
|
|
5863
|
+
*/
|
|
5909
5864
|
setCanDestroy(blockIdentifiers?: string[]): void;
|
|
5865
|
+
/**
|
|
5866
|
+
* @remarks
|
|
5867
|
+
* The list of block types this item can be placed on in
|
|
5868
|
+
* Adventure mode. This is only applicable to block items. The
|
|
5869
|
+
* block names are displayed in the item's tooltip. Setting the
|
|
5870
|
+
* value to undefined will clear the list.
|
|
5871
|
+
* @param blockIdentifiers
|
|
5872
|
+
* @throws
|
|
5873
|
+
* Throws if any of the provided block identifiers are invalid.
|
|
5874
|
+
* @example example.ts
|
|
5875
|
+
* ```typescript
|
|
5876
|
+
* // Creates a gold block that can be placed on grass and dirt
|
|
5877
|
+
* const specialGoldBlock = new ItemStack("minecraft:gold_block");
|
|
5878
|
+
* specialPickaxe.setCanPlaceOn(["minecraft:grass", "minecraft:dirt"]);
|
|
5879
|
+
*
|
|
5880
|
+
* ```
|
|
5881
|
+
*/
|
|
5910
5882
|
setCanPlaceOn(blockIdentifiers?: string[]): void;
|
|
5911
5883
|
/**
|
|
5912
5884
|
* @remarks
|
|
5913
5885
|
* Sets the lore value - a secondary display string - for an
|
|
5914
5886
|
* ItemStack.
|
|
5915
5887
|
* @param loreList
|
|
5888
|
+
* @example multilineLore.ts
|
|
5889
|
+
* ```typescript
|
|
5890
|
+
* // Set the lore of an item to multiple lines of text
|
|
5891
|
+
* const itemStack = new ItemStack("minecraft:diamond_sword");
|
|
5892
|
+
* itemStack.setLore(["Line 1", "Line 2", "Line 3"]);
|
|
5893
|
+
*
|
|
5894
|
+
* ```
|
|
5916
5895
|
*/
|
|
5917
5896
|
setLore(loreList?: string[]): void;
|
|
5918
5897
|
/**
|
|
@@ -10336,7 +10315,6 @@ export class MinecraftItemTypes {
|
|
|
10336
10315
|
* Minecraft.
|
|
10337
10316
|
*/
|
|
10338
10317
|
static readonly deadbush: ItemType;
|
|
10339
|
-
static readonly debugStick: ItemType;
|
|
10340
10318
|
/**
|
|
10341
10319
|
* Represents an item that can place a block of deepslate
|
|
10342
10320
|
* within Minecraft.
|
|
@@ -12704,6 +12682,47 @@ export class Player extends Entity {
|
|
|
12704
12682
|
* @throws This function can throw errors.
|
|
12705
12683
|
*/
|
|
12706
12684
|
runCommandAsync(commandString: string): Promise<CommandResult>;
|
|
12685
|
+
/**
|
|
12686
|
+
* @beta
|
|
12687
|
+
* @remarks
|
|
12688
|
+
* Sends a message to the player.
|
|
12689
|
+
* @param message
|
|
12690
|
+
* The message to be displayed.
|
|
12691
|
+
* @throws
|
|
12692
|
+
* This method can throw if the provided {@link RawMessage} is
|
|
12693
|
+
* in an invalid format. For example, if an empty `name` string
|
|
12694
|
+
* is provided to `score`.
|
|
12695
|
+
* @example nestedTranslation.ts
|
|
12696
|
+
* ```typescript
|
|
12697
|
+
* // Displays "Apple or Coal"
|
|
12698
|
+
* let rawMessage = {
|
|
12699
|
+
* translate: "accessibility.list.or.two",
|
|
12700
|
+
* with: { rawtext: [{ translate: "item.apple.name" }, { translate: "item.coal.name" }] },
|
|
12701
|
+
* };
|
|
12702
|
+
* player.sendMessage(rawMessage);
|
|
12703
|
+
*
|
|
12704
|
+
* ```
|
|
12705
|
+
* @example scoreWildcard.ts
|
|
12706
|
+
* ```typescript
|
|
12707
|
+
* // Displays the player's score for objective "obj". Each player will see their own score.
|
|
12708
|
+
* const rawMessage = { score: { name: "*", objective: "obj" } };
|
|
12709
|
+
* world.sendMessage(rawMessage);
|
|
12710
|
+
*
|
|
12711
|
+
* ```
|
|
12712
|
+
* @example simpleString.ts
|
|
12713
|
+
* ```typescript
|
|
12714
|
+
* // Displays "Hello, world!"
|
|
12715
|
+
* world.sendMessage("Hello, world!");
|
|
12716
|
+
*
|
|
12717
|
+
* ```
|
|
12718
|
+
* @example translation.ts
|
|
12719
|
+
* ```typescript
|
|
12720
|
+
* // Displays "First or Second"
|
|
12721
|
+
* const rawMessage = { translate: "accessibility.list.or.two", with: ["First", "Second"] };
|
|
12722
|
+
* player.sendMessage(rawMessage);
|
|
12723
|
+
*
|
|
12724
|
+
* ```
|
|
12725
|
+
*/
|
|
12707
12726
|
sendMessage(message: (RawMessage | string)[] | RawMessage | string): void;
|
|
12708
12727
|
/**
|
|
12709
12728
|
* @beta
|
|
@@ -12799,100 +12818,17 @@ export class Player extends Entity {
|
|
|
12799
12818
|
*/
|
|
12800
12819
|
triggerEvent(eventName: string): void;
|
|
12801
12820
|
}
|
|
12802
|
-
/**
|
|
12803
|
-
* @beta
|
|
12804
|
-
* Represents the inventory of a {@link Player} in the world.
|
|
12805
|
-
*/
|
|
12806
12821
|
export class PlayerInventoryComponentContainer extends InventoryComponentContainer {
|
|
12807
12822
|
protected constructor();
|
|
12808
|
-
/**
|
|
12809
|
-
* Contains a count of the slots in the container that are
|
|
12810
|
-
* empty.
|
|
12811
|
-
* @throws This property can throw when used.
|
|
12812
|
-
*/
|
|
12813
12823
|
readonly emptySlotsCount: number;
|
|
12814
|
-
/**
|
|
12815
|
-
* Returns the size capacity of the inventory container on this
|
|
12816
|
-
* block.
|
|
12817
|
-
* @throws This property can throw when used.
|
|
12818
|
-
*/
|
|
12819
12824
|
readonly size: number;
|
|
12820
|
-
/**
|
|
12821
|
-
* @remarks
|
|
12822
|
-
* Adds an item to the specified container. Item will be placed
|
|
12823
|
-
* in the first available empty slot. (use .setItem if you wish
|
|
12824
|
-
* to set items in a particular slot.)
|
|
12825
|
-
* @param itemStack
|
|
12826
|
-
* The stack of items to add.
|
|
12827
|
-
* @throws This function can throw errors.
|
|
12828
|
-
*/
|
|
12829
12825
|
addItem(itemStack: ItemStack): void;
|
|
12830
|
-
/**
|
|
12831
|
-
* @remarks
|
|
12832
|
-
* Empties all items in this players' inventory.
|
|
12833
|
-
* @throws This function can throw errors.
|
|
12834
|
-
*/
|
|
12835
12826
|
clearAll(): void;
|
|
12836
|
-
/**
|
|
12837
|
-
* @remarks
|
|
12838
|
-
* Clears out a specific item at the specified slot index.
|
|
12839
|
-
* @param slot
|
|
12840
|
-
* @throws This function can throw errors.
|
|
12841
|
-
*/
|
|
12842
12827
|
clearItem(slot: number): void;
|
|
12843
|
-
/**
|
|
12844
|
-
* @remarks
|
|
12845
|
-
* Gets the item stack for the set of items at the specified
|
|
12846
|
-
* slot. If the slot is empty, returns undefined. This method
|
|
12847
|
-
* does not change or clear the contents of the specified slot.
|
|
12848
|
-
* @param slot
|
|
12849
|
-
* Zero-based index of the slot to retrieve items from.
|
|
12850
|
-
* @throws This function can throw errors.
|
|
12851
|
-
*/
|
|
12852
12828
|
getItem(slot: number): ItemStack;
|
|
12853
|
-
/**
|
|
12854
|
-
* @remarks
|
|
12855
|
-
* Returns a slot object for specifically managing a slot
|
|
12856
|
-
* within a broader inventory.
|
|
12857
|
-
* @param slot
|
|
12858
|
-
* @throws This function can throw errors.
|
|
12859
|
-
*/
|
|
12860
12829
|
getSlot(slot: number): ContainerSlot;
|
|
12861
|
-
/**
|
|
12862
|
-
* @remarks
|
|
12863
|
-
* Sets an item stack within a particular slot.
|
|
12864
|
-
* @param slot
|
|
12865
|
-
* Zero-based index of the slot to set an item at.
|
|
12866
|
-
* @param itemStack
|
|
12867
|
-
* Stack of items to place within the specified slot.
|
|
12868
|
-
* @throws This function can throw errors.
|
|
12869
|
-
*/
|
|
12870
12830
|
setItem(slot: number, itemStack?: ItemStack): void;
|
|
12871
|
-
/**
|
|
12872
|
-
* @remarks
|
|
12873
|
-
* Swaps items between two different slots within containers.
|
|
12874
|
-
* @param slot
|
|
12875
|
-
* Zero-based index of the slot to swap from this container.
|
|
12876
|
-
* @param otherSlot
|
|
12877
|
-
* Zero-based index of the slot to swap with.
|
|
12878
|
-
* @param otherContainer
|
|
12879
|
-
* Target container to swap with. Note this can be the same
|
|
12880
|
-
* container as this source.
|
|
12881
|
-
* @throws This function can throw errors.
|
|
12882
|
-
*/
|
|
12883
12831
|
swapItems(slot: number, otherSlot: number, otherContainer: Container): boolean;
|
|
12884
|
-
/**
|
|
12885
|
-
* @remarks
|
|
12886
|
-
* Moves an item from one slot to another, potentially across
|
|
12887
|
-
* containers.
|
|
12888
|
-
* @param fromSlot
|
|
12889
|
-
* @param toSlot
|
|
12890
|
-
* Zero-based index of the slot to move to.
|
|
12891
|
-
* @param toContainer
|
|
12892
|
-
* Target container to transfer to. Note this can be the same
|
|
12893
|
-
* container as the source.
|
|
12894
|
-
* @throws This function can throw errors.
|
|
12895
|
-
*/
|
|
12896
12832
|
transferItem(fromSlot: number, toSlot: number, toContainer: Container): boolean;
|
|
12897
12833
|
}
|
|
12898
12834
|
/**
|
|
@@ -13816,6 +13752,47 @@ export class World {
|
|
|
13816
13752
|
* @throws This function can throw errors.
|
|
13817
13753
|
*/
|
|
13818
13754
|
removeDynamicProperty(identifier: string): boolean;
|
|
13755
|
+
/**
|
|
13756
|
+
* @beta
|
|
13757
|
+
* @remarks
|
|
13758
|
+
* Sends a message to all players.
|
|
13759
|
+
* @param message
|
|
13760
|
+
* The message to be displayed.
|
|
13761
|
+
* @throws
|
|
13762
|
+
* This method can throw if the provided {@link RawMessage} is
|
|
13763
|
+
* in an invalid format. For example, if an empty `name` string
|
|
13764
|
+
* is provided to `score`.
|
|
13765
|
+
* @example nestedTranslation.ts
|
|
13766
|
+
* ```typescript
|
|
13767
|
+
* // Displays "Apple or Coal"
|
|
13768
|
+
* let rawMessage = {
|
|
13769
|
+
* translate: "accessibility.list.or.two",
|
|
13770
|
+
* with: { rawtext: [{ translate: "item.apple.name" }, { translate: "item.coal.name" }] },
|
|
13771
|
+
* };
|
|
13772
|
+
* world.sendMessage(rawMessage);
|
|
13773
|
+
*
|
|
13774
|
+
* ```
|
|
13775
|
+
* @example scoreWildcard.ts
|
|
13776
|
+
* ```typescript
|
|
13777
|
+
* // Displays the player's score for objective "obj". Each player will see their own score.
|
|
13778
|
+
* const rawMessage = { score: { name: "*", objective: "obj" } };
|
|
13779
|
+
* world.sendMessage(rawMessage);
|
|
13780
|
+
*
|
|
13781
|
+
* ```
|
|
13782
|
+
* @example simpleString.ts
|
|
13783
|
+
* ```typescript
|
|
13784
|
+
* // Displays "Hello, world!"
|
|
13785
|
+
* world.sendMessage("Hello, world!");
|
|
13786
|
+
*
|
|
13787
|
+
* ```
|
|
13788
|
+
* @example translation.ts
|
|
13789
|
+
* ```typescript
|
|
13790
|
+
* // Displays "First or Second"
|
|
13791
|
+
* const rawMessage = { translate: "accessibility.list.or.two", with: ["First", "Second"] };
|
|
13792
|
+
* world.sendMessage(rawMessage);
|
|
13793
|
+
*
|
|
13794
|
+
* ```
|
|
13795
|
+
*/
|
|
13819
13796
|
sendMessage(message: (RawMessage | string)[] | RawMessage | string): void;
|
|
13820
13797
|
setDefaultSpawn(spawnPosition: Vector3): void;
|
|
13821
13798
|
/**
|