Skip to content

Commit 2763ea1

Browse files
committed
Update a0.6-pre2.1
1 parent 5c16e49 commit 2763ea1

File tree

6 files changed

+68
-90
lines changed

6 files changed

+68
-90
lines changed

EasyMineLauncher.jar

82.1 KB
Binary file not shown.

compile_unix.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ echo Adding dependencies.
1919
pip install pyqt5 requests appdirs pyinstaller pypresence
2020

2121
echo Using pyinstaller.
22-
pyinstaller -y -F -i "favicon.ico" --add-data "background.png":"." --add-data "logo.png":"." --add-data "favicon.ico":"." --add-data "blogbackground.png":"." --add-data "blog.html":"." --add-data "refresh.png":"." --add-data "venv/Lib/site-packages/mitmproxy/addons/onboardingapp":"mitmproxy/addons/onboardingapp" pymcl.py
22+
pyinstaller -y -F -i "favicon.ico" --add-data "background.png":"." --add-data "logo.png":"." --add-data "favicon.ico":"." --add-data "blogbackground.png":"." --add-data "blog.html":"." --add-data "refresh.png":"." --add-data "venv/Lib/site-packages/mitmproxy/addons/onboardingapp":"mitmproxy/addons/onboardingapp" --add-data "EasyMineLauncher.jar":"." pymcl.py
2323
echo Complete!
2424
read -p "Press enter to continue..."

compile_win.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ echo Is "%pythonver%" the correct python 3.6+ directory?
88
echo Close the window if incorrect.
99
PAUSE
1010

11-
echo Activating venv. && venv\scripts\activate && echo Adding dependencies. && pip install pyqt5 requests appdirs pypresence mitmproxy && echo Using pyinstaller. && pyinstaller -y -F -i "favicon.ico" --add-data "background.png";"." --add-data "logo.png";"." --add-data "favicon.ico";"." --add-data "blogbackground.png";"." --add-data "blog.html";"." --add-data "refresh.png";"." --add-data "venv\Lib\site-packages\mitmproxy\addons\onboardingapp";"mitmproxy\addons\onboardingapp" pymcl.py
11+
echo Activating venv. && venv\scripts\activate && echo Adding dependencies. && pip install pyqt5 requests appdirs pypresence mitmproxy && echo Using pyinstaller. && pyinstaller -y -F -i "favicon.ico" --add-data "background.png";"." --add-data "logo.png";"." --add-data "favicon.ico";"." --add-data "blogbackground.png";"." --add-data "blog.html";"." --add-data "refresh.png";"." --add-data "venv\Lib\site-packages\mitmproxy\addons\onboardingapp";"mitmproxy\addons\onboardingapp" --add-data "EasyMineLauncher.jar";"." pymcl.py
1212
echo Complete!
1313
PAUSE

mainlauncher.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def login(self):
9696
else:
9797
self.error("Invalid credidentials.")
9898
else:
99-
self.creds = self.loginBox.text()
99+
self.creds = " --username=" + self.loginBox.text()
100100
self.launch()
101101

102102
self.loginButton.setText("Force Quit")
@@ -302,16 +302,14 @@ def launch(self):
302302
self.proxy.start()
303303
self.proxiedArgs += " -Dhttp.proxyHost=localhost -Dhttp.proxyPort=25560 -Dhttps.proxyHost=localhost -Dhttps.proxyPort=25560"
304304

