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


Java Property.getBoolean方法代码示例

本文整理汇总了Java中net.minecraftforge.common.config.Property.getBoolean方法的典型用法代码示例。如果您正苦于以下问题:Java Property.getBoolean方法的具体用法?Java Property.getBoolean怎么用?Java Property.getBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.common.config.Property的用法示例。


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

示例1: constructFromConfig

import net.minecraftforge.common.config.Property; //导入方法依赖的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

示例2: refresh

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
/**
 * Refreshes this mod's configuration
 */
public void refresh()
{
	load();

	Property prop;

	prop = get("options", "spinspeed", 1.0D);
	prop.setLanguageKey("globalxp.config.spinspeed");
	spinSpeed = prop.getDouble(1.0D);

	prop = get("options", "bobspeed", 1.0D);
	prop.setLanguageKey("globalxp.config.bobspeed");
	bobSpeed = prop.getDouble(1.0D);

	prop = get("options", "renderNameplate", true);
	prop.setLanguageKey("globalxp.config.renderNameplate");
	renderNameplate = prop.getBoolean(true);

	if(hasChanged())
		save();
}
 
开发者ID:bl4ckscor3,项目名称:GlobalXP,代码行数:25,代码来源:Config.java

示例3: getBooleanFor

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
public static boolean getBooleanFor(Configuration config,String heading, String item, boolean value, String comment)
{
	if (config == null)
		return value;
	try
	{
		Property prop = config.get(heading, item, value);
		prop.comment = comment;
		return prop.getBoolean(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

示例4: initConfig

import net.minecraftforge.common.config.Property; //导入方法依赖的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

示例5: registerFeature

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
public static void registerFeature(String name, int[] base) {
	String catName = "feature" + Configuration.CATEGORY_SPLITTER + name;
	Property property = configWorldGen.get(catName, "Generate", true);
	property.setComment("Generate " + name + " in world");
	if (!property.getBoolean(true)) {
		features.put(name, FALSE);
		logWarn("Feature '" + name + "' is disabled");
	} else {
		property = configWorldGen.get(catName, "Blacklist dimenstions", base);
		List<Integer> list = new ArrayList<>();
		int[] intArray = property.getIntList();
		for (int i = 0;i < intArray.length;i++)
			list.add(intArray[i]);
		features.put(name, w -> !list.contains(w.provider.getDimension()));
	}
}
 
开发者ID:tom5454,项目名称:Toms-Mod,代码行数:17,代码来源:Config.java

示例6: preInit

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
    logger = event.getModLog();
    config = new Configuration(event.getSuggestedConfigurationFile());
    Property breakChest = config.get("Balance", "BreakChestOnHarvest", true);
    if (!breakChest.wasRead())
        config.save();
    else
        breakChestOnHarvest = breakChest.getBoolean();

    registerTileEntities();

    NetworkRegistry.INSTANCE.registerGuiHandler(this, guiHandler);

    channel = NetworkRegistry.INSTANCE.newSimpleChannel(CHANNEL);

    int messageNumber = 0;
    channel.registerMessage(UpdatePlayersUsing.Handler.class, UpdatePlayersUsing.class, messageNumber++, Side.CLIENT);
    logger.debug("Final message number: " + messageNumber);

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

示例7: init

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
@EventHandler
public void init(FMLPreInitializationEvent event)
{
    Configuration config = new Configuration(new File(event.getModConfigurationDirectory(), NAME + ".cfg"));
    config.load();

    Property prop = config.get(Configuration.CATEGORY_CLIENT, "verboseDebug", false,
            "If true, verbose debugging will be written to the log.");
    verbose = prop.getBoolean();
    if (verbose) {
        out = System.out;
    }
    prop = config.get(Configuration.CATEGORY_GENERAL, "enableCommand", false,
            "If true, the /xpseed command will be enabled, allowing you to retrieve "
            + "and set players' enchantment seeds directly.");
    enableCommand = prop.getBoolean();

    if (config.hasChanged()) {
        config.save();
    }
    EnchantmentRevealer.out.println("EnchantmentRevealer initialized.");
    MinecraftForge.EVENT_BUS.register(events);
}
 
开发者ID:d0sboots,项目名称:EnchantmentRevealer,代码行数:24,代码来源:EnchantmentRevealer.java

示例8: getBooleanFor

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

示例9: getBoolean

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
public static boolean getBoolean(EMod mod, String name, boolean defaultBoolean) {
    Property prop = getOption(mod, name);
    if (prop == null) {
        return defaultBoolean;
    } else {
        return prop.getBoolean(defaultBoolean);
    }
}
 
开发者ID:Herobone,项目名称:HeroUtils,代码行数:9,代码来源:ConfigAccessor.java

示例10: handleConfig

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
public static void handleConfig(Configuration config){
	Property current;
	int chunkRange; double maxSpawnTime;
	String[] dimensionArray = {"0"};
	config.load();
	current = config.get(Configuration.CATEGORY_GENERAL, "Logging", false);
	current.setComment("Enable this to receive server messages whenever a villager tries to spawn.  Default false.");
	LOGGING = current.getBoolean();
	current = config.get("SpawnValues", "Chunk check range", 2);
	current.setComment("This is the range in chunks from each player that Emergent Villages checks for valid spawn positions.  Default 2.");
	chunkRange = current.getInt();
	current = config.get("SpawnValues", "Inhabited time for maximum spawn chance", 3600000.0d);
	current.setComment("This is the time in ticks at which the spawn chance for a villager for any given chunk is 100%.  Minecraft increments this timer for each player "
			+ "in a chunk once per tick.  Increase this value for a slower spawn rate, and decrease it for a faster spawn rate.  "
			+ "Default 3600000.0f.");
	maxSpawnTime = current.getDouble();
	current = config.get(Configuration.CATEGORY_GENERAL, "Max villagers per chunk", 1);
	current.setComment("This is the maximum amount of villagers that Emergent Villages spawns per chunk.  Default 1.");
	SpawnHandler.initConfig(chunkRange, current.getInt(), maxSpawnTime);
	current = config.get(Configuration.CATEGORY_GENERAL , "Dimensions", dimensionArray);
	current.setComment("These are the dimensions that Emergent Villages will spawn villagers in.  Default 0 (Overworld).");
	dimensionArray = current.getStringList();
	current = config.get(Configuration.CATEGORY_GENERAL, "Tick speed", 600);
	current.setComment("This is the amount of time that Emergent Villages waits between checks.  Minecraft ticks 20 times per second.  Higher numbers means that even if "
			+ "the regional difficulty is high it will take a while to spawn villagers, but the impact on the server will be low.  Lower numbers means villagers spawn "
			+ "faster, up to the limit, but there will be a performance hit.  Default 600.");
	TickHandler.initConfig(current.getInt(), dimensionArray);
	config.save();
}
 
开发者ID:Edicatad,项目名称:EmergentVillages,代码行数:30,代码来源:ConfigHandler.java

示例11: syncConfigDefaults

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
/**
 * Synchronizes the local fields with the values in the Configuration object.
 */
public static void syncConfigDefaults()
{
    // By adding a property order list we are defining the order that the properties will appear both in the config file and on the GUIs.
    // Property order lists are defined per-ConfigCategory.
    List<String> propOrder = new ArrayList<String>();

    config.setCategoryComment("defaults", "Default configuration for forge chunk loading control")
            .setCategoryRequiresWorldRestart("defaults", true);

    Property temp = config.get("defaults", "enabled", true);
    temp.setComment("Are mod overrides enabled?");
    temp.setLanguageKey("forge.configgui.enableModOverrides");
    overridesEnabled = temp.getBoolean(true);
    propOrder.add("enabled");

    temp = config.get("defaults", "maximumChunksPerTicket", 25);
    temp.setComment("The default maximum number of chunks a mod can force, per ticket, \n" +
                "for a mod without an override. This is the maximum number of chunks a single ticket can force.");
    temp.setLanguageKey("forge.configgui.maximumChunksPerTicket");
    temp.setMinValue(0);
    defaultMaxChunks = temp.getInt(25);
    propOrder.add("maximumChunksPerTicket");

    temp = config.get("defaults", "maximumTicketCount", 200);
    temp.setComment("The default maximum ticket count for a mod which does not have an override\n" +
                "in this file. This is the number of chunk loading requests a mod is allowed to make.");
    temp.setLanguageKey("forge.configgui.maximumTicketCount");
    temp.setMinValue(0);
    defaultMaxCount = temp.getInt(200);
    propOrder.add("maximumTicketCount");

    temp = config.get("defaults", "playerTicketCount", 500);
    temp.setComment("The number of tickets a player can be assigned instead of a mod. This is shared across all mods and it is up to the mods to use it.");
    temp.setLanguageKey("forge.configgui.playerTicketCount");
    temp.setMinValue(0);
    playerTicketLength = temp.getInt(500);
    propOrder.add("playerTicketCount");

    temp = config.get("defaults", "dormantChunkCacheSize", 0);
    temp.setComment("Unloaded chunks can first be kept in a dormant cache for quicker\n" +
                "loading times. Specify the size (in chunks) of that cache here");
    temp.setLanguageKey("forge.configgui.dormantChunkCacheSize");
    temp.setMinValue(0);
    dormantChunkCacheSize = temp.getInt(0);
    propOrder.add("dormantChunkCacheSize");
    FMLLog.info("Configured a dormant chunk cache size of %d", temp.getInt(0));

    config.setCategoryPropertyOrder("defaults", propOrder);

    config.addCustomCategoryComment("Forge", "Sample mod specific control section.\n" +
            "Copy this section and rename the with the modid for the mod you wish to override.\n" +
            "A value of zero in either entry effectively disables any chunkloading capabilities\n" +
            "for that mod");

    temp = config.get("Forge", "maximumTicketCount", 200);
    temp.setComment("Maximum ticket count for the mod. Zero disables chunkloading capabilities.");
    temp = config.get("Forge", "maximumChunksPerTicket", 25);
    temp.setComment("Maximum chunks per ticket for the mod.");
    for (String mod : config.getCategoryNames())
    {
        if (mod.equals("Forge") || mod.equals("defaults"))
        {
            continue;
        }
        config.get(mod, "maximumTicketCount", 200).setLanguageKey("forge.configgui.maximumTicketCount").setMinValue(0);
        config.get(mod, "maximumChunksPerTicket", 25).setLanguageKey("forge.configgui.maximumChunksPerTicket").setMinValue(0);
    }

    if (config.hasChanged())
    {
        config.save();
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:77,代码来源:ForgeChunkManager.java

示例12: syncConfig

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
public static void syncConfig() {
	Property mbPerTankProp = config.get(Configuration.CATEGORY_GENERAL, "mbPerVirtualTank", 16000);
	mbPerTankProp.setComment("How many millibuckets can each block within the tank store? (Has to be higher than 1!)\nDefault: 16000");
	MB_PER_TANK_BLOCK = Math.max(1, Math.min(Integer.MAX_VALUE, mbPerTankProp.getInt(16000)));
	if(mbPerTankProp.getInt(16000) < 1 || mbPerTankProp.getInt(16000) > Integer.MAX_VALUE) {
		mbPerTankProp.set(16000);
	}

	Property maxAirBlocksProp = config.get(Configuration.CATEGORY_GENERAL, "maxAirBlocks", 2197);
	maxAirBlocksProp.setComment("Define the maximum number of air blocks a tank can have. 2197 have been tested to not cause any feelable lag.!\nMinimum: 1, Maximum: 2197\nDefault: 2197");
	MAX_AIR_BLOCKS = Math.max(1, Math.min(maxAirBlocksProp.getInt(2197), 2197));
	if(maxAirBlocksProp.getInt(2197) < 3 || maxAirBlocksProp.getInt(1) > 2197) {
		maxAirBlocksProp.set(2197);
	}

	Property tankOverlayRender = config.get(Configuration.CATEGORY_CLIENT, "tankOverlayRender", true);
	tankOverlayRender.setComment("Should a semi-transparent tank overlay be rendered on the tank when you look at it?\nDefault: true");
	TANK_OVERLAY_RENDER = tankOverlayRender.getBoolean(true);

	Property metaphasedFluxEnergyLoss = config.get(Configuration.CATEGORY_GENERAL, "metaphasedFluxEnergyLoss", 10);
	metaphasedFluxEnergyLoss.setComment("The amount of energy loss you have when you extract energy / metaphased flux from the tank.\nDefault: 10\nValue needs to be between 0 and 50!\n0 to disable.");
	METAPHASED_FLUX_ENERGY_LOSS = Math.max(0, metaphasedFluxEnergyLoss.getInt(10));
	if(metaphasedFluxEnergyLoss.getInt(10) < 0 || metaphasedFluxEnergyLoss.getInt(10) > 50) {
		metaphasedFluxEnergyLoss.set(10);
	}

	if(config.hasChanged()) {
		config.save();
	}
}
 
开发者ID:Lordmau5,项目名称:FFS,代码行数:31,代码来源:Config.java

示例13: doDebugConfigs

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
private void doDebugConfigs()
{
	Property p;
	p = configuration.get(CATEGORY_GENERAL, "logOreSpawns", false);
	p.setComment("Enable to see exact locations of Fyrestone ore spawns.");
	logOreSpawns = p.getBoolean();
}
 
开发者ID:gunnerwolf,项目名称:Fyrestone,代码行数:8,代码来源:Config.java

示例14: enableOreGen

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
public static boolean enableOreGen(OreGenEntry name) {
	Property property = configWorldGen.get("ore_generation", "Generate " + name.name, true);
	property.setComment("Generate " + name.name + " in world. (Default: true)");
	boolean ret = property.getBoolean(true);
	int yStart = configWorldGen.getInt("Y Start " + name.name, "ore_generation_adv", name.yStart, 1, 255, "Generate " + name.name + " above set value", name.name + ".ystart");
	int yEnd = configWorldGen.getInt("Y End " + name.name, "ore_generation_adv", name.yStart + name.ySize, 1, 255, "Generate " + name.name + " below set value", name.name + ".yend");
	name.yStart = Math.min(yEnd, yStart);
	yEnd = Math.max(yEnd, yStart);
	name.yStart = yEnd - name.yStart;
	name.maxAmount = configWorldGen.getInt("Max Per Chunk " + name.name, "ore_generation_adv", name.maxAmount, 1, 128, "Max Ore per Chunk " + name.name, name.name + ".maxamount");
	name.veinSize = configWorldGen.getInt("Vein Size Per Chunk " + name.name, "ore_generation_adv", name.veinSize, 1, 128, "Vein Size per Chunk " + name.name, name.name + ".veinsize");
	return ret;
}
 
开发者ID:tom5454,项目名称:Toms-Mod,代码行数:14,代码来源:Config.java

示例15: parse

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
@Override
public Ingredient parse(JsonContext context, JsonObject json)
{
    JsonPrimitive categoryName = json.getAsJsonPrimitive("category");
    JsonPrimitive keyName = json.getAsJsonPrimitive("key");

    ConfigCategory category = ConfigManager.instance.config.getCategory(categoryName.getAsString());
    Property property = category.get(keyName.getAsString());

    if (property.getBoolean())
        return CraftingHelper.getIngredient(json.getAsJsonObject("then"), context);

    return CraftingHelper.getIngredient(json.getAsJsonObject("else"), context);
}
 
开发者ID:gigaherz,项目名称:Survivalist,代码行数:15,代码来源:ConfigurationToggledIngredient.java


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