Skip to content

Instantly share code, notes, and snippets.

@killjoy1221
Created May 28, 2015 02:55
Show Gist options
  • Save killjoy1221/e20b8e7f44b49045ca38 to your computer and use it in GitHub Desktop.
Save killjoy1221/e20b8e7f44b49045ca38 to your computer and use it in GitHub Desktop.
private void loadUtils() {
ModContainer thisCont = FMLCommonHandler.instance().findContainerFor(this);
String str = Color.class.getProtectionDomain().getCodeSource().getLocation().toString();
str = str.replace("/" + Color.class.getCanonicalName().replace('.', '/').concat(".class"), "");
str = str.replace('\\', '/');
System.out.println(str);
if (str.endsWith("!")) {
str = str.substring(0, str.length() - 1);
}
System.out.println(str);
if (str.startsWith("jar:")) {
str = str.substring(4);
}
System.out.println(str);
if (str.startsWith("file:/")) {
str = str.substring(6);
}
File source = new File(str);
System.out.println(source);
System.out.println(source.exists());
ModContainer container = new InjectedModContainer(thisCont, source) {
@Override
public String getName() {
return "Mnm Utils";
}
};
FMLCommonHandler.instance().addModToResourcePack(container);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment