@kzheart_/mc-pilot 0.1.2 → 0.1.4

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.
@@ -9,7 +9,7 @@
9
9
  "loader": "fabric",
10
10
  "support": "ready",
11
11
  "validation": "verified",
12
- "modVersion": "0.1.0",
12
+ "modVersion": "0.1.1",
13
13
  "fabricLoaderVersion": "0.16.10",
14
14
  "yarnMappings": "1.18.2+build.4",
15
15
  "javaVersion": 17,
@@ -21,7 +21,7 @@
21
21
  "loader": "fabric",
22
22
  "support": "ready",
23
23
  "validation": "verified",
24
- "modVersion": "0.1.0",
24
+ "modVersion": "0.1.1",
25
25
  "fabricLoaderVersion": "0.16.10",
26
26
  "yarnMappings": "1.20.1+build.10",
27
27
  "javaVersion": 17,
@@ -33,7 +33,7 @@
33
33
  "loader": "forge",
34
34
  "support": "planned",
35
35
  "validation": "planned",
36
- "modVersion": "0.1.0",
36
+ "modVersion": "0.1.1",
37
37
  "forgeVersion": "47.3.0",
38
38
  "javaVersion": 17
39
39
  },
@@ -43,7 +43,7 @@
43
43
  "loader": "fabric",
44
44
  "support": "ready",
45
45
  "validation": "verified",
46
- "modVersion": "0.1.0",
46
+ "modVersion": "0.1.1",
47
47
  "fabricLoaderVersion": "0.16.10",
48
48
  "yarnMappings": "1.20.2+build.4",
49
49
  "javaVersion": 17,
@@ -55,7 +55,7 @@
55
55
  "loader": "forge",
56
56
  "support": "planned",
57
57
  "validation": "planned",
58
- "modVersion": "0.1.0",
58
+ "modVersion": "0.1.1",
59
59
  "forgeVersion": "48.1.0",
60
60
  "javaVersion": 17
61
61
  },
@@ -65,7 +65,7 @@
65
65
  "loader": "fabric",
66
66
  "support": "ready",
67
67
  "validation": "verified",
68
- "modVersion": "0.1.0",
68
+ "modVersion": "0.1.1",
69
69
  "fabricLoaderVersion": "0.16.10",
70
70
  "yarnMappings": "1.20.4+build.3",
71
71
  "javaVersion": 17,
@@ -77,7 +77,7 @@
77
77
  "loader": "forge",
78
78
  "support": "planned",
79
79
  "validation": "planned",
80
- "modVersion": "0.1.0",
80
+ "modVersion": "0.1.1",
81
81
  "forgeVersion": "49.0.49",
82
82
  "javaVersion": 17
83
83
  },
@@ -87,7 +87,7 @@
87
87
  "loader": "neoforge",
88
88
  "support": "planned",
89
89
  "validation": "planned",
90
- "modVersion": "0.1.0",
90
+ "modVersion": "0.1.1",
91
91
  "neoforgeVersion": "20.4.237",
92
92
  "javaVersion": 17
93
93
  },
@@ -97,7 +97,7 @@
97
97
  "loader": "fabric",
98
98
  "support": "ready",
99
99
  "validation": "verified",
100
- "modVersion": "0.1.0",
100
+ "modVersion": "0.1.1",
101
101
  "fabricLoaderVersion": "0.16.10",
102
102
  "yarnMappings": "1.21.1+build.3",
103
103
  "javaVersion": 21,
@@ -109,7 +109,7 @@
109
109
  "loader": "neoforge",
110
110
  "support": "planned",
111
111
  "validation": "planned",
112
- "modVersion": "0.1.0",
112
+ "modVersion": "0.1.1",
113
113
  "neoforgeVersion": "21.1.77",
114
114
  "javaVersion": 21
115
115
  },
@@ -119,7 +119,7 @@
119
119
  "loader": "fabric",
120
120
  "support": "ready",
121
121
  "validation": "verified",
122
- "modVersion": "0.1.0",
122
+ "modVersion": "0.1.1",
123
123
  "fabricLoaderVersion": "0.16.10",
124
124
  "yarnMappings": "1.21.4+build.1",
125
125
  "javaVersion": 21,
@@ -131,7 +131,7 @@
131
131
  "loader": "neoforge",
132
132
  "support": "planned",
133
133
  "validation": "planned",
134
- "modVersion": "0.1.0",
134
+ "modVersion": "0.1.1",
135
135
  "neoforgeVersion": "21.4.75",
136
136
  "javaVersion": 21
137
137
  }
@@ -1,9 +1,15 @@
1
1
  import { mkdirSync, openSync } from "node:fs";
2
2
  import { spawn } from "node:child_process";
3
3
  import path from "node:path";
4
+ import { fileURLToPath } from "node:url";
4
5
  import { MctError } from "../util/errors.js";
5
6
  import { getListeningPids, isProcessRunning, killProcessTree } from "../util/process.js";
6
7
  import { WebSocketClient } from "./WebSocketClient.js";
8
+ function getLaunchScriptPath() {
9
+ const thisFile = fileURLToPath(import.meta.url);
10
+ // dist/client/ClientManager.js -> scripts/launch-fabric-client.mjs
11
+ return path.resolve(path.dirname(thisFile), "..", "..", "scripts", "launch-fabric-client.mjs");
12
+ }
7
13
  const CLIENT_STATE_FILE = "clients.json";
