net.minecraftforge.common
Class Configuration

java.lang.Object
  extended by net.minecraftforge.common.Configuration

public class Configuration
extends Object

This class offers advanced configurations capabilities, allowing to provide various categories for configuration variables.


Nested Class Summary
static class Configuration.UnicodeInputStreamReader
           
 
Field Summary
static String ALLOWED_CHARS
           
static com.google.common.base.CharMatcher allowedProperties
           
 Map<String,ConfigCategory> categories
           
static String CATEGORY_BLOCK
           
static String CATEGORY_GENERAL
           
static String CATEGORY_ITEM
           
static String CATEGORY_SPLITTER
           
static String DEFAULT_ENCODING
           
 String defaultEncoding
           
 boolean isChild
           
static String NEW_LINE
           
 
Constructor Summary
Configuration()
           
Configuration(File file)
          Create a configuration file for the file given in parameter.
Configuration(File file, boolean caseSensitiveCustomCategories)
           
 
Method Summary
 void addCustomCategoryComment(String category, String comment)
           
static void enableGlobalConfig()
           
 Property get(String category, String key, boolean defaultValue)
           
 Property get(String category, String key, boolean[] defaultValue)
           
 Property get(String category, String key, boolean[] defaultValue, String comment)
           
 Property get(String category, String key, boolean defaultValue, String comment)
           
 Property get(String category, String key, double defaultValue)
           
 Property get(String category, String key, double[] defaultValue)
           
 Property get(String category, String key, double[] defaultValue, String comment)
           
 Property get(String category, String key, double defaultValue, String comment)
           
 Property get(String category, String key, int defaultValue)
           
 Property get(String category, String key, int[] defaultValue)
           
 Property get(String category, String key, int[] defaultValue, String comment)
           
 Property get(String category, String key, int defaultValue, String comment)
           
 Property get(String category, String key, String defaultValue)
           
 Property get(String category, String key, String[] defaultValue)
           
 Property get(String category, String key, String[] defaultValue, String comment)
           
 Property get(String category, String key, String[] defaultValue, String comment, Property.Type type)
           
 Property get(String category, String key, String defaultValue, String comment)
           
 Property get(String category, String key, String defaultValue, String comment, Property.Type type)
           
 Property getBlock(String key, int defaultID)
          Gets or create a block id property.
 Property getBlock(String key, int defaultID, String comment)
           
 Property getBlock(String category, String key, int defaultID)
           
 Property getBlock(String category, String key, int defaultID, String comment)
           
 ConfigCategory getCategory(String category)
           
 Property getItem(String key, int defaultID)
           
 Property getItem(String key, int defaultID, String comment)
           
 Property getItem(String category, String key, int defaultID)
           
 Property getItem(String category, String key, int defaultID, String comment)
           
 Property getTerrainBlock(String category, String key, int defaultID, String comment)
          Special version of getBlock to be used when you want to garentee the ID you get is below 256 This should ONLY be used by mods who do low level terrain generation, or ones that add new biomes.
 boolean hasCategory(String category)
           
 boolean hasKey(String category, String key)
           
 void load()
           
 void save()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CATEGORY_GENERAL

public static final String CATEGORY_GENERAL
See Also:
Constant Field Values

CATEGORY_BLOCK

public static final String CATEGORY_BLOCK
See Also:
Constant Field Values

CATEGORY_ITEM

public static final String CATEGORY_ITEM
See Also:
Constant Field Values

ALLOWED_CHARS

public static final String ALLOWED_CHARS
See Also:
Constant Field Values

DEFAULT_ENCODING

public static final String DEFAULT_ENCODING
See Also:
Constant Field Values

CATEGORY_SPLITTER

public static final String CATEGORY_SPLITTER
See Also:
Constant Field Values

NEW_LINE

public static final String NEW_LINE

allowedProperties

public static final com.google.common.base.CharMatcher allowedProperties

categories

public Map<String,ConfigCategory> categories

defaultEncoding

public String defaultEncoding

isChild

public boolean isChild
Constructor Detail

Configuration

public Configuration()

Configuration

public Configuration(File file)
Create a configuration file for the file given in parameter.


Configuration

public Configuration(File file,
                     boolean caseSensitiveCustomCategories)
Method Detail

getBlock

public Property getBlock(String key,
                         int defaultID)
Gets or create a block id property. If the block id property key is already in the configuration, then it will be used. Otherwise, defaultId will be used, except if already taken, in which case this will try to determine a free default id.


getBlock

public Property getBlock(String key,
                         int defaultID,
                         String comment)

getBlock

public Property getBlock(String category,
                         String key,
                         int defaultID)

getBlock

public Property getBlock(String category,
                         String key,
                         int defaultID,
                         String comment)

getTerrainBlock

public Property getTerrainBlock(String category,
                                String key,
                                int defaultID,
                                String comment)
Special version of getBlock to be used when you want to garentee the ID you get is below 256 This should ONLY be used by mods who do low level terrain generation, or ones that add new biomes. EXA: ExtraBiomesXL Specifically, if your block is used BEFORE the Chunk is created, and placed in the terrain byte array directly. If you add a new biome and you set the top/filler block, they need to be <256, nothing else. If you're adding a new ore, DON'T call this function. Normal mods such as '50 new ores' do not need to be below 256 so should use the normal getBlock


getItem

public Property getItem(String key,
                        int defaultID)

getItem

public Property getItem(String key,
                        int defaultID,
                        String comment)

getItem

public Property getItem(String category,
                        String key,
                        int defaultID)

getItem

public Property getItem(String category,
                        String key,
                        int defaultID,
                        String comment)

get

public Property get(String category,
                    String key,
                    int defaultValue)

get

public Property get(String category,
                    String key,
                    int defaultValue,
                    String comment)

get

public Property get(String category,
                    String key,
                    boolean defaultValue)

get

public Property get(String category,
                    String key,
                    boolean defaultValue,
                    String comment)

get

public Property get(String category,
                    String key,
                    double defaultValue)

get

public Property get(String category,
                    String key,
                    double defaultValue,
                    String comment)

get

public Property get(String category,
                    String key,
                    String defaultValue)

get

public Property get(String category,
                    String key,
                    String defaultValue,
                    String comment)

get

public Property get(String category,
                    String key,
                    String[] defaultValue)

get

public Property get(String category,
                    String key,
                    String[] defaultValue,
                    String comment)

get

public Property get(String category,
                    String key,
                    int[] defaultValue)

get

public Property get(String category,
                    String key,
                    int[] defaultValue,
                    String comment)

get

public Property get(String category,
                    String key,
                    double[] defaultValue)

get

public Property get(String category,
                    String key,
                    double[] defaultValue,
                    String comment)

get

public Property get(String category,
                    String key,
                    boolean[] defaultValue)

get

public Property get(String category,
                    String key,
                    boolean[] defaultValue,
                    String comment)

get

public Property get(String category,
                    String key,
                    String defaultValue,
                    String comment,
                    Property.Type type)

get

public Property get(String category,
                    String key,
                    String[] defaultValue,
                    String comment,
                    Property.Type type)

hasCategory

public boolean hasCategory(String category)

hasKey

public boolean hasKey(String category,
                      String key)

load

public void load()

save

public void save()

getCategory

public ConfigCategory getCategory(String category)

addCustomCategoryComment

public void addCustomCategoryComment(String category,
                                     String comment)

enableGlobalConfig

public static void enableGlobalConfig()