本文整理匯總了Java中net.minecraftforge.fml.common.ModContainer.getSource方法的典型用法代碼示例。如果您正苦於以下問題:Java ModContainer.getSource方法的具體用法?Java ModContainer.getSource怎麽用?Java ModContainer.getSource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraftforge.fml.common.ModContainer
的用法示例。
在下文中一共展示了ModContainer.getSource方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createHelper
import net.minecraftforge.fml.common.ModContainer; //導入方法依賴的package包/類
private static ContentHelper createHelper(CS4Mod mod)
{
ModContainer container = FMLCommonHandler.instance().findContainerFor(mod);
File modDirectory = container.getSource();
return new ContentHelperImpl(container.getModId(), modDirectory);
}
示例2: applyModContainer
import net.minecraftforge.fml.common.ModContainer; //導入方法依賴的package包/類
@Override
public void applyModContainer(ModContainer activeContainer)
{
this.modContainer = activeContainer;
this.modMetadata = activeContainer.getMetadata();
this.sourceFile = activeContainer.getSource();
this.suggestedConfigFile = new File(configurationDir, activeContainer.getModId()+".cfg");
}
示例3: getPlatforms
import net.minecraftforge.fml.common.ModContainer; //導入方法依賴的package包/類
protected List<ResourceLocation> getPlatforms()
{
if (platforms.size() == 0)
{
for (ModContainer mc : Loader.instance().getModList())
{
File src = mc.getSource();
if (src == null)
continue;
InputStream is = getClass().getResourceAsStream("/assets/" + mc.getModId() + "/structures/sky_block_platforms.txt");
if (is == null)
continue;
try
{
for (String line : CharStreams.readLines(new InputStreamReader(is)))
{
if (getClass().getResourceAsStream("/assets/" + mc.getModId() + "/structures/" + line + ".nbt") != null)
platforms.add(new ResourceLocation(mc.getModId(), line));
}
} catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
for (File f : YUNoMakeGoodMap.instance.getStructFolder().listFiles())
{
if (!f.isFile() || !f.getName().endsWith(".nbt"))
continue;
platforms.add(new ResourceLocation("/config/", f.getName().substring(0, f.getName().length() - 4)));
}
}
return platforms;
}
示例4: FMLFileResourcePack
import net.minecraftforge.fml.common.ModContainer; //導入方法依賴的package包/類
public FMLFileResourcePack(ModContainer container)
{
super(container.getSource());
this.container = container;
}
示例5: FMLFolderResourcePack
import net.minecraftforge.fml.common.ModContainer; //導入方法依賴的package包/類
public FMLFolderResourcePack(ModContainer container)
{
super(container.getSource());
this.container = container;
}
示例6: checkJar
import net.minecraftforge.fml.common.ModContainer; //導入方法依賴的package包/類
public static void checkJar() {
// Was necessary in 1.7. Is this still needed in 1.8?
if (checked) return;
checked = true;
// Apparently some people somehow manage to get "Factorization.jar.zip", which somehow breaks the coremod.
if (Core.dev_environ) {
Core.logSevere("Dev environ; skipping jar check.");
return;
}
if (Boolean.parseBoolean(System.getProperty("fz.dontCheckJar"))) {
Core.logSevere("checkJar disabled by system property");
return;
}
ModContainer mod = FMLCommonHandler.instance().findContainerFor(modId);
if (mod == null) {
Core.logSevere("I don't have a mod container? Wat?");
return;
}
final File src = mod.getSource();
if (src == null) {
Core.logSevere("mod has null source!");
return;
}
if (src.isDirectory()) {
throw new RuntimeException("Factorization jar has been unpacked into a directory. Don't do that. Just put Factorization.jar in the mods/ folder");
}
final String path = src.getPath();
if (!isBadName(path)) {
Core.logSevere("Mod jar seems to have a valid filename");
return;
}
String correctName = path.replaceAll("\\.zip$", ".jar");
if (isBadName(correctName)) {
// Carefully ensure we don't make a loop
Core.logSevere("Failed to fix filename? " + path + " didn't work when changed to " + correctName);
return;
}
Core.logSevere("The factorization jar is improperly named! Renaming " + path + " to " + correctName);
boolean success = src.renameTo(new File(correctName));
if (success) {
throw new RuntimeException("The Factorization jar had an improper file extension. It has been renamed. Please restart Minecraft.");
} else {
throw new RuntimeException("The Factorization jar has an improper file extension; it should be a .jar, not a .zip, and not a .jar.zip.");
}
}