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


Java Property.getString方法代碼示例

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


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

示例1: getSafeColorFromProperty

import net.minecraftforge.common.config.Property; //導入方法依賴的package包/類
public static int getSafeColorFromProperty(Property property, int min, int max) {
 String colorString = property.getString();
 if (colorString.startsWith("0x"))
	 colorString = colorString.replace("0x", "");
 try {
	 int color = Integer.parseInt(colorString, 16);
	 if (color<min || color>max)
		 return -1;
	 else
		 return color;
 }
 catch (NumberFormatException e) {
	 property.setToDefault();
	 return -1;
 }
}
 
開發者ID:GWYOG,項目名稱:GTVeinLocator,代碼行數:17,代碼來源:ModConfig.java

示例2: getStringFor

import net.minecraftforge.common.config.Property; //導入方法依賴的package包/類
public static String getStringFor(Configuration config, String heading, String item, String value)
{
	if (config == null)
		return value;
	try
	{
		Property prop = config.get(heading, item, value);
		return prop.getString();
	} catch (Exception e)
	{
		System.out.println("[" + ModDetails.ModName + "] Error while trying to add String, config wasn't loaded properly!");
	}
	return value;
}
 
開發者ID:Wahazar,項目名稱:TFCPrimitiveTech,代碼行數:15,代碼來源:ModOptions.java

示例3: syncConfig

import net.minecraftforge.common.config.Property; //導入方法依賴的package包/類
private static void syncConfig()
{
    Property fontNameProp = cfg.get(Configuration.CATEGORY_GENERAL, "fontName", "SansSerif", "Valid font names: " + Arrays.toString(ALL_FONT_NAMES));

    fontName = fontNameProp.getString();
    fontSize = cfg.getInt("fontSize", Configuration.CATEGORY_GENERAL, 18, 1, 100, "The font's size");
    antiAlias = cfg.getBoolean("antiAlias", Configuration.CATEGORY_GENERAL, false, "Whether to use anti-aliasing");
    dropShadow = cfg.getBoolean("dropShadow", Configuration.CATEGORY_GENERAL, true, "Setting this to \"false\" will disable drop shadows completely");

    fontNameProp.setConfigEntryClass(SelectFontEntry.class);

    if (cfg.hasChanged())
        cfg.save();
}
 
開發者ID:cubex2,項目名稱:BetterFonts,代碼行數:15,代碼來源:Config.java

示例4: getStringFor

import net.minecraftforge.common.config.Property; //導入方法依賴的package包/類
public static String getStringFor(Configuration config, String heading, String item, String value) {
	if (config == null)
		return value;
	try {
		Property prop = config.get(heading, item, value);
		return prop.getString();
	} catch (Exception e) {
		TFCTech.LOG.error("Error while trying to add String, config wasn't loaded properly!");
	}
	return value;
}
 
開發者ID:Shurgent,項目名稱:TFCTech,代碼行數:12,代碼來源:ModOptions.java

示例5: getStringFor

import net.minecraftforge.common.config.Property; //導入方法依賴的package包/類
public static String getStringFor(Configuration config, String heading, String item, String value)
{
	if (config == null)
		return value;
	try
	{
		Property prop = config.get(heading, item, value);
		return prop.getString();
	} catch (Exception e)
	{
		System.out.println("[" + TFCPPDetails.ModName + "] Error while trying to add String, config wasn't loaded properly!");
	}
	return value;
}
 
開發者ID:Wahazar,項目名稱:TerraFirmaProgressivePack,代碼行數:15,代碼來源:TFCPPOptions.java

示例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);
}
 
開發者ID:Lunatrius,項目名稱:Tracer,代碼行數:41,代碼來源:ConfigurationHandler.java

示例7: StringConfigProperty

import net.minecraftforge.common.config.Property; //導入方法依賴的package包/類
protected StringConfigProperty(final @Nonnull Configuration config, final @Nonnull Property property) {
	super(config, property, property.getString());
}
 
開發者ID:Team-Fruit,項目名稱:ServerObserver,代碼行數:4,代碼來源:ConfigBase.java

示例8: dataFrom

import net.minecraftforge.common.config.Property; //導入方法依賴的package包/類
@Override
public String dataFrom(Property source) {
    return source.getString();
}
 
開發者ID:Zeno410,項目名稱:Geographicraft,代碼行數:5,代碼來源:Settings.java

示例9: structures

