Skip to content

Commit e1af1f8

Browse files
committed
add config modpack version
1 parent 14a8c99 commit e1af1f8

File tree

2 files changed

+128
-121
lines changed

2 files changed

+128
-121
lines changed

src/main/java/com/impact/client/gui/ImpactGuiMainMenu.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.google.common.base.Strings;
44
import com.google.common.collect.Lists;
55
import com.impact.client.gui.button.ImpactGuiButton;
6+
import com.impact.core.Config;
67
import cpw.mods.fml.client.GuiModList;
78
import cpw.mods.fml.common.FMLCommonHandler;
89
import cpw.mods.fml.relauncher.FMLInjectionData;
@@ -137,7 +138,7 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks) {
137138
drawString(this.fontRendererObj, brd, 2, this.height - 10 + i * (this.fontRendererObj.FONT_HEIGHT + 1), 16777215);
138139
}
139140
}
140-
String eBug2 = translateToLocal("current_version") + ": " + EnumChatFormatting.YELLOW + ModPackVersion;
141+
String eBug2 = translateToLocal("current_version") + ": " + EnumChatFormatting.YELLOW + Config.modpackVersion;
141142
drawString(this.fontRendererObj, eBug2, this.width - this.fontRendererObj.getStringWidth(eBug2) - 10, this.height - 10, -1);
142143
super.drawScreen(mouseX, mouseY, partialTicks);
143144
}

src/main/java/com/impact/core/Config.java

Lines changed: 126 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -10,124 +10,130 @@
1010
import java.util.ArrayList;
1111