305-
# If windows, then only override appdata. Otherwise override them all. because compatibility, amirite?
306-
if platform.platform().startswith("Windows"):
307-
os.environ["APPDATA"] = config.MC_DIR + "/instances/" + self.currentInstance
308-
else:
309-
os.environ["APPDATA"] = config.MC_DIR + "/instances/" + self.currentInstance
310-
os.environ["USER.HOME"] = config.MC_DIR + "/instances/" + self.currentInstance
311-
os.environ["HOME"] = config.MC_DIR + "/instances/" + self.currentInstance
312-
# Launch the game. I ONLY DEAL IN ABSOLUTES. (Lies!)
313-
print("java " + self.proxiedArgs + " -Xms" + self.instanceConfig["minram"] + " -Xmx" + self.instanceConfig["maxram"] + " -cp \"" + config.MC_DIR + "/instances/" + self.currentInstance + "/.minecraft" + "/bin/minecraft.jar;" + config.MC_DIR + "/instances/" + self.currentInstance + "/.minecraft" + "/bin/jinput.jar;" + config.MC_DIR + "/instances/" + self.currentInstance + "/.minecraft" + "/bin/lwjgl.jar;" + config.MC_DIR + "/instances/" + self.currentInstance + "/.minecraft" + "/bin/lwjgl_util.jar\" " + "-Djava.library.path=\"" + config.MC_DIR + "/instances/" + self.currentInstance + "/.minecraft" + "/bin/natives\" net.minecraft.client.Minecraft " + self.creds)
314-
self.prc = subprocess.Popen("java " + self.proxiedArgs + " -Xms" + self.instanceConfig["minram"] + " -Xmx" + self.instanceConfig["maxram"] + " -cp \"" + config.MC_DIR + "/instances/" + self.currentInstance + "/.minecraft" + "/bin/minecraft.jar;" + config.MC_DIR + "/instances/" + self.currentInstance + "/.minecraft" + "/bin/jinput.jar;" + config.MC_DIR + "/instances/" + self.currentInstance + "/.minecraft" + "/bin/lwjgl.jar;" + config.MC_DIR + "/instances/" + self.currentInstance + "/.minecraft" + "/bin/lwjgl_util.jar\" " + "-Djava.library.path=\"" + config.MC_DIR + "/instances/" + self.currentInstance + "/.minecraft" + "/bin/natives\" net.minecraft.client.Minecraft " + self.creds, env=dict(os.environ))
305+
# Overrides all references to %appdata%, $user.home and $home
306+
os.environ["APPDATA"] = config.MC_DIR + "/instances/" + self.currentInstance
307+
os.environ["USER.HOME"] = config.MC_DIR + "/instances/" + self.currentInstance
308+
os.environ["HOME"] = config.MC_DIR + "/instances/" + self.currentInstance
309+
310+
# Launch the game. I ONLY DEAL IN ABSOLUTES.
311+
print("java " + self.proxiedArgs + " -Xms" + self.instanceConfig["minram"] + " -Xmx" + self.instanceConfig["maxram"] + " -jar \"" + utils.resourcePath("EasyMineLauncher.jar") + "\" --lwjgl-dir=\"" + config.MC_DIR + "/instances/" + self.currentInstance + "/.minecraft/bin" + "\" --jar=\"" + config.MC_DIR + "/instances/" + self.currentInstance + "/.minecraft/bin/minecraft.jar" + "\" --native-dir=\"" + config.MC_DIR + "/instances/" + self.currentInstance + "/.minecraft" + "/bin/natives\"" + " --height=520 --width=870 --x=" + str(int((app.desktop().screenGeometry().width() / 2) - 435)) + " --y=" + str(int((app.desktop().screenGeometry().height() / 2) - 270)) + self.creds)
312+
self.prc = subprocess.Popen("java " + self.proxiedArgs + " -Xms" + self.instanceConfig["minram"] + " -Xmx" + self.instanceConfig["maxram"] + " -jar \"" + utils.resourcePath("EasyMineLauncher.jar") + "\" --lwjgl-dir=\"" + config.MC_DIR + "/instances/" + self.currentInstance + "/.minecraft/bin" + "\" --jar=\"" + config.MC_DIR + "/instances/" + self.currentInstance + "/.minecraft/bin/minecraft.jar" + "\" --native-dir=\"" + config.MC_DIR + "/instances/" + self.currentInstance + "/.minecraft" + "/bin/natives\"" + " --height=520 --width=870 --x=" + str(int((app.desktop().screenGeometry().width() / 2) - 435)) + " --y=" + str(int((app.desktop().screenGeometry().height() / 2) - 270)) + self.creds, env=dict(os.environ))
315313

316314
self.launcherConfig["lastusedname"] = self.loginBox.text()
317315
utils.saveSettings(self.launcherConfig)
@@ -346,9 +344,6 @@ def forceQuit(self):
346344
# Fires whe the launcher is closed.
347345
def closeEvent(self, event):
348346
global checkAliveTimer
349-
# Deletes the tmp folder. Gotta keep those directories clean!
350-
if os.path.exists(config.MC_DIR + "/tmp"):
351-
shutil.rmtree(config.MC_DIR + "/tmp")
352347
checkAliveTimer.cancel()
353348
try:
354349
self.pres.close()
@@ -359,6 +354,10 @@ def closeEvent(self, event):
359354
except:
360355
pass
361356

357+
# Deletes the tmp folder. Gotta keep those directories clean!
358+
if os.path.exists(config.MC_DIR + "/tmp"):
359+
shutil.rmtree(config.MC_DIR + "/tmp")
360+
362361

