@minecraft/server-gametest 1.0.0-beta.1.19.60-preview.25 → 1.0.0-beta.1.19.60-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.
- package/index.d.ts +54 -45
- package/package.json +2 -2
- package/tests.ts +11 -11
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.19.60-
|
|
20
|
+
* "version": "1.0.0-internal.1.19.60-stable"
|
|
21
21
|
* }
|
|
22
22
|
* ```
|
|
23
23
|
*
|
|
@@ -947,7 +947,7 @@ export class SimulatedPlayer extends minecraftserver.Player {
|
|
|
947
947
|
* @param message
|
|
948
948
|
* @throws This function can throw errors.
|
|
949
949
|
*/
|
|
950
|
-
tell(message: minecraftserver.RawMessage | string): void;
|
|
950
|
+
tell(message: (minecraftserver.RawMessage | string)[] | minecraftserver.RawMessage | string): void;
|
|
951
951
|
/**
|
|
952
952
|
* @remarks
|
|
953
953
|
* Triggers an entity type event. For every entity, a number of
|
|
@@ -1284,21 +1284,23 @@ export class Test {
|
|
|
1284
1284
|
* @throws This function can throw errors.
|
|
1285
1285
|
* @example simpleMobTest.ts
|
|
1286
1286
|
* ```typescript
|
|
1287
|
-
*
|
|
1288
|
-
*
|
|
1289
|
-
*
|
|
1287
|
+
* gt.register("StarterTests", "simpleMobTest", (test: gt.Test) => {
|
|
1288
|
+
* const attackerId = "fox";
|
|
1289
|
+
* const victimId = "chicken";
|
|
1290
1290
|
*
|
|
1291
|
-
*
|
|
1292
|
-
*
|
|
1291
|
+
* test.spawn(attackerId, { x: 5, y: 2, z: 5 });
|
|
1292
|
+
* test.spawn(victimId, { x: 2, y: 2, z: 2 });
|
|
1293
|
+
*
|
|
1294
|
+
* test.assertEntityPresentInArea(victimId, true);
|
|
1295
|
+
*
|
|
1296
|
+
* test.succeedWhen(() => {
|
|
1297
|
+
* test.assertEntityPresentInArea(victimId, false);
|
|
1298
|
+
* });
|
|
1299
|
+
* })
|
|
1300
|
+
* .maxTicks(400)
|
|
1301
|
+
* .structureName("gametests:mediumglass");
|
|
1293
1302
|
*
|
|
1294
|
-
* test.assertEntityPresentInArea(victimId, true);
|
|
1295
1303
|
*
|
|
1296
|
-
* test.succeedWhen(() => {
|
|
1297
|
-
* test.assertEntityPresentInArea(victimId, false);
|
|
1298
|
-
* });
|
|
1299
|
-
* })
|
|
1300
|
-
* .maxTicks(400)
|
|
1301
|
-
* .structureName("gametests:mediumglass");
|
|
1302
1304
|
* ```
|
|
1303
1305
|
*/
|
|
1304
1306
|
assertEntityPresentInArea(entityTypeIdentifier: string, isPresent?: boolean): void;
|
|
@@ -1692,25 +1694,27 @@ export class Test {
|
|
|
1692
1694
|
* @throws This function can throw errors.
|
|
1693
1695
|
* @example simpleMobTest.ts
|
|
1694
1696
|
* ```typescript
|
|
1695
|
-
*
|
|
1696
|
-
*
|
|
1697
|
-
*
|
|
1697
|
+
* gt.register("StarterTests", "simpleMobTest", (test: gt.Test) => {
|
|
1698
|
+
* const attackerId = "fox";
|
|
1699
|
+
* const victimId = "chicken";
|
|
1698
1700
|
*
|
|
1699
|
-
*
|
|
1700
|
-
*
|
|
1701
|
+
* test.spawn(attackerId, { x: 5, y: 2, z: 5 });
|
|
1702
|
+
* test.spawn(victimId, { x: 2, y: 2, z: 2 });
|
|
1701
1703
|
*
|
|
1702
|
-
*
|
|
1704
|
+
* test.assertEntityPresentInArea(victimId, true);
|
|
1705
|
+
*
|
|
1706
|
+
* test.succeedWhen(() => {
|
|
1707
|
+
* test.assertEntityPresentInArea(victimId, false);
|
|
1708
|
+
* });
|
|
1709
|
+
* })
|
|
1710
|
+
* .maxTicks(400)
|
|
1711
|
+
* .structureName("gametests:mediumglass");
|
|
1703
1712
|
*
|
|
1704
|
-
* test.succeedWhen(() => {
|
|
1705
|
-
* test.assertEntityPresentInArea(victimId, false);
|
|
1706
|
-
* });
|
|
1707
|
-
* })
|
|
1708
|
-
* .maxTicks(400)
|
|
1709
|
-
* .structureName("gametests:mediumglass");
|
|
1710
1713
|
* ```
|
|
1711
1714
|
* @example spawnAdultPig.js
|
|
1712
1715
|
* ```typescript
|
|
1713
|
-
* test.spawn("minecraft:pig<minecraft:ageable_grow_up>",
|
|
1716
|
+
* test.spawn("minecraft:pig<minecraft:ageable_grow_up>", { x: 1, y: 2, z: 1 });
|
|
1717
|
+
*
|
|
1714
1718
|
*
|
|
1715
1719
|
* ```
|
|
1716
1720
|
*/
|
|
@@ -1730,7 +1734,8 @@ export class Test {
|
|
|
1730
1734
|
* @throws This function can throw errors.
|
|
1731
1735
|
* @example spawnAdultPig.js
|
|
1732
1736
|
* ```typescript
|
|
1733
|
-
* test.spawn("minecraft:pig<minecraft:ageable_grow_up>",
|
|
1737
|
+
* test.spawn("minecraft:pig<minecraft:ageable_grow_up>", { x: 1.5, y: 2, z: 1.5 });
|
|
1738
|
+
*
|
|
1734
1739
|
* ```
|
|
1735
1740
|
*/
|
|
1736
1741
|
spawnAtLocation(entityTypeIdentifier: string, location: minecraftserver.Location): minecraftserver.Entity;
|
|
@@ -1747,8 +1752,9 @@ export class Test {
|
|
|
1747
1752
|
* const oneEmerald = new ItemStack(MinecraftItemTypes.emerald, 1, 0);
|
|
1748
1753
|
* const fiveEmeralds = new ItemStack(MinecraftItemTypes.emerald, 5, 0);
|
|
1749
1754
|
*
|
|
1750
|
-
* test.spawnItem(oneEmerald,
|
|
1751
|
-
* test.spawnItem(fiveEmeralds,
|
|
1755
|
+
* test.spawnItem(oneEmerald, { x: 3.5, y: 3, z: 1.5 });
|
|
1756
|
+
* test.spawnItem(fiveEmeralds, { x: 1.5, y: 3, z: 1.5 });
|
|
1757
|
+
*
|
|
1752
1758
|
*
|
|
1753
1759
|
* ```
|
|
1754
1760
|
*/
|
|
@@ -1810,7 +1816,8 @@ export class Test {
|
|
|
1810
1816
|
* @throws This function can throw errors.
|
|
1811
1817
|
* @example spreadFromFaceTowardDirection.js
|
|
1812
1818
|
* ```typescript
|
|
1813
|
-
* test.spreadFromFaceTowardDirection(
|
|
1819
|
+
* test.spreadFromFaceTowardDirection({ x: 1, y: 2, z: 1 }, Direction.south, Direction.down);
|
|
1820
|
+
*
|
|
1814
1821
|
* ```
|
|
1815
1822
|
*/
|
|
1816
1823
|
spreadFromFaceTowardDirection(
|
|
@@ -1883,8 +1890,8 @@ export class Test {
|
|
|
1883
1890
|
* const attackerId = "fox";
|
|
1884
1891
|
* const victimId = "chicken";
|
|
1885
1892
|
*
|
|
1886
|
-
* test.spawn(attackerId,
|
|
1887
|
-
* test.spawn(victimId,
|
|
1893
|
+
* test.spawn(attackerId, { x: 5, y: 2, z: 5 });
|
|
1894
|
+
* test.spawn(victimId, { x: 2, y: 2, z: 2 });
|
|
1888
1895
|
*
|
|
1889
1896
|
* test.assertEntityPresentInArea(victimId, true);
|
|
1890
1897
|
*
|
|
@@ -1895,6 +1902,7 @@ export class Test {
|
|
|
1895
1902
|
* .maxTicks(400)
|
|
1896
1903
|
* .structureName("gametests:mediumglass");
|
|
1897
1904
|
*
|
|
1905
|
+
*
|
|
1898
1906
|
* ```
|
|
1899
1907
|
*/
|
|
1900
1908
|
succeedWhen(callback: () => void): void;
|
|
@@ -2076,21 +2084,22 @@ export class Test {
|
|
|
2076
2084
|
* ```
|
|
2077
2085
|
* @example simpleMobTest.ts
|
|
2078
2086
|
* ```typescript
|
|
2079
|
-
*
|
|
2080
|
-
*
|
|
2081
|
-
*
|
|
2087
|
+
* gt.register("StarterTests", "simpleMobTest", (test: gt.Test) => {
|
|
2088
|
+
* const attackerId = "fox";
|
|
2089
|
+
* const victimId = "chicken";
|
|
2090
|
+
*
|
|
2091
|
+
* test.spawn(attackerId, { x: 5, y: 2, z: 5 });
|
|
2092
|
+
* test.spawn(victimId, { x: 2, y: 2, z: 2 });
|
|
2082
2093
|
*
|
|
2083
|
-
*
|
|
2084
|
-
* test.spawn(victimId, new mc.BlockLocation(2, 2, 2));
|
|
2094
|
+
* test.assertEntityPresentInArea(victimId, true);
|
|
2085
2095
|
*
|
|
2086
|
-
*
|
|
2096
|
+
* test.succeedWhen(() => {
|
|
2097
|
+
* test.assertEntityPresentInArea(victimId, false);
|
|
2098
|
+
* });
|
|
2099
|
+
* })
|
|
2100
|
+
* .maxTicks(400)
|
|
2101
|
+
* .structureName("gametests:mediumglass");
|
|
2087
2102
|
*
|
|
2088
|
-
* test.succeedWhen(() => {
|
|
2089
|
-
* test.assertEntityPresentInArea(victimId, false);
|
|
2090
|
-
* });
|
|
2091
|
-
* })
|
|
2092
|
-
* .maxTicks(400)
|
|
2093
|
-
* .structureName("gametests:mediumglass");
|
|
2094
2103
|
* ```
|
|
2095
2104
|
*/
|
|
2096
2105
|
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.19.60-
|
|
3
|
+
"version": "1.0.0-beta.1.19.60-stable",
|
|
4
4
|
"description": "",
|
|
5
5
|
"contributors": [
|
|
6
6
|
{
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
}
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@minecraft/server": "1.1.0-beta.1.19.60-
|
|
16
|
+
"@minecraft/server": "1.1.0-beta.1.19.60-stable"
|
|
17
17
|
},
|
|
18
18
|
"license": "MIT"
|
|
19
19
|
}
|
package/tests.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
2
|
import * as mc from '@minecraft/server';
|
|
3
3
|
|
|
4
|
-
export function simpleMobTest(log: (message: string, status?: number) => void, targetLocation: mc.
|
|
4
|
+
export function simpleMobTest(log: (message: string, status?: number) => void, targetLocation: mc.Vector3) {
|
|
5
5
|
gt.register('StarterTests', 'simpleMobTest', (test: gt.Test) => {
|
|
6
6
|
const attackerId = 'fox';
|
|
7
7
|
const victimId = 'chicken';
|
|
8
8
|
|
|
9
|
-
test.spawn(attackerId,
|
|
10
|
-
test.spawn(victimId,
|
|
9
|
+
test.spawn(attackerId, { x: 5, y: 2, z: 5 });
|
|
10
|
+
test.spawn(victimId, { x: 2, y: 2, z: 2 });
|
|
11
11
|
|
|
12
12
|
test.assertEntityPresentInArea(victimId, true);
|
|
13
13
|
|
|
@@ -23,13 +23,13 @@ export default class SampleManager {
|
|
|
23
23
|
tickCount = 0;
|
|
24
24
|
|
|
25
25
|
_availableFuncs: {
|
|
26
|
-
[name: string]: Array<(log: (message: string, status?: number) => void, location: mc.
|
|
26
|
+
[name: string]: Array<(log: (message: string, status?: number) => void, location: mc.Vector3) => void>;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
pendingFuncs: Array<{
|
|
30
30
|
name: string;
|
|
31
|
-
func: (log: (message: string, status?: number) => void, location: mc.
|
|
32
|
-
location: mc.
|
|
31
|
+
func: (log: (message: string, status?: number) => void, location: mc.Vector3) => void;
|
|
32
|
+
location: mc.Vector3;
|
|
33
33
|
}> = [];
|
|
34
34
|
|
|
35
35
|
gameplayLogger(message: string, status?: number) {
|
|
@@ -56,7 +56,7 @@ export default class SampleManager {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
const nearbyBlockLoc = nearbyBlock.location;
|
|
59
|
-
const nearbyLoc =
|
|
59
|
+
const nearbyLoc: mc.Vector3 = { x: nearbyBlockLoc.x, y: nearbyBlockLoc.y + 1, z: nearbyBlockLoc.z };
|
|
60
60
|
|
|
61
61
|
const sampleId = message.substring(5).trim();
|
|
62
62
|
|
|
@@ -86,8 +86,8 @@ export default class SampleManager {
|
|
|
86
86
|
|
|
87
87
|
runSample(
|
|
88
88
|
sampleId: string,
|
|
89
|
-
snippetFunctions: Array<(log: (message: string, status?: number) => void, location: mc.
|
|
90
|
-
targetLocation: mc.
|
|
89
|
+
snippetFunctions: Array<(log: (message: string, status?: number) => void, location: mc.Vector3) => void>,
|
|
90
|
+
targetLocation: mc.Vector3,
|
|
91
91
|
) {
|
|
92
92
|
for (let i = snippetFunctions.length - 1; i >= 0; i--) {
|
|
93
93
|
this.pendingFuncs.push({ name: sampleId, func: snippetFunctions[i], location: targetLocation });
|
|
@@ -118,7 +118,7 @@ export default class SampleManager {
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
registerSamples(sampleSet: {
|
|
121
|
-
[name: string]: Array<(log: (message: string, status?: number) => void, location: mc.
|
|
121
|
+
[name: string]: Array<(log: (message: string, status?: number) => void, location: mc.Vector3) => void>;
|
|
122
122
|
}) {
|
|
123
123
|
for (const sampleKey in sampleSet) {
|
|
124
124
|
if (sampleKey.length > 1 && sampleSet[sampleKey]) {
|
|
@@ -131,7 +131,7 @@ export default class SampleManager {
|
|
|
131
131
|
import * as gt from '@minecraft/server-gametest'; // keep in for gametest samples
|
|
132
132
|
|
|
133
133
|
const mojangGameTestFuncs: {
|
|
134
|
-
[name: string]: Array<(log: (message: string, status?: number) => void, location: mc.
|
|
134
|
+
[name: string]: Array<(log: (message: string, status?: number) => void, location: mc.Vector3) => void>;
|
|
135
135
|
} = {
|
|
136
136
|
simpleMobTest: [simpleMobTest],
|
|
137
137
|
};
|