Skip to content

Commit

Permalink
shave like a second off of launching
Browse files Browse the repository at this point in the history
  • Loading branch information
WindClan committed Mar 3, 2024
1 parent 60cec55 commit 6d82665
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions MinecraftLauncher.pyw
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,31 @@ from subprocess import STDOUT,PIPE
#variables
webUrl = "https://api.github.com/repos/olauncher/olauncher/releases/latest"
path = ""
root = ""
jre = shutil.which("javaw")
#platform specific code
if sys.platform == "win32":
path = os.path.expandvars("%APPDATA%")
if not os.path.isdir(path+"\\.minecraft"):
os.mkdir(path+"\\.minecraft")
path = path+"\\.minecraft\\"
root = path+"\\.minecraft\\"
if not os.path.isdir(root+"\\bin"):
os.mkdir(root+"\\bin")
path = root+"\\bin\\"
elif sys.platform == "linux":
path = os.path.expandvars("$HOME")
if not os.path.isdir(path+"/.minecraft"):
os.mkdir(path+"/.minecraft")
path = path+"/.minecraft/"
root = path+"/.minecraft/"
if not os.path.isdir(root+"/bin"):
os.mkdir(root+"/bin")
path = root+"/bin/"
os.chdir(path)
if not jre:
tkinter.messagebox.showerror(title="Error", message="Java is required to play Minecraft. Please install Java")
raise Exception("Java not installed!")
else:
file = root+"autool/patched.jar"
#starts the launcher
if not os.path.isfile(path+"version.txt"):
a = open(path+"version.txt", "w")
Expand All @@ -47,11 +55,13 @@ else:
a.close()
current = content["name"]
jar = requests.get(release["browser_download_url"], stream=True)
file = path+"redist.jar"
if jar.status_code == 200:
with open(path+"redist.jar", 'wb') as a:
for chunk in jar.iter_content(chunk_size=128):
a.write(chunk)
elif not os.path.isfile(path+"redist.jar"):
tkinter.messagebox.showerror(title="Error", message="OLauncher Redist failed to download")
raise Exception("no internet?")
subprocess.Popen([jre,"-Dnet.minecraft.launcher.WindowTitle=Minecraft Launcher "+current[1:len(current)],"-jar",path+"redist.jar"], stdin=PIPE, stdout=PIPE, stderr=STDOUT)

subprocess.Popen([jre,"-Dnet.minecraft.launcher.WindowTitle=Minecraft Launcher "+current[1:len(current)],"-jar",file], stdin=PIPE, stdout=PIPE, stderr=STDOUT)

0 comments on commit 6d82665

Please sign in to comment.