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

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

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

Configuration.getBoolean介绍

暂无

代码示例

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

/**
 * Constructor using the configuration. Apparently there are some race conditions if constructing configurations on
 * multiple file accesses
 *
 * @param config to be wrapped configuration.
 */
public ForgeExportConfig( @Nonnull final Configuration config )
{
  this.config = Preconditions.checkNotNull( config );
  this.exportItemNamesEnabled = this.config.getBoolean( EXPORT_ITEM_NAMES_KEY, GENERAL_CATEGORY, EXPORT_ITEM_NAMES_DEFAULT,
      EXPORT_ITEM_NAMES_DESCRIPTION );
  this.cacheEnabled = this.config.getBoolean( ENABLE_CACHE_KEY, CACHE_CATEGORY, ENABLE_CACHE_DEFAULT, ENABLE_CACHE_DESCRIPTION );
  this.additionalInformationEnabled = this.config.getBoolean( ENABLE_ADDITIONAL_INFO_KEY, GENERAL_CATEGORY, ENABLE_ADDITIONAL_INFO_DEFAULT,
      ENABLE_ADDITIONAL_INFO_DESCRIPTION );
  this.cache = this.config.getString( DIGEST_KEY, CACHE_CATEGORY, DIGEST_DEFAULT, DIGEST_DESCRIPTION );
  this.forceRefreshEnabled = this.config.getBoolean( ENABLE_FORCE_REFRESH_KEY, GENERAL_CATEGORY, ENABLE_FORCE_REFRESH_DEFAULT,
      ENABLE_FORCE_REFRESH_DESCRIPTION );
}

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

/**
 * @param file requires fully qualified file in which the config is saved
 */
public VersionCheckerConfig( @Nonnull final File file )
{
  Preconditions.checkNotNull( file );
  Preconditions.checkState( !file.isDirectory() );
  this.config = new Configuration( file );
  // initializes default values by caching
  this.isEnabled = this.config.getBoolean( "enabled", "general", true, "If true, the version checker is enabled. Acts as a master switch." );
  this.lastCheck = this.config.getString( "lastCheck", "cache", "0",
      "The number of milliseconds since January 1, 1970, 00:00:00 GMT of the last successful check." );
  this.interval = this.config.getInt( "interval", "cache", DEFAULT_INTERVAL_HOURS, MIN_INTERVAL_HOURS, MAX_INTERVAL_HOURS,
      "Waits as many hours, until it checks again." );
  this.level = this.config.getString( "level", "channel", "Beta",
      "Determines the channel level which should be checked for updates. Can be either Stable, Beta or Alpha." );
  this.shouldNotifyPlayer = this.config.getBoolean( "notify", "client", true,
      "If true, the player is getting a notification, that a new version is available." );
  this.shouldPostChangelog = this.config.getBoolean( "changelog", "client", true,
      "If true, the player is getting a notification including changelog. Only happens if notification are enabled." );
}

代码示例来源: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: Vazkii/Quark

@Override
public void setupConfig(String category) {
  slimeBlockChance = ModuleLoader.config.getInt("Slime Block Chance", category, 12, 0, Integer.MAX_VALUE, "The higher, the less slime blocks will spawn");
  waterFloor = ModuleLoader.config.getBoolean("Enable Water Floor", category, true, "");
}

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

@Override
public void setupConfig(String category) {
  stalagmiteChance = ModuleLoader.config.getInt("Stalagmite Chance", category, 60, 0, Integer.MAX_VALUE, "The higher, the less stalagmites will spawn");
  usePackedIce = ModuleLoader.config.getBoolean("Use Packed Ice", category, true, "");
}

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

public static void config() {
  String category = "Tome.Experience";
  String comment = "If TRUE, the recipe for the Tome of Knowledge is enabled. Set this to FALSE only if you know what you are doing and/or want to create needless inconvenience.";
  enable = ThermalFoundation.CONFIG.getConfiguration().getBoolean("EnableRecipe", category, enable, comment);
}

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

public static void config() {
  String category = "Fluid.Cryotheum";
  String comment;
  comment = "If TRUE, Fluid Cryotheum will be worse than lava, except cold.";
  effect = ThermalFoundation.CONFIG.getConfiguration().getBoolean("Effect", category, effect, comment);
  comment = "If TRUE, Fluid Cryotheum Source blocks will gradually fall downwards.";
  enableSourceFall = ThermalFoundation.CONFIG.getConfiguration().getBoolean("Fall", category, enableSourceFall, comment);
}

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

