@minecraft/server-gametest 1.0.0-beta.1.20.0-preview.24 → 1.0.0-beta.1.20.0-stable

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 +92 -147
  2. 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.24"
20
+ * "version": "1.0.0-internal.1.20.0-stable"
21
21
  * }
22
22
  * ```
23
23
  *
@@ -41,7 +41,7 @@ export enum GameTestErrorType {
41
41
  * other fences in several directions.
42
42
  */
43
43
  export class FenceConnectivity {
44
- protected constructor();
44
+ private constructor();
45
45
  /**
46
46
  * @remarks
47
47
  * Represents whether this fence block is connected to another
@@ -78,7 +78,7 @@ export class FenceConnectivity {
78
78
  * GameTest setup methods and assertions over time.
79
79
  */
80
80
  export class GameTestSequence {
81
- protected constructor();
81
+ private constructor();
82
82
  /**
83
83
  * @remarks
84
84
  * Runs the given callback as a step within a GameTest
@@ -201,7 +201,7 @@ export class GameTestSequence {
201
201
  * Methods can be chained together to set multiple properties.
202
202
  */
203
203
  export class RegistrationBuilder {
204
- protected constructor();
204
+ private constructor();
205
205
  /**
206
206
  * @remarks
207
207
  * Sets the batch for the test to run in.
@@ -335,7 +335,7 @@ export class RegistrationBuilder {
335
335
  * growth of sculk around a particular block.
336
336
  */
337
337
  export class SculkSpreader {
338
- protected constructor();
338
+ private constructor();
339
339
  /**
340
340
  * @remarks
341
341
  * Gets the maximum charge of a sculk spreader.
@@ -388,8 +388,9 @@ export class SculkSpreader {
388
388
  * player. This type derives much of its structure and methods
389
389
  * from the {@link @minecraft/server.Player} type.
390
390
  */
391
+ // @ts-ignore Class inheritance allowed for native defined classes
391
392
  export class SimulatedPlayer extends minecraftserver.Player {
392
- protected constructor();
393
+ private constructor();
393
394
  /**
394
395
  * @remarks
395
396
  * Rotation of the head across pitch and yaw angles.
@@ -454,13 +455,6 @@ export class SimulatedPlayer extends minecraftserver.Player {
454
455
  * @throws This function can throw errors.
455
456
  */
456
457
  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
458
  /**
465
459
  * @remarks
466
460
  * Gives the simulated player a particular item stack.
@@ -474,13 +468,6 @@ export class SimulatedPlayer extends minecraftserver.Player {
474
468
  * @throws This function can throw errors.
475
469
  */
476
470
  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
471
  /**
485
472
  * @remarks
486
473
  * Performs a raycast from the player’s head and interacts with
@@ -722,20 +709,6 @@ export class SimulatedPlayer extends minecraftserver.Player {
722
709
  * @throws This function can throw errors.
723
710
  */
724
711
  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
712
  /**
740
713
  * @remarks
741
714
  * Stops interacting with entities or blocks.
@@ -755,13 +728,6 @@ export class SimulatedPlayer extends minecraftserver.Player {
755
728
  * @throws This function can throw errors.
756
729
  */
757
730
  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
731
  /**
766
732
  * @remarks
767
733
  * Stops using the currently active item.
@@ -771,13 +737,6 @@ export class SimulatedPlayer extends minecraftserver.Player {
771
737
  * @throws This function can throw errors.
772
738
  */
773
739
  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
740
  /**
782
741
  * @remarks
783
742
  * Causes the simulated player to use an item. Does not consume
@@ -859,7 +818,7 @@ export class SimulatedPlayer extends minecraftserver.Player {
859
818
  * tests into suites to run.
860
819
  */
861
820
  export class Tags {
862
- protected constructor();
821
+ private constructor();
863
822
  /**
864
823
  * @remarks
865
824
  * Indicates that the tagged test should be a part of all
@@ -897,7 +856,7 @@ export class Tags {
897
856
  * the GameTest structure block.
898
857
  */
899
858
  export class Test {
900
- protected constructor();
859
+ private constructor();
901
860
  /**
902
861
  * @remarks
903
862
  * Tests that the condition specified in _condition_ is true.
@@ -945,10 +904,9 @@ export class Test {
945
904
  * @throws This function can throw errors.
946
905
  * @example testIfButtonNotPressed.js
947
906
  * ```typescript
