• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Type类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Type类属于net.minecraftforge.common.config.Property包,在下文中一共展示了Type类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: registerConfig

import net.minecraftforge.common.config.Property.Type; //导入依赖的package包/类
@Override
protected void registerConfig() {
	addConfigManager(new FileConfigManagerBuilder()
			.setFileName("twintails.cfg")
			.setDesc("TwinTails Configuration")
			.addCategory("general")
			.addValue("TwinTailsEffects", "false", Type.BOOLEAN,
					"Enable to get effects while wearing certain twintails", new Consumer<Property>() {
						@Override
						public void accept(Property property) {
							ItemHairBand.twinTailsEffects = property.getBoolean();
						}
					})
			.endCategory()
			.Update(new Consumer<Configuration>() {
				@Override
				public void accept(Configuration configuration) {
					ConfigCategory gralCat = configuration.getCategory("general");
					if (gralCat.containsKey("VersionCheck"))
						gralCat.remove("VersionCheck");
					if (gralCat.containsKey("VersionLatest"))
						gralCat.remove("VersionLatest");
				}
			}));
}
 
开发者ID:hea3ven,项目名称:TwinTails,代码行数:26,代码来源:TwinTailsCommonProxy.java


示例2: getConfig

import net.minecraftforge.common.config.Property.Type; //导入依赖的package包/类
@Override
public CategoryConfigManagerBuilder getConfig() {
	return new CategoryConfigManagerBuilder("World").addValue("enableWorldTweaks", "true", Type.BOOLEAN,
			"Enable world tweaks.", property -> {
				if (property.getBoolean()) {
					if (worldManager == null) {
						worldManager = new WorldTweaksManager();
						MinecraftForge.EVENT_BUS.register(worldManager);
					}
				} else {
					if (worldManager != null) {
						MinecraftForge.EVENT_BUS.unregister(worldManager);
						worldManager = null;
					}
				}
			})
			.addValue("maxBreakSpeed", "300", Type.INTEGER,
					"The maximum break speed allowed. For reference, diamond pickaxe is a" +
							" break speed of 8, and with efficiency V it's speed is 34", property -> {
						WorldTweaksManager.maxBreakSpeed = property.getInt();
					});
}
 
开发者ID:hea3ven,项目名称:HardModeTweaks,代码行数:23,代码来源:ProxyModHardModeTweaksWorld.java


示例3: getConfig

import net.minecraftforge.common.config.Property.Type; //导入依赖的package包/类
@Override
public CategoryConfigManagerBuilder getConfig() {
	return new CategoryConfigManagerBuilder("Other").addValue("enableAnimalAITweak", "true", Type.BOOLEAN,
			"Enable changing the animals AI to make them run from their attackers.", property -> {
				if (property.getBoolean()) {
					if (aiManager == null) {
						aiManager = new AITweaksManager();
						MinecraftForge.EVENT_BUS.register(aiManager);
					}
				} else {
					if (aiManager != null) {
						MinecraftForge.EVENT_BUS.unregister(aiManager);
						aiManager = null;
					}
				}
			})
			.addValue("enableNonSolidLeaves", "true", Type.BOOLEAN,
					"Enable tweak to make leaves blocks non-solid (like vines).", property -> {
						Hea3venTweaks.setConfig("NonSolidLeaves.enabled",
								Boolean.toString(property.getBoolean()));
					}, true, true);
}
 
开发者ID:hea3ven,项目名称:HardModeTweaks,代码行数:23,代码来源:ProxyModHardModeTweaksOther.java


示例4: getConfig

import net.minecraftforge.common.config.Property.Type; //导入依赖的package包/类
@Override
public CategoryConfigManagerBuilder getConfig() {
	return new CategoryConfigManagerBuilder("DayNightCycle").addValue("enableDayCycleTweaks", "true",
			Type.BOOLEAN, "Enable the day/night cycle tweaks", property -> {
				Hea3venTweaks.setConfig("DayNightCycle.enabled", property.getString());
			}, true, true)
			.addValue("cycleLengthMultiplier", "1.0", Type.DOUBLE, "Change the length of the day/night " +
					"cycle, 1.0 is the same as vanilla, which is 20 minutes.", property -> {
				Hea3venTweaks.setConfig("DayNightCycle.cycleLengthMultiplier",
						Double.toString(property.getDouble()));
				DayNightCycle.dayLengthMultiplier = 1.0d / property.getDouble();
			}, false, true)
			.addValue("dayToNightRatio", "0.5", Type.DOUBLE, "Ratio between the length of the day and " +
					"the length of the night, values should be between 0.0 and 1.0. A value of 0.5 " +
					"means day and night are the same length, a value of 0.75 means the day is longer " +
					"than the night.", property -> {
				Hea3venTweaks.setConfig("DayNightCycle.dayToNightRatio",
						Float.toString((float) property.getDouble()));
				DayNightCycle.dayToNightRatio = 2.0f * (float) property.getDouble();
			}, false, true);
}
 
