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


Java Property.setComment方法代码示例

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


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

示例1: get

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
protected <T> T get(String name, String category, String comment, T normal)
{
	try
	{
		Object returned = HarshenUtils.getMethod("get", config.getClass(), String.class, String.class, normal.getClass()).invoke(config, category, name, normal);
		if(normal.getClass().isArray())
			for(Method method : config.getClass().getMethods())
				if(method.getParameterTypes().length == 3 && method.getParameterTypes()[0] == String.class && method.getParameterTypes()[1] == String.class
				&& method.getParameterTypes()[2] == normal.getClass() && method.getParameterTypes()[2].isArray())
					returned = method.invoke(config, category, name, normal);
		if(!(returned instanceof Property))	throw new IllegalArgumentException("Returned Type was not a property. This is practically impossible");
		Property property = (Property) returned;
		property.setComment(comment);
		propertyMap.put(category + "*" + name, property);
		return (T) property.getClass().getMethod("get" + normal.getClass().getSimpleName().replace("Integer", "Int").replace("[]", "List")).invoke(property);
	}
	catch (NullPointerException | SecurityException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
		HarshenCastle.LOGGER.error("Forge Config has no such getter for " + normal.getClass() + ". ErrorClass: " + e.getClass().getSimpleName());
		e.printStackTrace();
	}
	return normal;
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:23,代码来源:BaseConfig.java

示例2: getConfigElements

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
private static List<IConfigElement> getConfigElements()
{
    PROPERTIES.clear();
    ImmutableList.Builder<IConfigElement> builder = ImmutableList.builder();
    Map<String, AuthlibLoginHelper.Data> accounts = AuthlibLoginHelper.getInstance().listAccounts();
    for (Map.Entry<String, AuthlibLoginHelper.Data> entry : accounts.entrySet())
    {
        String name = entry.getKey();
        AuthlibLoginHelper.Data data = entry.getValue();
        boolean skip = data.userid.isEmpty() && !data.accessToken.isPresent();

        String[] choices = skip ? SKIP_CHOICES.toArray(new String[0]) : LOGIN_CHOICES.toArray(new String[0]);
        Property property = new Property(name, choices[0], Property.Type.STRING, choices);
        property.setComment(skip ? SKIP_COMMENT : LOGIN_COMMENT);

        builder.add(new ConfigElement(property));
        PROPERTIES.put(name, property);
    }
    return builder.build();
}
 
开发者ID:ustc-zzzz,项目名称:AuthlibLoginHelper,代码行数:21,代码来源:AuthlibLoginHelperGuiFactory.java

示例3: gravesConfig

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
private static void gravesConfig() {
    // spawn rate
    Property graveSpawnRateProperty = config.get(Config.CATEGORY_GRAVES, "GravesMobsSpawnRate", 1000);
    graveSpawnRateProperty.setComment("This value must be bigger than 600!");
    graveSpawnRate = graveSpawnRateProperty.getInt();

    if (graveSpawnRate < 600) {
        graveSpawnRate = 600;
    }

    spawnMobsByGraves = config.get(Config.CATEGORY_GRAVES, "SpawnMobsByGraves", true).getBoolean(true);
    spawnMobAtGraveDestruction = config.get(Config.CATEGORY_GRAVES, "SpawnMobAtGraveDestruction", true).getBoolean(true);
    spawnChance = config.get(Config.CATEGORY_GRAVES, "GravesMobsSpawnChance", 80).getInt();

    isFogEnabled = config.get(Config.CATEGORY_GRAVES, "CemeteryFogEnabled", true).getBoolean(true);
}
 
开发者ID:NightKosh,项目名称:Gravestone-mod-Extended,代码行数:17,代码来源:ExtendedConfig.java

示例4: 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

示例5: read

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
@Override
public void read() {
	for(T componant: allComponants)
	{
		if(!testIfLegit(componant))
		{
			continue;
		}
		Property property = config.get(CATEGORY, getComponantPathInConfig(componant), true);
		property.setComment(new TextComponentTranslation("config.isEnabled", getComponantCommentName(componant)).getUnformattedText());
		enabledMap.put(componant, property.getBoolean());
	}
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:14,代码来源:BaseEnabledConfig.java

示例6: syncConfig

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
private static void syncConfig() {
    Property prop;

    prop = config.get(Configuration.CATEGORY_GENERAL, "dimensionId", 37);
    prop.setComment("ID for the dimension used by Genesis");
    prop.setRequiresMcRestart(true);
    prop.setLanguageKey("genesis.configgui.dimension_id");
    dimensionId = prop.getInt();

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

示例7: 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

示例8: syncConfig

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
private static void syncConfig(boolean loadFromConfigFile, boolean readFieldsFromConfig) {
	if (loadFromConfigFile)
		config.load();

	Property propertyMachineCooldownBasic = config.get(CATEGORY_NAME_BLOCKS, "machine_cooldown_basic", 100);
	propertyMachineCooldownBasic.setLanguageKey("gui.config.blocks.machine_cooldown_basic.name");
	propertyMachineCooldownBasic.setComment(I18n.format("gui.config.blocks.machine_cooldown_basic.comment"));
	propertyMachineCooldownBasic.setMinValue(10);
	propertyMachineCooldownBasic.setMaxValue(200);
	Property propertyMachineCooldownAdvanced = config.get(CATEGORY_NAME_BLOCKS, "machine_cooldown_advanced", 50);
	propertyMachineCooldownAdvanced.setLanguageKey("gui.config.blocks.machine_cooldown_advanced.name");
	propertyMachineCooldownAdvanced.setComment(I18n.format("gui.config.blocks.machine_cooldown_advanced.comment"));
	propertyMachineCooldownAdvanced.setMinValue(10);
	propertyMachineCooldownAdvanced.setMaxValue(200);

	List<String> propertyOrderBlocks = new ArrayList<String>();
	propertyOrderBlocks.add(propertyMachineCooldownBasic.getName());
	propertyOrderBlocks.add(propertyMachineCooldownAdvanced.getName());
	config.setCategoryPropertyOrder(CATEGORY_NAME_BLOCKS, propertyOrderBlocks);

	if (readFieldsFromConfig) {
		machineCooldownBasic = propertyMachineCooldownBasic.getInt();
		machineCooldownAdvanced = propertyMachineCooldownAdvanced.getInt();
	}

	propertyMachineCooldownBasic.set(machineCooldownBasic);
	propertyMachineCooldownAdvanced.set(machineCooldownAdvanced);

	if (config.hasChanged())
		config.save();
}
 
开发者ID:IvanSteklow,项目名称:VanillaExtras,代码行数:32,代码来源:VExConfig.java

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: syncMain

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
private static void syncMain()
{
	String category = "main";
	List<String> propOrder = Lists.newArrayList();
	Property prop;
	
	prop = main.get(category, "difficulty", difficulty);
	prop.setComment("Changes the difficulty of the mod: 0 = normal, 1 = hard, 2 = legendary.");
	difficulty = prop.getInt();
	propOrder.add(prop.getName());
	
	main.setCategoryPropertyOrder(category, propOrder);
	main.save();
}
 
开发者ID:TheXFactor117,项目名称:Lost-Eclipse-Outdated,代码行数:15,代码来源:Config.java

示例14: doGeneralConfigs

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
private void doGeneralConfigs()
{
	Property p;
	p = configuration.get(CATEGORY_GENERAL, "teslaCoilTransferRate", 20);
	p.setComment("The base power transfer rate per tick of Tesla Coils");
	teslaCoilTransferRate = p.getLong();
}
 
开发者ID:gunnerwolf,项目名称:TeslaCoils,代码行数:8,代码来源:Config.java

示例15: loadConfig

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
static void loadConfig(File configurationFile)
{
    config = new Configuration(configurationFile);

    Property bl = config.get("items", "blacklist", new String[0]);
    bl.setComment("List of items to disallow from placing in the belt.");

    Property wl = config.get("items", "whitelist", new String[0]);
    wl.setComment("List of items to force-allow placing in the belt. Takes precedence over blacklist.");

    Property showBeltOnPlayersProperty = config.get("display", "showBeltOnPlayers", true);
    showBeltOnPlayersProperty.setComment("If set to FALSE, the belts and tools will NOT draw on players.");

    Property beltItemScaleProperty = config.get("display", "beltItemScale", 0.5);
    beltItemScaleProperty.setComment("Changes the scale of items on the belt.");

    Property releaseToSwapProperty = config.get("input", "releaseToSwap", false);
    releaseToSwapProperty.setComment("If set to TRUE, releasing the menu key (R) will activate the swap. Requires a click otherwise (default).");

    Property clipMouseToCircleProperty = config.get("input", "clipMouseToCircle", false);
    clipMouseToCircleProperty.setComment("If set to TRUE, the radial menu will try to prevent the mouse from leaving the outer circle.");

    Property allowClickOutsideBoundsProperty = config.get("input", "allowClickOutsideBounds", false);
    allowClickOutsideBoundsProperty.setComment("If set to TRUE, the radial menu will allow clicking outside the outer circle to activate the items.");

    display = config.getCategory("display");
    display.setComment("Options for customizing the display of tools on the player");

    input = config.getCategory("input");
    input.setComment("Options for customizing the interaction with the radial menu");

    showBeltOnPlayers = showBeltOnPlayersProperty.getBoolean();
    beltItemScale = (float)beltItemScaleProperty.getDouble();

    releaseToSwap = releaseToSwapProperty.getBoolean();
    clipMouseToCircle = clipMouseToCircleProperty.getBoolean();
    allowClickOutsideBounds = allowClickOutsideBoundsProperty.getBoolean();

    blackListString.addAll(Arrays.asList(bl.getStringList()));
    whiteListString.addAll(Arrays.asList(wl.getStringList()));
    if (!bl.wasRead() ||
            !wl.wasRead() ||
            !releaseToSwapProperty.wasRead() ||
            !showBeltOnPlayersProperty.wasRead() ||
            !beltItemScaleProperty.wasRead() ||
            !clipMouseToCircleProperty.wasRead() ||
            !allowClickOutsideBoundsProperty.wasRead())
    {
        config.save();
    }
}
 
开发者ID:gigaherz,项目名称:ToolBelt,代码行数:52,代码来源:Config.java


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