-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfcc.pyw
133 lines (110 loc) · 3.62 KB
/
fcc.pyw
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
122
123
124
125
126
127
128
129
130
131
132
133
#fcc.exe args
import argparse
import configparser
import json
import os
import time
import uuid
import shutil
def set_user_data(username):
current_directory = os.getcwd()
id_hex = uuid.uuid4().hex
client_token_hex = uuid.uuid4().hex
iat = int(time.time())
account_data = {
"active": True,
"entitlement": {
"canPlayMinecraft": True,
"ownsMinecraft": True
},
"profile": {
"capes": [],
"id": id_hex,
"name": username,
"skin": {
"id": "",
"url": "",
"variant": ""
}
},
"type": "dummy",
"ygg": {
"extra": {
"clientToken": client_token_hex,
"userName": username
},
"iat": iat,
"token": username
}
}
file_path = "./assets/UltimMC/accounts.json"
with open(file_path, 'r') as f:
data = json.load(f)
data['accounts'].append(account_data)
with open(file_path, 'w') as f:
json.dump(data, f, indent=4)
print("INFO - Account data set successfully.")
return
def set_startup_ram(ram_value):
if not ram_value:
ram_value = "4096"
current_directory = os.getcwd()
config_file = os.path.join(current_directory, "assets", "UltimMC", "ultimmc.cfg")
config_file2 = os.path.join(current_directory, "assets", "UltimMC", "instances", "VL4", "instance.cfg")
with open(config_file, 'r') as f:
lines = f.readlines()
new_lines = []
for line in lines:
if line.startswith("MaxMemAlloc="):
line = f"MaxMemAlloc={ram_value}\n"
elif line.startswith("MinMemAlloc="):
line = f"MinMemAlloc={ram_value}\n"
new_lines.append(line)
with open(config_file, 'w') as f:
f.writelines(new_lines)
with open(config_file2, 'r') as f:
lines = f.readlines()
new_lines = []
for line in lines:
if line.startswith("MaxMemAlloc="):
line = f"MaxMemAlloc={ram_value}\n"
elif line.startswith("MinMemAlloc="):
line = f"MinMemAlloc={ram_value}\n"
new_lines.append(line)
with open(config_file2, 'w') as f:
f.writelines(new_lines)
with open('config.ini', 'r+') as f:
lines = f.readlines()
for i, line in enumerate(lines):
if line.startswith("ram = "):
lines[i] = f"ram = {ram_value}\n"
break
f.seek(0)
f.writelines(lines)
f.truncate()
return
def copy_configs_fse():
current_directory = os.getcwd()
default_folder = os.path.join(current_directory, "assets", "default", "UltimMC")
where_copy = os.path.join(current_directory, "assets")
destination_folder = os.path.join(where_copy, "UltimMC")
shutil.copytree(default_folder, destination_folder, dirs_exist_ok=True)
return
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Set user data for fcc.exe args')
parser.add_argument('-u', '--username', type=str, help='Username to set')
parser.add_argument('-r', '--ram', type=str, help='RAM to allocate')
parser.add_argument('-ccfg', '--copyconfigs', action='store_true', help='Copy default configs')
args = parser.parse_args()
if args.username:
set_user_data(args.username)
else:
print("ERROR - fcc.exe invalid username.")
if args.ram:
set_startup_ram(args.ram)
else:
print("ERROR - fcc.exe invalid RAM.")
if args.copyconfigs:
copy_configs_fse()
else:
print("ERROR - fcc.exe invalid configs.")