Java 类cpw.mods.fml.common.DummyModContainer 实例源码
项目:TRHS_Club_Mod_2016
文件:FMLClientHandler.java
private void detectOptifine()
{
try
{
Class<?> optifineConfig = Class.forName("Config", false, Loader.instance().getModClassLoader());
String optifineVersion = (String) optifineConfig.getField("VERSION").get(null);
Map<String,Object> dummyOptifineMeta = ImmutableMap.<String,Object>builder().put("name", "Optifine").put("version", optifineVersion).build();
ModMetadata optifineMetadata = MetadataCollection.from(getClass().getResourceAsStream("optifinemod.info"),"optifine").getMetadataForId("optifine", dummyOptifineMeta);
optifineContainer = new DummyModContainer(optifineMetadata);
FMLLog.info("Forge Mod Loader has detected optifine %s, enabling compatibility features",optifineContainer.getVersion());
}
catch (Exception e)
{
optifineContainer = null;
}
}
项目:TFC-Tweaks
文件:Helper.java
/**
* We must force the following load order, otherwise many things break:
* - TFC
* - This mod
* - Anything else
*/
public static void doLoadOrderHaxing()
{
File injectedDepFile = new File(Loader.instance().getConfigDir(), "injectedDependencies.json");
JsonArray deps = new JsonArray();
JsonObject dep = new JsonObject();
dep.addProperty("type", "after");
dep.addProperty("target", TFC);
deps.add(dep);
for (ModContainer container : Loader.instance().getModList())
{
if (container instanceof DummyModContainer || container instanceof InjectedModContainer) continue;
String modid = container.getModId();
if (modid.equals(MODID) || modid.equals(TFC)) continue;
dep = new JsonObject();
dep.addProperty("type", "before");
dep.addProperty("target", modid);
deps.add(dep);
}
JsonArray root = new JsonArray();
JsonObject mod = new JsonObject();
mod.addProperty("modId", MODID);
mod.add("deps", deps);
root.add(mod);
try
{
FileUtils.write(injectedDepFile, GSON.toJson(root));
}
catch (IOException e)
{
throw new RuntimeException(e);
}
}
项目:Elite-Armageddon
文件:EAPluginContainer.java
public EAPluginContainer(File file)
{
ModMetadata stub = new ModMetadata();
stub.modId = file.getName().toLowerCase();
stub.name = file.getName();
stub.version = "eaLua Compatible Plugin 1.0";
this.container = (ModContainer)new DummyModContainer(stub);
}
项目:BetterLoadingScreen_1.7
文件:ProgressDisplayer.java
public static void start(File coremodLocation) {
LoadingFrame.setSystemLAF();
coreModLocation = coremodLocation;
if (coreModLocation == null)
coreModLocation = new File("./../bin/");
// Assume this is a dev environment, and that the build dir is in bin, and the test dir has the same parent as
// the bin dir...
ModMetadata md = new ModMetadata();
md.name = Lib.Mod.NAME;
md.modId = Lib.Mod.ID;
modContainer = new DummyModContainer(md) {
@Override
public Class<?> getCustomResourcePackClass() {
return FMLFileResourcePack.class;
}
@Override
public File getSource() {
return coreModLocation;
}
@Override
public String getModId() {
return Lib.Mod.ID;
}
};
File fileOld = new File("./config/betterloadingscreen.cfg");
File fileNew = new File("./config/BetterLoadingScreen/config.cfg");
if (fileOld.exists())
cfg = new Configuration(fileOld);
else
cfg = new Configuration(fileNew);
boolean useMinecraft = isClient();
if (useMinecraft) {
String comment =
"Whether or not to use minecraft's display to show the progress. This looks better, but there is a possibilty of not being ";
comment += "compatible, so if you do have any strange crash reports or compatability issues, try setting this to false";
useMinecraft = cfg.getBoolean("useMinecraft", "general", true, comment);
}
connectExternally = cfg.getBoolean("connectExternally", "general", true, "If this is true, it will conect to drone.io to get a changelog");
playSound = cfg.getBoolean("playSound", "general", true, "Play a sound after minecraft has finished starting up");
if (useMinecraft)
displayer = new MinecraftDisplayerWrapper();
else if (!GraphicsEnvironment.isHeadless())
displayer = new FrameDisplayer();
else
displayer = new LoggingDisplayer();
displayer.open(cfg);
cfg.save();
}