当前位置: 首页>>代码示例>>Java>>正文


Java Configuration类代码示例

本文整理汇总了Java中net.minecraftforge.common.config.Configuration的典型用法代码示例。如果您正苦于以下问题:Java Configuration类的具体用法?Java Configuration怎么用?Java Configuration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Configuration类属于net.minecraftforge.common.config包,在下文中一共展示了Configuration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addProps

import net.minecraftforge.common.config.Configuration; //导入依赖的package包/类
@Override
public void addProps(FMLPreInitializationEvent event, Configuration config)
{
	this.Enabled = config.get(this.nameInternal, "Am I enabled? (default true)", true).getBoolean(true);
	this.namePublic = config.get(this.nameInternal, "What's my name?", this.nameInternal).getString();

	this.DmgMin = config.get(this.nameInternal, "What damage am I dealing, at least? (default 1)", 1).getInt();
	this.DmgMax = config.get(this.nameInternal, "What damage am I dealing, tops? (default 3)", 3).getInt();

	this.Speed = config.get(this.nameInternal, "How fast are my projectiles? (default 2.0 BPT (Blocks Per Tick))", 2.0).getDouble();

	this.Kickback = (byte) config.get(this.nameInternal, "How hard do I kick the user back when firing? (default 1)", 1).getInt();
	this.Spread = (float) config.get(this.nameInternal, "How accurate am I? (default 10 spread)", 10).getDouble();

	this.isMobUsable = config.get(this.nameInternal, "Can I be used by QuiverMobs? (default true. They'll probably figure it out.)", true).getBoolean(true);
}
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:17,代码来源:SugarEngine.java

示例2: 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();
    }
}
 
开发者ID:lukas2005,项目名称:Device-Mod-Apps,代码行数:27,代码来源:ModConfig.java

示例3: init

import net.minecraftforge.common.config.Configuration; //导入依赖的package包/类
public static void init(File configFile)
{
    Configuration config = new Configuration(configFile);
    try
    {
        config.load();

        for (FurnaceType type : FurnaceType.values())
        {
            int speed = config.get("General", type.name().toLowerCase() + "FurnaceSpeed", type.speed).getInt(type.speed);
            float consumptionRate = (float) config.get("General", type.name().toLowerCase() + "FurnaceConsumptionRate", type.consumptionRate).getDouble(type.consumptionRate);

            furanceSpeeds.put(type, speed);
            consumptionRates.put(type, consumptionRate);
        }
    } finally
    {
        config.save();
    }
}
 
开发者ID:cubex2,项目名称:morefurnaces,代码行数:21,代码来源:Config.java

示例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();
}
 
开发者ID:PearXTeam,项目名称:PurificatiMagicae,代码行数:21,代码来源:PMConfig.java

示例5: addProps

import net.minecraftforge.common.config.Configuration; //导入依赖的package包/类
@Override
public void addProps(FMLPreInitializationEvent event, Configuration config)
{
	this.Enabled = config.get(this.nameInternal, "Am I enabled? (default true)", true).getBoolean(true);
	this.namePublic = config.get(this.nameInternal, "What's my name?", this.nameInternal).getString();

	this.DmgMin = config.get(this.nameInternal, "What damage are my arrows dealing, at least? (default 2)", 2).getInt();
	this.DmgMax = config.get(this.nameInternal, "What damage are my arrows dealing, tops? (default 10)", 10).getInt();

	this.Speed = config.get(this.nameInternal, "How fast are my projectiles? (default 1.5 BPT (Blocks Per Tick))", 1.5).getDouble();
	this.Kickback = (byte) config.get(this.nameInternal, "How hard do I kick the user back when firing? (default 3)", 3).getInt();

	this.Cooldown = config.get(this.nameInternal, "How long until I can fire again? (default 20 ticks)", 20).getInt();

	this.isMobUsable = config.get(this.nameInternal, "Can I be used by QuiverMobs? (default true.)", true).getBoolean(true);
}
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:17,代码来源:Mortar_Arrow.java

示例6: preInit

import net.minecraftforge.common.config.Configuration; //导入依赖的package包/类
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
    logger = event.getModLog();

    config = new Configuration(event.getSuggestedConfigurationFile());
    doConfig();

    int id = 1; // Don't use 0, more easy debug.
    snw = NetworkRegistry.INSTANCE.newSimpleChannel(MOD_ID);

    snw.registerMessage(Request.Handler.class, Request.class, id++, Side.SERVER);
    snw.registerMessage(Data.Handler.class, Data.class, id++, Side.CLIENT);

    proxy.preInit();
}
 
开发者ID:dries007,项目名称:DebugServerInfo,代码行数:17,代码来源:DebugServerInfo.java

示例7: constructFromConfig

