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


Java Property.set方法代码示例

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


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

示例1: setZoomAmount

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
public static void setZoomAmount(int zoomAmount) {
	if (zoomAmount > MAX_ZOOM) {
		zoomAmount = MAX_ZOOM;
	} else if (zoomAmount < MIN_ZOOM) {
		zoomAmount = MIN_ZOOM;
	}

	if (Config.zoomAmount != zoomAmount) {
		Config.zoomAmount = zoomAmount;
		if (config != null) {
			String configComment = I18n.format("config.itemzoom.zoom.amount");
			configComment = configComment + " [range: " + MIN_ZOOM + " ~ " + MAX_ZOOM + ", default: " + DEFAULT_ZOOM + "]";
			Property property = config.get(category, "zoom.amount", DEFAULT_ZOOM, configComment, MIN_ZOOM, MAX_ZOOM);
			property.set(Config.zoomAmount);
			if (config.hasChanged()) {
				config.save();
			}
		}
	}
}
 
开发者ID:mezz,项目名称:ItemZoom,代码行数:21,代码来源:Config.java

示例2: getIntFor

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
public static int getIntFor(Configuration config, String heading, String item, int value, int minValue, int maxValue, String comment) {
	if (config == null)
		return value;
	try {
		Property prop = config.get(heading, item, value);
		prop.comment = comment + " [range: " + minValue + " ~ " + maxValue + ", default: " + value + "]";
		prop.setMinValue(minValue);
		prop.setMaxValue(maxValue);
		if (prop.getInt(value) < minValue || prop.getInt(value) > maxValue) {
			TFCTech.LOG.info("An invalid value has been entered for " + item
					+ " in the config file. Reverting to the default value.");
			prop.set(value);
			return value;
		}
		return prop.getInt(value);
	} catch (Exception e) {
		TFCTech.LOG.error("Error while trying to add Integer, config wasn't loaded properly!");
	}
	return value;
}
 
开发者ID:Shurgent,项目名称:TFCTech,代码行数:21,代码来源:ModOptions.java

示例3: getTierBasedIntList

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
private static int[] getTierBasedIntList(Configuration cfg, String name, String category, int[] def, String comment) {
	Property prop = cfg.get(category, name, def, comment);
	int[] ret = prop.getIntList();
	if(ret == null || ret.length < 3) {
		ret = def;
		prop.set(ret);
	}
	return ret;
}
 
开发者ID:SolraBizna,项目名称:j6502,代码行数:10,代码来源:MainClass.java

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

示例5: toggleEnabled

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
public static void toggleEnabled() {
	toggledEnabled = !toggledEnabled;
	if (config != null) {
		String configComment = I18n.format("config.itemzoom.toggle.enabled");
		Property property = config.get(category, "toggled.enabled", true, configComment);
		property.set(toggledEnabled);
		if (config.hasChanged()) {
			config.save();
		}
	}
}
 
开发者ID:mezz,项目名称:ItemZoom,代码行数:12,代码来源:Config.java