948
- * test.assertBlockState(buttonPos, (block) => {
949
- * return block.permutation.getProperty("button_pressed_bit") == 0;
950
- * });
951
- *
907
+ * test.assertBlockState(buttonPos, (block) => {
908
+ * return block.permutation.getProperty("button_pressed_bit") == 0;
909
+ * });
952
910
  * ```
953
911
  */
954
912
  assertBlockState(blockLocation: minecraftserver.Vector3, callback: (arg: minecraftserver.Block) => boolean): void;
@@ -1023,8 +981,7 @@ export class Test {
1023
981
  * @throws This function can throw errors.
1024
982
  * @example horseArmorTest.js
1025
983
  * ```typescript
1026
- * test.assertEntityHasArmor("minecraft:horse", armorSlotTorso, "diamond_horse_armor", 0, horseLocation, true);
1027
- *
984
+ * test.assertEntityHasArmor("minecraft:horse", armorSlotTorso, "diamond_horse_armor", 0, horseLocation, true);
1028
985
  * ```
1029
986
  */
1030
987
  assertEntityHasArmor(
@@ -1056,8 +1013,7 @@ export class Test {
1056
1013
  * @throws This function can throw errors.
1057
1014
  * @example sheepShearedTest.js
1058
1015
  * ```typescript
1059
- * test.assertEntityHasComponent("minecraft:sheep", "minecraft:is_sheared", entityLoc, false);
1060
- *
1016
+ * test.assertEntityHasComponent("minecraft:sheep", "minecraft:is_sheared", entityLoc, false);
1061
1017
  * ```
1062
1018
  */
1063
1019
  assertEntityHasComponent(
@@ -1101,22 +1057,21 @@ export class Test {
1101
1057
  * @throws This function can throw errors.
1102
1058
  * @example simpleMobTest.ts
1103
1059
  * ```typescript
1104
- * gt.register("StarterTests", "simpleMobTest", (test: gt.Test) => {
1105
- * const attackerId = "fox";
1106
- * const victimId = "chicken";
1060
+ * gt.register("StarterTests", "simpleMobTest", (test: gt.Test) => {
1061
+ * const attackerId = "fox";
1062
+ * const victimId = "chicken";
1107
1063
  *
1108
- * test.spawn(attackerId, { x: 5, y: 2, z: 5 });
1109
- * let victim = test.spawn(victimId, { x: 2, y: 2, z: 2 });
1064
+ * test.spawn(attackerId, { x: 5, y: 2, z: 5 });
1065
+ * let victim = test.spawn(victimId, { x: 2, y: 2, z: 2 });
1110
1066
  *
1111
- * test.assertEntityInstancePresentInArea(victim, true);
1112
- *
1113
- * test.succeedWhen(() => {
1114
- * test.assertEntityInstancePresentInArea(victim, false);
1115
- * });
1116
- * })
1117
- * .maxTicks(400)
1118
- * .structureName("gametests:mediumglass");
1067
+ * test.assertEntityInstancePresentInArea(victim, true);
1119
1068
  *
1069
+ * test.succeedWhen(() => {
1070
+ * test.assertEntityInstancePresentInArea(victim, false);
1071
+ * });
1072
+ * })
1073
+ * .maxTicks(400)
1074
+ * .structureName("gametests:mediumglass");
1120
1075
  *
1121
1076
  * ```
1122
1077
  */
@@ -1165,22 +1120,21 @@ export class Test {
1165
1120
  * @throws This function can throw errors.
1166
1121
  * @example simpleMobTest.ts
1167
1122
  * ```typescript
