當前位置: 首頁>>代碼示例>>Java>>正文


Java ModContainer.getSource方法代碼示例

本文整理匯總了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);
}
 
開發者ID:cubex2,項目名稱:customstuff4,代碼行數:8,代碼來源:ModLoader.java

示例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");
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:9,代碼來源:FMLPreInitializationEvent.java

示例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;
}
 
開發者ID:LexManos,項目名稱:YUNoMakeGoodMap,代碼行數:38,代碼來源:PlatformCommand.java

示例4: FMLFileResourcePack

import net.minecraftforge.fml.common.ModContainer; //導入方法依賴的package包/類
public FMLFileResourcePack(ModContainer container)
{
    super(container.getSource());
    this.container = container;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:6,代碼來源:FMLFileResourcePack.java

示例5: FMLFolderResourcePack

import net.minecraftforge.fml.common.ModContainer; //導入方法依賴的package包/類
public FMLFolderResourcePack(ModContainer container)
{
    super(container.getSource());
    this.container = container;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:6,代碼來源:FMLFolderResourcePack.java

示例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.");
    }
}
 
開發者ID:purpleposeidon,項目名稱:Factorization,代碼行數:47,代碼來源:Core.java


注:本文中的net.minecraftforge.fml.common.ModContainer.getSource方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。