示例6: addToBlacklist

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
public boolean addToBlacklist(ItemStack stack){
	if(stack.useItemRightClick(Minecraft.getMinecraft().world, new EntityOtherPlayerMP(Minecraft.getMinecraft().world, new GameProfile(null, "fake")), EnumHand.MAIN_HAND).getType()!=EnumActionResult.PASS){
		Property blackList=conf.get("config", "Blacklist items", new String[0]);
		blackList.set(Arrays.copyOf(blackList.getStringList(),blackList.getStringList().length+1));
		blackList.getStringList()[blackList.getStringList().length-1]=stack.getItem().getRegistryName().toString();
		syncConfig();
		return true;
	}
	return false;
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:12,代码来源:SpinToWin.java

示例7: setLoaded

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
public static boolean setLoaded(int newID)
{
    boolean found = false;

    for (int staticLoadDimension : ConfigManagerCore.staticLoadDimensions)
    {
        if (staticLoadDimension == newID)
        {
            found = true;
            break;
        }
    }

    if (!found)
    {
        int[] oldIDs = ConfigManagerCore.staticLoadDimensions;
        ConfigManagerCore.staticLoadDimensions = new int[ConfigManagerCore.staticLoadDimensions.length + 1];
        System.arraycopy(oldIDs, 0, staticLoadDimensions, 0, oldIDs.length);

        ConfigManagerCore.staticLoadDimensions[ConfigManagerCore.staticLoadDimensions.length - 1] = newID;
        String[] values = new String[ConfigManagerCore.staticLoadDimensions.length];
        Arrays.sort(ConfigManagerCore.staticLoadDimensions);

        for (int i = 0; i < values.length; i++)
        {
            values[i] = String.valueOf(ConfigManagerCore.staticLoadDimensions[i]);
        }

        Property prop = config.get(Constants.CONFIG_CATEGORY_DIMENSIONS, "Static Loaded Dimensions", ConfigManagerCore.staticLoadDimensions);
        prop.comment = "IDs to load at startup, and keep loaded until server stops. Can be added via /gckeeploaded";
        prop.setLanguageKey("gc.configgui.staticLoadedDimensions");
        prop.set(values);

        ConfigManagerCore.config.save();
    }

    return !found;
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:39,代码来源:ConfigManagerCore.java

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

示例9: Config

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
private Config(final @Nonnull File configFile) {
	super(configFile);
	this.configFile = configFile;

	addCustomCategoryComment("Entry", "Entry(sign text parse cache) Management");
	addCustomCategoryComment("Content", "Content Data Management");
	addCustomCategoryComment("Multiplay.PreventAntiAutoSign", "Prevent from Anti-AutoSign Plugin such as NoCheatPlus. (ms)");
	addCustomCategoryComment("Api.Upload", "Api Upload Settings");

	final Property joinBeta = get("Version", "JoinBeta", false);
	final String[] v = StringUtils.split(Reference.VERSION, "\\.");
	if (v.length>=4&&StringUtils.equals(v[3], "beta"))
		joinBeta.set(true);
	this.informationJoinBeta = propertyBoolean(joinBeta);
}
 
开发者ID:Team-Fruit,项目名称:SignPicture,代码行数:16,代码来源:Config.java

示例10: setDefault

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
private static void setDefault(@Nonnull final Configuration config, @Nonnull final String cat,
		@Nonnull final String prop, final float prevDefault, final float newDefault) {
	final ConfigCategory cc = config.getCategory(cat);
	if (cc != null) {
		final Property p = cc.get(prop);
		if (p != null) {
			final float cv = (float) p.getDouble();
			if (cv == prevDefault)
				p.set(newDefault);
		}
	}
}
 
开发者ID:OreCruncher,项目名称:DynamicSurroundings,代码行数:13,代码来源:ModOptions.java

示例11: load

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
@Nonnull
public ConfigurationHelper load(@Nonnull final String category, @Nonnull final Property prop) {
	final String id = category + "." + prop.getName();
	switch (prop.getType()) {
	case STRING:
		if (prop.isList())
			prop.set(this.data.getStringList(id, prop.getDefaults(), PresetData.SPLIT_NEWLINE_CHAR));
		else
			prop.set(this.data.getString(id, prop.getDefault()));
		break;
	case INTEGER:
		if (prop.isList())
			prop.set(this.data.getIntList(id, Utils.toIntArray(prop.getDefaults())));
		else
			prop.set(this.data.getInt(id, Integer.parseInt(prop.getDefault())));
		break;
	case BOOLEAN:
		if (prop.isList())
			prop.set(this.data.getBooleanList(id, Utils.toBooleanArray(prop.getDefaults())));
		else
			prop.set(this.data.getBoolean(id, Boolean.parseBoolean(prop.getDefault())));
		break;
	case DOUBLE:
		if (prop.isList())
			prop.set(this.data.getDoubleList(id, Utils.toDoubleArray(prop.getDefaults())));
		else
			prop.set(this.data.getDouble(id, Double.parseDouble(prop.getDefault())));
		break;
	case COLOR:
	case MOD_ID:
	default:
	}
	return this;
}
 
开发者ID:OreCruncher,项目名称:DynamicSurroundings,代码行数:35,代码来源:ConfigurationHelper.java

示例12: takeCell

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
Coord takeCell(int channel, DeltaCoord size) {
    loadGlobalConfig();
    Property chanAllocs = worldState.get("allocations", "channel" + channel, 0);
    int start = roundToChunk(chanAllocs.getInt(0));
    int add = size.x + getPaddingForChannel(channel);
    chanAllocs.set(Integer.toString(start + add));
    Coord ret = new Coord(DeltaChunk.getServerShadowWorld(), start, 16, roundToChunk(channel*Hammer.channelWidth));
    dirtyCellAllocations();
    return ret;
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:11,代码来源:HammerInfo.java

示例13: syncConfig

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


	Property propEnableInventoryGUI = config.get(Configuration.CATEGORY_GENERAL, "enableInventoryGui", DefaultValues.enableInventoryGui, "");
	propEnableInventoryGUI.setLanguageKey("villagerinventory.options.enableInventoryGui");
	propEnableInventoryGUI.setRequiresMcRestart(false);

	Property propRequireEmptyHand = config.get(Configuration.CATEGORY_GENERAL, "requireEmptyHand", DefaultValues.requireEmptyHand, "");
	propRequireEmptyHand.setLanguageKey("villagerinventory.options.requireEmptyHand");
	propRequireEmptyHand.setRequiresMcRestart(false);

	Property propEnableDeathDrops = config.get(Configuration.CATEGORY_GENERAL, "enableDeathDrops", DefaultValues.enableDeathDrops, "");
	propEnableDeathDrops.setLanguageKey("villagerinventory.options.enableDeathDrops");
	propEnableDeathDrops.setRequiresMcRestart(false);


	try
	{
		propEnableInventoryGUI.setConfigEntryClass(ModGuiConfigEntries.BooleanEntry.class);
		propRequireEmptyHand.setConfigEntryClass(ModGuiConfigEntries.BooleanEntry.class);
		propEnableDeathDrops.setConfigEntryClass(ModGuiConfigEntries.BooleanEntry.class);

		List<String> propOrderGeneral = new ArrayList<String>();
		propOrderGeneral.add(propEnableInventoryGUI.getName());
		propOrderGeneral.add(propRequireEmptyHand.getName());
		propOrderGeneral.add(propEnableDeathDrops.getName());
		config.setCategoryPropertyOrder(Configuration.CATEGORY_GENERAL, propOrderGeneral);

	}
	catch (NoClassDefFoundError e)
	{
	}


	if (readFieldsFromConfig)
	{
		enableInventoryGui = propEnableInventoryGUI.getBoolean();
		requireEmptyHand = propRequireEmptyHand.getBoolean();
		enableDeathDrops = propEnableDeathDrops.getBoolean();
	}

	propEnableInventoryGUI.set(enableInventoryGui);
	propRequireEmptyHand.set(requireEmptyHand);
	propEnableDeathDrops.set(enableDeathDrops);

	if (config.hasChanged()) config.save();
}
 
开发者ID:crazysnailboy,项目名称:VillagerInventory,代码行数:50,代码来源:ModConfiguration.java

示例14: updateNag

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
public static void updateNag()
{
    Property prop = config.get(Configuration.CATEGORY_CLIENT, "java8Reminder", java8Reminder);
    prop.set((new Date()).getTime());
    config.save();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:7,代码来源:ForgeModContainer.java

示例15: setUnloaded

import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
public static boolean setUnloaded(int idToRemove)
{
    int foundCount = 0;

    for (int staticLoadDimension : ConfigManagerCore.staticLoadDimensions)
    {
        if (staticLoadDimension == idToRemove)
        {
            foundCount++;
        }
    }

    if (foundCount > 0)
    {
        List<Integer> idArray = new ArrayList<Integer>(Ints.asList(ConfigManagerCore.staticLoadDimensions));
        idArray.removeAll(Collections.singleton(idToRemove));

        ConfigManagerCore.staticLoadDimensions = new int[idArray.size()];

        for (int i = 0; i < idArray.size(); i++)
        {
            ConfigManagerCore.staticLoadDimensions[i] = idArray.get(i);
        }

        String[] values = new String[ConfigManagerCore.staticLoadDimensions.length];
        Arrays.sort(ConfigManagerCore.staticLoadDimensions);

        for (int i = 0; i < values.length; i++)
        {
            values[i] = String.valueOf(ConfigManagerCore.staticLoadDimensions[i]);
        }

        Property prop = config.get(Constants.CONFIG_CATEGORY_DIMENSIONS, "Static Loaded Dimensions", ConfigManagerCore.staticLoadDimensions);
        prop.comment = "IDs to load at startup, and keep loaded until server stops. Can be added via /gckeeploaded";
        prop.setLanguageKey("gc.configgui.staticLoadedDimensions");
        prop.set(values);

        ConfigManagerCore.config.save();
    }

    return foundCount > 0;
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:43,代码来源:ConfigManagerCore.java


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