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

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

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

Configuration.getStringList介绍

暂无

代码示例

代码示例来源:origin: McJtyMods/LostCities

public static String[] getPrivateProfiles(Configuration cfg) {
  return cfg.getStringList("privateProfiles", CATEGORY_GENERAL,
      PRIVATE_PROFILES, PRIVATE_PROFILES_COMMENT);
}

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

private void initializeScannerSkippedBlocks() {
  String[] defaultSkippableBlocks = new String[] {"AncientWarfareStructure:gate_proxy",
      //skip gate proxy blocks by default... possibly some others that need skipping as well
  };
  defaultSkippableBlocks = config.getStringList("scanner_skipped_blocks", scanSkippedBlocks, defaultSkippableBlocks, "Blocks TO be skipped by structure scanner");
  Collections.addAll(scannerSkippedBlocks, defaultSkippableBlocks);
}

代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition

private static void loadBiomeBlacklist(ConfigurationHandler config) {
  biomesBlacklist.clear();
  String[] blacklist = config.config.getStringList("biome.blacklist", ConfigurationHandler.CATEGORY_ENTITIES + ".rogue_android", new String[]{"Hell", "Sky", "MushroomIsland", "MushroomIslandShore"}, "Rogue Android biome blacklist");
  for (String aBlacklist : blacklist) {
    biomesBlacklist.add(aBlacklist.toLowerCase());
  }
}

代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition

private static void loadBiomesWhitelist(ConfigurationHandler configurationHandler) {
  biomesWhitelist.clear();
  String[] whitelist = configurationHandler.config.getStringList("biome.whitelist", ConfigurationHandler.CATEGORY_ENTITIES + "." + "rogue_android", new String[0], "Rogue Android biome whitelist");
  for (String aWhitelist : whitelist) {
    biomesBlacklist.add(aWhitelist.toLowerCase());
  }
}

代码示例来源:origin: Vazkii/Quark

public DimensionConfig(String parent, boolean blacklist, String... defaultStrs) {
  String category = parent + ".dimensions";
  this.blacklist = ModuleLoader.config.getBoolean("Is Blacklist", category, blacklist, "");
  
  String[] dimStrs = ModuleLoader.config.getStringList("Dimensions", category, defaultStrs, "");
  dims = new ArrayList();
  for(String s : dimStrs)
    try {
      dims.add(Integer.parseInt(s));
    } catch(NumberFormatException e) {}
}

代码示例来源:origin: PrinceOfAmber/Cyclic

@Override
 public void syncConfig(Configuration config) {
  String category = Const.ConfigCategory.modpackMisc;
  String[] deflist = new String[] { "extracells:fluidcrafter",
    "extracells:ecbaseblock",
    "extracells:fluidfiller",
    "refinedstorage:disk_drive" };
  String[] blacklist = config.getStringList("SackHoldingBlacklist",
    category, deflist, "Containers that cannot be lifted up with the Empty Sack of Holding.  Use block id; for example minecraft:chest");
  blacklistAll = NonNullList.from("",
    blacklist);
 }
}

代码示例来源:origin: PrinceOfAmber/Cyclic

public static void syncConfig(Configuration config) {
  String category = Const.ConfigCategory.modpackMisc;
  String[] deflist = new String[0];
  String[] blacklist = config.getStringList("AutoUserTargetBlacklist",
    category, deflist, "Blocks in-world that cannot be targeted by the auto user.  Use block id; for example minecraft:chest");
  blacklistAll = NonNullList.from("",
    blacklist);
 }
}

代码示例来源:origin: Vazkii/Quark

public static List<BiomeDictionary.Type> parseBiomeTypeArrayConfig(String name, String category, BiomeDictionary.Type... biomes) {
  String[] defaultBiomes = Arrays.stream(biomes).<String>map(b -> b.getName()).toArray(i -> new String[i]);
  String[] readBiomes = ModuleLoader.config.getStringList(name, category, defaultBiomes, 
      "Biome Type List: https://github.com/MinecraftForge/MinecraftForge/blob/1.11.x/src/main/java/net/minecraftforge/common/BiomeDictionary.java#L44-L90\n"
      + "Types per Biome: https://github.com/MinecraftForge/MinecraftForge/blob/1.11.x/src/main/java/net/minecraftforge/common/BiomeDictionary.java#L402-L463");
  
  return Arrays.stream(readBiomes).map(s -> BiomeDictionary.Type.getType(s)).collect(Collectors.toList());
}

代码示例来源:origin: MatrexsVigil/harvestcraft