363362
# The option window. (Duh!)
364363
class optionWindow(QDialog):
@@ -680,7 +679,7 @@ def modpackInstallDone(self):
680679

681680
def installModpackWrapper(self, modpackName):
682681
self.installModpack.stop()
683-
self.installModpack = utils.installModpack(modpackName=modpackName)
682+
self.installModpack = utils.installModpack(modpackName)
684683
self.installModpack.done.connect(self.modpackInstallDone)
685684
self.installModpack.starting.connect(self.progressWinWrapper)
686685
self.installModpack.updateIStatus.connect(self.updateIStatus)
@@ -689,15 +688,15 @@ def installModpackWrapper(self, modpackName):
689688

690689
def getModpackURLWrapper(self, modpackURL):
691690
self.getModpackURL.stop()
692-
self.getModpackURL = utils.getModpackURL(modpackURL=modpackURL)
691+
self.getModpackURL = utils.getModpackURL(modpackURL)
693692
self.getModpackURL.starting.connect(self.progressWinWrapper)
694693
self.getModpackURL.installModpack.connect(self.installModpackWrapper)
695694
self.getModpackURL.updateIStatus.connect(self.updateIStatus)
696695
self.getModpackURL.start()
697696

698697
def getModpackFSWrapper(self, modpackDir):
699698
self.getModpackFS.stop()
700-
self.getModpackFS = utils.getModpackFS(modpackDir=modpackDir)
699+
self.getModpackFS = utils.getModpackFS(modpackDir)
701700
self.getModpackFS.starting.connect(self.progressWinWrapper)
702701
self.getModpackFS.installModpack.connect(self.installModpackWrapper)
703702
self.getModpackFS.start()
@@ -725,6 +724,7 @@ def updateStatus(self, text="", color="black", bgcolor="lightgrey"):
725724
self.status.setStyleSheet("color: " + color + "; background-color: " + bgcolor + ";")
726725

727726
def updateIStatus(self, text):
727+
print(text)
728728
try:
729729
if text.startswith("[") and self.progressWin.status.toPlainText().split("\n")[len(self.progressWin.status.toPlainText().split("\n"))-2].startswith("["):
730730
newtext = self.progressWin.status.toPlainText().split("\n")

proxy-standalone.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,31 @@ class AddHeader:
1111
def request(flow):
1212
if flow.request.pretty_host == "s3.amazonaws.com":
1313

14-
if doSoundFix == True:
14+
if doSoundFix:
1515
if flow.request.path.__contains__("MinecraftResources"):
1616
flow.request.host = "resourceproxy.pymcl.net"
1717

18-
if doSkinFix == True:
18+
if doSkinFix:
1919
if flow.request.path.__contains__("MinecraftSkins"):
20-
response = requests.get("http://api.mojang.com/users/profiles/minecraft", verify=False)
21-
uid = json.loads(response.content)["id"]
22-
img64 = requests.get("http://sessionserver.mojang.com/session/minecraft/profile/" + uid, verify=False)
23-
img = requests.get(base64.decode(img64)["textures"]["SKIN"])
24-
flow.response = http.HTTPResponse.make(
25-
200,
26-
img,
27-
{"Content-Type": "image/png"}
28-
)
20+
flow.request.host = "resourceproxy.pymcl.net"
21+
flow.request.path = "/skinapi.php?user=" + flow.request.path.split("/")[2].split(".")[0]
2922

30-
if doCapeFix == True:
23+
if doCapeFix:
3124
if flow.request.path.__contains__("MinecraftCloaks"):
3225
flow.request.host = "resourceproxy.pymcl.net"
3326
flow.request.path = "/capeapi.php?user=" + flow.request.path.split("/")[2].split(".")[0]
3427

28+
if flow.request.pretty_host.__contains__("minecraft.net"):
29+
if doSkinFix:
30+
if flow.request.path.__contains__("skin"):
31+
flow.request.host = "resourceproxy.pymcl.net"
32+
flow.request.path = "/skinapi.php?user=" + flow.request.path.split("/")[2].split(".")[0]
33+
34+
if doCapeFix:
35+
if flow.request.path.__contains__("cloak"):
36+
flow.request.host = "resourceproxy.pymcl.net"
37+
flow.request.path = "/capeapi.php?user=" + flow.request.path.split("=")[1]
38+
3539

3640
def start():
3741
myaddon = AddHeader()

utils.py