开发者ID:hea3ven,项目名称:HardModeTweaks,代码行数:22,代码来源:ProxyModHardModeTweaksDayNightCycle.java


示例5: getConfig

import net.minecraftforge.common.config.Property.Type; //导入依赖的package包/类
@Override
public CategoryConfigManagerBuilder getConfig() {
	return new CategoryConfigManagerBuilder("Sleep").addValue("enableSleepPrevention", "true",
			Type.BOOLEAN, "Enable beds requiring a timeout after being placed before they can be used.",
			property -> {
				if (property.getBoolean()) {
					if (sleepManager == null) {
						sleepManager = new SleepManager();
						MinecraftForge.EVENT_BUS.register(sleepManager);
					}
				} else {
					if (sleepManager != null) {
						MinecraftForge.EVENT_BUS.unregister(sleepManager);
						sleepManager = null;
					}
				}
			})
			.addValue("sleepTimeout", "3", Type.INTEGER,
					"The number of days that must pass after placing a bed before it can be used.",
					property -> {
						SleepManager.sleepPreventionTimeout =
								(int) (property.getInt() * 24000 / DayNightCycle.dayLengthMultiplier);
					});
}
 
开发者ID:hea3ven,项目名称:HardModeTweaks,代码行数:25,代码来源:ProxyModHardModeTweaksSleep.java


示例6: getConfig

import net.minecraftforge.common.config.Property.Type; //导入依赖的package包/类
@Override
public CategoryConfigManagerBuilder getConfig() {
	CategoryConfigManagerBuilder cfg =
			new CategoryConfigManagerBuilder("GameRules").addValue("enableGameRules", "true",
					Type.BOOLEAN, "Enable changing the game rules.", property -> {
						if (property.getBoolean()) {
							if (rulesManager == null) {
								rulesManager = new GameRulesManager();
								MinecraftForge.EVENT_BUS.register(rulesManager);
							}
						} else {
							if (rulesManager != null) {
								MinecraftForge.EVENT_BUS.unregister(rulesManager);
								rulesManager = null;
							}
						}
					});
	GameRules rules = new GameRules();
	for (String ruleName : rules.getRules()) {
		cfg = cfg.addValue(ruleName, rules.getString(ruleName), Type.STRING, "", property -> {
			GameRulesManager.gameRules.put(property.getName(), property.getString());
		}, false, true);
	}
	return cfg;
}
 
开发者ID:hea3ven,项目名称:HardModeTweaks,代码行数:26,代码来源:ProxyModHardModeTweaksGameRules.java


示例7: updateValueFromConfig

import net.minecraftforge.common.config.Property.Type; //导入依赖的package包/类
void updateValueFromConfig(boolean force) {
	// return on newly created value. Due to forge bug list properties
	// don't set this value properly
	if (!force && !wrappedProperty.wasRead() && !wrappedProperty.isList()) return;

	final Type actualType = wrappedProperty.getType();

	Preconditions.checkState(type == actualType, "Invalid config property type '%s', expected '%s'", actualType, type);

	String[] currentValue = getActualPropertyValue();
	try {
		Object converted = convertValue(currentValue);
		setFieldValue(converted);
	} catch (StringConversionException e) {
		Log.warn(e, "Invalid config property value %s, using default value", Arrays.toString(currentValue));
	}
}
 
开发者ID:OpenMods,项目名称:OpenModsLib,代码行数:18,代码来源:ConfigPropertyMeta.java


示例8: PropertyType

