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


Java Property.setValue方法代碼示例

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


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

示例1: getConfigProperties

import net.minecraftforge.common.config.Property; //導入方法依賴的package包/類
@Override
public ConfigProperties getConfigProperties() {
	Property property = Mobycraft.config.get("files", "docker-host", "Docker host IP",
			"The IP of your Docker host (set using /docker host <host>); only used if DOCKER_HOST environment variable is not set");
	if (property.isDefault()) {
		property.setValue(getDefaultHost());
	}
	configProperties.setDockerHostProperty(property);

	property = Mobycraft.config.get("files", "docker-cert-path", "File path",
			"The directory path of your Docker certificate (set using /docker path <path>); only used if DOCKER_CERT_PATH environment variable is not set");
	if (property.isDefault()) {
		property.setValue(getDefaultPath());
	}
	configProperties.setCertPathProperty(property);

	configProperties.setStartPosProperty(Mobycraft.config.get("container-building", "start-pos", "0, 0, 0",
			"The position - x, y, z - to start building containers at (set using /docker start_pos"));

	configProperties.setPollRateProperty(Mobycraft.config.get("container-building", "poll-rate", "2",
			"The rate in seconds at which the containers will update (set using /docker poll_rate <rate in seconds>)"));

	MainCommand.maxCount = (int) Math.floor((Float.parseFloat(configProperties.getPollRateProperty().getString()) * 50));

	return configProperties;
}
 
開發者ID:AdityaGupta1,項目名稱:mobycraft,代碼行數:27,代碼來源:ConfigurationCommands.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


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