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


Java ModContainer.getName方法代碼示例

本文整理匯總了Java中net.minecraftforge.fml.common.ModContainer.getName方法的典型用法代碼示例。如果您正苦於以下問題:Java ModContainer.getName方法的具體用法?Java ModContainer.getName怎麽用?Java ModContainer.getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraftforge.fml.common.ModContainer的用法示例。


在下文中一共展示了ModContainer.getName方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: IGWSupportNotifier

import net.minecraftforge.fml.common.ModContainer; //導入方法依賴的package包/類
/**
 * Needs to be instantiated somewhere in your mod's loading stage.
 */
public IGWSupportNotifier() {
    if (FMLCommonHandler.instance().getSide() == Side.CLIENT && !Loader.isModLoaded("IGWMod")) {
        File dir = new File(".", "config");
        Configuration config = new Configuration(new File(dir, "IGWMod.cfg"));
        config.load();

        if (config.get(Configuration.CATEGORY_GENERAL, "enable_missing_notification", true, "When enabled, this will notify players when IGW-Mod is not installed even though mods add support.").getBoolean()) {
            ModContainer mc = Loader.instance().activeModContainer();
            String modid = mc.getModId();
            List<ModContainer> loadedMods = Loader.instance().getActiveModList();
            for (ModContainer container : loadedMods) {
                if (container.getModId().equals(modid)) {
                    supportingMod = container.getName();
                    MinecraftForge.EVENT_BUS.register(this);
                    ClientCommandHandler.instance.registerCommand(new CommandDownloadIGW());
                    break;
                }
            }
        }
        config.save();
    }
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:26,代碼來源:IGWSupportNotifier.java

示例2: getModNameFromID

import net.minecraftforge.fml.common.ModContainer; //導入方法依賴的package包/類
/** Get the name of a mod from its mod ID (non-case sensitive) */
public static String getModNameFromID(String modid) {
	modid = modid.toLowerCase();
	if(modid.equals("minecraft")) return "Minecraft";
	if(nameCache.containsKey(modid)) {
		return nameCache.get(modid);
	} else {
		List<ModContainer> modlist = Loader.instance().getModList();
		for(ModContainer m : modlist) {
			if(m.getModId().toLowerCase().equals(modid)) {
				nameCache.put(modid, m.getName());
				return m.getName();
			}
		}
		return ERROR;
	}
}
 
開發者ID:sblectric,項目名稱:EverythingBlocks,代碼行數:18,代碼來源:ForgeUtils.java

示例3: IGWSupportNotifier

import net.minecraftforge.fml.common.ModContainer; //導入方法依賴的package包/類
/**
 * Needs to be instantiated somewhere in your mod's loading stage.
 */
public IGWSupportNotifier(){
    if(FMLCommonHandler.instance().getSide() == Side.CLIENT && !Loader.isModLoaded("IGWMod")) {
        File dir = new File(".", "config");
        Configuration config = new Configuration(new File(dir, "IGWMod.cfg"));
        config.load();

        if(config.get(Configuration.CATEGORY_GENERAL, "enable_missing_notification", true, "When enabled, this will notify players when IGW-Mod is not installed even though mods add support.").getBoolean()) {
            ModContainer mc = Loader.instance().activeModContainer();
            String modid = mc.getModId();
            List<ModContainer> loadedMods = Loader.instance().getActiveModList();
            for(ModContainer container : loadedMods) {
                if(container.getModId().equals(modid)) {
                    supportingMod = container.getName();
                    MinecraftForge.EVENT_BUS.register(this);
                    ClientCommandHandler.instance.registerCommand(new CommandDownloadIGW());
                    break;
                }
            }
        }
        config.save();
    }
}
 
開發者ID:Keridos,項目名稱:FloodLights,代碼行數:26,代碼來源:IGWSupportNotifier.java

示例4: getModNameFromID

import net.minecraftforge.fml.common.ModContainer; //導入方法依賴的package包/類
public static String getModNameFromID(String modid)
{
	String result = "Unknown";

	for (ModContainer mod : Loader.instance().getModList())
	{
		if (mod.getModId().equals(modid))
		{
			result = mod.getName();
			break;
		}
	}

	return result;
}
 
開發者ID:orbwoi,項目名稱:UniversalRemote,代碼行數:16,代碼來源:Util.java

示例5: getModName

import net.minecraftforge.fml.common.ModContainer; //導入方法依賴的package包/類
@Nonnull
public static String getModName(@Nonnull final String modId) {
	if ("minecraft".equalsIgnoreCase(modId))
		return "Minecraft";
	final ModContainer cont = findModContainer(modId);
	return cont != null ? cont.getName() : "UNKNOWN";
}
 
開發者ID:OreCruncher,項目名稱:DynamicSurroundings,代碼行數:8,代碼來源:ForgeUtils.java

示例6: getModName

import net.minecraftforge.fml.common.ModContainer; //導入方法依賴的package包/類
private String getModName(String modId) {
    for (ModContainer container : Loader.instance().getModList()) {
        if(container.getModId().toLowerCase().equals(modId.toLowerCase()))
            return container.getName();
    }
    return "";
}
 
開發者ID:Creysys,項目名稱:GuideBook,代碼行數:8,代碼來源:GuideBookGui.java

示例7: getModNameFromItem

import net.minecraftforge.fml.common.ModContainer; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
private static String getModNameFromItem(ItemStack stack) {
    try {
        ResourceLocation resource = GameData.getItemRegistry().getNameForObject(stack.getItem());
        ModContainer mod = findModContainer(resource.getResourceDomain());
        return mod == null ? "Minecraft" : mod.getName();
    }
    catch (NullPointerException e) {
        return "";
    }
}
 
開發者ID:fabbe50,項目名稱:TFICore,代碼行數:12,代碼來源:SpecialDropRegistry.java

示例8: getModName

import net.minecraftforge.fml.common.ModContainer; //導入方法依賴的package包/類
/**
 * Attempts to get the name of the mod which registered the entity. Minecraft will be
 * returned for vanilla content while Unknown will be used for invalid cases.
 *
 * @param entity The entity to get the mod name for.
 * @return The name of the mod which registered the entity.
 */
public static String getModName (Entity entity) {
    if (entity == null)
        return "Unknown";
    final EntityRegistration reg = EntityRegistry.instance().lookupModSpawn(entity.getClass(), false);
    if (reg != null) {
        final ModContainer mod = reg.getContainer();
        if (mod != null)
            return mod.getName();
        return "Unknown";
    }
    return "Minecraft";
}
 
開發者ID:MinecraftModDevelopmentMods,項目名稱:MMDLib-old,代碼行數:20,代碼來源:ModUtils.java

示例9: addUpdateToList

import net.minecraftforge.fml.common.ModContainer; //導入方法依賴的package包/類
public static void addUpdateToList(ModContainer mod, VersionContainer.Version version)
{
    Update update = new Update(mod.getModId());
    update.displayName = mod.getName();
    update.oldVersion = mod.getVersion();
    update.newVersion = version.getModVersion();

    if (version.getUpdateURL() != null && !version.getUpdateURL().isEmpty())
    {
        update.updateURL = version.getUpdateURL();
    }
    update.isDirectLink = version.isDirectLink();

    if (!version.getChangeLog().isEmpty())
    {
        StringBuilder builder = new StringBuilder();
        for (String changeLogLine : version.getChangeLog())
        {
            builder.append(changeLogLine).append("\n");
        }
        update.changeLog = builder.toString();
    }

    if (version.getNewFileName() != null && !version.getNewFileName().isEmpty())
    {
        update.newFileName = version.getNewFileName();
    }

    UpdateHandler.addUpdate(update);
}
 
開發者ID:Dynious,項目名稱:VersionChecker,代碼行數:31,代碼來源:UpdateChecker.java

示例10: apply

import net.minecraftforge.fml.common.ModContainer; //導入方法依賴的package包/類
@Override
public String apply(ModContainer input)
{
    return input.getName();
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:6,代碼來源:ModNameFunction.java

示例11: getModName

import net.minecraftforge.fml.common.ModContainer; //導入方法依賴的package包/類
/**
 * Gets the name of a mod that registered the entity. Due to Entity not using
 * IForgeRegistryEntry.Impl a special method is required.
 *
 * @param entity The entity to get the mod name for.
 * @return String The name of the mod that registered the entity.
 */
public static String getModName (Entity entity) {

    if (entity == null) {
        return "Unknown";
    }

    final EntityRegistration reg = getRegistryInfo(entity);

    if (reg != null) {

        final ModContainer mod = reg.getContainer();

        if (mod != null) {
            return mod.getName();
        }

        return "Unknown";
    }

    return "Minecraft";
}
 
開發者ID:Darkhax-Minecraft,項目名稱:Bookshelf,代碼行數:29,代碼來源:ModUtils.java

示例12: getModName

import net.minecraftforge.fml.common.ModContainer; //導入方法依賴的package包/類
public String getModName() {
	ModContainer container = identifyDonationItem();
	return container != null? container.getName() : null;
}
 
開發者ID:OpenMods,項目名稱:OpenBlocks,代碼行數:5,代碼來源:TileEntityDonationStation.java

示例13: getDisplayString

import net.minecraftforge.fml.common.ModContainer; //導入方法依賴的package包/類
public static String getDisplayString() {
	ModContainer metadata = FMLInterface.getModContainer();
   	return metadata.getName() + " " + metadata.getVersion();
}
 
開發者ID:lawremi,項目名稱:CustomOreGen,代碼行數:5,代碼來源:FMLInterface.java


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