import net.minecraftforge.common.config.Configuration; //导入依赖的package包/类
private static void constructFromConfig(String ID,
                             Potion effect,
                             String enableKey,
                             String enableComment,
                             int maxLevelDefault,
                             int defaultDifficultyCost,
                             double defaultWeight,
                             List<DifficultyModifier> returns,
                             Configuration config) {
    Property modifierEnabledProp = config.get(ID,
            enableKey, true, enableComment);
    boolean modifierEnabled = modifierEnabledProp.getBoolean();
    Property MaxLevelProp = config.get(ID,
            "ModifierMaxLevel", maxLevelDefault, "Maximum level of this effect added to the target player when entering the cloud.");
    int maxLevel = MaxLevelProp.getInt();
    Property difficultyCostPerLevelProp = config.get(ID,
            "DifficultyCostPerLevel", defaultDifficultyCost, "Cost of each level of the effect applied to the target player.");
    int diffCostPerLevel = difficultyCostPerLevelProp.getInt();
    Property selectionWeightProp = config.get(ID,
            "ModifierWeight", defaultWeight, "Weight that affects how often this modifier is selected.");
    double selectionWeight = selectionWeightProp.getDouble();
    if (modifierEnabled && maxLevel > 0 && diffCostPerLevel > 0 && selectionWeight > 0) {
        returns.add(new PotionCloudModifier(effect, maxLevel, diffCostPerLevel, selectionWeight, ID));
    }
}
 
开发者ID:talandar,项目名称:ProgressiveDifficulty,代码行数:26,代码来源:PotionCloudModifier.java

示例8: getMachineConfig

import net.minecraftforge.common.config.Configuration; //导入依赖的package包/类
@Override
public void getMachineConfig() {
    super.getMachineConfig();
    sewageAdult = CustomConfiguration.config.getInt("sewageAdult", "machines" + Configuration.CATEGORY_SPLITTER + this.getRegistryName().getResourcePath().toString(), 15, 1, Integer.MAX_VALUE, "Sewage produced by an adult animal");
    sewageBaby = CustomConfiguration.config.getInt("sewageBaby", "machines" + Configuration.CATEGORY_SPLITTER + this.getRegistryName().getResourcePath().toString(), 5, 1, Integer.MAX_VALUE, "Sewage produced by a baby animal");
    maxSludgeOperation = CustomConfiguration.config.getInt("maxSludgeOperation", "machines" + Configuration.CATEGORY_SPLITTER + this.getRegistryName().getResourcePath().toString(), 150, 1, Integer.MAX_VALUE, "Max sludge produced in an operation");
}
 
开发者ID:Buuz135,项目名称:Industrial-Foregoing,代码行数:8,代码来源:AnimalByproductRecolectorBlock.java

示例9: addProps

import net.minecraftforge.common.config.Configuration; //导入依赖的package包/类
@Override
public void addProps(FMLPreInitializationEvent event, Configuration config)
{
	this.Enabled = config.get(this.nameInternal, "Am I enabled? (default true)", true).getBoolean(true);
	this.namePublic = config.get(this.nameInternal, "What's my name?", this.nameInternal).getString();

	this.DmgMin = config.get(this.nameInternal, "What damage am I dealing, at least? (default 1)", 1).getInt();
	this.DmgMax = config.get(this.nameInternal, "What damage am I dealing, tops? (default 3)", 3).getInt();

	this.Speed = config.get(this.nameInternal, "How fast are my projectiles? (default 2.5 BPT (Blocks Per Tick))", 2.5).getDouble();

	this.Weakness_Strength = config.get(this.nameInternal, "How strong is my Weakness effect? (default 2)", 2).getInt();
	this.Weakness_Duration = config.get(this.nameInternal, "How long does my Weakness effect last? (default 40 ticks)", 40).getInt();
	this.Nausea_Duration = config.get(this.nameInternal, "How long does my Nausea effect last? (default 40 ticks)", 40).getInt();
	this.Hunger_Strength = config.get(this.nameInternal, "How strong is my Hunger effect? (default 2)", 2).getInt();
	this.Hunger_Duration = config.get(this.nameInternal, "How long does my Hunger effect last? (default 40 ticks)", 40).getInt();

	this.isMobUsable = config.get(this.nameInternal, "Can I be used by QuiverMobs? (default true.)", true).getBoolean(true);
}
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:20,代码来源:LapisCoil.java

示例10: 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();
    }
}
 
开发者ID:LeshaInc,项目名称:openarch,代码行数:18,代码来源:Config.java

示例11: 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();
		}
	}
}
 
开发者ID:Maxwell-lt,项目名称:MobBlocker,代码行数:19,代码来源:Config.java

示例12: getIntFor

import net.minecraftforge.common.config.Configuration; //导入依赖的package包/类
public static int getIntFor(Configuration config,String heading, String item, int value, String comment)
{
	if (config == null)
		return value;
	try
	{
		Property prop = config.get(heading, item, value);
		prop.comment = comment;
		return prop.getInt(value);
	}
	catch (Exception e)
	{
		System.out.println("[" + ModDetails.ModName + "] Error while trying to add Integer, config wasn't loaded properly!");
	}
	return value;
}
 
开发者ID:Wahazar,项目名称:TFCPrimitiveTech,代码行数:17,代码来源:ModOptions.java

示例13: loadOre