8
14
  function getDefaultSnapshot() {
9
15
  return {
@@ -46,11 +52,13 @@ export class ClientManager {
46
52
  await new Promise((resolve) => setTimeout(resolve, 250));
47
53
  }
48
54
  }
49
- const launchCommand = configured.launchCommand;
55
+ const launchCommand = configured.launchArgs
56
+ ? [process.execPath, getLaunchScriptPath(), ...configured.launchArgs]
57
+ : configured.launchCommand;
50
58
  if (!launchCommand || launchCommand.length === 0) {
51
59
  throw new MctError({
52
60
  code: "INVALID_PARAMS",
53
- message: `Client ${options.name} requires launchCommand in config`
61
+ message: `Client ${options.name} requires launchArgs (or launchCommand) in config`
54
62
  }, 4);
55
63
  }
56
64
  const cwd = configured.workingDir
@@ -36,7 +36,7 @@ export declare function downloadClientMod(context: CommandContext, options: Down
36
36
  jar: string;
37
37
  cachePath: string;
38
38
  clientName: string;
39
- launchCommandConfigured: boolean;
39
+ launchArgsConfigured: boolean;
40
40
  runtimeRootDir: string | undefined;
41
41
  runtimeVersionId: string | undefined;
42
42
  }>;
@@ -114,10 +114,8 @@ function resolveLaunchRuntimePaths(context, options) {
114
114
  : {})
115
115
  };
116
116
  }
117
- function buildLaunchCommand(context, runtimePaths, variant) {
117
+ function buildLaunchArgs(runtimePaths, variant) {
118
118
  return [
119
- process.execPath,
120
- getLaunchScriptPath(),
121
119
  "--instance-dir",
122
120
  runtimePaths.instanceDir,
123
121
  "--meta-dir",
@@ -133,10 +131,8 @@ function buildLaunchCommand(context, runtimePaths, variant) {
133
131
  variant.fabricLoaderVersion ?? "0.16.10"
134
132
  ];
135
133
  }
136
- function buildManagedLaunchCommand(context, runtimeRootDir, versionId, gameDir) {
134
+ function buildManagedLaunchArgs(runtimeRootDir, versionId, gameDir) {
137
135
  return [
138
- process.execPath,
139
- getLaunchScriptPath(),
140
136
  "--runtime-root",
141
137
  runtimeRootDir,
142
138
  "--version-id",
@@ -202,21 +198,22 @@ export async function downloadClientMod(context, options, dependencies = {}) {
202
198
  const managedRuntime = runtimePaths
203
199
  ? undefined
204
200
  : await prepareManagedRuntimeImpl(variant, clientRootDir, { fetchImpl });
205
- const generatedLaunchCommand = runtimePaths
206
- ? buildLaunchCommand(context, runtimePaths, variant)
207
- : buildManagedLaunchCommand(context, managedRuntime.runtimeRootDir, managedRuntime.versionId, managedRuntime.gameDir);
201
+ const generatedLaunchArgs = runtimePaths
202
+ ? buildLaunchArgs(runtimePaths, variant)
203
+ : buildManagedLaunchArgs(managedRuntime.runtimeRootDir, managedRuntime.versionId, managedRuntime.gameDir);
208
204
  latestConfig.clients[clientName] = {
209
205
  ...configuredClient,
210
206
  version: variant.minecraftVersion,
211
207
  wsPort: options.wsPort ?? configuredClient.wsPort ?? DEFAULT_WS_PORT_BASE,
212
208
  server: options.server ?? configuredClient.server ?? "localhost:25565",
213
209
  workingDir: path.relative(context.cwd, minecraftDir) || ".",
210
+ launchCommand: undefined,
211
+ launchArgs: generatedLaunchArgs,
214
212
  env: {
215
213
  ...configuredClient.env,
216
214
  MCT_CLIENT_MOD_VARIANT: variant.id,
217
215
  MCT_CLIENT_MOD_JAR: path.relative(context.cwd, targetJarPath)
218
216
  },
219
- ...(generatedLaunchCommand ? { launchCommand: generatedLaunchCommand } : {})
220
217
  };
221
218
  await writeConfig(context.configPath, context.cwd, latestConfig);
222
219
  return {
@@ -232,7 +229,7 @@ export async function downloadClientMod(context, options, dependencies = {}) {
232
229
  jar: targetJarPath,
233
230
  cachePath: artifact.cachePath,
234
231
  clientName,
235
- launchCommandConfigured: Boolean(generatedLaunchCommand),
232
+ launchArgsConfigured: Boolean(generatedLaunchArgs),
236
233
  runtimeRootDir: managedRuntime?.runtimeRootDir,
237
234
  runtimeVersionId: managedRuntime?.versionId
238
235
  };
@@ -13,6 +13,7 @@ export interface MctConfig {
13
13
  server?: string;
14
14
  headless?: boolean;
15
15
  launchCommand?: string[];
16
+ launchArgs?: string[];
16
17
  workingDir?: string;
17
18
  env?: Record<string, string>;
18
19
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kzheart_/mc-pilot",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Minecraft plugin/mod automated testing CLI – control a real Minecraft client to simulate player actions",
5
5
  "type": "module",
6
6
  "bin": {