本文整理了Java中net.minecraftforge.common.config.Configuration
类的一些代码示例,展示了Configuration
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration
类的具体详情如下:
包路径:net.minecraftforge.common.config.Configuration
类名称:Configuration
暂无
代码示例来源:origin: Vazkii/Botania
public static void loadConfig(File configFile) {
config = new Configuration(configFile);
config.load();
load();
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
final Configuration configurartion = migrate( new Configuration( configFile, CONFIG_VERSION ) );
.get( CONFIG_COMMON_KEY, CONFIG_COMMON_ALLOW_TILEENTITIES_KEY, false, CONFIG_COMMON_ALLOW_TILEENTITIES_COMMENT )
.setRequiresMcRestart( true )
.setShowInGui( false )
final Set<ConfigCategory> whitelist = configurartion.getCategory( CONFIG_FACADES_KEY ).getChildren();
for( ConfigCategory configCategory : whitelist )
if( configurartion.hasChanged() )
configurartion.save();
代码示例来源: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: AppliedEnergistics/Applied-Energistics-2
public void save()
{
if( this.config.hasChanged() )
{
this.config.save();
}
}
}
代码示例来源: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: SonarSonic/Calculator
public static void loadItems() {
Configuration items = new Configuration(new File("config/calculator/Items-BlackList.cfg"));
items.load();
String[] itemExamples = new String[2];
itemExamples[0] = "ExampleItem";
itemExamples[1] = "ExampleItem2";
itemsblackList = items.get("Item Config", "Disabled", itemExamples);
items.save();
}
代码示例来源:origin: ExtraCells/ExtraCells2
public void reload() {
shortenedBuckets = config.get("Tooltips", "shortenedBuckets", true, "Shall the guis shorten large mB values?").getBoolean(true);
dynamicTypes = config.get("Storage Cells", "dynamicTypes", true, "Should the mount of bytes needed for a new type depend on the cellsize?").getBoolean(true);
ExtraCells.integration.loadConfig(config);
if (config.hasChanged()) {
config.save();
}
}
代码示例来源:origin: ForestryMC/Binnie
public void reload(boolean load) {
if (load) {
config.load();
}
for (IConfigurable configurable : configurables) {
configurable.configure(config);
}
if (config.hasChanged()) {
config.save();
}
}
}
代码示例来源: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: AppliedEnergistics/Applied-Energistics-2
@Override
public void onWorldStart()
{
this.lastPlayerID = this.config.get( LAST_PLAYER_CATEGORY, LAST_PLAYER_KEY, LAST_PLAYER_DEFAULT ).getInt( LAST_PLAYER_DEFAULT );
this.config.save();
}
代码示例来源:origin: superckl/BiomeTweaker
public Config(final File config) {
this.configFile = new Configuration(new File(config, ModData.MOD_NAME+".cfg"));
this.btConfigFolder = config;
this.configFile.load();
if(this.configFile.hasChanged())
this.configFile.save();
}
代码示例来源:origin: SlimeKnights/TinkersConstruct
Gameplay = configFile.getCategory(cat);
prop = configFile.get(cat, "spawnWithBook", spawnWithBook);
prop.setComment("Players who enter the world for the first time get a Tinkers' Book");
spawnWithBook = prop.getBoolean();
propOrder.add(prop.getName());
prop = configFile.get(cat, "reuseStencils", reuseStencil);
prop.setComment("Allows to reuse stencils in the stencil table to turn them into other stencils");
reuseStencil = prop.getBoolean();
propOrder.add(prop.getName());
prop = configFile.get(cat, "chestsKeepInventory", chestsKeepInventory);
prop.setComment("Pattern and Part chests keep their inventory when harvested.");
chestsKeepInventory = prop.getBoolean();
propOrder.add(prop.getName());
prop = configFile.get(cat, "enableClayCasts", claycasts);
prop.setComment("Adds single-use clay casts.");
claycasts = prop.getBoolean();
prop = configFile.get(cat, "allowBrickCasting", castableBricks);
prop.setComment("Allows the creation of bricks from molten clay");
castableBricks = prop.getBoolean();
prop = configFile.get(cat, "AutosmeltFortuneInteraction", autosmeltlapis);
prop.setComment("Fortune increases drops after harvesting a block with autosmelt");
autosmeltlapis = prop.getBoolean();
propOrder.add(prop.getName());
代码示例来源:origin: elucent/Albedo
public static void load(){
config.addCustomCategoryComment("light", "Settings related to lighting.");
config.addCustomCategoryComment("misc", "Settings related to random effects.");
maxLights = config.getInt("maxLights", "light", 10, 0, 100, "The maximum number of lights allowed to render in a scene. Lights are sorted nearest-first, so further-away lights will be culled after nearer lights.");
enableLights = config.getBoolean("enableLights", "light", true, "Enables lighting in general.");
eightBitNightmare = config.getBoolean("eightBitNightmare", "misc", false, "Enables retro mode.");
if (config.hasChanged())
{
config.save();
}
}
代码示例来源: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: AppliedEnergistics/Applied-Energistics-2
private int nextPlayer()
{
final int r = this.lastPlayerID;
this.lastPlayerID++;
this.config.get( LAST_PLAYER_CATEGORY, LAST_PLAYER_KEY, this.lastPlayerID ).set( this.lastPlayerID );
return r;
}
代码示例来源:origin: ValkyrienWarfare/Valkyrien-Warfare-Revamped
private void runConfiguration(FMLPreInitializationEvent event) {
configFile = event.getSuggestedConfigurationFile();
config = new Configuration(configFile);
config.load();
applyConfig(config);
config.save();
}
代码示例来源: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: SlimeKnights/TinkersConstruct
category = Config.configFile.getCategory(serverCategory.getName());
if(Config.configFile.hasChanged()) {
Config.configFile.save();
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
private WorldData( @Nonnull final File worldDirectory )
{
Preconditions.checkNotNull( worldDirectory );
Preconditions.checkArgument( worldDirectory.isDirectory() );
this.ae2directory = new File( worldDirectory, AE2_DIRECTORY_NAME );
this.spawnDirectory = new File( this.ae2directory, SPAWNDATA_DIR_NAME );
this.compassDirectory = new File( this.ae2directory, COMPASS_DIR_NAME );
final File settingsFile = new File( this.ae2directory, SETTING_FILE_NAME );
this.sharedConfig = new Configuration( settingsFile, AEConfig.VERSION );
final PlayerData playerData = new PlayerData( this.sharedConfig );
final StorageData storageData = new StorageData( this.sharedConfig );
final ThreadFactory compassThreadFactory = new CompassThreadFactory();
final CompassService compassService = new CompassService( this.compassDirectory, compassThreadFactory );
final CompassData compassData = new CompassData( this.compassDirectory, compassService );
final IWorldSpawnData spawnData = new SpawnData( this.spawnDirectory );
this.playerData = playerData;
this.storageData = storageData;
this.compassData = compassData;
this.spawnData = spawnData;
this.startables = Lists.<IOnWorldStartable>newArrayList( playerData, storageData );
this.stoppables = Lists.<IOnWorldStoppable>newArrayList( playerData, storageData, compassData );
}
代码示例来源: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();
}
内容来源于网络,如有侵权,请联系作者删除!