1168
- * gt.register("StarterTests", "simpleMobTest", (test: gt.Test) => {
1169
- * const attackerId = "fox";
1170
- * const victimId = "chicken";
1171
- *
1172
- * test.spawn(attackerId, { x: 5, y: 2, z: 5 });
1173
- * test.spawn(victimId, { x: 2, y: 2, z: 2 });
1123
+ * gt.register("StarterTests", "simpleMobTest", (test: gt.Test) => {
1124
+ * const attackerId = "fox";
1125
+ * const victimId = "chicken";
1174
1126
  *
1175
- * test.assertEntityPresentInArea(victimId, true);
1127
+ * test.spawn(attackerId, { x: 5, y: 2, z: 5 });
1128
+ * test.spawn(victimId, { x: 2, y: 2, z: 2 });
1176
1129
  *
1177
- * test.succeedWhen(() => {
1178
- * test.assertEntityPresentInArea(victimId, false);
1179
- * });
1180
- * })
1181
- * .maxTicks(400)
1182
- * .structureName("gametests:mediumglass");
1130
+ * test.assertEntityPresentInArea(victimId, true);
1183
1131
  *
1132
+ * test.succeedWhen(() => {
1133
+ * test.assertEntityPresentInArea(victimId, false);
1134
+ * });
1135
+ * })
1136
+ * .maxTicks(400)
1137
+ * .structureName("gametests:mediumglass");
1184
1138
  *
1185
1139
  * ```
1186
1140
  */
@@ -1205,12 +1159,11 @@ export class Test {
1205
1159
  * @throws This function can throw errors.
1206
1160
  * @example villagerEffectTest.js
1207
1161
  * ```typescript
1208
- * test.assertEntityState(
1209
- * villagerPos,
1210
- * "minecraft:villager_v2",
1211
- * (entity) => entity.getEffect(MinecraftEffectTypes.regeneration).duration > 120
1212
- * ); // At least 6 seconds remaining in the villagers' effect
1213
- *
1162
+ * test.assertEntityState(
1163
+ * villagerPos,
1164
+ * "minecraft:villager_v2",
1165
+ * (entity) => entity.getEffect(MinecraftEffectTypes.Regeneration).duration > 120
1166
+ * ); // At least 6 seconds remaining in the villagers' effect
1214
1167
  * ```
1215
1168
  */
1216
1169
  assertEntityState(
@@ -1269,8 +1222,7 @@ export class Test {
1269
1222
  * @throws This function can throw errors.
1270
1223
  * @example findFeathers.js
1271
1224
  * ```typescript
1272
- * test.assertItemEntityCountIs(Items.feather, expectedFeatherLoc, 0, 1);
1273
- *
1225
+ * test.assertItemEntityCountIs(Items.feather, expectedFeatherLoc, 0, 1);
1274
1226
  * ```
1275
1227
  */
1276
1228
  assertItemEntityCountIs(
@@ -1650,27 +1602,25 @@ export class Test {
1650
1602
  * @throws This function can throw errors.
1651
1603
  * @example simpleMobTest.ts
1652
1604
  * ```typescript
1653
- * gt.register("StarterTests", "simpleMobTest", (test: gt.Test) => {
1654
- * const attackerId = "fox";
1655
- * const victimId = "chicken";
1656
- *
1657
- * test.spawn(attackerId, { x: 5, y: 2, z: 5 });
1658
- * test.spawn(victimId, { x: 2, y: 2, z: 2 });
1605
+ * gt.register("StarterTests", "simpleMobTest", (test: gt.Test) => {
1606
+ * const attackerId = "fox";
1607
+ * const victimId = "chicken";
1659
1608
  *
1660
- * test.assertEntityPresentInArea(victimId, true);
1609
+ * test.spawn(attackerId, { x: 5, y: 2, z: 5 });
1610
+ * test.spawn(victimId, { x: 2, y: 2, z: 2 });
1661
1611
  *
1662
- * test.succeedWhen(() => {
1663
- * test.assertEntityPresentInArea(victimId, false);
1664
- * });
1665
- * })
1666
- * .maxTicks(400)
1667
- * .structureName("gametests:mediumglass");
1612
+ * test.assertEntityPresentInArea(victimId, true);
1668
1613
  *
1614
+ * test.succeedWhen(() => {
1615
+ * test.assertEntityPresentInArea(victimId, false);
1616
+ * });
1617
+ * })
1618
+ * .maxTicks(400)
1619
+ * .structureName("gametests:mediumglass");
1669
1620
  * ```
1670
1621
  * @example spawnAdultPig.js
1671
1622
  * ```typescript
