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


Java Type类代码示例

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


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


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