|
6 | 6 | import net.minecraftforge.common.config.Configuration; |
7 | 7 |
|
8 | 8 | public class Config { |
9 | | - |
| 9 | + |
10 | 10 | private final Configuration config; |
11 | 11 | private static final String STRING_PREFIX = "config."; |
12 | 12 | private int startEntityID = -1; |
13 | 13 | private boolean canOwnMultipleDragons = true; |
14 | 14 | private boolean debugMode = false; |
| 15 | + private boolean experimentalMode = false; |
15 | 16 |
|
16 | 17 | public Config(FMLPreInitializationEvent evt) { |
17 | 18 | config = new Configuration(evt.getSuggestedConfigurationFile()); |
18 | | - |
| 19 | + |
19 | 20 | syncConfig(); |
20 | 21 | } |
21 | | - |
| 22 | + |
22 | 23 | public void syncConfig() { |
23 | | - |
24 | | - startEntityID = config.getInt("DragonEntityID", Configuration.CATEGORY_GENERAL, startEntityID, -1, 255, "Overrides the entity ID for dragons to fix problems with manual IDs from other mods.\nSet to -1 for automatic assignment (recommended).\nWarning: wrong values may cause crashes and loss of data! Must restart Minecraft to take effect", getLocalKey("startEntityID")); |
25 | | - canOwnMultipleDragons = config.getBoolean("MultiDragonOwnership", Configuration.CATEGORY_GENERAL, true, "Provides ability to own multiple dragons", getLocalKey("multiDragonOwnership")); |
26 | | - debugMode = config.getBoolean("DebugMode", Configuration.CATEGORY_GENERAL, false, "Enable debug mode, developers recommended", getLocalKey("debugMode")); |
27 | | - |
28 | | - if(config.hasChanged()) config.save(); |
29 | | - } |
30 | | - |
| 24 | + |
| 25 | + startEntityID = config.getInt("DragonEntityID", Configuration.CATEGORY_GENERAL, startEntityID, -1, 255, |
| 26 | + "Overrides the entity ID for dragons to fix problems with manual IDs from other mods.\nSet to -1 for automatic assignment (recommended).\nWarning: wrong values may cause crashes and loss of data! Must restart Minecraft to take effect", |
| 27 | + getLocalKey("startEntityID")); |
| 28 | + canOwnMultipleDragons = config.getBoolean("MultiDragonOwnership", Configuration.CATEGORY_GENERAL, true, |
| 29 | + "Provides ability to own multiple dragons", getLocalKey("multiDragonOwnership")); |
| 30 | + debugMode = config.getBoolean("DebugMode", Configuration.CATEGORY_GENERAL, false, |
| 31 | + "Enable debug mode, developers recommended", getLocalKey("debugMode")); |
| 32 | + experimentalMode = config.getBoolean("ExperimentalMode", Configuration.CATEGORY_GENERAL, false, |
| 33 | + "Enable an experimental version (warning: may be less stable)", getLocalKey("experimentalMode")); |
| 34 | + |
| 35 | + if (config.hasChanged()) |
| 36 | + config.save(); |
| 37 | + } |
| 38 | + |
31 | 39 | protected String getLocalKey(String ending) { |
32 | | - return Utils.getLocalString(STRING_PREFIX+ending); |
| 40 | + return Utils.getLocalString(STRING_PREFIX + ending); |
33 | 41 | } |
34 | | - |
| 42 | + |
35 | 43 | public Configuration getConfig() { |
36 | 44 | return config; |
37 | 45 | } |
38 | 46 |
|
39 | 47 | public int getStartEntityID() { |
40 | 48 | return startEntityID; |
41 | 49 | } |
42 | | - |
| 50 | + |
43 | 51 | public boolean getMultiDragonOwnership() { |
44 | 52 | return canOwnMultipleDragons; |
45 | 53 | } |
46 | | - |
| 54 | + |
47 | 55 | public boolean isDebugMode() { |
48 | 56 | return debugMode; |
49 | 57 | } |
| 58 | + |
| 59 | + public boolean isExperimental() { |
| 60 | + return experimentalMode; |
| 61 | + } |
50 | 62 | } |
0 commit comments