import net.minecraftforge.common.config.Property.Type; //导入依赖的package包/类
private PropertyType(int id, String name, Type type) {
	this.name = name;
	this.id = id;
	this.type = type;
	propertyTypes[id] = this;
	MapList.propertyTypes.put(name, this);
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:8,代码来源:WeaponData.java


示例9: addValue

import net.minecraftforge.common.config.Property.Type; //导入依赖的package包/类
public CategoryConfigManagerBuilder addValue(String name, String defaultValue, Property.Type type,
		String desc, Consumer<Property> listener, boolean requiresMcRestart,
		boolean requiresWorldRestart) {
	values.add(new ValueBuilder(name, defaultValue, type, desc, listener, requiresMcRestart,
			requiresWorldRestart));
	return this;
}
 
开发者ID:hea3ven,项目名称:CommonUtils,代码行数:8,代码来源:FileConfigManagerBuilder.java


示例10: ValueBuilder

import net.minecraftforge.common.config.Property.Type; //导入依赖的package包/类
public ValueBuilder(String name, String defaultValue, Type type, String desc,
		Consumer<Property> listener, boolean requiresMcRestart, boolean requiresWorldRestart) {
	this.name = name;
	this.defaultValue = defaultValue;
	this.defaultValues = null;
	this.type = type;
	this.desc = desc;
	this.listener = listener;
	this.requiresMcRestart = requiresMcRestart;
	this.requiresWorldRestart = requiresWorldRestart;
}
 
开发者ID:hea3ven,项目名称:CommonUtils,代码行数:12,代码来源:FileConfigManagerBuilder.java


示例11: getConfig

import net.minecraftforge.common.config.Property.Type; //导入依赖的package包/类
@Override
public CategoryConfigManagerBuilder getConfig() {
	return new CategoryConfigManagerBuilder("Mobs").addValue("enableMobsTweak", "true", Type.BOOLEAN,
			"Enable tweaks for mobs.", property -> {
				if (property.getBoolean()) {
					if (mobsManager == null) {
						mobsManager = new MobsTweaksManager();
						MinecraftForge.EVENT_BUS.register(mobsManager);
					}
				} else {
					if (mobsManager != null) {
						MinecraftForge.EVENT_BUS.unregister(mobsManager);
						mobsManager = null;
					}
				}
			})
			.addValue("spidersApplySlowness", "true", Type.BOOLEAN,
					"Enable to make spiders apply slowness when they attack.", property -> {
						MobsTweaksManager.spidersApplySlowness = property.getBoolean();
					})
			.addValue("replaceCaveSpiderPoison", "true", Type.BOOLEAN,
					"Enable to make it so cave spiders apply weakness in stead of poison.", property -> {
						MobsTweaksManager.replaceCaveSpiderPoison = property.getBoolean();
					})
			.addValue("creeperSpawnTweak", "true", Type.BOOLEAN,
					"Make it so that creepers only spawn on blocks without sky access.", property -> {
						MobsTweaksManager.creeperSpawnTweak = property.getBoolean();
					})
			.addValue("zombieKnockbackResistance", "0.6d", Type.DOUBLE,
					"The value for zombies knockback resistance, use values between 0.0 and 1.0." +
							" Set to 0.0 to disable.", property -> {
						MobsTweaksManager.zombieKnockbackResistance = (float) property.getDouble();
					});
}
 
开发者ID:hea3ven,项目名称:HardModeTweaks,代码行数:35,代码来源:ProxyModHardModeTweaksMobs.java


示例12: deserialize

import net.minecraftforge.common.config.Property.Type; //导入依赖的package包/类
@Override
public WeaponData deserialize(JsonElement json, java.lang.reflect.Type typeOfT,
		JsonDeserializationContext context) throws JsonParseException {

	return null;
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:7,代码来源:WeaponData.java


示例13: TypeAdapterBase

import net.minecraftforge.common.config.Property.Type; //导入依赖的package包/类
public TypeAdapterBase(TypeToken<ACTUAL> actualType, Property.Type type, Class<?> primitiveType) {
  this.actualType = actualType;
  this.type = type;
  this.primitiveType = primitiveType;
}
 
开发者ID:SleepyTrousers,项目名称:EnderCore,代码行数:6,代码来源:TypeAdapterBase.java


示例14: getType

import net.minecraftforge.common.config.Property.Type; //导入依赖的package包/类
@Override
public Property.Type getType() {
  return type;
}
 
开发者ID:SleepyTrousers,项目名称:EnderCore,代码行数:5,代码来源:TypeAdapterBase.java


示例15: TypeAdapterSame

import net.minecraftforge.common.config.Property.Type; //导入依赖的package包/类
public TypeAdapterSame(TypeToken<TYPE> actual, Property.Type base) {
  super(actual, base);
}
 
开发者ID:SleepyTrousers,项目名称:EnderCore,代码行数:4,代码来源:TypeAdapterBase.java


示例16: getPropertyType

import net.minecraftforge.common.config.Property.Type; //导入依赖的package包/类
@Override
protected Type getPropertyType() { return Type.INTEGER; }
 
开发者ID:copygirl,项目名称:copycore,代码行数:3,代码来源:IntegerSetting.java


示例17: getPropertyType

import net.minecraftforge.common.config.Property.Type; //导入依赖的package包/类
@Override
protected Type getPropertyType() { return Type.BOOLEAN; }
 
开发者ID:copygirl,项目名称:copycore,代码行数:3,代码来源:BooleanSetting.java


示例18: getPropertyType

import net.minecraftforge.common.config.Property.Type; //导入依赖的package包/类
@Override
protected Type getPropertyType() { return Type.STRING; }
 
开发者ID:copygirl,项目名称:copycore,代码行数:3,代码来源:StringSetting.java


示例19: getPropertyType

import net.minecraftforge.common.config.Property.Type; //导入依赖的package包/类
@Override
protected Type getPropertyType() { return Type.DOUBLE; }
 
开发者ID:copygirl,项目名称:copycore,代码行数:3,代码来源:DoubleSetting.java


示例20: getConfig

import net.minecraftforge.common.config.Property.Type; //导入依赖的package包/类
@Override
public CategoryConfigManagerBuilder getConfig() {
	return new CategoryConfigManagerBuilder("Food").addValue("enableFoodTweaks", "true", Type.BOOLEAN,
			"Enable food tweaks. The food healing stacks with the normal natural regeneration, " +
					"so consider disabling the gamerule for that.", property -> {
				if (property.getBoolean()) {
					if (foodManager == null) {
						foodManager = new FoodTweaksManager();
						MinecraftForge.EVENT_BUS.register(foodManager);
					}
				} else {
					if (foodManager != null) {
						MinecraftForge.EVENT_BUS.unregister(foodManager);
						foodManager = null;
					}
				}
			}, true, true)
			.addValue("foodValues",
					new String[] {"minecraft:rabbit_stew|12|12.0", "minecraft:golden_carrot|8|14.4",
							"minecraft:pumpkin_pie|8|12.0", "minecraft:golden_apple|10|9.6",
							"minecraft:mushroom_stew|8|11", "minecraft:bread|6|11",
							"minecraft:beetroot_soup|6|7.8", "minecraft:cooked_salmon|7|6.4",
							"minecraft:cooked_fish|5|7.8", "minecraft:spider_eye|4|6.4",
							"minecraft:baked_potato|5|5.2", "minecraft:apple|4|5.2",
							"minecraft:cooked_beef|3|5.2", "minecraft:cooked_porkchop|3|5.2",
							"minecraft:cooked_mutton|3|5.2", "minecraft:cooked_chicken|3|5.2",
							"minecraft:cooked_rabbit|3|5.2", "minecraft:chorus_fruit|6|1.2",
							"minecraft:cookie|4|3.2", "minecraft:carrot|4|2.4", "minecraft:melon|4|2.4",
							"minecraft:beetroot|4|2.4", "minecraft:potato|4|2.4",
							"minecraft:rotten_flesh|4|0.8", "minecraft:raw_salmon|2|2.4",
							"minecraft:raw_fish|2|2.4", "minecraft:rabbit|2|2.4",
							"minecraft:porkchop|2|2.4", "minecraft:beef|2|2.4", "minecraft:mutton|2|2.4",
							"minecraft:chicken|2|2.4", "minecraft:poisonous_potato|2|0.8"}, Type.STRING,
					"Modifications to food's value and saturation." +
							" Remove all entries to leave as default vanilla values.", property -> {
						FoodValueTweaker.foodValuesConfig = Lists.newArrayList();
						for (String foodConfigString : property.getStringList()) {
							FoodConfig foodConfig = FoodConfig.parse(foodConfigString);
							if (foodConfig != null)
								FoodValueTweaker.foodValuesConfig.add(foodConfig);
						}
					}, true, true)
			.addValue("healMinFoodLevel", "4", Type.INTEGER,
					"The minimum food level required to be able to heal.", property -> {
						FoodTweaksManager.healMinFoodLevel = property.getInt();
					})
			.addValue("healTimeout", "20", Type.INTEGER, "The timeout between heals.", property -> {
				FoodTweaksManager.healTimeout = (byte) property.getInt();
			})
			.addValue("healAmount", "0.2", Type.DOUBLE, "The amount of healing done.", property -> {
				FoodTweaksManager.healAmount = (float) property.getDouble();
			})
			.addValue("healExhaustion", "3.0", Type.DOUBLE,
					"The amount of exhaustion added when healing.", property -> {
						FoodTweaksManager.healExhaustion = (float) property.getDouble();
					});
}
 
开发者ID:hea3ven,项目名称:HardModeTweaks,代码行数:58,代码来源:ProxyModHardModeTweaksFood.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java InstanceTag类代码示例发布时间:2022-05-22
下一篇:
Java IndicatorStyle类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap