@syncshio/kano-plugin-minecraft 0.0.0-stage → 1.0.0
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.
Potentially problematic release.
This version of @syncshio/kano-plugin-minecraft might be problematic. Click here for more details.
- package/dist/entry.js +114 -0
- package/kano-release.json +5 -0
- package/package.json +28 -4
- package/plugin.json +28 -0
- package/README.md +0 -3
package/dist/entry.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
//#region ../kano-plugin-sdk/src/helpers/define-plugin.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
return e;
|
|
4
|
+
}
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region packages/plugins/minecraft/launch.ts
|
|
7
|
+
var t = "26.1", n = `versions/${t}/${t}`, r = n + ".json", i = n + ".jar", a = "net.minecraft.client.main.Main";
|
|
8
|
+
function o(e, t) {
|
|
9
|
+
return !e.rules || e.rules.filter((e) => !e.os || e.os.name === t).at(-1)?.action === "allow";
|
|
10
|
+
}
|
|
11
|
+
var s = {
|
|
12
|
+
entry: {
|
|
13
|
+
type: "binary",
|
|
14
|
+
path: { param: "javaPath" }
|
|
15
|
+
},
|
|
16
|
+
dependencies: !1,
|
|
17
|
+
params: [{
|
|
18
|
+
id: "javaPath",
|
|
19
|
+
label: "Java 25 可执行文件",
|
|
20
|
+
description: "选择 Java 25 的 bin/java 或 bin/java.exe。",
|
|
21
|
+
type: "path",
|
|
22
|
+
pathKind: "file",
|
|
23
|
+
required: !0
|
|
24
|
+
}],
|
|
25
|
+
strategy: {
|
|
26
|
+
requirements: {},
|
|
27
|
+
async compile(e, n) {
|
|
28
|
+
let c = await n.launch.compileLaunchProvider(e, s), l = (t) => n.launch.resolvePath(e.app.path, t);
|
|
29
|
+
try {
|
|
30
|
+
let s = JSON.parse((await n.fs.readTextFile(l(r))).content);
|
|
31
|
+
if (s.id !== t || s.mainClass !== a || !s.assetIndex?.id || !s.libraries?.length) throw Error("版本清单与原版 Minecraft 26.1 不匹配");
|
|
32
|
+
let u = e.host.os.name.toLowerCase(), d = u === "windows" || u === "win32", f = [
|
|
33
|
+
"darwin",
|
|
34
|
+
"macos",
|
|
35
|
+
"osx"
|
|
36
|
+
].includes(u), p = d ? "windows" : f ? "osx" : "linux", m = s.libraries.filter((e) => o(e, p)).map((e) => "libraries/" + e.downloads.artifact.path);
|
|
37
|
+
m.push(i), c.args = [
|
|
38
|
+
"-Xmx4G",
|
|
39
|
+
...f ? ["-XstartOnFirstThread"] : [],
|
|
40
|
+
"--sun-misc-unsafe-memory-access=allow",
|
|
41
|
+
"--enable-native-access=ALL-UNNAMED",
|
|
42
|
+
"-cp",
|
|
43
|
+
m.join(d ? ";" : ":"),
|
|
44
|
+
a,
|
|
45
|
+
"--demo",
|
|
46
|
+
"--version",
|
|
47
|
+
t,
|
|
48
|
+
"--gameDir",
|
|
49
|
+
l(".kano/minecraft-demo"),
|
|
50
|
+
"--assetsDir",
|
|
51
|
+
l("assets"),
|
|
52
|
+
"--assetIndex",
|
|
53
|
+
s.assetIndex.id,
|
|
54
|
+
"--username",
|
|
55
|
+
"Player",
|
|
56
|
+
"--uuid",
|
|
57
|
+
"00000000-0000-0000-0000-000000000000",
|
|
58
|
+
"--accessToken",
|
|
59
|
+
"0",
|
|
60
|
+
"--versionType",
|
|
61
|
+
"release"
|
|
62
|
+
];
|
|
63
|
+
let h = await n.launch.checkPaths([
|
|
64
|
+
{
|
|
65
|
+
id: "minecraft-client",
|
|
66
|
+
paths: [l(i)],
|
|
67
|
+
successMessage: "已找到游戏客户端",
|
|
68
|
+
failureMessage: "缺少 26.1 客户端 JAR,请补全游戏安装。"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: "minecraft-assets",
|
|
72
|
+
paths: [l(`assets/indexes/${s.assetIndex.id}.json`)],
|
|
73
|
+
successMessage: "已找到游戏资源索引",
|
|
74
|
+
failureMessage: "缺少 26.1 资源索引,请补全游戏安装。"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: "minecraft-libraries",
|
|
78
|
+
paths: [l("libraries")],
|
|
79
|
+
successMessage: "已找到依赖库目录",
|
|
80
|
+
failureMessage: "缺少 libraries 目录,请导入完整游戏目录。"
|
|
81
|
+
}
|
|
82
|
+
]);
|
|
83
|
+
c.checks = [...c.checks ?? [], ...h];
|
|
84
|
+
} catch (e) {
|
|
85
|
+
c.checks = [...c.checks ?? [], {
|
|
86
|
+
id: "minecraft-installation",
|
|
87
|
+
stage: "compile",
|
|
88
|
+
severity: "error",
|
|
89
|
+
passed: !1,
|
|
90
|
+
message: "无法读取原版 Minecraft 26.1 安装,请检查游戏目录。",
|
|
91
|
+
suggestion: e instanceof Error ? e.message : String(e)
|
|
92
|
+
}];
|
|
93
|
+
}
|
|
94
|
+
return c;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}, c = e({
|
|
98
|
+
id: "minecraft",
|
|
99
|
+
app: {
|
|
100
|
+
icon: "i-lucide-box",
|
|
101
|
+
color: "#578044",
|
|
102
|
+
identifiers: [{
|
|
103
|
+
type: "file",
|
|
104
|
+
pattern: r,
|
|
105
|
+
weight: 50
|
|
106
|
+
}],
|
|
107
|
+
async discoverImport() {
|
|
108
|
+
return { suggestedName: "Minecraft 26.1 试玩" };
|
|
109
|
+
},
|
|
110
|
+
launchProvider: s
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
//#endregion
|
|
114
|
+
export { c as default };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"payload": "eyJzY2hlbWEiOjEsInBhY2thZ2VOYW1lIjoiQHN5bmNzaGlvL2thbm8tcGx1Z2luLW1pbmVjcmFmdCIsInBsdWdpbklkIjoibWluZWNyYWZ0IiwidmVyc2lvbiI6IjEuMC4wIiwiZmlsZXMiOlt7InBhdGgiOiJwYWNrYWdlLmpzb24iLCJzaXplIjo2NDIsInNoYTI1NiI6IjljZTM1MTQ0YTk0Y2JkMzdlYzgwZDgyZDFjYTk2ZTcxNTZlN2EyMjNiMzU1MzJmYWIzODkzODU5ODM4NDlhN2QifSx7InBhdGgiOiJwbHVnaW4uanNvbiIsInNpemUiOjU5Nywic2hhMjU2IjoiM2ZkZGU3OGIyNGY3NDAyYWRiMmU2ZGFkYjYyMTNmNTQwMDE0YjgyNDZhYmQ1MDRlNTQwNzlkZTZkN2EwNTc2NCJ9LHsicGF0aCI6ImRpc3QvZW50cnkuanMiLCJzaXplIjozMjQwLCJzaGEyNTYiOiI0ZmJkZTllZTk0ZGRmMTEyNzU3MTc0MTBiYWM2YWFkNjk1ODNjYWM2MjJkYWZkNTU5NGU2OGFmMDlmZjUzOTY4In1dfQ==",
|
|
3
|
+
"keyId": "release-1",
|
|
4
|
+
"signature": "6mxpV2ZTWStyavO/4q3scBDZXBIR44xwYtq3+jfDvPLi1/iBkPAGdoD34Rcr9Qitmbn5ns5LDCSiTZs48mIkBA=="
|
|
5
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syncshio/kano-plugin-minecraft",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Launch the Minecraft Java Edition 26.1 client from Kano",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"kano-plugin",
|
|
8
|
+
"app",
|
|
9
|
+
"minecraft",
|
|
10
|
+
"java"
|
|
11
|
+
],
|
|
12
|
+
"files": [
|
|
13
|
+
"plugin.json",
|
|
14
|
+
"dist",
|
|
15
|
+
"kano-release.json"
|
|
16
|
+
],
|
|
17
|
+
"kano": {
|
|
18
|
+
"manifest": "plugin.json"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "node ../../../scripts/build-plugins.mjs minecraft"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@syncshio/kano-plugin-sdk": "file:../../../../kano-plugin-sdk"
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public",
|
|
28
|
+
"registry": "https://registry.npmjs.org/"
|
|
29
|
+
}
|
|
30
|
+
}
|
package/plugin.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"manifestVersion": 2,
|
|
3
|
+
"id": "minecraft",
|
|
4
|
+
"name": "Minecraft Java 版",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"description": "直接用 Java 25 启动本地原版 Minecraft 26.1 客户端并进入试玩模式。",
|
|
7
|
+
"author": "Kano",
|
|
8
|
+
"homepage": "https://www.minecraft.net/en-us/article/minecraft-java-edition-26-1",
|
|
9
|
+
"engines": {
|
|
10
|
+
"kano": "^1.0.0",
|
|
11
|
+
"pluginSdk": "^4.0.0"
|
|
12
|
+
},
|
|
13
|
+
"runtime": {
|
|
14
|
+
"entry": "./dist/entry.js"
|
|
15
|
+
},
|
|
16
|
+
"permissions": {
|
|
17
|
+
"rpc": [
|
|
18
|
+
"fs.readTextFile",
|
|
19
|
+
"fs.exists"
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"kano-plugin",
|
|
24
|
+
"app",
|
|
25
|
+
"minecraft",
|
|
26
|
+
"java"
|
|
27
|
+
]
|
|
28
|
+
}
|
package/README.md
DELETED