Lines changed: 33 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,11 @@ def login(username, password):
119119
}
120120

121121
data = requests.post("https://authserver.mojang.com/authenticate", json=data)
122-
print(data.content)
123122
data = json.loads(data.content)
124123

125124
try:
126-
return True, data["selectedProfile"]["name"] + " " + data["accessToken"]
127-
except AttributeError:
125+
return True, " --username=" + data["selectedProfile"]["name"] + " --session-id=" + data["accessToken"]
126+
except KeyError:
128127
return False, None
129128

130129

@@ -203,15 +202,16 @@ def stop(self):
203202
class getModpackFS(QThread):
204203
installModpack = pyqtSignal(str)
205204
starting = pyqtSignal()
205+
updateIStatus = pyqtSignal(str)
206+
updateStatus = pyqtSignal(str)
206207

207-
def __init__(self, win=None, modpackDir=None):
208+
def __init__(self, modpackDir=None):
208209
super().__init__()
209-
self.win = win
210-
self.modpackName = modpackDir
210+
self.modpackDir = modpackDir
211211

212212
def run(self):
213213
self.starting.emit()
214-
if not self.modpackDir or not self.win:
214+
if not self.modpackDir:
215215
modpackName = "Error"
216216
else:
217217
self.updateIStatus.emit("Retrieving modpack from path...")
@@ -226,7 +226,10 @@ def run(self):
226226
try:
227227
shutil.copy(self.modpackDir, config.MC_DIR + "/modpackzips/"+modpackName + ".zip")
228228
except:
229+
traceback.print_exc()
229230
modpackName = "Error"
231+
self.updateStatus.emit("Modpack cached. Starting install.")
232+
self.updateIStatus.emit("Modpack cached. Starting install.")
230233
self.installModpack.emit(modpackName)
231234

232235
def stop(self):
@@ -283,12 +286,13 @@ def run(self):
283286
print("Installing modpack")
284287
try:
285288
if self.modpackName == "Error" or self.modpackName is None:
289+
traceback.print_exc()
286290
raise IOError("Modpack does not exist in directory?")
287291
if not os.path.exists(config.MC_DIR + "/tmp/" + self.modpackName):
288292
os.makedirs(config.MC_DIR + "/tmp/" + self.modpackName)
289293

290294
# Extracts the zip file to the temp dir.
291-
self.updateIStatus.emit("Extracting modpack...")
295+
self.updateIStatus.emit("Extracting modpack...")
292296
with zipfile.ZipFile(config.MC_DIR + "/modpackzips/" + self.modpackName + ".zip", "r") as zip:
293297
zip.extractall(config.MC_DIR + "/tmp/" + self.modpackName)
294298

@@ -303,6 +307,7 @@ def run(self):
303307
except:
304308
mcVer = None
305309
except:
310+
traceback.print_exc()
306311
self.updateIStatus.emit("No modpack name found. Using zip file name. Get the modpack author to create a \"modpack.json\" file in his/her modpack.")
307312
modpackJsonName = self.modpackName
308313
mcVer = None
@@ -338,7 +343,7 @@ def run(self):
338343

339344
# Gotta stay clean!
340345
self.updateIStatus.emit("Deleting temp files...")
341-
remove_tree(config.MC_DIR + "/tmp/" + self.modpackName)
346+
#remove_tree(config.MC_DIR + "/tmp/" + self.modpackName)
342347
self.updateStatus.emit("Modpack installed!", "green")
343348

344349
# And in case the zip didnt exist in the first place.
@@ -362,6 +367,8 @@ def makeModpack(self, mcVer):
362367
if response.content is None:
363368
raise ConnectionError("Something went very wrong.")
364369

370+
areYouThere(config.MC_DIR + "/tmp/" + self.modpackName + "/.minecraft/bin")
371+
365372
self.updateIStatus.emit("Started connection..")
366373

367374
dl = 0
@@ -384,13 +391,21 @@ def makeModpack(self, mcVer):
384391

385392
self.updateIStatus.emit("Extracted.\nExtracting modpack jar and merging jars..")
386393

387-
shutil.unpack_archive(config.MC_DIR + "/tmp/" + self.modpackName + "/.minecraft/bin/minecraft.jar", config.MC_DIR + "/tmp/" + self.modpackName + "/.minecraft/bin/minecraft", "zip")
394+
try:
395+
shutil.unpack_archive(config.MC_DIR + "/tmp/" + self.modpackName + "/.minecraft/bin/minecraft.jar", config.MC_DIR + "/tmp/" + self.modpackName + "/.minecraft/bin/minecraft", "zip")
396+
except:
397+
traceback.print_exc()
398+
print("No modpack jar found. Making a vanilla instance with contents of modpack zip.")
388399

