當前位置: 首頁>>代碼示例>>Java>>正文


Java Property.setRequiresMcRestart方法代碼示例

本文整理匯總了Java中net.minecraftforge.common.config.Property.setRequiresMcRestart方法的典型用法代碼示例。如果您正苦於以下問題:Java Property.setRequiresMcRestart方法的具體用法?Java Property.setRequiresMcRestart怎麽用?Java Property.setRequiresMcRestart使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraftforge.common.config.Property的用法示例。


在下文中一共展示了Property.setRequiresMcRestart方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

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

示例2: generateSoundList

import net.minecraftforge.common.config.Property; //導入方法依賴的package包/類
protected void generateSoundList(final ConfigCategory cat) {
	cat.setRequiresMcRestart(false);
	cat.setRequiresWorldRestart(false);

	final SoundHandler handler = Minecraft.getMinecraft().getSoundHandler();
	final List<String> sounds = new ArrayList<String>();
	for (final Object resource : handler.soundRegistry.getKeys())
		sounds.add(resource.toString());
	Collections.sort(sounds);

	final SoundRegistry registry = RegistryManager.get(RegistryType.SOUND);
	for (final String sound : sounds) {
		final Property prop = new Property(sound, "", Property.Type.STRING);
		prop.setDefaultValue("");
		prop.setRequiresMcRestart(false);
		prop.setRequiresWorldRestart(false);
		prop.setConfigEntryClass(SoundConfigEntry.class);
		final StringBuilder builder = new StringBuilder();
		if (registry.isSoundBlocked(sound))
			builder.append(GuiConstants.TOKEN_BLOCK).append(' ');
		if (registry.isSoundCulled(sound))
			builder.append(GuiConstants.TOKEN_CULL).append(' ');
		final float v = registry.getVolumeScale(sound);
		if (v != 1.0F)
			builder.append((int) (v * 100F));
		prop.setValue(builder.toString());
		cat.put(sound, prop);
	}
}
 
開發者ID:OreCruncher,項目名稱:DynamicSurroundings,代碼行數:30,代碼來源:DynSurroundConfigGui.java

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

示例4: parseOther

import net.minecraftforge.common.config.Property; //導入方法依賴的package包/類
private void parseOther(Property property, ModConfig modConfig)
{
	property.setRequiresMcRestart(modConfig.requireMCRestart());
	property.setRequiresWorldRestart(modConfig.requireWorldRestart());
	property.setShowInGui(modConfig.showInGui());
}
 
開發者ID:InfinityStudio,項目名稱:InspiringWorld,代碼行數:7,代碼來源:ConfigDelegate.java

示例5: process

import net.minecraftforge.common.config.Property; //導入方法依賴的package包/類
public static void process(@Nonnull final Configuration config, @Nonnull final Class<?> clazz,
		@Nullable final Object parameters) {
	for (final Field field : clazz.getFields()) {
		final Parameter annotation = field.getAnnotation(Parameter.class);
		if (annotation != null) {
			final String category = annotation.category();
			final String property = annotation.property();
			final String language = annotation.lang();
			final String comment = field.getAnnotation(Comment.class) != null
					? field.getAnnotation(Comment.class).value() : "NEEDS COMMENT";

			try {
				final Object defaultValue = field.get(parameters);

				if (defaultValue instanceof Boolean) {
					field.set(parameters, config.getBoolean(property, category,
							Boolean.valueOf(annotation.defaultValue()), comment));
				} else if (defaultValue instanceof Integer) {
					int minInt = Integer.MIN_VALUE;
					int maxInt = Integer.MAX_VALUE;
					final MinMaxInt mmi = field.getAnnotation(MinMaxInt.class);
					if (mmi != null) {
						minInt = mmi.min();
						maxInt = mmi.max();
					}
					field.set(parameters, config.getInt(property, category,
							Integer.valueOf(annotation.defaultValue()), minInt, maxInt, comment));
				} else if (defaultValue instanceof Float) {
					float minFloat = Float.MIN_VALUE;
					float maxFloat = Float.MAX_VALUE;
					final MinMaxFloat mmf = field.getAnnotation(MinMaxFloat.class);
					if (mmf != null) {
						minFloat = mmf.min();
						maxFloat = mmf.max();
					}
					field.set(parameters, config.getFloat(property, category,
							Float.valueOf(annotation.defaultValue()), minFloat, maxFloat, comment));
				} else if (defaultValue instanceof String) {
					field.set(parameters, config.getString(property, category, annotation.defaultValue(), comment));
				} else if (defaultValue instanceof String[]) {
					field.set(parameters, config.getStringList(property, category,
							StringUtils.split(annotation.defaultValue(), ','), comment));
				}

				// Configure other settings
				final Property prop = config.getCategory(category).get(property);
				if (!StringUtils.isEmpty(language))
					prop.setLanguageKey(language);
				if (field.getAnnotation(RestartRequired.class) != null) {
					final RestartRequired restart = field.getAnnotation(RestartRequired.class);
					prop.setRequiresMcRestart(restart.server());
					prop.setRequiresWorldRestart(restart.world());
				} else {
					prop.setRequiresMcRestart(false);
					prop.setRequiresWorldRestart(false);
				}

				prop.setShowInGui(field.getAnnotation(Hidden.class) == null);

			} catch (final Throwable t) {
				LibLog.log().error("Unable to parse configuration", t);
			}
		}
	}
}
 
開發者ID:OreCruncher,項目名稱:DynamicSurroundings,代碼行數:66,代碼來源:ConfigProcessor.java


注:本文中的net.minecraftforge.common.config.Property.setRequiresMcRestart方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。