mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-28 07:55:53 +00:00
More tweaks to stuff: mod list, branding, more hooks
This commit is contained in:
1 parent
b1ee6c3c95
commit
7ec180ee7c
7 files changed
+326
-87
No files matched your search
@@ -16,6 +16,8 @@ package cpw.mods.fml.common;
|
||||
import java.io.File;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -403,4 +405,30 @@ public class FMLCommonHandler
|
||||
throw new RuntimeException(exception);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string
|
||||
* @return
|
||||
*/
|
||||
public String[] getBrandingStrings(String mcVersion)
|
||||
{
|
||||
ArrayList<String> brandings=new ArrayList<String>();
|
||||
brandings.add(mcVersion);
|
||||
brandings.add(Loader.instance().getFMLVersionString());
|
||||
try {
|
||||
brandings.add((String)Class.forName("forge.MinecraftForge").getMethod("getVersionString").invoke(null));
|
||||
} catch (Exception ex) {
|
||||
// Ignore- forge isn't loaded
|
||||
}
|
||||
try {
|
||||
Properties props=new Properties();
|
||||
props.load(FMLCommonHandler.class.getClassLoader().getResourceAsStream("fmlbranding.properties"));
|
||||
brandings.add(props.getProperty("fmlbranding"));
|
||||
} catch (Exception ex) {
|
||||
// Ignore - no branding file found
|
||||
}
|
||||
brandings.add(String.format("%d mod%s loaded",Loader.getModList().size(), Loader.getModList().size()>1?"s":""));
|
||||
Collections.reverse(brandings);
|
||||
return brandings.toArray(new String[brandings.size()]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -614,4 +614,12 @@ public class Loader
|
||||
}
|
||||
return ret.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getFMLVersionString()
|
||||
{
|
||||
return String.format("FML v%s.%s.%s.%s", major, minor, rev, build);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user