389400
self.updateIStatus.emit("Extracted.\nArchiving..")
390401

391402
shutil.make_archive(config.MC_DIR + "/tmp/" + self.modpackName + "/.minecraft/bin/minecraft", "zip", config.MC_DIR + "/tmp/" + self.modpackName + "/.minecraft/bin/minecraft")
392403

393-
os.remove(config.MC_DIR + "/tmp/" + self.modpackName + "/.minecraft/bin/minecraft.jar")
404+
try:
405+
os.remove(config.MC_DIR + "/tmp/" + self.modpackName + "/.minecraft/bin/minecraft.jar")
406+
except:
407+
traceback.print_exc()
408+
394409
os.rename(config.MC_DIR + "/tmp/" + self.modpackName + "/.minecraft/bin/minecraft.zip", config.MC_DIR + "/tmp/" + self.modpackName + "/.minecraft/bin/minecraft.jar")
395410

396411
self.updateIStatus.emit("Archived.\nDownloading LWJGL for " + config.OS + "..")
@@ -438,11 +453,11 @@ def rmInstance(instanceName, self):
438453
except:
439454
pass
440455

441-
# TODO Remove this if new solution works.
442-
"""class minecraftProxy(threading.Thread):
456+
457+
class minecraftProxy(QThread):
443458

444459
def __init__(self, doSkinFix, doSoundFix, doCapeFix, loop):
445-
super(minecraftProxy, self).__init__()
460+
super().__init__()
446461
self.doSkinFix = doSkinFix
447462
self.doCapeFix = doCapeFix
448463
self.doSoundFix = doSoundFix
@@ -470,57 +485,16 @@ def request(self, flow):
470485
flow.request.host = "resourceproxy.pymcl.net"
471486
flow.request.path = "/capeapi.php?user=" + flow.request.path.split("/")[2].split(".")[0]
472487

473-
return AddHeader(self)
474-
475-
def run(self):
476-
asyncio.set_event_loop(self.loop)
477-
myaddon = self.getHeader()
478-
opts = options.Options(listen_host="0.0.0.0", listen_port=25560)
479-
pconf = proxy.config.ProxyConfig(opts)
480-
self.m = DumpMaster(opts)
481-
self.m.server = proxy.server.ProxyServer(pconf)
482-
self.m.addons.add(myaddon)
483-
484-
self.m.run()
485-
486-
def stop(self):
487-
self.m.shutdown()
488-
489-
def join(self):
490-
threading.Thread.join(self)
491-
"""
492-
493-
494-
class minecraftProxy(QThread):
495-
496-
def __init__(self, doSkinFix, doSoundFix, doCapeFix, loop):
497-
super().__init__()
498-
self.doSkinFix = doSkinFix
499-
self.doCapeFix = doCapeFix
500-
self.doSoundFix = doSoundFix
501-
self.loop = loop
502-
503-
def getHeader(self):
504-
class AddHeader:
505-
def __init__(self, parent):
506-
self.parent = parent
507-
508-
def request(self, flow):
509-
if flow.request.pretty_host == "s3.amazonaws.com":
510-
511-
if self.parent.doSoundFix:
512-
if flow.request.path.__contains__("MinecraftResources"):
513-
flow.request.host = "resourceproxy.pymcl.net"
514-
488+
if flow.request.pretty_host.__contains__("minecraft.net"):
515489
if self.parent.doSkinFix:
516-
if flow.request.path.__contains__("MinecraftSkins"):
490+
if flow.request.path.__contains__("skin"):
517491
flow.request.host = "resourceproxy.pymcl.net"
518492
flow.request.path = "/skinapi.php?user=" + flow.request.path.split("/")[2].split(".")[0]
519493

520494
if self.parent.doCapeFix:
521-
if flow.request.path.__contains__("MinecraftCloaks"):
495+
if flow.request.path.__contains__("cloak"):
522496
flow.request.host = "resourceproxy.pymcl.net"
523-
flow.request.path = "/capeapi.php?user=" + flow.request.path.split("/")[2].split(".")[0]
497+
flow.request.path = "/capeapi.php?user=" + flow.request.path.split("=")[1]
524498

525499
return AddHeader(self)
526500

0 commit comments

Comments
 (0)