net.minecraftforge.common.config.Configuration.getCategoryNames()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(140)

本文整理了Java中net.minecraftforge.common.config.Configuration.getCategoryNames()方法的一些代码示例,展示了Configuration.getCategoryNames()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.getCategoryNames()方法的具体详情如下:
包路径:net.minecraftforge.common.config.Configuration
类名称:Configuration
方法名:getCategoryNames

Configuration.getCategoryNames介绍

暂无

代码示例

代码示例来源:origin: CoFH/CoFHCore

public Set<String> getCategoryNames() {
  return modConfiguration.getCategoryNames();
}

代码示例来源:origin: SquidDev-CC/plethora

@SuppressWarnings("rawtypes")
  private static List<IConfigElement> getConfigElements(Configuration config) {
    ArrayList<IConfigElement> elements = new ArrayList<>();
    for (String category : config.getCategoryNames()) {
      if (!category.contains(".")) {
        elements.add(new ConfigElement(config.getCategory(category)));
      }
    }
    return elements;
  }
}

代码示例来源:origin: Funwayguy/BetterQuesting

public static List<IConfigElement> getCategories(Configuration config)
  {
    List<IConfigElement> cats = new ArrayList<>();
    
    for(String s : config.getCategoryNames())
    {
      cats.add(new ConfigElement(config.getCategory(s)));
    }
    
    return cats;
  }
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

for( String category : configurartion.getCategoryNames() )

代码示例来源:origin: iLexiconn/LLibrary

public ConfigGUI(GuiScreen parent, Object mod, Configuration config, String parentName) {
  this.parent = parent;
  this.parentName = parentName;
  if (!mod.getClass().isAnnotationPresent(Mod.class)) {
    throw new RuntimeException("@Mod annotation not found in class " + mod + "!");
  }
  this.mod = mod.getClass().getAnnotation(Mod.class);
  if (config != null) {
    this.categories.addAll(config.getCategoryNames().stream()
        .map(config::getCategory)
        .filter(category -> category.size() > 0)
        .map(category -> {
          List<ConfigProperty> configProperties = new ArrayList<>();
          for (Property property : category.values()) {
            ConfigProperty configProperty = ForgeConfigProperty.factory(property);
            if (configProperty != null) {
              configProperties.add(configProperty);
            }
          }
          return new ConfigCategory(category.getQualifiedName(), configProperties);
        })
        .collect(Collectors.toList()));
  }
}

代码示例来源:origin: Glitchfiend/ToughAsNails

private static List<IConfigElement> getConfigElements()
  {
    List<IConfigElement> list = new ArrayList<IConfigElement>();

    for (ConfigHandler handler : ModConfig.configHandlers)
    {
      List<IConfigElement> configChildCategories = Lists.newArrayList();

      for (String categoryName : handler.config.getCategoryNames())
      {
        ConfigCategory category = handler.config.getCategory(categoryName);
        List<IConfigElement> elements = new ConfigElement(category).getChildElements();

        configChildCategories.add(new DummyConfigElement.DummyCategoryElement(WordUtils.capitalize(categoryName), "", elements));
      }

      list.add(new DummyConfigElement.DummyCategoryElement(handler.description, "", configChildCategories));
    }

    return list;
  }
}

代码示例来源:origin: RS485/LogisticsPipes

@Override
public void sendNameUpdateRequest(EntityPlayer player) {
  for (String category : langDatabase.getCategoryNames()) {
    if (!category.startsWith("itemNames.")) {
      continue;
    }
    String name = langDatabase.get(category, "name", "").getString();
    if (name.equals("")) {
      String itemPart = category.substring(10);
      String metaPart = "0";
      if (itemPart.contains(".")) {
        String[] itemPartSplit = itemPart.split("\\.");
        itemPart = itemPartSplit[0];
        metaPart = itemPartSplit[1];
      }
      int id = Integer.valueOf(itemPart);
      int meta = Integer.valueOf(metaPart);
      SimpleServiceLocator.serverBufferHandler.addPacketToCompressor(PacketHandler.getPacket(UpdateName.class).setIdent(ItemIdentifier.get(Item.getItemById(id), meta, null)).setName("-"), player);
    }
  }
}

代码示例来源:origin: Glitchfiend/FamiliarFauna

private static List<IConfigElement> getConfigElements()
  {
    List<IConfigElement> list = new ArrayList<IConfigElement>();

    List<IConfigElement> configChildCategories = Lists.newArrayList();

    for (String categoryName : ConfigurationHandler.config.getCategoryNames())
    {
      ConfigCategory category = ConfigurationHandler.config.getCategory(categoryName);
      List<IConfigElement> elements = new ConfigElement(category).getChildElements();

      configChildCategories.add(new DummyConfigElement.DummyCategoryElement(WordUtils.capitalize(categoryName), "", elements));
    }

    list.add(new DummyConfigElement.DummyCategoryElement(I18n.translateToLocal("config.category.mobSettings.title"), "", configChildCategories));

    return list;
  }
}

相关文章