本文整理汇总了Java中net.minecraftforge.common.config.Configuration.hasChanged方法的典型用法代码示例。如果您正苦于以下问题:Java Configuration.hasChanged方法的具体用法?Java Configuration.hasChanged怎么用?Java Configuration.hasChanged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.common.config.Configuration
的用法示例。
在下文中一共展示了Configuration.hasChanged方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: load
import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
public static void load(File file) {
Configuration cfg = new Configuration(file);
ARM_CYCLES_PER_TICK = cfg.get(
"arm", "cyclesPerTick", new int[]{1000, 5000, 25000},
"CPU cycles per Minecraft tick. Default values: 1000, 5000, 25000 (20 kHz, 100 kHz, 500 kHz)",
1, Config.ARM_MAX_CYCLES_PER_TICK, true, 3).getIntList();
ARM_MAX_MEMORY = cfg.get(
"arm", "maxMemory", 4 * 1024 * 1024,
"Max memory allowed to be used by CPU. Default value: 4 MiB",
0, Config.ARM_MAX_MAX_MEMORY).getInt();
if (cfg.hasChanged()) {
cfg.save();
}
}
示例2: readConfig
import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
/**
* Accesses config field from CommonProxy and loads data to the static fields in this class
*/
public static void readConfig() {
Configuration cfg = CommonProxy.config;
try {
cfg.load();
initGeneralConfig(cfg);
initProtectionConfig(cfg);
initAreaProtConfig(cfg);
} catch (Exception exception) {
MobBlocker.logger.log(Level.ERROR, "Problem loading config file!", exception);
} finally {
if (cfg.hasChanged()) {
cfg.save();
}
}
}
示例3: preLoad
import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
@Mod.EventHandler
public void preLoad(FMLPreInitializationEvent event)
{
Configuration config = new Configuration(event.getSuggestedConfigurationFile());
config.load();
config.addCustomCategoryComment("general", "General settings");
fancyWeightage = config.getInt("fancyWeightage", "general", 80, 0, 100, "Weightage of llamas wearing parts of their outfit, in percentage% (0-100)");
randomizeParts = config.getInt("randomizeParts", "general", 1, 0, 1, "0 = Render the entire outfit (except disabled parts)\n1 = Randomly choose which parts of the outfit to render (per llama)");
disabledParts = config.getStringList("disabledParts", "general", disabledParts, "Disable parts of the outfit", new String[] { "hat", "monocle", "pipe", "bowtie", "fez", "moustache" });
if(config.hasChanged())
{
config.save();
}
MinecraftForge.EVENT_BUS.register(this);
}
示例4: setup
import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
public void setup(Configuration configFile)
{
genCrystalRock = loadCrystal(configFile, "Rock", new String[]{"-1", "1"}, false);
genCrystalSea = loadCrystal(configFile, "Sea", new String[]{"-1", "1"}, false);
genCrystalFlame = loadCrystal(configFile, "Flame", new String[]{"-1"}, true);
genCrystalAir = loadCrystal(configFile, "Air", new String[]{"-1", "1"}, false);
genCrystalVision = loadCrystal(configFile, "Vision", new String[]{"1"}, true);
genCrysagnetite = loadOre(configFile, "Crysagnetite", 15, 25, 1, 3, 1, 2, 0.1f, new String[]{"-1", "1"}, false);
genCrystallizedRedstone = loadOreOnOre(configFile, "Crystallized Redstone", 0, 16, 0.03f, new String[]{"-1", "1"}, false);
genCrystallizedGlowstone = loadOreOnOre(configFile, "Crystallized Glowstone", 4, 123, 0.03f, new String[]{"-1"}, true);
genLabSmall = loadStructure(configFile, "Small Laboratory", 0.0007f, 15, 256, new String[]{"-1", "1"}, false);
genLabMedium = loadStructure(configFile, "Medium Laboratory", 0.0007f, 15, 256, new String[]{"-1", "1"}, false);
genBrulantaFlower = loadGround(configFile, "Brulanta Flower", 3, 256, 0, 4, 0.1f, new String[]{"-1", "1"}, false);
debugMessages = configFile.getBoolean("Debug", GENERAL, false, "Enables or disables the debug logger.");
animateIfTabletPageTransition = configFile.getBoolean("Animate IF Tablet page transitions", CLIENT, true, "");
testItem = configFile.getBoolean("Test Item", CLIENT, false, "Enables or disables the test item made for messing with models.");
if (configFile.hasChanged())
configFile.save();
}
示例5: preInit
import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
@EventHandler
public void preInit(FMLPreInitializationEvent event){
Configuration config = new Configuration(event.getSuggestedConfigurationFile());
config.load();
canBeDeactivated = config.getBoolean("canBeDeactivated", Configuration.CATEGORY_GENERAL, true, "If the wopper can be deactivated using redstone");
wopperSpeed = config.getInt("speed", Configuration.CATEGORY_GENERAL, 10, 1, 1000, "The amount of ticks that have to pass before the wopper does a movement action again");
if(config.hasChanged()){
config.save();
}
blockWopper = new BlockWopper("wopper");
GameRegistry.registerTileEntity(TileEntityWopper.class, MOD_ID+":wopper");
proxy.preInit();
}
示例6: initConfig
import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
public static void initConfig(File configFile) { // Gets called from preInit
try {
// Ensure that the config file exists
if (!configFile.exists()) configFile.createNewFile();
// Create the config object
config = new Configuration(configFile);
// Load config
config.load();
// Read props from config
Property debugModeProp = config.get(Configuration.CATEGORY_GENERAL, // What category will it be saved to, can be any string
"debug_mode", // Property name
"false", // Default value
"Enable the debug mode (useful for reporting issues)"); // Comment
DEBUG_MODE = debugModeProp.getBoolean(); // Get the boolean value, also set the property value to boolean
} catch (Exception e) {
// Failed reading/writing, just continue
} finally {
// Save props to config IF config changed
if (config.hasChanged()) config.save();
}
}
示例7: readConfig
import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
public static void readConfig() {
Configuration cfg = CommonProxy.config;
try {
cfg.load();
initGeneralConfig(cfg);
} catch (Exception e1) {
Lanolin.logger.log(Level.ERROR, "Problem loading config file!", e1);
} finally {
if (cfg.hasChanged()) {
cfg.save();
}
}
}
示例8: readConfig
import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
public void readConfig(){
File regionFolder = new File(DifficultyManager.getConfigDir(),getName());
File regionConfigFile = new File(regionFolder,"region.cfg");
File defaultRegionConfigFile = new File(regionFolder,"default.cfg");
File[] filesInRegion = regionFolder.listFiles();
List<File> mobConfigFiles = Lists.newArrayList();
if(filesInRegion!=null) {
mobConfigFiles.addAll(Arrays.stream(filesInRegion)
.filter(
file -> {
return !(file.getName().endsWith("region.cfg") || file.getName().endsWith("default.cfg"));
}).collect(Collectors.toList()));
}
Configuration regionConfig = new Configuration(regionConfigFile);
readRegionConfig(regionConfig);
Configuration defaultConfiguration = new Configuration(defaultRegionConfigFile);
try {
defaultConfiguration.load();
defaultConfig = new RegionMobConfig(defaultConfiguration);
}finally {
if(defaultConfiguration.hasChanged()){
defaultConfiguration.save();
}
}
for(File mobConfigFile : mobConfigFiles){
String mobId = mobConfigFile.getName();
mobId = mobId.substring(0,mobId.lastIndexOf("."));
Configuration config = new Configuration(mobConfigFile);
try {
config.load();
RegionMobConfig mobConfig = new RegionMobConfig(config);
byMobConfig.put(mobId,mobConfig);
}finally {
if(config.hasChanged()){
config.save();
}
}
}
}
示例9: preInit
import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
public static void preInit()
{
// load the configuration options from a file, if present
File configFile = new File(Loader.instance().getConfigDir(), CombinedPotions.MODID + ".cfg");
Configuration config = new Configuration(configFile);
config.load();
// set the variables to the configuration values
maxPotionEffects = config.get(Configuration.CATEGORY_GENERAL, "maxPotionEffects", DefaultValues.maxPotionEffects, "Maximum number of potion effects that can be applied to a single item. Use -1 for no limit.").getInt();
// save the configuration if it's changed
if (config.hasChanged()) config.save();
}
示例10: loadFrom
import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
public static void loadFrom(File file) {
lastReadFile = file;
lastReadConfig = new Configuration(file);
load();
if(lastReadConfig.hasChanged()) {
lastReadConfig.save();
}
}
示例11: readConfig
import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
public static void readConfig() {
Configuration cfg = CommonProxy.config;
try {
cfg.load();
initGeneralConfig(cfg);
initPermissionConfig(cfg);
} catch (Exception e1) {
MeeCreeps.logger.log(Level.ERROR, "Problem loading config file!", e1);
} finally {
if (cfg.hasChanged()) {
cfg.save();
}
}
}
示例12: preInit
import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
public void preInit(FMLPreInitializationEvent event)
{
// Handle configuration
File configDir = event.getModConfigurationDirectory();
config = new Configuration(new File(configDir.getPath(), "simplechunks.cfg"));
try
{
config.load();
GeneralConfig.readConfig(config);
}
catch (Exception e)
{
SimpleChunks.logger.error("Error loading config file!", e);
}
finally
{
if (config.hasChanged())
{
config.save();
}
}
// Integrate with other mods
if (Loader.isModLoaded("theoneprobe"))
{
TOPCompat.register();
}
// Register chunkloading callback
ForgeChunkManager.setForcedChunkLoadingCallback(SimpleChunks.instance, new ChunkLoadingHandler());
}
示例13: readcfg
import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
public static void readcfg(){
Configuration cfg=CommonProxy.config;
try{
cfg.load();
initConfig(cfg);
} catch(Exception e){
System.out.println("Charcoal Pit mod could not load configs");
} finally{
if(cfg.hasChanged()){
cfg.save();
}
}
}
示例14: YouTubeConfiguration
import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
private YouTubeConfiguration(File path) {
config = new Configuration(path);
config.load();
addGeneralConfig();
if (config.hasChanged()) {
config.save();
}
}
示例15: setupInit
import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
public void setupInit(Configuration configFile)
{
for(Map.Entry<ResourceLocation, IExpression> expr : PurMag.INSTANCE.getExpressionRegistry().getRegistry().getEntries())
{
boolean bool = configFile.getBoolean(expr.getKey().toString(), EXPRESSIONS, expr.getValue().enabledByDefault(), expr.getValue().getDescription());
if(bool)
enabledExpressions.add(expr.getKey());
}
if (configFile.hasChanged())
configFile.save();
}