@minecraft/server-gametest 1.0.0-beta.1.20.0-preview.24 → 1.0.0-beta.1.20.0-preview.25
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 +82 -139
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* ```json
|
|
18
18
|
* {
|
|
19
19
|
* "module_name": "@minecraft/server-gametest",
|
|
20
|
-
* "version": "1.0.0-internal.1.20.0-preview.
|
|
20
|
+
* "version": "1.0.0-internal.1.20.0-preview.25"
|
|
21
21
|
* }
|
|
22
22
|
* ```
|
|
23
23
|
*
|
|
@@ -454,13 +454,6 @@ export class SimulatedPlayer extends minecraftserver.Player {
|
|
|
454
454
|
* @throws This function can throw errors.
|
|
455
455
|
*/
|
|
456
456
|
disconnect(): void;
|
|
457
|
-
/**
|
|
458
|
-
* @remarks
|
|
459
|
-
* This function can't be called in read-only mode.
|
|
460
|
-
*
|
|
461
|
-
* @throws This function can throw errors.
|
|
462
|
-
*/
|
|
463
|
-
fly(): void;
|
|
464
457
|
/**
|
|
465
458
|
* @remarks
|
|
466
459
|
* Gives the simulated player a particular item stack.
|
|
@@ -474,13 +467,6 @@ export class SimulatedPlayer extends minecraftserver.Player {
|
|
|
474
467
|
* @throws This function can throw errors.
|
|
475
468
|
*/
|
|
476
469
|
giveItem(itemStack: minecraftserver.ItemStack, selectSlot?: boolean): boolean;
|
|
477
|
-
/**
|
|
478
|
-
* @remarks
|
|
479
|
-
* This function can't be called in read-only mode.
|
|
480
|
-
*
|
|
481
|
-
* @throws This function can throw errors.
|
|
482
|
-
*/
|
|
483
|
-
glide(): boolean;
|
|
484
470
|
/**
|
|
485
471
|
* @remarks
|
|
486
472
|
* Performs a raycast from the player’s head and interacts with
|
|
@@ -722,20 +708,6 @@ export class SimulatedPlayer extends minecraftserver.Player {
|
|
|
722
708
|
* @throws This function can throw errors.
|
|
723
709
|
*/
|
|
724
710
|
stopBreakingBlock(): void;
|
|
725
|
-
/**
|
|
726
|
-
* @remarks
|
|
727
|
-
* This function can't be called in read-only mode.
|
|
728
|
-
*
|
|
729
|
-
* @throws This function can throw errors.
|
|
730
|
-
*/
|
|
731
|
-
stopFlying(): void;
|
|
732
|
-
/**
|
|
733
|
-
* @remarks
|
|
734
|
-
* This function can't be called in read-only mode.
|
|
735
|
-
*
|
|
736
|
-
* @throws This function can throw errors.
|
|
737
|
-
*/
|
|
738
|
-
stopGliding(): void;
|
|
739
711
|
/**
|
|
740
712
|
* @remarks
|
|
741
713
|
* Stops interacting with entities or blocks.
|
|
@@ -755,13 +727,6 @@ export class SimulatedPlayer extends minecraftserver.Player {
|
|
|
755
727
|
* @throws This function can throw errors.
|
|
756
728
|
*/
|
|
757
729
|
stopMoving(): void;
|
|
758
|
-
/**
|
|
759
|
-
* @remarks
|
|
760
|
-
* This function can't be called in read-only mode.
|
|
761
|
-
*
|
|
762
|
-
* @throws This function can throw errors.
|
|
763
|
-
*/
|
|
764
|
-
stopSwimming(): void;
|
|
765
730
|
/**
|
|
766
731
|
* @remarks
|
|
767
732
|
* Stops using the currently active item.
|
|
@@ -771,13 +736,6 @@ export class SimulatedPlayer extends minecraftserver.Player {
|
|
|
771
736
|
* @throws This function can throw errors.
|
|
772
737
|
*/
|
|
773
738
|
stopUsingItem(): void;
|
|
774
|
-
/**
|
|
775
|
-
* @remarks
|
|
776
|
-
* This function can't be called in read-only mode.
|
|
777
|
-
*
|
|
778
|
-
* @throws This function can throw errors.
|
|
779
|
-
*/
|
|
780
|
-
swim(): void;
|
|
781
739
|
/**
|
|
782
740
|
* @remarks
|
|
783
741
|
* Causes the simulated player to use an item. Does not consume
|
|
@@ -945,10 +903,9 @@ export class Test {
|
|
|
945
903
|
* @throws This function can throw errors.
|
|
946
904
|
* @example testIfButtonNotPressed.js
|
|
947
905
|
* ```typescript
|
|
948
|
-
*
|
|
949
|
-
*
|
|
950
|
-
*
|
|
951
|
-
*
|
|
906
|
+
* test.assertBlockState(buttonPos, (block) => {
|
|
907
|
+
* return block.permutation.getProperty("button_pressed_bit") == 0;
|
|
908
|
+
* });
|
|
952
909
|
* ```
|
|
953
910
|
*/
|
|
954
911
|
assertBlockState(blockLocation: minecraftserver.Vector3, callback: (arg: minecraftserver.Block) => boolean): void;
|
|
@@ -1023,8 +980,7 @@ export class Test {
|
|
|
1023
980
|
* @throws This function can throw errors.
|
|
1024
981
|
* @example horseArmorTest.js
|
|
1025
982
|
* ```typescript
|
|
1026
|
-
*
|
|
1027
|
-
*
|
|
983
|
+
* test.assertEntityHasArmor("minecraft:horse", armorSlotTorso, "diamond_horse_armor", 0, horseLocation, true);
|
|
1028
984
|
* ```
|
|
1029
985
|
*/
|
|
1030
986
|
assertEntityHasArmor(
|
|
@@ -1056,8 +1012,7 @@ export class Test {
|
|
|
1056
1012
|
* @throws This function can throw errors.
|
|
1057
1013
|
* @example sheepShearedTest.js
|
|
1058
1014
|
* ```typescript
|
|
1059
|
-
*
|
|
1060
|
-
*
|
|
1015
|
+
* test.assertEntityHasComponent("minecraft:sheep", "minecraft:is_sheared", entityLoc, false);
|
|
1061
1016
|
* ```
|
|
1062
1017
|
*/
|
|
1063
1018
|
assertEntityHasComponent(
|
|
@@ -1101,22 +1056,21 @@ export class Test {
|
|
|
1101
1056
|
* @throws This function can throw errors.
|
|
1102
1057
|
* @example simpleMobTest.ts
|
|
1103
1058
|
* ```typescript
|
|
1104
|
-
*
|
|
1105
|
-
*
|
|
1106
|
-
*
|
|
1059
|
+
* gt.register("StarterTests", "simpleMobTest", (test: gt.Test) => {
|
|
1060
|
+
* const attackerId = "fox";
|
|
1061
|
+
* const victimId = "chicken";
|
|
1107
1062
|
*
|
|
1108
|
-
*
|
|
1109
|
-
*
|
|
1063
|
+
* test.spawn(attackerId, { x: 5, y: 2, z: 5 });
|
|
1064
|
+
* let victim = test.spawn(victimId, { x: 2, y: 2, z: 2 });
|
|
1110
1065
|
*
|
|
1111
|
-
*
|
|
1112
|
-
*
|
|
1113
|
-
* test.succeedWhen(() => {
|
|
1114
|
-
* test.assertEntityInstancePresentInArea(victim, false);
|
|
1115
|
-
* });
|
|
1116
|
-
* })
|
|
1117
|
-
* .maxTicks(400)
|
|
1118
|
-
* .structureName("gametests:mediumglass");
|
|
1066
|
+
* test.assertEntityInstancePresentInArea(victim, true);
|
|
1119
1067
|
*
|
|
1068
|
+
* test.succeedWhen(() => {
|
|
1069
|
+
* test.assertEntityInstancePresentInArea(victim, false);
|
|
1070
|
+
* });
|
|
1071
|
+
* })
|
|
1072
|
+
* .maxTicks(400)
|
|
1073
|
+
* .structureName("gametests:mediumglass");
|
|
1120
1074
|
*
|
|
1121
1075
|
* ```
|
|
1122
1076
|
*/
|
|
@@ -1165,22 +1119,21 @@ export class Test {
|
|
|
1165
1119
|
* @throws This function can throw errors.
|
|
1166
1120
|
* @example simpleMobTest.ts
|
|
1167
1121
|
* ```typescript
|
|
1168
|
-
*
|
|
1169
|
-
*
|
|
1170
|
-
*
|
|
1171
|
-
*
|
|
1172
|
-
* test.spawn(attackerId, { x: 5, y: 2, z: 5 });
|
|
1173
|
-
* test.spawn(victimId, { x: 2, y: 2, z: 2 });
|
|
1122
|
+
* gt.register("StarterTests", "simpleMobTest", (test: gt.Test) => {
|
|
1123
|
+
* const attackerId = "fox";
|
|
1124
|
+
* const victimId = "chicken";
|
|
1174
1125
|
*
|
|
1175
|
-
*
|
|
1126
|
+
* test.spawn(attackerId, { x: 5, y: 2, z: 5 });
|
|
1127
|
+
* test.spawn(victimId, { x: 2, y: 2, z: 2 });
|
|
1176
1128
|
*
|
|
1177
|
-
*
|
|
1178
|
-
* test.assertEntityPresentInArea(victimId, false);
|
|
1179
|
-
* });
|
|
1180
|
-
* })
|
|
1181
|
-
* .maxTicks(400)
|
|
1182
|
-
* .structureName("gametests:mediumglass");
|
|
1129
|
+
* test.assertEntityPresentInArea(victimId, true);
|
|
1183
1130
|
*
|
|
1131
|
+
* test.succeedWhen(() => {
|
|
1132
|
+
* test.assertEntityPresentInArea(victimId, false);
|
|
1133
|
+
* });
|
|
1134
|
+
* })
|
|
1135
|
+
* .maxTicks(400)
|
|
1136
|
+
* .structureName("gametests:mediumglass");
|
|
1184
1137
|
*
|
|
1185
1138
|
* ```
|
|
1186
1139
|
*/
|
|
@@ -1205,12 +1158,11 @@ export class Test {
|
|
|
1205
1158
|
* @throws This function can throw errors.
|
|
1206
1159
|
* @example villagerEffectTest.js
|
|
1207
1160
|
* ```typescript
|
|
1208
|
-
*
|
|
1209
|
-
*
|
|
1210
|
-
*
|
|
1211
|
-
*
|
|
1212
|
-
*
|
|
1213
|
-
*
|
|
1161
|
+
* test.assertEntityState(
|
|
1162
|
+
* villagerPos,
|
|
1163
|
+
* "minecraft:villager_v2",
|
|
1164
|
+
* (entity) => entity.getEffect(MinecraftEffectTypes.regeneration).duration > 120
|
|
1165
|
+
* ); // At least 6 seconds remaining in the villagers' effect
|
|
1214
1166
|
* ```
|
|
1215
1167
|
*/
|
|
1216
1168
|
assertEntityState(
|
|
@@ -1269,8 +1221,7 @@ export class Test {
|
|
|
1269
1221
|
* @throws This function can throw errors.
|
|
1270
1222
|
* @example findFeathers.js
|
|
1271
1223
|
* ```typescript
|
|
1272
|
-
*
|
|
1273
|
-
*
|
|
1224
|
+
* test.assertItemEntityCountIs(Items.feather, expectedFeatherLoc, 0, 1);
|
|
1274
1225
|
* ```
|
|
1275
1226
|
*/
|
|
1276
1227
|
assertItemEntityCountIs(
|
|
@@ -1650,27 +1601,25 @@ export class Test {
|
|
|
1650
1601
|
* @throws This function can throw errors.
|
|
1651
1602
|
* @example simpleMobTest.ts
|
|
1652
1603
|
* ```typescript
|
|
1653
|
-
*
|
|
1654
|
-
*
|
|
1655
|
-
*
|
|
1656
|
-
*
|
|
1657
|
-
* test.spawn(attackerId, { x: 5, y: 2, z: 5 });
|
|
1658
|
-
* test.spawn(victimId, { x: 2, y: 2, z: 2 });
|
|
1604
|
+
* gt.register("StarterTests", "simpleMobTest", (test: gt.Test) => {
|
|
1605
|
+
* const attackerId = "fox";
|
|
1606
|
+
* const victimId = "chicken";
|
|
1659
1607
|
*
|
|
1660
|
-
*
|
|
1608
|
+
* test.spawn(attackerId, { x: 5, y: 2, z: 5 });
|
|
1609
|
+
* test.spawn(victimId, { x: 2, y: 2, z: 2 });
|
|
1661
1610
|
*
|
|
1662
|
-
*
|
|
1663
|
-
* test.assertEntityPresentInArea(victimId, false);
|
|
1664
|
-
* });
|
|
1665
|
-
* })
|
|
1666
|
-
* .maxTicks(400)
|
|
1667
|
-
* .structureName("gametests:mediumglass");
|
|
1611
|
+
* test.assertEntityPresentInArea(victimId, true);
|
|
1668
1612
|
*
|
|
1613
|
+
* test.succeedWhen(() => {
|
|
1614
|
+
* test.assertEntityPresentInArea(victimId, false);
|
|
1615
|
+
* });
|
|
1616
|
+
* })
|
|
1617
|
+
* .maxTicks(400)
|
|
1618
|
+
* .structureName("gametests:mediumglass");
|
|
1669
1619
|
* ```
|
|
1670
1620
|
* @example spawnAdultPig.js
|
|
1671
1621
|
* ```typescript
|
|
1672
|
-
*
|
|
1673
|
-
*
|
|
1622
|
+
* test.spawn("minecraft:pig<minecraft:ageable_grow_up>", { x: 1, y: 2, z: 1 });
|
|
1674
1623
|
*
|
|
1675
1624
|
* ```
|
|
1676
1625
|
*/
|
|
@@ -1692,8 +1641,7 @@ export class Test {
|
|
|
1692
1641
|
* @throws This function can throw errors.
|
|
1693
1642
|
* @example spawnAdultPig.js
|
|
1694
1643
|
* ```typescript
|
|
1695
|
-
*
|
|
1696
|
-
*
|
|
1644
|
+
* test.spawn("minecraft:pig<minecraft:ageable_grow_up>", { x: 1.5, y: 2, z: 1.5 });
|
|
1697
1645
|
* ```
|
|
1698
1646
|
*/
|
|
1699
1647
|
spawnAtLocation(entityTypeIdentifier: string, location: minecraftserver.Vector3): minecraftserver.Entity;
|
|
@@ -1710,12 +1658,11 @@ export class Test {
|
|
|
1710
1658
|
* @throws This function can throw errors.
|
|
1711
1659
|
* @example spawnEmeralds.js
|
|
1712
1660
|
* ```typescript
|
|
1713
|
-
*
|
|
1714
|
-
*
|
|
1715
|
-
*
|
|
1716
|
-
* test.spawnItem(oneEmerald, { x: 3.5, y: 3, z: 1.5 });
|
|
1717
|
-
* test.spawnItem(fiveEmeralds, { x: 1.5, y: 3, z: 1.5 });
|
|
1661
|
+
* const oneEmerald = new ItemStack(MinecraftItemTypes.emerald, 1, 0);
|
|
1662
|
+
* const fiveEmeralds = new ItemStack(MinecraftItemTypes.emerald, 5, 0);
|
|
1718
1663
|
*
|
|
1664
|
+
* test.spawnItem(oneEmerald, { x: 3.5, y: 3, z: 1.5 });
|
|
1665
|
+
* test.spawnItem(fiveEmeralds, { x: 1.5, y: 3, z: 1.5 });
|
|
1719
1666
|
*
|
|
1720
1667
|
* ```
|
|
1721
1668
|
*/
|
|
@@ -1783,8 +1730,7 @@ export class Test {
|
|
|
1783
1730
|
* @throws This function can throw errors.
|
|
1784
1731
|
* @example spreadFromFaceTowardDirection.js
|
|
1785
1732
|
* ```typescript
|
|
1786
|
-
*
|
|
1787
|
-
*
|
|
1733
|
+
* test.spreadFromFaceTowardDirection({ x: 1, y: 2, z: 1 }, Direction.south, Direction.down);
|
|
1788
1734
|
* ```
|
|
1789
1735
|
*/
|
|
1790
1736
|
spreadFromFaceTowardDirection(
|
|
@@ -1871,22 +1817,21 @@ export class Test {
|
|
|
1871
1817
|
* @throws This function can throw errors.
|
|
1872
1818
|
* @example simpleMobTest.ts
|
|
1873
1819
|
* ```typescript
|
|
1874
|
-
*
|
|
1875
|
-
*
|
|
1876
|
-
*
|
|
1820
|
+
* gt.register("StarterTests", "simpleMobTest", (test: gt.Test) => {
|
|
1821
|
+
* const attackerId = "fox";
|
|
1822
|
+
* const victimId = "chicken";
|
|
1877
1823
|
*
|
|
1878
|
-
*
|
|
1879
|
-
*
|
|
1824
|
+
* test.spawn(attackerId, { x: 5, y: 2, z: 5 });
|
|
1825
|
+
* test.spawn(victimId, { x: 2, y: 2, z: 2 });
|
|
1880
1826
|
*
|
|
1881
|
-
*
|
|
1882
|
-
*
|
|
1883
|
-
* test.succeedWhen(() => {
|
|
1884
|
-
* test.assertEntityPresentInArea(victimId, false);
|
|
1885
|
-
* });
|
|
1886
|
-
* })
|
|
1887
|
-
* .maxTicks(400)
|
|
1888
|
-
* .structureName("gametests:mediumglass");
|
|
1827
|
+
* test.assertEntityPresentInArea(victimId, true);
|
|
1889
1828
|
*
|
|
1829
|
+
* test.succeedWhen(() => {
|
|
1830
|
+
* test.assertEntityPresentInArea(victimId, false);
|
|
1831
|
+
* });
|
|
1832
|
+
* })
|
|
1833
|
+
* .maxTicks(400)
|
|
1834
|
+
* .structureName("gametests:mediumglass");
|
|
1890
1835
|
*
|
|
1891
1836
|
* ```
|
|
1892
1837
|
*/
|
|
@@ -2096,29 +2041,27 @@ export class GameTestError extends Error {
|
|
|
2096
2041
|
* builder methods.
|
|
2097
2042
|
* @example example1.js
|
|
2098
2043
|
* ```typescript
|
|
2099
|
-
*
|
|
2100
|
-
*
|
|
2101
|
-
*
|
|
2102
|
-
*
|
|
2044
|
+
* GameTest.register("ExampleTests", "alwaysFail", (test) => {
|
|
2045
|
+
* test.fail("This test, runnable via '/gametest run ExampleTests:alwaysFail', will always fail");
|
|
2046
|
+
* });
|
|
2103
2047
|
* ```
|
|
2104
2048
|
* @example simpleMobTest.ts
|
|
2105
2049
|
* ```typescript
|
|
2106
|
-
*
|
|
2107
|
-
*
|
|
2108
|
-
*
|
|
2109
|
-
*
|
|
2110
|
-
* test.spawn(attackerId, { x: 5, y: 2, z: 5 });
|
|
2111
|
-
* test.spawn(victimId, { x: 2, y: 2, z: 2 });
|
|
2050
|
+
* gt.register("StarterTests", "simpleMobTest", (test: gt.Test) => {
|
|
2051
|
+
* const attackerId = "fox";
|
|
2052
|
+
* const victimId = "chicken";
|
|
2112
2053
|
*
|
|
2113
|
-
*
|
|
2054
|
+
* test.spawn(attackerId, { x: 5, y: 2, z: 5 });
|
|
2055
|
+
* test.spawn(victimId, { x: 2, y: 2, z: 2 });
|
|
2114
2056
|
*
|
|
2115
|
-
*
|
|
2116
|
-
* test.assertEntityPresentInArea(victimId, false);
|
|
2117
|
-
* });
|
|
2118
|
-
* })
|
|
2119
|
-
* .maxTicks(400)
|
|
2120
|
-
* .structureName("gametests:mediumglass");
|
|
2057
|
+
* test.assertEntityPresentInArea(victimId, true);
|
|
2121
2058
|
*
|
|
2059
|
+
* test.succeedWhen(() => {
|
|
2060
|
+
* test.assertEntityPresentInArea(victimId, false);
|
|
2061
|
+
* });
|
|
2062
|
+
* })
|
|
2063
|
+
* .maxTicks(400)
|
|
2064
|
+
* .structureName("gametests:mediumglass");
|
|
2122
2065
|
* ```
|
|
2123
2066
|
*/
|
|
2124
2067
|
export function register(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@minecraft/server-gametest",
|
|
3
|
-
"version": "1.0.0-beta.1.20.0-preview.
|
|
3
|
+
"version": "1.0.0-beta.1.20.0-preview.25",
|
|
4
4
|
"description": "",
|
|
5
5
|
"contributors": [
|
|
6
6
|
{
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
}
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@minecraft/server": "1.
|
|
16
|
+
"@minecraft/server": "1.3.0-beta.1.20.0-preview.25"
|
|
17
17
|
},
|
|
18
18
|
"license": "MIT"
|
|
19
19
|
}
|