-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpack-server.py
More file actions
121 lines (108 loc) · 3.17 KB
/
Copy pathpack-server.py
File metadata and controls
121 lines (108 loc) · 3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
if __name__ != "__main__":
exit()
import info
import zipfile
import os
need = ("rhino", "jupiter", "megacells", "patchouli")
skip = (
"colorwheel",
"extremeSoundmuffler",
"entityculling" "searchables",
"skinlayers3d",
"kubejsoffline",
"wi-zoom",
"cherishedworlds",
"notenoughanimations",
"catalogue",
"toastcontrol",
"modernui",
"realcamera",
"configured",
"sodiumdynamiclights",
)
config = (
"cookingforblockheads-common",
"immersiveengineering-server",
"integrateddynamics-common",
"constructionstick-server",
"twilightforest-common",
"ftbultimine-server",
"solcarrot-server",
"ftbchunks-world",
"create-server",
"curios-common",
"rolling_gate",
"xnet-server",
"xnetgases",
"fml",
)
os.chdir(os.path.dirname(__file__))
target: list[str] = []
for name in os.listdir("mods"):
if any(True for item in skip if item in name.lower()):
continue
path = os.path.join("mods", name)
keep = False
if any(True for item in need if item in name.lower()):
keep = True
else:
with zipfile.ZipFile(path, "r") as zf:
if "META-INF/neoforge.mods.toml" not in zf.namelist():
continue
for line in (
zf.read("META-INF/neoforge.mods.toml").decode("utf-8").splitlines()
):
line = line.strip().lower()
if not line.startswith("side"):
continue
side = line.partition("=")[-1].strip().replace("'", '"').split('"')[1]
if side == "client":
break
elif side == "both" or side == "server":
keep = True
break
if not keep:
continue
target.append(path)
print(f"模组: {name}")
for root, _, files in os.walk("config"):
for file in files:
path = os.path.join(root, file)
if "ftbquests" in path or (
"yes_steve_model" in path
and "custom" in path
and (".ysm" in file or ".zip" in file)
):
pass
elif (
"client" in path
or ".bak" in path
or all(False if item in file else True for item in config)
):
continue
print(f"配置: {path}")
target.append(path)
print(f"配置: defaultconfigs/ftbessentials-server.snbt")
target.append("defaultconfigs/ftbessentials-server.snbt")
for root, _, files in os.walk("kubejs"):
for file in files:
path = os.path.join(root, file)
if (
"documentation" in path
or "README" in path
or "client" in path
or "assets" in path
):
continue
print(f"魔改: {path}")
target.append(path)
for file in os.listdir("tacz"):
path = os.path.join("tacz", file)
if os.path.isfile(path) and os.path.splitext(file)[-1] == ".zip":
print(f"枪包: {file}")
target.append(path)
print("导出至dist文件夹")
with zipfile.ZipFile(f"./dist/{info.out_server}", "w") as zf:
for path in target:
zf.write(path)
print(f"完成!\n已保存至: ./dist/{info.out_server}")