public static void config() {
  String category = "Lexicon";
  String comment;
  comment = "If TRUE, a WHITELIST is used, if FALSE, a BLACKLIST is used.";
  isWhitelist = ThermalFoundation.CONFIG.getConfiguration().getBoolean("UseWhiteList", category, isWhitelist, comment);
  comment = "If TRUE, a default list will be generated depending on your list setting. This will ONLY generate if no list file already exists OR the Always Generate option is enabled.";
  writeDefaultFile = ThermalFoundation.CONFIG.getConfiguration().getBoolean("GenerateDefaultList", category, writeDefaultFile, comment);
  comment = "If TRUE, a default list will generate EVERY time. Enable this if you are satisfied with the default filtering and are adding/removing mods.";
  alwaysWriteFile = ThermalFoundation.CONFIG.getConfiguration().getBoolean("AlwaysGenerateList", category, alwaysWriteFile, comment);
  comment = "If TRUE, all entries will be echoed to the system LOG.";
  logEntries = ThermalFoundation.CONFIG.getConfiguration().getBoolean("LogEntries", category, logEntries, comment);
}

代码示例来源:origin: WayofTime/BloodMagic

public void syncConfig() {
  config.addCustomCategoryComment("rituals", "Toggles for all rituals");
  rituals.forEach((k, v) -> config.getBoolean(k, "rituals", true, "Enable the " + k + " ritual."));
  imperfectRituals.forEach((k, v) -> config.getBoolean(k, "rituals.imperfect", true, "Enable the " + k + " imperfect ritual."));
  config.save();
}

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

@Override
public void setupConfig(String category) {
  stalactiteChance = ModuleLoader.config.getInt("Stalactite Chance", category, 10, 0, Integer.MAX_VALUE, "The higher, the less stalactites will spawn");
  chiseledSandstoneChance = ModuleLoader.config.getInt("Chiseled Sandstone Chance", category, 10, 0, Integer.MAX_VALUE, "The higher, the less chiseled sandstone will spawn");
  deadBushChance = ModuleLoader.config.getInt("Dead Bush Chance", category, 20, 0, Integer.MAX_VALUE, "The higher, the less dead bushes will spawn");
  enableSand = ModuleLoader.config.getBoolean("Enable Sand Floors", category, true, "");
  allowGenInMesa = ModuleLoader.config.getBoolean("Allow in Mesa biomes", category, false, "");
}

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

public static void config() {
  String category = "Fluid.Aerotheum";
  String comment;
  comment = "If TRUE, Fluid Aerotheum will slow and redirect entities on contact.";
  effect = ThermalFoundation.CONFIG.getConfiguration().getBoolean("Effect", category, effect, comment);
  comment = "If TRUE, Fluid Aerotheum Source blocks will dissipate back into air above a given y-value.";
  enableSourceDissipate = ThermalFoundation.CONFIG.getConfiguration().getBoolean("Dissipate", category, enableSourceDissipate, comment);
  comment = "If TRUE, Fluid Aerotheum Source blocks will gradually float upwards.";
  enableSourceFloat = ThermalFoundation.CONFIG.getConfiguration().getBoolean("Float", category, enableSourceFloat, comment);
  comment = "This adjusts the y-value where Fluid Aerotheum will *always* dissipate, if that is enabled.";
  maxHeight = ThermalFoundation.CONFIG.getConfiguration().getInt("MaxHeight", category, maxHeight, maxHeight / 2, maxHeight * 2, comment);
}

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

public static void config() {
  String category = "Fluid.Glowstone";
  String comment;
  comment = "If TRUE, Fluid Glowstone will provide buffs to entities on contact.";
  effect = ThermalFoundation.CONFIG.getConfiguration().getBoolean("Effect", category, effect, comment);
  comment = "If TRUE, Fluid Glowstone Source blocks will condense back into solid Glowstone above a given y-value.";
  enableSourceCondense = ThermalFoundation.CONFIG.getConfiguration().getBoolean("Condense", category, enableSourceCondense, comment);
  comment = "If TRUE, Fluid Glowstone Source blocks will gradually float upwards.";
  enableSourceFloat = ThermalFoundation.CONFIG.getConfiguration().getBoolean("Float", category, enableSourceFloat, comment);
  comment = "This adjusts the y-value where Fluid Glowstone will *always* condense, if that is enabled. It will also condense above 80% of this value, if it cannot flow.";
  maxHeight = ThermalFoundation.CONFIG.getConfiguration().getInt("MaxHeight", category, maxHeight, maxHeight / 2, maxHeight * 2, comment);
}