1672
- * test.spawn("minecraft:pig<minecraft:ageable_grow_up>", { x: 1, y: 2, z: 1 });
1673
- *
1623
+ * test.spawn("minecraft:pig<minecraft:ageable_grow_up>", { x: 1, y: 2, z: 1 });
1674
1624
  *
1675
1625
  * ```
1676
1626
  */
@@ -1692,8 +1642,7 @@ export class Test {
1692
1642
  * @throws This function can throw errors.
1693
1643
  * @example spawnAdultPig.js
1694
1644
  * ```typescript
1695
- * test.spawn("minecraft:pig<minecraft:ageable_grow_up>", { x: 1.5, y: 2, z: 1.5 });
1696
- *
1645
+ * test.spawn("minecraft:pig<minecraft:ageable_grow_up>", { x: 1.5, y: 2, z: 1.5 });
1697
1646
  * ```
1698
1647
  */
1699
1648
  spawnAtLocation(entityTypeIdentifier: string, location: minecraftserver.Vector3): minecraftserver.Entity;
@@ -1710,12 +1659,11 @@ export class Test {
1710
1659
  * @throws This function can throw errors.
1711
1660
  * @example spawnEmeralds.js
1712
1661
  * ```typescript
1713
- * const oneEmerald = new ItemStack(MinecraftItemTypes.emerald, 1, 0);
1714
- * const fiveEmeralds = new ItemStack(MinecraftItemTypes.emerald, 5, 0);
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 });
1662
+ * const oneEmerald = new ItemStack(MinecraftItemTypes.emerald, 1, 0);
1663
+ * const fiveEmeralds = new ItemStack(MinecraftItemTypes.emerald, 5, 0);
1718
1664
  *
1665
+ * test.spawnItem(oneEmerald, { x: 3.5, y: 3, z: 1.5 });
1666
+ * test.spawnItem(fiveEmeralds, { x: 1.5, y: 3, z: 1.5 });
1719
1667
  *
1720
1668
  * ```
1721
1669
  */
@@ -1783,8 +1731,7 @@ export class Test {
1783
1731
  * @throws This function can throw errors.
1784
1732
  * @example spreadFromFaceTowardDirection.js
1785
1733
  * ```typescript
1786
- * test.spreadFromFaceTowardDirection({ x: 1, y: 2, z: 1 }, Direction.south, Direction.down);
1787
- *
1734
+ * test.spreadFromFaceTowardDirection({ x: 1, y: 2, z: 1 }, Direction.south, Direction.down);
1788
1735
  * ```
1789
1736
  */
1790
1737
  spreadFromFaceTowardDirection(
@@ -1871,22 +1818,21 @@ export class Test {
1871
1818
  * @throws This function can throw errors.
1872
1819
  * @example simpleMobTest.ts
1873
1820
  * ```typescript
