本文整理汇总了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");
}
}));
}
示例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();
});
}
示例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);
}
示例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);
}
示例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);
});
}
示例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;
}
示例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));
}
}
示例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);
}
示例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;
}
示例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;
}
示例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();
});
}
示例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;
}
示例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;
}
示例14: getType
import net.minecraftforge.common.config.Property.Type; //导入依赖的package包/类
@Override
public Property.Type getType() {
return type;
}
示例15: TypeAdapterSame
import net.minecraftforge.common.config.Property.Type; //导入依赖的package包/类
public TypeAdapterSame(TypeToken<TYPE> actual, Property.Type base) {
super(actual, base);
}