代码示例来源:origin: Azanor/Baubles

public static void load() {
  String desc = "Set this to false to disable rendering of baubles in the player.";
  renderBaubles = config.getBoolean("baubleRender.enabled", 
      Configuration.CATEGORY_CLIENT, renderBaubles, desc);
  
  if(config.hasChanged())	config.save();
}

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

TradeInfo(String category, Biome biome, boolean enabled, int level, int minPrice, int maxPrice, int color, String name) {
    this.enabled = ModuleLoader.config.getBoolean("Enabled", category, enabled, "");
    this.biome = biome;
    this.level = ModuleLoader.config.getInt("Required Villager Level", category, level, 0, 10, "");
    this.minPrice = ModuleLoader.config.getInt("Minimum Emerald Price", category, minPrice, 1, 64, "");
    this.maxPrice = Math.max(minPrice, ModuleLoader.config.getInt("Maximum Emerald Price", category, maxPrice, 1, 64, ""));
    this.color = color;
    this.name = name;
  }
}

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

private StoneInfo(String category, int clusterSize, int clusterRarity, int upperBound, int lowerBound, boolean enabled, String dimStr, BiomeDictionary.Type... biomes) {
    this.enabled = ModuleLoader.config.getBoolean("Enabled", category, true, "") && enabled;
    this.clusterSize = ModuleLoader.config.getInt("Cluster Radius", category, clusterSize, 0, Integer.MAX_VALUE, "");
    this.clusterRarity = ModuleLoader.config.getInt("Cluster Rarity", category, clusterRarity, 0, Integer.MAX_VALUE, "Out of how many chunks would one of these clusters generate");
    this.upperBound = ModuleLoader.config.getInt("Y Level Max", category, upperBound, 0, 255, "");
    this.lowerBound = ModuleLoader.config.getInt("Y Level Min", category, lowerBound, 0, 255, "");
    clustersRarityPerChunk = ModuleLoader.config.getBoolean("Invert Cluster Rarity", category, false, "Setting this to true will make the 'Cluster Rarity' feature be X per chunk rather than 1 per X chunks");
    
    dims = new DimensionConfig(category, dimStr);
    allowedBiomes = BiomeTypeConfigHandler.parseBiomeTypeArrayConfig("Allowed Biome Types", category, biomes);
  }
}

代码示例来源:origin: Ellpeck/ActuallyAdditions

public ItemArmorAA(String name, ArmorMaterial material, int type, ItemStack repairItem, EnumRarity rarity){
  super(material, 0, ContainerEnergizer.VALID_EQUIPMENT_SLOTS[type]);
  this.repairItem = repairItem;
  this.name = name;
  this.rarity = rarity;
  this.disabled = ConfigurationHandler.config.getBoolean("Disable: " + StringUtil.badTranslate(name), "Tool Control", false, "This will disable the " + StringUtil.badTranslate(name) +". It will not be registered.");
  if(!disabled) this.register();
}

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

@Override
public boolean preInit() {
  String category = "Plugins";
  String comment = "If TRUE, support for " + modName + " is enabled.";
  enable = ThermalFoundation.CONFIG.getConfiguration().getBoolean(modName, category, true, comment) && Loader.isModLoaded(modId);
  if (!enable) {
    return false;
  }
  initializeDelegate();
  return !error;
}

代码示例来源: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: Ellpeck/ActuallyAdditions

public ItemSwordAA(ToolMaterial toolMat, ItemStack repairItem, String unlocalizedName, EnumRarity rarity){
  super(toolMat);
  this.repairItem = repairItem;
  this.name = unlocalizedName;
  this.rarity = rarity;
  this.disabled = ConfigurationHandler.config.getBoolean("Disable: " + StringUtil.badTranslate(name), "Tool Control", false, "This will disable the " + StringUtil.badTranslate(name) +". It will not be registered.");
  if(!disabled) this.register();
}

代码示例来源:origin: Ellpeck/ActuallyAdditions

public ItemHoeAA(Item.ToolMaterial toolMat, ItemStack repairItem, String unlocalizedName, EnumRarity rarity){
  super(toolMat);
  this.repairItem = repairItem;
  this.name = unlocalizedName;
  this.rarity = rarity;
  this.disabled = ConfigurationHandler.config.getBoolean("Disable: " + StringUtil.badTranslate(name), "Tool Control", false, "This will disable the " + StringUtil.badTranslate(name) +". It will not be registered.");
  if(!disabled) this.register();
}

相关文章