本文整理匯總了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();
}
}
示例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;
}
}
示例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();
}
}
示例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;
}
示例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";
}
示例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 "";
}
示例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 "";
}
}
示例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";
}
示例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);
}
示例10: apply
import net.minecraftforge.fml.common.ModContainer; //導入方法依賴的package包/類
@Override
public String apply(ModContainer input)
{
return input.getName();
}
示例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";
}
示例12: getModName
import net.minecraftforge.fml.common.ModContainer; //導入方法依賴的package包/類
public String getModName() {
ModContainer container = identifyDonationItem();
return container != null? container.getName() : null;
}
示例13: getDisplayString
import net.minecraftforge.fml.common.ModContainer; //導入方法依賴的package包/類
public static String getDisplayString() {
ModContainer metadata = FMLInterface.getModContainer();
return metadata.getName() + " " + metadata.getVersion();
}