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


Java Property.setRequiresWorldRestart方法代码示例

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


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

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

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

示例3: 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.setRequiresWorldRestart方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。