import net.minecraftforge.common.config.Configuration; //导入依赖的package包/类
private ConfigOregenEntry loadOre(Configuration config, String name, int minY, int maxY, int minVs, int maxVs, int minVeins, int maxVeins, float chance, String[] dimList, boolean dimListMode)
{
    ConfigOregenEntry entr = new ConfigOregenEntry();

    entr.generate = config.getBoolean(name, WORLD, true, "");
    entr.minY = config.getInt(name + " Min Y", WORLD, minY, 0, Integer.MAX_VALUE, "");
    entr.maxY = config.getInt(name + " Max Y", WORLD, maxY, 0, Integer.MAX_VALUE, "");
    entr.minVeinSize = config.getInt(name + " Min Vein Size", WORLD, minVs, 0, Integer.MAX_VALUE, "");
    entr.maxVeinSize = config.getInt(name + " Max Vein Size", WORLD, maxVs, 0, Integer.MAX_VALUE, "");
    entr.minVeins = config.getInt(name + " Min Veins Per Chunk", WORLD, minVeins, 0, Integer.MAX_VALUE, "");
    entr.maxVeins = config.getInt(name + " Max Veins Per Chunk", WORLD, maxVeins, 0, Integer.MAX_VALUE, "");
    entr.chance = config.getFloat(name + " Generation Chance", WORLD, chance, 0, 1, "");
    entr.dimList = loadIntList(config, name + " DimList", WORLD, dimList, "");
    entr.dimListMode = config.getBoolean(name + " DimList Mode", WORLD, dimListMode, "True = whitelist; False = blacklist");

    return entr;
}
 
开发者ID:PearXTeam,项目名称:PurificatiMagicae,代码行数:18,代码来源:PMConfig.java

示例14: defineConfigValues

import net.minecraftforge.common.config.Configuration; //导入依赖的package包/类
public static void defineConfigValues(){
    maxRange = config.get(Configuration.CATEGORY_GENERAL, "maxRange", 8D, "The maximum distance a player can be away from another for the trust effect to take place", 1D, 50D).getDouble();
    updateInterval = config.get(Configuration.CATEGORY_GENERAL, "updateInterval", 20, "The amount of ticks between updates and reapplication of the potion effect", 1, 100).getInt();
    allowMultiplePlayers = config.get(Configuration.CATEGORY_GENERAL, "allowMultiplePlayers", true, "If multiple players can influence the strength of the trust effect").getBoolean();

    baseCalcModifier = config.get(Configuration.CATEGORY_GENERAL, "baseCalcModifier", 5D, "The modifier used to determine both the duration and the amplifier of the effect", 0D, 100D).getDouble();
    durationModifier = config.get(Configuration.CATEGORY_GENERAL, "durationModifier", 50D, "The modifier used to determine the duration of the effect", 0D, 500D).getDouble();
    amplifierModifier = config.get(Configuration.CATEGORY_GENERAL, "amplifierModifier", 0.5D, "The modifier used to determine the amplifier of the effect", 0D, 100D).getDouble();

    baseStrength = config.get(Configuration.CATEGORY_GENERAL, "baseStrength", 1D, "The base strength effect that will be applied through the trust potion effect, set to 0 to disable", 0D, 10D).getDouble();
    baseRegen = (float)config.get(Configuration.CATEGORY_GENERAL, "baseRegen", 0.75D, "The base regen effect that will be applied through the trust potion effect, set to 0 to disable", 0D, 10D).getDouble();

    isTeamDependent = config.get(Configuration.CATEGORY_GENERAL, "isTeamDependent", true, "If the trust effect will only be given to players that are in the same scoreboard team").getBoolean();
    trustWithoutTeam = config.get(Configuration.CATEGORY_GENERAL, "trustWithoutTeam", true, "If players that are in no scoreboard team at all will also get the effect").getBoolean();

    if(config.hasChanged()){
        config.save();
    }
}
 
开发者ID:Ellpeck,项目名称:TrustCircle,代码行数:20,代码来源:TrustCircle.java

示例15: getConfiguration

import net.minecraftforge.common.config.Configuration; //导入依赖的package包/类
static Configuration getConfiguration() {
    if (configuration == null) {
        try {
            final String fileName = Main.MODID_LOWER + ".cfg";

            @SuppressWarnings("unchecked")
            final Map<String, Configuration> configsMap = (Map<String, Configuration>) CONFIGS_GETTER.invokeExact();

            final Optional<Map.Entry<String, Configuration>> entryOptional = configsMap.entrySet().stream()
                    .filter(entry -> fileName.equals(new File(entry.getKey()).getName()))
                    .findFirst();

            if (entryOptional.isPresent()) {
                configuration = entryOptional.get().getValue();
            }
        } catch (Throwable e) {
            Main.LOGGER.error("Failed to get Configuration instance", e);
        }
    }

    return configuration;
}
 
开发者ID:TerminatorNL,项目名称:LagGoggles,代码行数:23,代码来源:ConfigData.java


注:本文中的net.minecraftforge.common.config.Configuration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。