@minecraft/server-gametest 1.0.0-beta.1.20.0-preview.24 → 1.0.0-beta.1.20.10-preview.20
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 -97
- 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.
|
|
20
|
+
* "version": "1.0.0-internal.1.20.10-preview.20"
|
|
21
21
|
* }
|
|
22
22
|
* ```
|
|
23
23
|
*
|
|
@@ -945,10 +945,9 @@ export class Test {
|
|
|
945
945
|
* @throws This function can throw errors.
|
|
946
946
|
* @example testIfButtonNotPressed.js
|
|
947
947
|
* ```typescript
|
|
948
|
-
*
|
|
949
|
-
*
|
|
950
|
-
*
|
|
951
|
-
*
|
|
948
|
+
* test.assertBlockState(buttonPos, (block) => {
|
|
949
|
+
* return block.permutation.getProperty("button_pressed_bit") == 0;
|
|
950
|
+
* });
|
|
952
951
|
* ```
|
|
953
952
|
*/
|
|
954
953
|
assertBlockState(blockLocation: minecraftserver.Vector3, callback: (arg: minecraftserver.Block) => boolean): void;
|
|
@@ -1023,8 +1022,7 @@ export class Test {
|
|
|
1023
1022
|
* @throws This function can throw errors.
|
|
1024
1023
|
* @example horseArmorTest.js
|
|
1025
1024
|
* ```typescript
|
|
1026
|
-
*
|
|
1027
|
-
*
|
|
1025
|
+
* test.assertEntityHasArmor("minecraft:horse", armorSlotTorso, "diamond_horse_armor", 0, horseLocation, true);
|
|
1028
1026
|
* ```
|
|
1029
1027
|
*/
|
|
1030
1028
|
assertEntityHasArmor(
|
|
@@ -1056,8 +1054,7 @@ export class Test {
|
|
|
1056
1054
|
* @throws This function can throw errors.
|
|
1057
1055
|
* @example sheepShearedTest.js
|
|
1058
1056
|
* ```typescript
|
|
1059
|
-
*
|
|
1060
|
-
*
|
|
1057
|
+
* test.assertEntityHasComponent("minecraft:sheep", "minecraft:is_sheared", entityLoc, false);
|
|
1061
1058
|
* ```
|
|
1062
1059
|
*/
|
|
1063
1060
|
assertEntityHasComponent(
|
|
@@ -1101,22 +1098,21 @@ export class Test {
|
|
|
1101
1098
|
* @throws This function can throw errors.
|
|
1102
1099
|
* @example simpleMobTest.ts
|
|
1103
1100
|
* ```typescript
|
|
1104
|
-
*
|
|
1105
|
-
*
|
|
1106
|
-
*
|
|
1107
|
-
*
|
|
1108
|
-
* test.spawn(attackerId, { x: 5, y: 2, z: 5 });
|
|
1109
|
-
* let victim = test.spawn(victimId, { x: 2, y: 2, z: 2 });
|
|
1101
|
+
* gt.register("StarterTests", "simpleMobTest", (test: gt.Test) => {
|
|
1102
|
+
* const attackerId = "fox";
|
|
1103
|
+
* const victimId = "chicken";
|
|
1110
1104
|
*
|
|
1111
|
-
*
|
|
1105
|
+
* test.spawn(attackerId, { x: 5, y: 2, z: 5 });
|
|
1106
|
+
* let victim = test.spawn(victimId, { x: 2, y: 2, z: 2 });
|
|
1112
1107
|
*
|
|
1113
|
-
*
|
|
1114
|
-
* test.assertEntityInstancePresentInArea(victim, false);
|
|
1115
|
-
* });
|
|
1116
|
-
* })
|
|
1117
|
-
* .maxTicks(400)
|
|
1118
|
-
* .structureName("gametests:mediumglass");
|
|
1108
|
+
* test.assertEntityInstancePresentInArea(victim, true);
|
|
1119
1109
|
*
|
|
1110
|
+
* test.succeedWhen(() => {
|
|
1111
|
+
* test.assertEntityInstancePresentInArea(victim, false);
|
|
1112
|
+
* });
|
|
1113
|
+
* })
|
|
1114
|
+
* .maxTicks(400)
|
|
1115
|
+
* .structureName("gametests:mediumglass");
|
|
1120
1116
|
*
|
|
1121
1117
|
* ```
|
|
1122
1118
|
*/
|
|
@@ -1165,22 +1161,21 @@ export class Test {
|
|
|
1165
1161
|
* @throws This function can throw errors.
|
|
1166
1162
|
* @example simpleMobTest.ts
|
|
1167
1163
|
* ```typescript
|
|
1168
|
-
*
|
|
1169
|
-
*
|
|
1170
|
-
*
|
|
1164
|
+
* gt.register("StarterTests", "simpleMobTest", (test: gt.Test) => {
|
|
1165
|
+
* const attackerId = "fox";
|
|
1166
|
+
* const victimId = "chicken";
|
|
1171
1167
|
*
|
|
1172
|
-
*
|
|
1173
|
-
*
|
|
1168
|
+
* test.spawn(attackerId, { x: 5, y: 2, z: 5 });
|
|
1169
|
+
* test.spawn(victimId, { x: 2, y: 2, z: 2 });
|
|
1174
1170
|
*
|
|
1175
|
-
*
|
|
1176
|
-
*
|
|
1177
|
-
* test.succeedWhen(() => {
|
|
1178
|
-
* test.assertEntityPresentInArea(victimId, false);
|
|
1179
|
-
* });
|
|
1180
|
-
* })
|
|
1181
|
-
* .maxTicks(400)
|
|
1182
|
-
* .structureName("gametests:mediumglass");
|
|
1171
|
+
* test.assertEntityPresentInArea(victimId, true);
|
|
1183
1172
|
*
|
|
1173
|
+
* test.succeedWhen(() => {
|
|
1174
|
+
* test.assertEntityPresentInArea(victimId, false);
|
|
1175
|
+
* });
|
|
1176
|
+
* })
|
|
1177
|
+
* .maxTicks(400)
|
|
1178
|
+
* .structureName("gametests:mediumglass");
|
|
1184
1179
|
*
|
|
1185
1180
|
* ```
|
|
1186
1181
|
*/
|
|
@@ -1205,12 +1200,11 @@ export class Test {
|
|
|
1205
1200
|
* @throws This function can throw errors.
|
|
1206
1201
|
* @example villagerEffectTest.js
|
|
1207
1202
|
* ```typescript
|
|
1208
|
-
*
|
|
1209
|
-
*
|
|
1210
|
-
*
|
|
1211
|
-
*
|
|
1212
|
-
*
|
|
1213
|
-
*
|
|
1203
|
+
* test.assertEntityState(
|
|
1204
|
+
* villagerPos,
|
|
1205
|
+
* "minecraft:villager_v2",
|
|
1206
|
+
* (entity) => entity.getEffect(MinecraftEffectTypes.Regeneration).duration > 120
|
|
1207
|
+
* ); // At least 6 seconds remaining in the villagers' effect
|
|
1214
1208
|
* ```
|
|
1215
1209
|
*/
|
|
1216
1210
|
assertEntityState(
|
|
@@ -1269,8 +1263,7 @@ export class Test {
|
|
|
1269
1263
|
* @throws This function can throw errors.
|
|
1270
1264
|
* @example findFeathers.js
|
|
1271
1265
|
* ```typescript
|
|
1272
|
-
*
|
|
1273
|
-
*
|
|
1266
|
+
* test.assertItemEntityCountIs(Items.feather, expectedFeatherLoc, 0, 1);
|
|
1274
1267
|
* ```
|
|
1275
1268
|
*/
|
|
1276
1269
|
assertItemEntityCountIs(
|
|
@@ -1650,27 +1643,25 @@ export class Test {
|
|
|
1650
1643
|
* @throws This function can throw errors.
|
|
1651
1644
|
* @example simpleMobTest.ts
|
|
1652
1645
|
* ```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 });
|
|
1646
|
+
* gt.register("StarterTests", "simpleMobTest", (test: gt.Test) => {
|
|
1647
|
+
* const attackerId = "fox";
|
|
1648
|
+
* const victimId = "chicken";
|
|
1659
1649
|
*
|
|
1660
|
-
*
|
|
1650
|
+
* test.spawn(attackerId, { x: 5, y: 2, z: 5 });
|
|
1651
|
+
* test.spawn(victimId, { x: 2, y: 2, z: 2 });
|
|
1661
1652
|
*
|
|
1662
|
-
*
|
|
1663
|
-
* test.assertEntityPresentInArea(victimId, false);
|
|
1664
|
-
* });
|
|
1665
|
-
* })
|
|
1666
|
-
* .maxTicks(400)
|
|
1667
|
-
* .structureName("gametests:mediumglass");
|
|
1653
|
+
* test.assertEntityPresentInArea(victimId, true);
|
|
1668
1654
|
*
|
|
1655
|
+
* test.succeedWhen(() => {
|
|
1656
|
+
* test.assertEntityPresentInArea(victimId, false);
|
|
1657
|
+
* });
|
|
1658
|
+
* })
|
|
1659
|
+
* .maxTicks(400)
|
|
1660
|
+
* .structureName("gametests:mediumglass");
|
|
1669
1661
|
* ```
|
|
1670
1662
|
* @example spawnAdultPig.js
|
|
1671
1663
|
* ```typescript
|
|
1672
|
-
*
|
|
1673
|
-
*
|
|
1664
|
+
* test.spawn("minecraft:pig<minecraft:ageable_grow_up>", { x: 1, y: 2, z: 1 });
|
|
1674
1665
|
*
|
|
1675
1666
|
* ```
|
|
1676
1667
|
*/
|
|
@@ -1692,8 +1683,7 @@ export class Test {
|
|
|
1692
1683
|
* @throws This function can throw errors.
|
|
1693
1684
|
* @example spawnAdultPig.js
|
|
1694
1685
|
* ```typescript
|
|
1695
|
-
*
|
|
1696
|
-
*
|
|
1686
|
+
* test.spawn("minecraft:pig<minecraft:ageable_grow_up>", { x: 1.5, y: 2, z: 1.5 });
|
|
1697
1687
|
* ```
|
|
1698
1688
|
*/
|
|
1699
1689
|
spawnAtLocation(entityTypeIdentifier: string, location: minecraftserver.Vector3): minecraftserver.Entity;
|
|
@@ -1710,12 +1700,11 @@ export class Test {
|
|
|
1710
1700
|
* @throws This function can throw errors.
|
|
1711
1701
|
* @example spawnEmeralds.js
|
|
1712
1702
|
* ```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 });
|
|
1703
|
+
* const oneEmerald = new ItemStack(MinecraftItemTypes.emerald, 1, 0);
|
|
1704
|
+
* const fiveEmeralds = new ItemStack(MinecraftItemTypes.emerald, 5, 0);
|
|
1718
1705
|
*
|
|
1706
|
+
* test.spawnItem(oneEmerald, { x: 3.5, y: 3, z: 1.5 });
|
|
1707
|
+
* test.spawnItem(fiveEmeralds, { x: 1.5, y: 3, z: 1.5 });
|
|
1719
1708
|
*
|
|
1720
1709
|
* ```
|
|
1721
1710
|
*/
|
|
@@ -1783,8 +1772,7 @@ export class Test {
|
|
|
1783
1772
|
* @throws This function can throw errors.
|
|
1784
1773
|
* @example spreadFromFaceTowardDirection.js
|
|
1785
1774
|
* ```typescript
|
|
1786
|
-
*
|
|
1787
|
-
*
|
|
1775
|
+
* test.spreadFromFaceTowardDirection({ x: 1, y: 2, z: 1 }, Direction.south, Direction.down);
|
|
1788
1776
|
* ```
|
|
1789
1777
|
*/
|
|
1790
1778
|
spreadFromFaceTowardDirection(
|
|
@@ -1871,22 +1859,21 @@ export class Test {
|
|
|
1871
1859
|
* @throws This function can throw errors.
|
|
1872
1860
|
* @example simpleMobTest.ts
|
|
1873
1861
|
* ```typescript
|
|
1874
|
-
*
|
|
1875
|
-
*
|
|
1876
|
-
*
|
|
1862
|
+
* gt.register("StarterTests", "simpleMobTest", (test: gt.Test) => {
|
|
1863
|
+
* const attackerId = "fox";
|
|
1864
|
+
* const victimId = "chicken";
|
|
1877
1865
|
*
|
|
1878
|
-
*
|
|
1879
|
-
*
|
|
1866
|
+
* test.spawn(attackerId, { x: 5, y: 2, z: 5 });
|
|
1867
|
+
* test.spawn(victimId, { x: 2, y: 2, z: 2 });
|
|
1880
1868
|
*
|
|
1881
|
-
*
|
|
1882
|
-
*
|
|
1883
|
-
* test.succeedWhen(() => {
|
|
1884
|
-
* test.assertEntityPresentInArea(victimId, false);
|
|
1885
|
-
* });
|
|
1886
|
-
* })
|
|
1887
|
-
* .maxTicks(400)
|
|
1888
|
-
* .structureName("gametests:mediumglass");
|
|
1869
|
+
* test.assertEntityPresentInArea(victimId, true);
|
|
1889
1870
|
*
|
|
1871
|
+
* test.succeedWhen(() => {
|
|
1872
|
+
* test.assertEntityPresentInArea(victimId, false);
|
|
1873
|
+
* });
|
|
1874
|
+
* })
|
|
1875
|
+
* .maxTicks(400)
|
|
1876
|
+
* .structureName("gametests:mediumglass");
|
|
1890
1877
|
*
|
|
1891
1878
|
* ```
|
|
1892
1879
|
*/
|
|
@@ -2096,29 +2083,27 @@ export class GameTestError extends Error {
|
|
|
2096
2083
|
* builder methods.
|
|
2097
2084
|
* @example example1.js
|
|
2098
2085
|
* ```typescript
|
|
2099
|
-
*
|
|
2100
|
-
*
|
|
2101
|
-
*
|
|
2102
|
-
*
|
|
2086
|
+
* GameTest.register("ExampleTests", "alwaysFail", (test) => {
|
|
2087
|
+
* test.fail("This test, runnable via '/gametest run ExampleTests:alwaysFail', will always fail");
|
|
2088
|
+
* });
|
|
2103
2089
|
* ```
|
|
2104
2090
|
* @example simpleMobTest.ts
|
|
2105
2091
|
* ```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 });
|
|
2092
|
+
* gt.register("StarterTests", "simpleMobTest", (test: gt.Test) => {
|
|
2093
|
+
* const attackerId = "fox";
|
|
2094
|
+
* const victimId = "chicken";
|
|
2112
2095
|
*
|
|
2113
|
-
*
|
|
2096
|
+
* test.spawn(attackerId, { x: 5, y: 2, z: 5 });
|
|
2097
|
+
* test.spawn(victimId, { x: 2, y: 2, z: 2 });
|
|
2114
2098
|
*
|
|
2115
|
-
*
|
|
2116
|
-
* test.assertEntityPresentInArea(victimId, false);
|
|
2117
|
-
* });
|
|
2118
|
-
* })
|
|
2119
|
-
* .maxTicks(400)
|
|
2120
|
-
* .structureName("gametests:mediumglass");
|
|
2099
|
+
* test.assertEntityPresentInArea(victimId, true);
|
|
2121
2100
|
*
|
|
2101
|
+
* test.succeedWhen(() => {
|
|
2102
|
+
* test.assertEntityPresentInArea(victimId, false);
|
|
2103
|
+
* });
|
|
2104
|
+
* })
|
|
2105
|
+
* .maxTicks(400)
|
|
2106
|
+
* .structureName("gametests:mediumglass");
|
|
2122
2107
|
* ```
|
|
2123
2108
|
*/
|
|
2124
2109
|
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.
|
|
3
|
+
"version": "1.0.0-beta.1.20.10-preview.20",
|
|
4
4
|
"description": "",
|
|
5
5
|
"contributors": [
|
|
6
6
|
{
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
}
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@minecraft/server": "1.4.0-beta.1.20.
|
|
16
|
+
"@minecraft/server": "1.4.0-beta.1.20.10-preview.20"
|
|
17
17
|
},
|
|
18
18
|
"license": "MIT"
|
|
19
19
|
}
|