private void configureForFruit(String fruit, BlockPamSapling.SaplingType saplingType) {
  boolean enable = this.config.getBoolean("enableGeneration", fruit, true, "");
  int rarity = this.config.getInt("rarity", fruit, 20, 0, 100, "rarity range 0 ... 100, where 0 is common and 100 is rare");
  String[] biomesAllowed = new String[]{};
  if (saplingType == BlockPamSapling.SaplingType.TEMPERATE) {
    biomesAllowed = config.getStringList(WHITELIST, fruit, defaultTemperate, "temperate");
  } else if (saplingType == BlockPamSapling.SaplingType.COLD) {
    biomesAllowed = config.getStringList(WHITELIST, fruit, defaultCold, "cold");
  } else if (saplingType == BlockPamSapling.SaplingType.WARM) {
    biomesAllowed = config.getStringList(WHITELIST, fruit, defaultWarm, "warm");
  }
  TreeGenerationConfiguration treeGenerationConfiguration = new TreeGenerationConfiguration(fruit, enable, rarity, availableBiomes, biomesAllowed);
  treeConfigurations.add(treeGenerationConfiguration);
}

代码示例来源:origin: McJtyMods/TheOneProbe

private void configureProviders() {
  List<IProbeInfoProvider> providers = TheOneProbe.theOneProbeImp.getProviders();
  String[] defaultValues = new String[providers.size()];
  int i = 0;
  for (IProbeInfoProvider provider : providers) {
    defaultValues[i++] = provider.getID();
  }
  String[] sortedProviders = TheOneProbe.config.getStringList("sortedProviders", Config.CATEGORY_PROVIDERS, defaultValues, "Order in which providers should be used");
  String[] excludedProviders = TheOneProbe.config.getStringList("excludedProviders", Config.CATEGORY_PROVIDERS, new String[] {}, "Providers that should be excluded");
  Set<String> excluded = new HashSet<>();
  Collections.addAll(excluded, excludedProviders);
  TheOneProbe.theOneProbeImp.configureProviders(sortedProviders, excluded);
}

代码示例来源:origin: McJtyMods/TheOneProbe

private void configureEntityProviders() {
    List<IProbeInfoEntityProvider> providers = TheOneProbe.theOneProbeImp.getEntityProviders();
    String[] defaultValues = new String[providers.size()];
    int i = 0;
    for (IProbeInfoEntityProvider provider : providers) {
      defaultValues[i++] = provider.getID();
    }

    String[] sortedProviders = TheOneProbe.config.getStringList("sortedEntityProviders", Config.CATEGORY_PROVIDERS, defaultValues, "Order in which entity providers should be used");
    String[] excludedProviders = TheOneProbe.config.getStringList("excludedEntityProviders", Config.CATEGORY_PROVIDERS, new String[] {}, "Entity providers that should be excluded");
    Set<String> excluded = new HashSet<>();
    Collections.addAll(excluded, excludedProviders);

    TheOneProbe.theOneProbeImp.configureEntityProviders(sortedProviders, excluded);
  }
}

代码示例来源:origin: PrinceOfAmber/Cyclic

@Override
 public void syncConfig(Configuration config) {
  enabled = config.getBoolean("EnchantBeheading", Const.ConfigCategory.content, true, Const.ConfigCategory.contentDefaultText);
  this.percentDrop = config.getInt("BeheadingPercent", Const.ConfigCategory.modpackMisc, 10, 1, 100, "Percent chance that the beheading enchant will actually drop a head.");
  String[] defaultConf = new String[] { "roots:fairy-Elucent" };
  String[] mappings = config.getStringList("BeheadingExtraMobs", Const.ConfigCategory.modpackMisc, defaultConf, "By default Beheading works on vanilla mobs and player heads.  Add creatures from any other mod here along with a player name to act as the skin for the dropped head.  Format is: mod:monster-player, see the /summon command for mod data. ");
  for (String s : mappings) {
   if (s.contains("-")) {
    String[] spl = s.split("-");
    if (spl.length == 2) {
     mapResourceToSkin.put(spl[0], spl[1]);
    }
   }
  }
 }
}

代码示例来源:origin: PrinceOfAmber/Cyclic

@Override
 public void syncConfig(Configuration config) {
  enabled = config.getBoolean("PotionBeacon", Const.ConfigCategory.content, true, Const.ConfigCategory.contentDefaultText);
  TileEntityBeaconPotion.doesConsumePotions = config.getBoolean("PharosBeaconDoesConsumePotions", Const.ConfigCategory.modpackMisc, true, "Set to make Pharos Beacon free and perpetual, so it will not consume potions.  However if this set false, once it reads an effect from a potion, you must break and replace the beacon to wipe out its current effect. ");
  String[] defList = new String[] {
    "minecraft:instant_health",
    "minecraft:instant_damage",
    "minecraft:wither",
    "minecraft:poison"
  };
  String[] blacklist = config.getStringList("PharosBeaconBlacklist", Const.ConfigCategory.modpackMisc, defList, "Potions that are blacklisted from this beacon");
  TileEntityBeaconPotion.blacklist = Arrays.asList(blacklist);
 }
}

代码示例来源:origin: ForestryMC/ForestryMC

public String[] getStringListLocalized(String category, String name, String[] defaultValue) {
  String langKey = "for.config." + category + '.' + name;
  String commentKey = langKey + '.' + "comment";
  String comment = "";
  if (Translator.canTranslateToLocal(commentKey)) {
    comment = Translator.translateToLocal(commentKey);
  }
  return super.getStringList(name, category, defaultValue, comment);
}