1874
- * gt.register("StarterTests", "simpleMobTest", (test: gt.Test) => {
1875
- * const attackerId = "fox";
1876
- * const victimId = "chicken";
1821
+ * gt.register("StarterTests", "simpleMobTest", (test: gt.Test) => {
1822
+ * const attackerId = "fox";
1823
+ * const victimId = "chicken";
1877
1824
  *
1878
- * test.spawn(attackerId, { x: 5, y: 2, z: 5 });
1879
- * test.spawn(victimId, { x: 2, y: 2, z: 2 });
1825
+ * test.spawn(attackerId, { x: 5, y: 2, z: 5 });
1826
+ * test.spawn(victimId, { x: 2, y: 2, z: 2 });
1880
1827
  *
1881
- * test.assertEntityPresentInArea(victimId, true);
1882
- *
1883
- * test.succeedWhen(() => {
1884
- * test.assertEntityPresentInArea(victimId, false);
1885
- * });
1886
- * })
1887
- * .maxTicks(400)
1888
- * .structureName("gametests:mediumglass");
1828
+ * test.assertEntityPresentInArea(victimId, true);
1889
1829
  *
1830
+ * test.succeedWhen(() => {
1831
+ * test.assertEntityPresentInArea(victimId, false);
1832
+ * });
1833
+ * })
1834
+ * .maxTicks(400)
1835
+ * .structureName("gametests:mediumglass");
1890
1836
  *
1891
1837
  * ```
1892
1838
  */
@@ -2069,8 +2015,9 @@ export interface GameTestErrorContext {
2069
2015
  tickCount: number;
2070
2016
  }
2071
2017
 
2018
+ // @ts-ignore Class inheritance allowed for native defined classes
2072
2019
  export class GameTestError extends Error {
2073
- protected constructor();
2020
+ private constructor();
2074
2021
  context?: GameTestErrorContext;
2075
2022
  messageParameters: string[];
2076
2023
  type: GameTestErrorType;
@@ -2096,29 +2043,27 @@ export class GameTestError extends Error {
2096
2043
  * builder methods.
2097
2044
  * @example example1.js
2098
2045
  * ```typescript
2099
- * GameTest.register("ExampleTests", "alwaysFail", (test) => {
2100
- * test.fail("This test, runnable via '/gametest run ExampleTests:alwaysFail', will always fail");
2101
- * });
2102
- *
2046
+ * GameTest.register("ExampleTests", "alwaysFail", (test) => {
2047
+ * test.fail("This test, runnable via '/gametest run ExampleTests:alwaysFail', will always fail");
2048
+ * });
2103
2049
  * ```
2104
2050
  * @example simpleMobTest.ts
2105
2051
  * ```typescript
2106
- * gt.register("StarterTests", "simpleMobTest", (test: gt.Test) => {
2107
- * const attackerId = "fox";
2108
- * const victimId = "chicken";
2109
- *
2110
- * test.spawn(attackerId, { x: 5, y: 2, z: 5 });
2111
- * test.spawn(victimId, { x: 2, y: 2, z: 2 });
2052
+ * gt.register("StarterTests", "simpleMobTest", (test: gt.Test) => {
2053
+ * const attackerId = "fox";
2054
+ * const victimId = "chicken";
2112
2055
  *
2113
- * test.assertEntityPresentInArea(victimId, true);
2056
+ * test.spawn(attackerId, { x: 5, y: 2, z: 5 });
2057
+ * test.spawn(victimId, { x: 2, y: 2, z: 2 });
2114
2058
  *
2115
- * test.succeedWhen(() => {
2116
- * test.assertEntityPresentInArea(victimId, false);
2117
- * });
2118
- * })
2119
- * .maxTicks(400)
2120
- * .structureName("gametests:mediumglass");
2059
+ * test.assertEntityPresentInArea(victimId, true);
2121
2060
  *
2061
+ * test.succeedWhen(() => {
2062
+ * test.assertEntityPresentInArea(victimId, false);
2063
+ * });
2064
+ * })
2065
+ * .maxTicks(400)
2066
+ * .structureName("gametests:mediumglass");
2122
2067
  * ```
2123
2068
  */
2124
2069
  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.24",
3
+ "version": "1.0.0-beta.1.20.0-stable",
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.0-preview.24"
16
+ "@minecraft/server": "1.3.0-beta.1.20.0-stable"
17
17
  },
18
18
  "license": "MIT"
19
19
  }