1212
public class Config {
13-
14-
public static boolean loadConfig;
15-
public static Configuration config;
16-
17-
public static boolean disableLogger;
18-
public static boolean hideBackground;
19-
public static boolean toolTips;
20-
public static boolean DisableNether;
21-
public static boolean DisableTheEnd;
22-
public static boolean downloadOnlyOnce;
23-
public static boolean mainMenu;
24-
public static boolean placedItems;
25-
public static int saveTime;
26-
public static int MiningWorldID;
27-
public static boolean enabledAutoUpdateQuests;
28-
public static boolean isEnabledExperimentalMultiThreading;
29-
public static boolean isDebugDev = BuildConfigKt.IS_DEBUG;
30-
31-
public static int MAX_TICK_RATE;
32-
33-
public Config(File file) {
34-
if (!loadConfig) {
35-
config = new Configuration(file);
36-
syncConfig(true);
37-
}
38-
}
39-
40-
public static void syncConfig(boolean load) {
41-
ArrayList<String> General = new ArrayList<>();
42-
ArrayList<String> Debug = new ArrayList<>();
43-
ArrayList<String> experimental = new ArrayList<>();
44-
45-
try {
46-
if (!config.isChild && load) {
47-
config.load();
48-
}
49-
50-
Property cfg;
51-
//GENERAL
52-
cfg = config.get("GENERAL", "Hide Background", true);
53-
cfg.comment = "[NEI Ore Plugin] Hides the Background when the tooltip for the Dimensions is renderedr. [Default: true]";
54-
hideBackground = cfg.getBoolean(true);
55-
General.add(cfg.getName());
56-
57-
cfg = config.get("GENERAL", "DimTooltip", true);
58-
cfg.comment = "[NEI Ore Plugin] Activates Dimensison Tooltips. [Default: true]";
59-
toolTips = cfg.getBoolean(true);
60-
General.add(cfg.getName());
61-
62-
cfg = config.get("GENERAL", "Disable Nether", false);
63-
cfg.comment = "Disable Nether. [Default: false]";
64-
DisableNether = cfg.getBoolean(false);
65-
General.add(cfg.getName());
66-
67-
cfg = config.get("GENERAL", "Disable The End", false);
68-
cfg.comment = "Disable The End. [Default: false]";
69-
DisableTheEnd = cfg.getBoolean(false);
70-
General.add(cfg.getName());
71-
72-
cfg = config.get("GENERAL", "Download Mods Only Once", true);
73-
cfg.comment = "Download Mods Only Once. [Default: true]";
74-
downloadOnlyOnce = cfg.getBoolean(true);
75-
General.add(cfg.getName());
76-
77-
cfg = config.get("GENERAL", "Enable Impact Main Menu", true);
78-
cfg.comment = "Enable Impact Main Menu. [Default: true]";
79-
mainMenu = cfg.getBoolean(true);
80-
General.add(cfg.getName());
81-
82-
cfg = config.get("GENERAL", "Enable Impact Placed Items", true);
83-
cfg.comment = "Enable Impact Placed Items. [Default: true]";
84-
placedItems = cfg.getBoolean(true);
85-
General.add(cfg.getName());
86-
87-
cfg = config.get("GENERAL", "Impact saves files timer", 30);
88-
cfg.comment = "SaveTimer. [Default: 30min]";
89-
saveTime = cfg.getInt(30);
90-
General.add(cfg.getName());
91-
92-
cfg = config.get("GENERAL", "Mining World (Copy OverWorld)", 45);
93-
cfg.comment = "MiningWorldID. [Default: 45]";
94-
MiningWorldID = cfg.getInt(45);
95-
General.add(cfg.getName());
96-
97-
cfg = config.get("GENERAL", "Max tickrate multiblocks (only IMPACT)", 2);
98-
cfg.comment = "MaxTickRate. [Default: 2]";
99-
MAX_TICK_RATE = cfg.getInt(2);
100-
General.add(cfg.getName());
101-
102-
cfg = config.get("GENERAL", "Enabled autodetect and update quests", true);
103-
cfg.comment = "enabledAutoUpdateQuests [Default: true]";
104-
enabledAutoUpdateQuests = cfg.getBoolean(true);
105-
General.add(cfg.getName());
106-
107-
//DEBUG
108-
cfg = config.get("DEBUG", "disableLogger", true);
109-
cfg.comment = "Disabled Logger. [Default: true]";
110-
disableLogger = cfg.getBoolean(true);
111-
Debug.add(cfg.getName());
112-
113-
//EXPERIMENTAL
114-
cfg = config.get("EXPERIMENTAL", "enabledMultiThreading", false);
115-
cfg.comment = "Enabled Multi Threading. [Default: false]";
116-
isEnabledExperimentalMultiThreading = cfg.getBoolean(false);
117-
experimental.add(cfg.getName());
118-
119-
config.setCategoryPropertyOrder("GENERAL", General);
120-
config.setCategoryPropertyOrder("DEBUG", Debug);
121-
config.setCategoryPropertyOrder("EXPERIMENTAL", experimental);
122-
123-
if (config.hasChanged()) {
124-
config.save();
125-
}
126-
127-
FMLLog.log(Level.INFO, "[IMPACT] Logger: " + disableLogger);
128-
129-
} catch (Exception e) {
130-
FMLLog.log(Level.ERROR, e, "[IMPACT] Error load config!");
131-
}
132-
}
13+
14+
public static boolean loadConfig;
15+
public static Configuration config;
16+
17+
public static boolean disableLogger;
18+
public static boolean hideBackground;
19+
public static boolean toolTips;
20+
public static boolean DisableNether;
21+
public static boolean DisableTheEnd;
22+
public static boolean downloadOnlyOnce;
23+
public static boolean mainMenu;
24+
public static boolean placedItems;
25+
public static int saveTime;
26+
public static int MiningWorldID;
27+
public static boolean enabledAutoUpdateQuests;
28+
public static boolean isEnabledExperimentalMultiThreading;
29+
public static boolean isDebugDev = BuildConfigKt.IS_DEBUG;
30+
public static String modpackVersion = "";
31+
32+
public static int MAX_TICK_RATE;
33+
34+
public Config(File file) {
35+
if (!loadConfig) {
36+
config = new Configuration(file);
37+
syncConfig(true);
38+
}
39+
}
40+
41+
public static void syncConfig(boolean load) {
42+
ArrayList<String> General = new ArrayList<>();
43+
ArrayList<String> Debug = new ArrayList<>();
44+
ArrayList<String> experimental = new ArrayList<>();
45+
46+
try {
47+
if (!config.isChild && load) {
48+
config.load();
49+
}
50+
51+
Property cfg;
52+
//GENERAL
53+
cfg = config.get("GENERAL", "Hide Background", true);
54+
cfg.comment = "[NEI Ore Plugin] Hides the Background when the tooltip for the Dimensions is renderedr. [Default: true]";
55+
hideBackground = cfg.getBoolean(true);
56+
General.add(cfg.getName());
57+
58+
cfg = config.get("GENERAL", "DimTooltip", true);
59+
cfg.comment = "[NEI Ore Plugin] Activates Dimensison Tooltips. [Default: true]";
60+
toolTips = cfg.getBoolean(true);
61+
General.add(cfg.getName());
62+
63+
cfg = config.get("GENERAL", "Disable Nether", false);
64+
cfg.comment = "Disable Nether. [Default: false]";
65+
DisableNether = cfg.getBoolean(false);
66+
General.add(cfg.getName());
67+
68+
cfg = config.get("GENERAL", "Disable The End", false);
69+
cfg.comment = "Disable The End. [Default: false]";
70+
DisableTheEnd = cfg.getBoolean(false);
71+
General.add(cfg.getName());
72+
73+
cfg = config.get("GENERAL", "Download Mods Only Once", true);
74+
cfg.comment = "Download Mods Only Once. [Default: true]";
75+
downloadOnlyOnce = cfg.getBoolean(true);
76+
General.add(cfg.getName());
77+
78+
cfg = config.get("GENERAL", "Enable Impact Main Menu", true);
79+
cfg.comment = "Enable Impact Main Menu. [Default: true]";
80+
mainMenu = cfg.getBoolean(true);
81+
General.add(cfg.getName());
82+
83+
cfg = config.get("GENERAL", "Enable Impact Placed Items", true);
84+
cfg.comment = "Enable Impact Placed Items. [Default: true]";
85+
placedItems = cfg.getBoolean(true);
86+
General.add(cfg.getName());
87+
88+
cfg = config.get("GENERAL", "Impact saves files timer", 30);
89+
cfg.comment = "SaveTimer. [Default: 30min]";
90+
saveTime = cfg.getInt(30);
91+
General.add(cfg.getName());
92+
93+
cfg = config.get("GENERAL", "Mining World (Copy OverWorld)", 45);
94+
cfg.comment = "MiningWorldID. [Default: 45]";
95+
MiningWorldID = cfg.getInt(45);
96+
General.add(cfg.getName());
97+
98+
cfg = config.get("GENERAL", "Max tickrate multiblocks (only IMPACT)", 2);
99+
cfg.comment = "MaxTickRate. [Default: 2]";
100+
MAX_TICK_RATE = cfg.getInt(2);
101+
General.add(cfg.getName());
102+
103+
cfg = config.get("GENERAL", "Enabled autodetect and update quests", true);
104+
cfg.comment = "enabledAutoUpdateQuests [Default: true]";
105+
enabledAutoUpdateQuests = cfg.getBoolean(true);
106+
General.add(cfg.getName());
107+
108+
//DEBUG
109+
cfg = config.get("DEBUG", "disableLogger", true);
110+
cfg.comment = "Disabled Logger. [Default: true]";
111+
disableLogger = cfg.getBoolean(true);
112+
Debug.add(cfg.getName());
113+
114+
//EXPERIMENTAL
115+
cfg = config.get("EXPERIMENTAL", "enabledMultiThreading", false);
116+
cfg.comment = "Enabled Multi Threading. [Default: false]";
117+
isEnabledExperimentalMultiThreading = cfg.getBoolean(false);
118+
experimental.add(cfg.getName());
119+
120+
cfg = config.get("EXPERIMENTAL", "modpackVersion", "");
121+
modpackVersion = cfg.getString();
122+
experimental.add(cfg.getName());
123+
124+
125+
config.setCategoryPropertyOrder("GENERAL", General);
126+
config.setCategoryPropertyOrder("DEBUG", Debug);
127+
config.setCategoryPropertyOrder("EXPERIMENTAL", experimental);
128+
129+
if (config.hasChanged()) {
130+
config.save();
131+
}
132+
133+
FMLLog.log(Level.INFO, "[IMPACT] Logger: " + disableLogger);
134+
135+
} catch (Exception e) {
136+
FMLLog.log(Level.ERROR, e, "[IMPACT] Error load config!");
137+
}
138+
}
133139
}

0 commit comments

Comments
 (0)