Skip to content

Commit 5ae1ec6

Browse files
author
REME
committed
2026-02-03 尖塔,启动
1 parent c97ac8e commit 5ae1ec6

3 files changed

Lines changed: 81 additions & 0 deletions

File tree

21.4 KB
Loading
124 KB
Loading
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# 一键开启mod调试
2+
3+
你发现想要调试一个mod需要先打包、然后回到steam启动游戏、再进入mts加载mod、然后才能测试,整个过程非常繁琐。其实我们可以在ide里设置一键运行整个流程,甚至能够断点调试。
4+
5+
## IDEA
6+
7+
点击右上角的调试配置按钮,选择`Edit Configurations...`
8+
9+
![](001.png)
10+
11+
点击左上角的`+`,选择`Application`
12+
13+
1. `Path to JAR`选择你`ModTheSpire`的位置。
14+
2. `Program arguments`选填,参考[MTS Wiki](https://github.com/kiooeht/ModTheSpire/wiki/Command-Line-Arguments)。方便起见你可以填写`--mods basemod,[你的mod id]`,这样就不用在mts里重新选择一遍了。当然你可以添加更多mod。
15+
3. `Working directory`选择你的尖塔游戏根目录。
16+
4. `JRE`选择一个java8(1.8)的版本。
17+
5. `Before launch`点击`+`,选择`Run Maven Goals`,然后写入`package`,这样每次运行前都会自动打包你的mod。
18+
19+
![](002.png)
20+
21+
点击`OK`保存。现在你可以直接点击右上角的运行或调试按钮来启动游戏并加载你的mod了!
22+
23+
当然你也可以进行断点调试。点击某一行代码左侧的空白处即可添加断点。运行调试后,游戏会在断点处暂停,你可以查看变量、单步执行等。
24+
25+
## VSCode
26+
27+
`.vscode`里新建一个`launch.json`文件,写入以下内容:
28+
29+
```json
30+
{
31+
"version": "0.2.0",
32+
"configurations": [
33+
{
34+
"type": "java",
35+
"name": "Debug",
36+
"request": "launch",
37+
"mainClass": "com.megacrit.cardcrawl.desktop.DesktopLauncher",
38+
// 相当于上面的Program arguments
39+
"args": ["--mods", "basemod,RyoikiTenkai,better-debug"],
40+
// 相当于上面的Working directory
41+
"cwd": "D:\\Files\\Softwares\\Steam\\steamapps\\common\\SlayTheSpire",
42+
// 相当于上面的JRE,选择一个java8(1.8)的版本
43+
"javaExec": "C:\\Program Files\\Eclipse Adoptium\\jdk-8.0.452.9-hotspot\\bin\\java.exe",
44+
// 需要和下面写的tasks.json里的task name一致
45+
"preLaunchTask": "maven-package",
46+
// 相当于上面的Path to JAR
47+
"classPaths": [
48+
"D:\\Files\\Softwares\\Steam\\steamapps\\workshop\\content\\646570\\1605060445\\ModTheSpire.jar"
49+
]
50+
}
51+
]
52+
}
53+
54+
```
55+
56+
然后在`.vscode`里新建一个`tasks.json`文件,写入以下内容:
57+
58+
```json
59+
{
60+
"version": "2.0.0",
61+
"tasks": [
62+
{
63+
"label": "maven-package",
64+
"type": "shell",
65+
"command": "mvn package",
66+
"group": {
67+
"kind": "build",
68+
"isDefault": true
69+
},
70+
"presentation": {
71+
"reveal": "silent",
72+
"clear": true,
73+
"panel": "shared"
74+
},
75+
"problemMatcher": [
76+
"$msCompile"
77+
]
78+
}
79+
]
80+
}
81+
```

0 commit comments

Comments
 (0)