import net.minecraftforge.common.config.Property; //導入方法依賴的package包/類
private static void structures() {
    // catacombs
    Property structuresDimensionIdProperty = config.get(CATEGORY_STRUCTURES_CATACOMBS, "StructuresDimensionIds", GraveStoneWorldGenerator.DEFAULT_DIMENSION_ID);
    structuresDimensionIdProperty.setComment("List of dimension id in which structures generation is allowed. \"dimension_id_1;dimension_id_2;.....\".");
    String ar = structuresDimensionIdProperty.getString();
    String[] ids = ar.split(";");
    structuresDimensionIds = new ArrayList<>(ids.length);
    for (String id : ids) {
        try {
            structuresDimensionIds.add(Integer.parseInt(id));
        } catch (NumberFormatException e) {
            GSLogger.logError("Can't parse StructuresDimensionIds!!!");
            e.printStackTrace();
        }
    }
    if (structuresDimensionIds.isEmpty()) {
        structuresDimensionIds.add(GraveStoneWorldGenerator.DEFAULT_DIMENSION_ID);
    }

    generateCatacombs = config.get(CATEGORY_STRUCTURES_CATACOMBS, "GenerateCatacombs", true).getBoolean(true);
    maxCatacombsHeight = config.get(CATEGORY_STRUCTURES_CATACOMBS, "MaximumCatacombsGenerationHeight", 75).getInt();
    catacombsGenerationChance = config.get(CATEGORY_STRUCTURES_CATACOMBS, "CatacombsGenerationChance", CatacombsGenerator.DEFAULT_GENERATION_CHANCE).getDouble();
    generateCatacombsGraveyard = config.get(CATEGORY_STRUCTURES_CATACOMBS, "GenerateCatacombsGraveyard", true).getBoolean(true);
    generatePilesOfBones = config.get(CATEGORY_STRUCTURES_CATACOMBS, "GeneratePilesOfBones", true).getBoolean(true);

    catacombsMinRoomsCountAt1Level = config.get(CATEGORY_STRUCTURES_CATACOMBS, "CatacombsMinRoomsCountAt1Level", CatacombsLevel.DEFAULT_MIN_ROOMS_COUNT_AT_1_LEVEL).getInt();
    catacombsMaxRoomsCountAt1Level = config.get(CATEGORY_STRUCTURES_CATACOMBS, "CatacombsMaxRoomsCountAt1Level", CatacombsLevel.DEFAULT_MAX_ROOMS_COUNT_AT_1_LEVEL).getInt();

    catacombsMinRoomsCountAt2Level = config.get(CATEGORY_STRUCTURES_CATACOMBS, "CatacombsMinRoomsCountAt2Level", CatacombsLevel.DEFAULT_MIN_ROOMS_COUNT_AT_2_LEVEL).getInt();
    catacombsMaxRoomsCountAt2Level = config.get(CATEGORY_STRUCTURES_CATACOMBS, "CatacombsMaxRoomsCountAt2Level", CatacombsLevel.DEFAULT_MAX_ROOMS_COUNT_AT_2_LEVEL).getInt();

    catacombsMinRoomsCountAt3Level = config.get(CATEGORY_STRUCTURES_CATACOMBS, "CatacombsMinRoomsCountAt3Level", CatacombsLevel.DEFAULT_MIN_ROOMS_COUNT_AT_3_LEVEL).getInt();
    catacombsMaxRoomsCountAt3Level = config.get(CATEGORY_STRUCTURES_CATACOMBS, "CatacombsMaxRoomsCountAt3Level", CatacombsLevel.DEFAULT_MAX_ROOMS_COUNT_AT_3_LEVEL).getInt();

    catacombsMinRoomsCountAt4Level = config.get(CATEGORY_STRUCTURES_CATACOMBS, "CatacombsMinRoomsCountAt4Level", CatacombsLevel.DEFAULT_MIN_ROOMS_COUNT_AT_4_LEVEL).getInt();
    catacombsMaxRoomsCountAt4Level = config.get(CATEGORY_STRUCTURES_CATACOMBS, "CatacombsMaxRoomsCountAt4Level", CatacombsLevel.DEFAULT_MAX_ROOMS_COUNT_AT_4_LEVEL).getInt();

    // other
    gravesGenerationChance = config.get(CATEGORY_STRUCTURES_OTHER, "GravesGenerationChance", SingleGraveGenerator.DEFAULT_GENERATION_CHANCE).getDouble();
    memorialsGenerationChance = config.get(CATEGORY_STRUCTURES_OTHER, "MemorialsGenerationChance", MemorialGenerator.DEFAULT_GENERATION_CHANCE).getDouble();

    generateGravesInMushroomBiomes = config.get(CATEGORY_STRUCTURES_OTHER, "GenerateGravesInMushroomBiomes", true).getBoolean(true);
    generateMemorials = config.get(CATEGORY_STRUCTURES_OTHER, "GenerateMemorials", true).getBoolean(true);
    generateSingleGraves = config.get(CATEGORY_STRUCTURES_OTHER, "GenerateSingleGraves", true).getBoolean(true);
    // village
    generateCemeteries = config.get(CATEGORY_STRUCTURES_VILLAGE, "GenerateCemeteries", false).getBoolean(false);
    generateVillageMemorials = config.get(CATEGORY_STRUCTURES_VILLAGE, "GenerateVillageMemorials", true).getBoolean(true);
    generateUndertaker = config.get(CATEGORY_STRUCTURES_VILLAGE, "GenerateUndertaker", true).getBoolean(true);
}
 
開發者ID:NightKosh,項目名稱:Gravestone-mod-Extended,代碼行數:50,代碼來源:ExtendedConfig.java

示例10: StringConfigProperty

import net.minecraftforge.common.config.Property; //導入方法依賴的package包/類
protected StringConfigProperty(final Configuration config, final Property property) {
	super(config, property, property.getString());
}
 
開發者ID:Team-Fruit,項目名稱:EEWReciever,代碼行數:4,代碼來源:ConfigHandler.java


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