本文整理汇总了Java中net.minecraftforge.common.config.Property.setLanguageKey方法的典型用法代码示例。如果您正苦于以下问题:Java Property.setLanguageKey方法的具体用法?Java Property.setLanguageKey怎么用?Java Property.setLanguageKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.common.config.Property
的用法示例。
在下文中一共展示了Property.setLanguageKey方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: refresh
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
/**
* Refreshes this mod's configuration
*/
public void refresh()
{
load();
Property prop;
prop = get("options", "spinspeed", 1.0D);
prop.setLanguageKey("globalxp.config.spinspeed");
spinSpeed = prop.getDouble(1.0D);
prop = get("options", "bobspeed", 1.0D);
prop.setLanguageKey("globalxp.config.bobspeed");
bobSpeed = prop.getDouble(1.0D);
prop = get("options", "renderNameplate", true);
prop.setLanguageKey("globalxp.config.renderNameplate");
renderNameplate = prop.getBoolean(true);
if(hasChanged())
save();
}
示例2: syncConfig
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
private static void syncConfig() {
Property prop;
prop = config.get(Configuration.CATEGORY_GENERAL, "dimensionId", 37);
prop.setComment("ID for the dimension used by Genesis");
prop.setRequiresMcRestart(true);
prop.setLanguageKey("genesis.configgui.dimension_id");
dimensionId = prop.getInt();
if (config.hasChanged()) {
config.save();
}
}
示例3: syncConfig
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
private static void syncConfig(boolean loadFromConfigFile, boolean readFieldsFromConfig) {
if (loadFromConfigFile)
config.load();
Property propertyMachineCooldownBasic = config.get(CATEGORY_NAME_BLOCKS, "machine_cooldown_basic", 100);
propertyMachineCooldownBasic.setLanguageKey("gui.config.blocks.machine_cooldown_basic.name");
propertyMachineCooldownBasic.setComment(I18n.format("gui.config.blocks.machine_cooldown_basic.comment"));
propertyMachineCooldownBasic.setMinValue(10);
propertyMachineCooldownBasic.setMaxValue(200);
Property propertyMachineCooldownAdvanced = config.get(CATEGORY_NAME_BLOCKS, "machine_cooldown_advanced", 50);
propertyMachineCooldownAdvanced.setLanguageKey("gui.config.blocks.machine_cooldown_advanced.name");
propertyMachineCooldownAdvanced.setComment(I18n.format("gui.config.blocks.machine_cooldown_advanced.comment"));
propertyMachineCooldownAdvanced.setMinValue(10);
propertyMachineCooldownAdvanced.setMaxValue(200);
List<String> propertyOrderBlocks = new ArrayList<String>();
propertyOrderBlocks.add(propertyMachineCooldownBasic.getName());
propertyOrderBlocks.add(propertyMachineCooldownAdvanced.getName());
config.setCategoryPropertyOrder(CATEGORY_NAME_BLOCKS, propertyOrderBlocks);
if (readFieldsFromConfig) {
machineCooldownBasic = propertyMachineCooldownBasic.getInt();
machineCooldownAdvanced = propertyMachineCooldownAdvanced.getInt();
}
propertyMachineCooldownBasic.set(machineCooldownBasic);
propertyMachineCooldownAdvanced.set(machineCooldownAdvanced);
if (config.hasChanged())
config.save();
}
示例4: syncConfigDefaults
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
/**
* Synchronizes the local fields with the values in the Configuration object.
*/
public static void syncConfigDefaults()
{
// By adding a property order list we are defining the order that the properties will appear both in the config file and on the GUIs.
// Property order lists are defined per-ConfigCategory.
List<String> propOrder = new ArrayList<String>();
config.setCategoryComment("defaults", "Default configuration for forge chunk loading control")
.setCategoryRequiresWorldRestart("defaults", true);
Property temp = config.get("defaults", "enabled", true);
temp.setComment("Are mod overrides enabled?");
temp.setLanguageKey("forge.configgui.enableModOverrides");
overridesEnabled = temp.getBoolean(true);
propOrder.add("enabled");
temp = config.get("defaults", "maximumChunksPerTicket", 25);
temp.setComment("The default maximum number of chunks a mod can force, per ticket, \n" +
"for a mod without an override. This is the maximum number of chunks a single ticket can force.");
temp.setLanguageKey("forge.configgui.maximumChunksPerTicket");
temp.setMinValue(0);
defaultMaxChunks = temp.getInt(25);
propOrder.add("maximumChunksPerTicket");
temp = config.get("defaults", "maximumTicketCount", 200);
temp.setComment("The default maximum ticket count for a mod which does not have an override\n" +
"in this file. This is the number of chunk loading requests a mod is allowed to make.");
temp.setLanguageKey("forge.configgui.maximumTicketCount");
temp.setMinValue(0);
defaultMaxCount = temp.getInt(200);
propOrder.add("maximumTicketCount");
temp = config.get("defaults", "playerTicketCount", 500);
temp.setComment("The number of tickets a player can be assigned instead of a mod. This is shared across all mods and it is up to the mods to use it.");
temp.setLanguageKey("forge.configgui.playerTicketCount");
temp.setMinValue(0);
playerTicketLength = temp.getInt(500);
propOrder.add("playerTicketCount");
temp = config.get("defaults", "dormantChunkCacheSize", 0);
temp.setComment("Unloaded chunks can first be kept in a dormant cache for quicker\n" +
"loading times. Specify the size (in chunks) of that cache here");
temp.setLanguageKey("forge.configgui.dormantChunkCacheSize");
temp.setMinValue(0);
dormantChunkCacheSize = temp.getInt(0);
propOrder.add("dormantChunkCacheSize");
FMLLog.info("Configured a dormant chunk cache size of %d", temp.getInt(0));
config.setCategoryPropertyOrder("defaults", propOrder);
config.addCustomCategoryComment("Forge", "Sample mod specific control section.\n" +
"Copy this section and rename the with the modid for the mod you wish to override.\n" +
"A value of zero in either entry effectively disables any chunkloading capabilities\n" +
"for that mod");
temp = config.get("Forge", "maximumTicketCount", 200);
temp.setComment("Maximum ticket count for the mod. Zero disables chunkloading capabilities.");
temp = config.get("Forge", "maximumChunksPerTicket", 25);
temp.setComment("Maximum chunks per ticket for the mod.");
for (String mod : config.getCategoryNames())
{
if (mod.equals("Forge") || mod.equals("defaults"))
{
continue;
}
config.get(mod, "maximumTicketCount", 200).setLanguageKey("forge.configgui.maximumTicketCount").setMinValue(0);
config.get(mod, "maximumChunksPerTicket", 25).setLanguageKey("forge.configgui.maximumChunksPerTicket").setMinValue(0);
}
if (config.hasChanged())
{
config.save();
}
}
示例5: setLoaded
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
public static boolean setLoaded(int newID)
{
boolean found = false;
for (int staticLoadDimension : ConfigManagerCore.staticLoadDimensions)
{
if (staticLoadDimension == newID)
{
found = true;
break;
}
}
if (!found)
{
int[] oldIDs = ConfigManagerCore.staticLoadDimensions;
ConfigManagerCore.staticLoadDimensions = new int[ConfigManagerCore.staticLoadDimensions.length + 1];
System.arraycopy(oldIDs, 0, staticLoadDimensions, 0, oldIDs.length);
ConfigManagerCore.staticLoadDimensions[ConfigManagerCore.staticLoadDimensions.length - 1] = newID;
String[] values = new String[ConfigManagerCore.staticLoadDimensions.length];
Arrays.sort(ConfigManagerCore.staticLoadDimensions);
for (int i = 0; i < values.length; i++)
{
values[i] = String.valueOf(ConfigManagerCore.staticLoadDimensions[i]);
}
Property prop = config.get(Constants.CONFIG_CATEGORY_DIMENSIONS, "Static Loaded Dimensions", ConfigManagerCore.staticLoadDimensions);
prop.comment = "IDs to load at startup, and keep loaded until server stops. Can be added via /gckeeploaded";
prop.setLanguageKey("gc.configgui.staticLoadedDimensions");
prop.set(values);
ConfigManagerCore.config.save();
}
return !found;
}
示例6: registerTraceRenderInformation
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
private static void registerTraceRenderInformation(final String categoryName, final String categoryQualifiedName) {
final Property propName = configuration.get(categoryQualifiedName, Names.Config.NAME, categoryName, Names.Config.NAME_DESC);
propName.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.NAME);
final String name = propName.getString();
final Property propColorRed = configuration.get(categoryQualifiedName, Names.Config.COLOR_RED, DEFAULT_COLOR_RED, Names.Config.COLOR_RED_DESC, 0, 255);
propColorRed.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.COLOR_RED);
final int red = propColorRed.getInt(DEFAULT_COLOR_RED);
final Property propColorGreen = configuration.get(categoryQualifiedName, Names.Config.COLOR_GREEN, DEFAULT_COLOR_GREEN, Names.Config.COLOR_GREEN_DESC, 0, 255);
propColorGreen.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.COLOR_GREEN);
final int green = propColorGreen.getInt(DEFAULT_COLOR_GREEN);
final Property propColorBlue = configuration.get(categoryQualifiedName, Names.Config.COLOR_BLUE, DEFAULT_COLOR_BLUE, Names.Config.COLOR_BLUE_DESC, 0, 255);
propColorBlue.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.COLOR_BLUE);
final int blue = propColorBlue.getInt(DEFAULT_COLOR_BLUE);
final Property propColorAlpha = configuration.get(categoryQualifiedName, Names.Config.COLOR_ALPHA, DEFAULT_COLOR_ALPHA, Names.Config.COLOR_ALPHA_DESC, 0, 255);
propColorAlpha.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.COLOR_ALPHA);
final int alpha = propColorAlpha.getInt(DEFAULT_COLOR_ALPHA);
final Property propTTL = configuration.get(categoryQualifiedName, Names.Config.TTL, DEFAULT_TTL, Names.Config.TTL_DESC, 1, 120);
propTTL.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.TTL);
final int ttl = propTTL.getInt(DEFAULT_TTL) * 20;
final Property propThickness = configuration.get(categoryQualifiedName, Names.Config.THICKNESS, DEFAULT_THICKNESS, Names.Config.THICKNESS_DESC, 1.0, 10.0);
propThickness.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.THICKNESS);
final double thickness = propThickness.getDouble(DEFAULT_THICKNESS);
final Property propOffsetY = configuration.get(categoryQualifiedName, Names.Config.OFFSET_Y, DEFAULT_OFFSET_Y, Names.Config.OFFSET_Y_DESC, -1.0, +1.0);
propOffsetY.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.OFFSET_Y);
final double offsetY = propOffsetY.getDouble(DEFAULT_OFFSET_Y);
setCategoryPropertyOrder(categoryQualifiedName, Names.Config.NAME, Names.Config.COLOR_RED, Names.Config.COLOR_GREEN, Names.Config.COLOR_BLUE, Names.Config.COLOR_ALPHA, Names.Config.TTL, Names.Config.THICKNESS, Names.Config.OFFSET_Y);
Tracer.proxy.setConfigEntryClassSlider(propColorRed, propColorGreen, propColorBlue, propColorAlpha);
Tracer.proxy.setConfigEntryClassSlider(propTTL, propThickness, propOffsetY);
TraceRegistry.INSTANCE.register(name, red, green, blue, alpha, thickness, ttl, offsetY);
}
示例7: syncConfig
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
public static void syncConfig(boolean loadConfigFromFile, boolean readFieldsFromConfig)
{
if (loadConfigFromFile) config.load();
Property propEnableInventoryGUI = config.get(Configuration.CATEGORY_GENERAL, "enableInventoryGui", DefaultValues.enableInventoryGui, "");
propEnableInventoryGUI.setLanguageKey("villagerinventory.options.enableInventoryGui");
propEnableInventoryGUI.setRequiresMcRestart(false);
Property propRequireEmptyHand = config.get(Configuration.CATEGORY_GENERAL, "requireEmptyHand", DefaultValues.requireEmptyHand, "");
propRequireEmptyHand.setLanguageKey("villagerinventory.options.requireEmptyHand");
propRequireEmptyHand.setRequiresMcRestart(false);
Property propEnableDeathDrops = config.get(Configuration.CATEGORY_GENERAL, "enableDeathDrops", DefaultValues.enableDeathDrops, "");
propEnableDeathDrops.setLanguageKey("villagerinventory.options.enableDeathDrops");
propEnableDeathDrops.setRequiresMcRestart(false);
try
{
propEnableInventoryGUI.setConfigEntryClass(ModGuiConfigEntries.BooleanEntry.class);
propRequireEmptyHand.setConfigEntryClass(ModGuiConfigEntries.BooleanEntry.class);
propEnableDeathDrops.setConfigEntryClass(ModGuiConfigEntries.BooleanEntry.class);
List<String> propOrderGeneral = new ArrayList<String>();
propOrderGeneral.add(propEnableInventoryGUI.getName());
propOrderGeneral.add(propRequireEmptyHand.getName());
propOrderGeneral.add(propEnableDeathDrops.getName());
config.setCategoryPropertyOrder(Configuration.CATEGORY_GENERAL, propOrderGeneral);
}
catch (NoClassDefFoundError e)
{
}
if (readFieldsFromConfig)
{
enableInventoryGui = propEnableInventoryGUI.getBoolean();
requireEmptyHand = propRequireEmptyHand.getBoolean();
enableDeathDrops = propEnableDeathDrops.getBoolean();
}
propEnableInventoryGUI.set(enableInventoryGui);
propRequireEmptyHand.set(requireEmptyHand);
propEnableDeathDrops.set(enableDeathDrops);
if (config.hasChanged()) config.save();
}
示例8: setUnloaded
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
public static boolean setUnloaded(int idToRemove)
{
int foundCount = 0;
for (int staticLoadDimension : ConfigManagerCore.staticLoadDimensions)
{
if (staticLoadDimension == idToRemove)
{
foundCount++;
}
}
if (foundCount > 0)
{
List<Integer> idArray = new ArrayList<Integer>(Ints.asList(ConfigManagerCore.staticLoadDimensions));
idArray.removeAll(Collections.singleton(idToRemove));
ConfigManagerCore.staticLoadDimensions = new int[idArray.size()];
for (int i = 0; i < idArray.size(); i++)
{
ConfigManagerCore.staticLoadDimensions[i] = idArray.get(i);
}
String[] values = new String[ConfigManagerCore.staticLoadDimensions.length];
Arrays.sort(ConfigManagerCore.staticLoadDimensions);
for (int i = 0; i < values.length; i++)
{
values[i] = String.valueOf(ConfigManagerCore.staticLoadDimensions[i]);
}
Property prop = config.get(Constants.CONFIG_CATEGORY_DIMENSIONS, "Static Loaded Dimensions", ConfigManagerCore.staticLoadDimensions);
prop.comment = "IDs to load at startup, and keep loaded until server stops. Can be added via /gckeeploaded";
prop.setLanguageKey("gc.configgui.staticLoadedDimensions");
prop.set(values);
ConfigManagerCore.config.save();
}
return foundCount > 0;
}
示例9: syncConfigDefaults
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
/**
* Synchronizes the local fields with the values in the Configuration object.
*/
public static void syncConfigDefaults()
{
// By adding a property order list we are defining the order that the properties will appear both in the config file and on the GUIs.
// Property order lists are defined per-ConfigCategory.
List<String> propOrder = new ArrayList<String>();
config.setCategoryComment("defaults", "Default configuration for forge chunk loading control")
.setCategoryRequiresWorldRestart("defaults", true);
Property temp = config.get("defaults", "enabled", true);
temp.comment = "Are mod overrides enabled?";
temp.setLanguageKey("forge.configgui.enableModOverrides");
overridesEnabled = temp.getBoolean(true);
propOrder.add("enabled");
temp = config.get("defaults", "maximumChunksPerTicket", 25);
temp.comment = "The default maximum number of chunks a mod can force, per ticket, \n" +
"for a mod without an override. This is the maximum number of chunks a single ticket can force.";
temp.setLanguageKey("forge.configgui.maximumChunksPerTicket");
temp.setMinValue(0);
defaultMaxChunks = temp.getInt(25);
propOrder.add("maximumChunksPerTicket");
temp = config.get("defaults", "maximumTicketCount", 200);
temp.comment = "The default maximum ticket count for a mod which does not have an override\n" +
"in this file. This is the number of chunk loading requests a mod is allowed to make.";
temp.setLanguageKey("forge.configgui.maximumTicketCount");
temp.setMinValue(0);
defaultMaxCount = temp.getInt(200);
propOrder.add("maximumTicketCount");
temp = config.get("defaults", "playerTicketCount", 500);
temp.comment = "The number of tickets a player can be assigned instead of a mod. This is shared across all mods and it is up to the mods to use it.";
temp.setLanguageKey("forge.configgui.playerTicketCount");
temp.setMinValue(0);
playerTicketLength = temp.getInt(500);
propOrder.add("playerTicketCount");
temp = config.get("defaults", "dormantChunkCacheSize", 0);
temp.comment = "Unloaded chunks can first be kept in a dormant cache for quicker\n" +
"loading times. Specify the size (in chunks) of that cache here";
temp.setLanguageKey("forge.configgui.dormantChunkCacheSize");
temp.setMinValue(0);
dormantChunkCacheSize = temp.getInt(0);
propOrder.add("dormantChunkCacheSize");
FMLLog.info("Configured a dormant chunk cache size of %d", temp.getInt(0));
config.setCategoryPropertyOrder("defaults", propOrder);
config.addCustomCategoryComment("Forge", "Sample mod specific control section.\n" +
"Copy this section and rename the with the modid for the mod you wish to override.\n" +
"A value of zero in either entry effectively disables any chunkloading capabilities\n" +
"for that mod");
temp = config.get("Forge", "maximumTicketCount", 200);
temp.comment = "Maximum ticket count for the mod. Zero disables chunkloading capabilities.";
temp = config.get("Forge", "maximumChunksPerTicket", 25);
temp.comment = "Maximum chunks per ticket for the mod.";
for (String mod : config.getCategoryNames())
{
if (mod.equals("Forge") || mod.equals("defaults"))
{
continue;
}
config.get(mod, "maximumTicketCount", 200).setLanguageKey("forge.configgui.maximumTicketCount").setMinValue(0);
config.get(mod, "maximumChunksPerTicket", 25).setLanguageKey("forge.configgui.maximumChunksPerTicket").setMinValue(0);
}
if (config.hasChanged())
{
config.save();
}
}
示例10: 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);
}
}
}
}
示例11: getIntArray
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
private static int[] getIntArray(String name, String category, int[] defaultValue, String comment)
{
Property prop = config.get(category, name, defaultValue, comment);
prop.setLanguageKey(name);
return prop.getIntList();
}
示例12: cfgInt
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
private static int cfgInt(String name, int def, int min, int max, String comment) {
final Property p = config.get(Configuration.CATEGORY_GENERAL, name, def, comment + " [default: " + def + "; " + min + " ~ " + max + ']', min, max);
p.setLanguageKey("mcflux.config." + name);
final int pv = p.getInt(def);
return pv < min ? min : pv > max ? max : pv;
}
示例13: cfgBool
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
private static boolean cfgBool(String name, boolean def, String comment) {
final Property p = config.get(Configuration.CATEGORY_GENERAL, name, def, comment + " [default: " + def + "]");
p.setLanguageKey("mcflux.config." + name);
return p.getBoolean(def);
}
示例14: getInt
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
/**
* Creates a integer property.
*
* @param name Name of the property.
* @param category Category of the property.
* @param defaultValue Default value of the property.
* @param comment A brief description what the property does.
* @param langKey A language key used for localization of GUIs
* @return The value of the new integer property.
*/
public int getInt(String name, String category, int defaultValue, String comment, String langKey) {
Property prop = this.get(category, name, defaultValue);
prop.setLanguageKey(langKey);
prop.setComment(comment + " [default: " + defaultValue + "]");
return prop.getInt(defaultValue);
}