Skip to content

Instantly share code, notes, and snippets.

@kennydude
Created December 15, 2011 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kennydude/1482353 to your computer and use it in GitHub Desktop.
Save kennydude/1482353 to your computer and use it in GitHub Desktop.
MCP Modifications

Hi, I have made some changes to MCP http://mcp.ocean-labs.de/

If you apply my changes, what you can do is:

  • Make a mods/YOURNAME folder and place any new Java files or PNG sprites and they will automatically work in Minecraft
  • Enable/Disable these folders

In the config, the mod called "kennydude" is switched on.

There is probably a lot to be changed (for example, I pulled in JSON parsing which may not be what you want).

{ "kennydude" : "on" }
# Top of file
import os, os.path, shutil
# At the end of readconf(self):
# Kennydude Edit! :D
import json
self.mods = json.load(open('conf/mods.cfg'))
# in recompile(self, side): (where if side == 0 appears)
if side == 0:
# mod packages
mods_added = []
for (mod, enabled) in self.mods.iteritems():
if os.path.exists(os.path.join("mods", mod)):
if enabled == "on" and mod not in mods_added:
mods_added.append(mod)
self.logger.debug("Adding *.java files for mod %s" % mod)
pkglist += os.path.join('mods', mod, '*.java') + ' '
self.logger.debug("Moving all PNG images for mod %s" % mod)
modpath = os.path.join("lib", mod)
if not os.path.exists(modpath):
os.makedirs(modpath)
for f in glob.glob(os.path.join('mods', mod, '*.png')):
shutil.copyfile(f, os.path.join(modpath, f.split(os.sep)[-1]))
else:
self.logger.warn("Mod %s doesn't exist on disk!" % mod)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment