Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

stephenmac7

Members
  • Posts

    15
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

stephenmac7's Achievements

Tree Puncher

Tree Puncher (2/8)

1

Reputation

  1. That's why I'm trying to get it to work on windows (which it currently doesn't for some reason...) and then I'll use py2exe or pyinstaller to make an exe file which does not require python.
  2. (Sorry about the double-post) Here is everything: Source (Python 2.x): import sys import os import glob import re import urllib2, urllib import httplib as httplib import shutil import zipfile as z from PySide.QtGui import * from PySide.QtCore import * from io import open class mainApp(QMainWindow): def __init__(self): super(mainApp, self).__init__() self.initUI() def initUI(self): self.mwidget = mainWidget() self.setCentralWidget(self.mwidget) status = self.statusBar() status.showMessage(u"Idle.") # Set the title self.setWindowTitle(u"Minecraft Forge Installer") self.resize(450, 180) self.show() class mainWidget(QWidget): def __init__(self): super(mainWidget, self).__init__() self.initUI() def initUI(self): # Create widgets self.input_ent = QLineEdit(self) input_btn = QPushButton(u"Select minecraft.jar") input_btn.clicked.connect(self.getFile) self.minecraft_version_ent = QLineEdit(self) run_btn = QPushButton(u"Run") run_btn.clicked.connect(self.runEditMJar) # Create a layout vbox = QVBoxLayout() input_hbox = QHBoxLayout() input_hbox.addWidget(self.input_ent) input_hbox.addWidget(input_btn) vbox.addLayout(input_hbox) mversion_hbox = QHBoxLayout() mversion_hbox.addWidget(QLabel(u"Minecraft Version:")) mversion_hbox.addWidget(self.minecraft_version_ent) vbox.addLayout(mversion_hbox) vbox.addWidget(run_btn) # Show the window self.setLayout(vbox) self.show() def getFile(self): fname = QFileDialog.getOpenFileName(self, u"minecraft.jar", u".", u"Jar Files (*.jar)")[0] self.input_ent.clear() self.input_ent.insert(fname) def runEditMJar(self): fname = self.input_ent.displayText() version = self.minecraft_version_ent.displayText() if self.parentWidget().statusBar().currentMessage() == u"Idle." and not os.path.exists(u"newzip"): self.sayWorking() QCoreApplication.processEvents() editJar(fname,version) self.sayDone() else: self.parentWidget().statusBar().showMessage(u"Action not allowed.", timeout=2000) def sayWorking(self): self.parentWidget().statusBar().showMessage(u"Editing Jar File.") def sayDone(self): self.parentWidget().statusBar().showMessage(u"Done.") def editJar(filename, mcversion): original = z.ZipFile(filename) basename = os.path.basename(filename).split(u".")[0] forge_name = download_forge(mcversion) forge = z.ZipFile(forge_name) os.makedirs(u"newzip") original.extractall(path=u"newzip") forge.extractall(path=u"newzip") original.close() forge.close() for delfile in glob.glob(u"newzip/META-INF/MOJANG*"): os.remove(delfile) shutil.make_archive(basename, u"zip", u"newzip") backup = os.path.dirname(filename) + u"/backup.jar" print u"Backup: {0}, Filename: {1}".format(backup, filename) shutil.move(filename, backup) shutil.move(basename + u".zip", filename) shutil.rmtree(u"newzip") os.remove(forge_name) def use_mirror(): connection = httplib.HTTPConnection(u"files.minecraftforge.net", 80) connection.request(u"OPTIONS", u"*") try: response = connection.getresponse() return False except: return True def getversions(it): unp_versions = re.compile(u"Build [0-9].[0-9].[0-9].[0-9]*.*[0-9.]*").findall(it) p_versions = [] for build in unp_versions: splitone = build.split(u":") p_versions.append((splitone[0].split(u" ")[1], splitone[-1][1:])) return p_versions def download_forge(mcversion): using_mirror = use_mirror() if using_mirror: response = urllib2.urlopen(u"http://ken.wingedboot.com/forgemirror/files.minecraftforge.net/").read() else: response = urllib2.urlopen(u"http://files.minecraftforge.net/").read() versions = getversions(response.decode()) if int(mcversion.replace(u".",u"")) <= 132: exit() compat_versions = [i[0] for i in versions if i[1] == mcversion] version = compat_versions[0] print u"Using Build", version filename = u"minecraftforge-universal-{0}-{1}.zip".format(mcversion, version) if use_mirror(): fileurl = u"http://ken.wingedboot.com/forgemirror/files.minecraftforge.net/minecraftforge/" + filename else: fileurl = u"http://files.minecraftforge.net/minecraftforge/" + filename open(filename, u"wb").write(urllib2.urlopen(fileurl).read()) return filename def main(): app = QApplication(sys.argv) ex = mainApp() sys.exit(app.exec_()) if __name__ == u'__main__': main() Source (Python 3.x): import sys import os import glob import re import urllib.request import http.client as httplib import shutil import zipfile as z from PySide.QtGui import * from PySide.QtCore import * class mainApp(QMainWindow): def __init__(self): super(mainApp, self).__init__() self.initUI() def initUI(self): self.mwidget = mainWidget() self.setCentralWidget(self.mwidget) status = self.statusBar() status.showMessage("Idle.") # Set the title self.setWindowTitle("Minecraft Forge Installer") self.resize(450, 180) self.show() class mainWidget(QWidget): def __init__(self): super(mainWidget, self).__init__() self.initUI() def initUI(self): # Create widgets self.input_ent = QLineEdit(self) input_btn = QPushButton("Select minecraft.jar") input_btn.clicked.connect(self.getFile) self.minecraft_version_ent = QLineEdit(self) run_btn = QPushButton("Run") run_btn.clicked.connect(self.runEditMJar) # Create a layout vbox = QVBoxLayout() input_hbox = QHBoxLayout() input_hbox.addWidget(self.input_ent) input_hbox.addWidget(input_btn) vbox.addLayout(input_hbox) mversion_hbox = QHBoxLayout() mversion_hbox.addWidget(QLabel("Minecraft Version:")) mversion_hbox.addWidget(self.minecraft_version_ent) vbox.addLayout(mversion_hbox) vbox.addWidget(run_btn) # Show the window self.setLayout(vbox) self.show() def getFile(self): fname = QFileDialog.getOpenFileName(self, "minecraft.jar", ".", "Jar Files (*.jar)")[0] self.input_ent.clear() self.input_ent.insert(fname) def runEditMJar(self): fname = self.input_ent.displayText() version = self.minecraft_version_ent.displayText() if self.parentWidget().statusBar().currentMessage() == "Idle." and not os.path.exists("newzip"): self.sayWorking() QCoreApplication.processEvents() editJar(fname,version) self.sayDone() else: self.parentWidget().statusBar().showMessage("Action not allowed.", timeout=2000) def sayWorking(self): self.parentWidget().statusBar().showMessage("Editing Jar File.") def sayDone(self): self.parentWidget().statusBar().showMessage("Done.") def editJar(filename, mcversion): original = z.ZipFile(filename) basename = os.path.basename(filename).split(".")[0] forge_name = download_forge(mcversion) forge = z.ZipFile(forge_name) os.makedirs("newzip") original.extractall(path="newzip") forge.extractall(path="newzip") original.close() forge.close() for delfile in glob.glob("newzip/META-INF/MOJANG*"): os.remove(delfile) shutil.make_archive(basename, "zip", "newzip") backup = os.path.dirname(filename) + "/backup.jar" print("Backup: {0}, Filename: {1}".format(backup, filename)) shutil.move(filename, backup) shutil.move(basename + ".zip", filename) shutil.rmtree("newzip") os.remove(forge_name) def use_mirror(): connection = httplib.HTTPConnection("files.minecraftforge.net", 80) connection.request("OPTIONS", "*") try: response = connection.getresponse() return False except: return True def getversions(it): unp_versions = re.compile("Build [0-9].[0-9].[0-9].[0-9]*.*[0-9.]*").findall(it) p_versions = [] for build in unp_versions: splitone = build.split(":") p_versions.append((splitone[0].split(" ")[1], splitone[-1][1:])) return p_versions def download_forge(mcversion): using_mirror = use_mirror() if using_mirror: response = urllib.request.urlopen("http://ken.wingedboot.com/forgemirror/files.minecraftforge.net/").read() else: response = urllib.request.urlopen("http://files.minecraftforge.net/").read() versions = getversions(response.decode()) if int(mcversion.replace(".","")) <= 132: exit() compat_versions = [i[0] for i in versions if i[1] == mcversion] version = compat_versions[0] print("Using Build", version) filename = "minecraftforge-universal-{0}-{1}.zip".format(mcversion, version) if use_mirror(): fileurl = "http://ken.wingedboot.com/forgemirror/files.minecraftforge.net/minecraftforge/" + filename else: fileurl = "http://files.minecraftforge.net/minecraftforge/" + filename open(filename, "wb").write(urllib.request.urlopen(fileurl).read()) return filename def main(): app = QApplication(sys.argv) ex = mainApp() sys.exit(app.exec_()) if __name__ == '__main__': main() Binaries: Linux- http://www.mediafire.com/?0358nmaz8dgmp (7z, tar.gz, tar.xz) Windows Coming Soon
  3. Okay, I'll see what I can do. I'll have to port my scripts to Python 2, though. Maybe I'll try 3to2.
  4. Just get a clean minecraft.jar file (Currently at http://assets.minecraft.net/1_4_6/minecraft.jar ) then install a new version of forge again.
  5. What do you mean by idiot proof? If you really think it could be helpful I'd be happy to idiot-proof it by handling anything the user throws at it and adding a GUI. One step toward idiot-proof, this one will download forge: http://pastie.org/5606751 (Python 3.x) And a GUI: http://pastie.org/5608431
  6. Did you delete all of META-INF or just everything that started with MOJANG_C in META-INF?
  7. I recently wrote a python script which modifies the minecraft_server.jar and minecraft.jar files and I was wondering why something like this hasn't been done before. It took me a very long time to figure out how to install Minecraft Forge into the jar file because the file always became corrupted when I tried to do it. Therefore, I thought it would be easier if Minecraft Forge just provided some type of installer like the one below. Here are the files: Python 3.x: http://pastie.org/5602598 Python 2.7+: http://pastie.org/5602602 (The script works on both the client and the server)
  8. Thanks for the replies. It seems that updating to the latest version of minecraft and minecraft forge then using the IC2 beta worked perfectly.
  9. Yes, MultiMC can't connect to the file server either.
  10. It goes back to the Minecraft home screen (Single Player, Multiplayer, Mods, Options, etc)
  11. But it doesn't, I tried really hard to make it work...
  12. What do you mean, I have a very old version? It's just one before the newest and I must have it to use Industrial Craft (as it does not work on the newest version)
  13. For some reason it seems that I cannot play on an SMP server (of my own) with Minecraft Forge. I have Minecraft 1.4.5 with Minecraft Forge 6.4.2.448 (I have an older version of minecraft and forge because Industrial Craft doesn't support 1.4.6 yet). If it helps: I have Minecraft Forge and Industrial Craft on the Server. Here is the error: http://paste.ubuntu.com/1464781/ ...and a screenshot:
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.