代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition

@Override
  public void onConfigChanged(ConfigurationHandler config) {
    this.blackListedBlocks.clear();
    String[] blackListedBlocks = config.config.getStringList("teleport_blacklist", ConfigurationHandler.CATEGORY_ABILITIES, new String[]{"hellsand", "barrier", "bedrock"}, "The Unlocalized names of the blacklist blocks that the player can't teleport to");
    Collections.addAll(this.blackListedBlocks, blackListedBlocks);
    MAX_TELEPORT_HEIGHT_CHECK = config.getInt("teleport_max_height_check", ConfigurationHandler.CATEGORY_ABILITIES, 8, "The max height amount that the teleport ability checks if there is no 2 blocks air space");
    ENERGY_PER_TELEPORT = config.getInt("teleport_energy_cost", ConfigurationHandler.CATEGORY_ABILITIES, 4096, "The Energy cost of each Teleportation");
    MAX_TELEPORT_DISTANCE = config.getInt("teleport_max_distance", ConfigurationHandler.CATEGORY_ABILITIES, 32, "The maximum distance in blocks, the player can teleport to");
  }
}

代码示例来源:origin: PrinceOfAmber/Cyclic

@Override
 public void syncConfig(Configuration config) {
  enabled = config.getBoolean("MonsterBall", Const.ConfigCategory.content, true, Const.ConfigCategory.contentDefaultText);
  String category = Const.ConfigCategory.modpackMisc + ".magic_net";
  // @formatter:off
  String[] deflist = new String[] {
    "minecraft:wither"
    , "minecraft:ender_dragon"
    ,"minecraft:ender_crystal"
  };
  // @formatter:on
  String[] blacklist = config.getStringList("CaptureBlacklist",
    category, deflist, "Entities that cannot be captured.  (even without this, players and non-living entities do not work)");
  EntityMagicNetEmpty.blacklistIds = NonNullList.from("", blacklist);
 }
}

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

private static void config() {
  CONFIG_FLORBS.setConfiguration(new Configuration(new File(CoreProps.configDir, "cofh/" + ThermalExpansion.MOD_ID + "/florbs.cfg"), true));
  String category = "General";
  String comment = "If TRUE, the recipes for Florbs are enabled. Setting this to FALSE means that you actively dislike fun things.";
  enable = CONFIG_FLORBS.getConfiguration().getBoolean("EnableRecipe", category, enable, comment);
  category = "Blacklist";
  comment = "List of fluids that are not allowed to be placed in Florbs.";
  blacklist = CONFIG_FLORBS.getConfiguration().getStringList("Blacklist", category, blacklist, comment);
}

代码示例来源:origin: PrinceOfAmber/Cyclic

@Override
 public void syncConfig(Configuration config) {
  enabled = config.getBoolean("Prospector", Const.ConfigCategory.content, true, Const.ConfigCategory.contentDefaultText);
  String category = Const.ConfigCategory.modpackMisc;
  ItemProspector.range = config.getInt("ProspectorRange", category, 32, 2, 256, "Block Range it will search onclick");
  isBlacklist = config.getBoolean("ProspectorIsBlacklist", category, true, "True means this (ProspectorBlockList) is a blacklist, ignore whats listed. False means its a whitelist: only print whats listed.");
  String[] deflist = new String[] { "minecraft:air", "minecraft:grass", "minecraft:dirt/0", "minecraft:dirt/1", "minecraft:stone", "minecraft:gravel", "minecraft:sand", "minecraft:bedrock" };
  blocklist = config.getStringList("ProspectorBlockList", category, deflist, "List of blocks that the Prospector knows about.");
 }
}

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

private static void config() {
  CONFIG_MORBS.setConfiguration(new Configuration(new File(CoreProps.configDir, "cofh/" + ThermalExpansion.MOD_ID + "/morbs.cfg"), true));
  String category = "General";
  String comment = "If TRUE, the recipes for Morbs are enabled. Setting this to FALSE means that you actively dislike fun things and/or Pokemon tributes.";
  enable = CONFIG_MORBS.getConfiguration().getBoolean("EnableRecipe", category, enable, comment);
  category = "Blacklist";
  comment = "List of entities that are not allowed to be placed in Morbs. Mobs without spawn eggs are automatically disallowed.";
  blacklist = CONFIG_MORBS.getConfiguration().getStringList("Blacklist", category, blacklist, comment);
}

代码示例来源:origin: superckl/BiomeTweaker

public void loadValues(){
  this.includes = this.configFile.getStringList("Script Files", "Scripting", new String[] {},
      "A list of script files to include that are not in the scripts folder. An example script file is created along with this configuration file.");
  this.outputSeperateFiles = this.configFile.getBoolean("Output Seperate Files", "Output Files", true,
      "If true, BiomeTweaker will generate separate files for each item when creating the status report.");
  if(this.configFile.hasChanged())
    this.configFile.save();
}

相关文章