mirror of
https://github.com/GTNewHorizons/StorageDrawers.git
synced 2026-11-28 07:55:38 +00:00
Auto-load config
This commit is contained in:
6 files changed
+68
-37
No files matched your search
@@ -2,6 +2,8 @@ package com.jaquadro.minecraft.storagedrawers.api.config;
|
||||
|
||||
public interface IPacksConfig {
|
||||
|
||||
boolean autoEnablePacks();
|
||||
|
||||
boolean isNaturaPackEnabled();
|
||||
|
||||
boolean isBopPackEnabled();
|
||||
|
||||
@@ -82,6 +82,7 @@ public class ConfigManager {
|
||||
public boolean enableThermalFoundationIntegration;
|
||||
public boolean enableChiselIntegration;
|
||||
public boolean enableGTNHIntegration;
|
||||
public boolean autoEnablePacks;
|
||||
public boolean enableNaturaPack;
|
||||
public boolean enableBopPack;
|
||||
public boolean enableForestryPack;
|
||||
@@ -189,6 +190,11 @@ public class ConfigManager {
|
||||
|
||||
private class PacksConfig implements IPacksConfig {
|
||||
|
||||
@Override
|
||||
public boolean autoEnablePacks() {
|
||||
return cache.autoEnablePacks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNaturaPackEnabled() {
|
||||
return cache.enableNaturaPack;
|
||||
@@ -417,15 +423,17 @@ public class ConfigManager {
|
||||
cache.enableGTNHIntegration = config.get(sectionIntegration.getQualifiedName(), "enableGTNH", true)
|
||||
.setLanguageKey(LANG_PREFIX + "integration.enableGTNH").setRequiresMcRestart(true).getBoolean();
|
||||
|
||||
cache.enableNaturaPack = config.get(sectionPacks.getQualifiedName(), "enableNatura", true)
|
||||
cache.autoEnablePacks = config.get(sectionPacks.getQualifiedName(), "autoEnablePacks", true, "If enabled, all explicit pack options will be ignored. Packs will be enabled if their corresponding mod is present (Not including misc pack)")
|
||||
.setLanguageKey(LANG_PREFIX + "packs.autoEnable").setRequiresMcRestart(true).getBoolean();
|
||||
cache.enableNaturaPack = config.get(sectionPacks.getQualifiedName(), "enableNatura", false)
|
||||
.setLanguageKey(LANG_PREFIX + "packs.enableNatura").setRequiresMcRestart(true).getBoolean();
|
||||
cache.enableBopPack = config.get(sectionPacks.getQualifiedName(), "enableBiomesOPlenty", true)
|
||||
cache.enableBopPack = config.get(sectionPacks.getQualifiedName(), "enableBiomesOPlenty", false)
|
||||
.setLanguageKey(LANG_PREFIX + "packs.enableBop").setRequiresMcRestart(true).getBoolean();
|
||||
cache.enableForestryPack = config.get(sectionPacks.getQualifiedName(), "enableForestry", true)
|
||||
cache.enableForestryPack = config.get(sectionPacks.getQualifiedName(), "enableForestry", false)
|
||||
.setLanguageKey(LANG_PREFIX + "packs.enableForestry").setRequiresMcRestart(true).getBoolean();
|
||||
cache.enableErebusPack = config.get(sectionPacks.getQualifiedName(), "enableErebus", true)
|
||||
cache.enableErebusPack = config.get(sectionPacks.getQualifiedName(), "enableErebus", false)
|
||||
.setLanguageKey(LANG_PREFIX + "packs.enableErebus").setRequiresMcRestart(true).getBoolean();
|
||||
cache.enableMiscPack = config.get(sectionPacks.getQualifiedName(), "enableMisc", true)
|
||||
cache.enableMiscPack = config.get(sectionPacks.getQualifiedName(), "enableMisc", false)
|
||||
.setLanguageKey(LANG_PREFIX + "packs.enableMisc").setRequiresMcRestart(true).getBoolean();
|
||||
|
||||
config.get(sectionBlocksFullDrawers1x1.getQualifiedName(), "enabled", true)
|
||||
|
||||
+14
-8
@@ -7,6 +7,7 @@ import com.jaquadro.minecraft.storagedrawers.packs.bop.core.DataResolver;
|
||||
import com.jaquadro.minecraft.storagedrawers.packs.bop.core.ModBlocks;
|
||||
import com.jaquadro.minecraft.storagedrawers.packs.bop.core.RefinedRelocation;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
@@ -34,29 +35,34 @@ public class StorageDrawersPack {
|
||||
@SidedProxy(clientSide = SOURCE_PATH + "CommonProxy", serverSide = SOURCE_PATH + "CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
public static boolean LOAD = true;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
if (!StorageDrawers.config.userConfig.packsConfig().isBopPackEnabled()) {
|
||||
return;
|
||||
if (StorageDrawers.config.userConfig.packsConfig().autoEnablePacks()) {
|
||||
if (!Loader.isModLoaded("BiomesOPlenty")) {
|
||||
LOAD = false;
|
||||
}
|
||||
} else if (!StorageDrawers.config.userConfig.packsConfig().isBopPackEnabled()) {
|
||||
LOAD = false;
|
||||
}
|
||||
|
||||
if (!LOAD) return;
|
||||
|
||||
blocks.init();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
if (!StorageDrawers.config.userConfig.packsConfig().isBopPackEnabled()) {
|
||||
return;
|
||||
}
|
||||
if (!LOAD) return;
|
||||
|
||||
RefinedRelocation.init();
|
||||
resolver.init();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
if (!StorageDrawers.config.userConfig.packsConfig().isBopPackEnabled()) {
|
||||
return;
|
||||
}
|
||||
if (!LOAD) return;
|
||||
|
||||
IStorageDrawersApi api = StorageDrawersApi.instance();
|
||||
if (api != null) {
|
||||
|
||||
+13
-8
@@ -7,6 +7,7 @@ import com.jaquadro.minecraft.storagedrawers.packs.erebus.core.DataResolver;
|
||||
import com.jaquadro.minecraft.storagedrawers.packs.erebus.core.ModBlocks;
|
||||
import com.jaquadro.minecraft.storagedrawers.packs.erebus.core.RefinedRelocation;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
@@ -34,20 +35,26 @@ public class StorageDrawersPack {
|
||||
@SidedProxy(clientSide = SOURCE_PATH + "CommonProxy", serverSide = SOURCE_PATH + "CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
public static boolean LOAD = true;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
if (!StorageDrawers.config.userConfig.packsConfig().isErebusPackEnabled()) {
|
||||
return;
|
||||
if (StorageDrawers.config.userConfig.packsConfig().autoEnablePacks()) {
|
||||
if (!Loader.isModLoaded("erebus")) {
|
||||
LOAD = false;
|
||||
}
|
||||
} else if (!StorageDrawers.config.userConfig.packsConfig().isErebusPackEnabled()) {
|
||||
LOAD = false;
|
||||
}
|
||||
|
||||
if (!LOAD) return;
|
||||
|
||||
blocks.init();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
if (!StorageDrawers.config.userConfig.packsConfig().isErebusPackEnabled()) {
|
||||
return;
|
||||
}
|
||||
if (!LOAD) return;
|
||||
|
||||
RefinedRelocation.init();
|
||||
resolver.init();
|
||||
@@ -55,9 +62,7 @@ public class StorageDrawersPack {
|
||||
|
||||
@Mod.EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
if (!StorageDrawers.config.userConfig.packsConfig().isErebusPackEnabled()) {
|
||||
return;
|
||||
}
|
||||
if (!LOAD) return;
|
||||
|
||||
IStorageDrawersApi api = StorageDrawersApi.instance();
|
||||
if (api != null) {
|
||||
|
||||
+13
-8
@@ -8,6 +8,7 @@ import com.jaquadro.minecraft.storagedrawers.packs.forestry.core.DataResolver;
|
||||
import com.jaquadro.minecraft.storagedrawers.packs.forestry.core.ModBlocks;
|
||||
import com.jaquadro.minecraft.storagedrawers.packs.forestry.core.RefinedRelocation;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
@@ -35,20 +36,26 @@ public class StorageDrawersPack {
|
||||
@SidedProxy(clientSide = SOURCE_PATH + "CommonProxy", serverSide = SOURCE_PATH + "CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
public static boolean LOAD = true;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
if (!StorageDrawers.config.userConfig.packsConfig().isForestryPackEnabled()) {
|
||||
return;
|
||||
if (StorageDrawers.config.userConfig.packsConfig().autoEnablePacks()) {
|
||||
if (!Loader.isModLoaded("Forestry")) {
|
||||
LOAD = false;
|
||||
}
|
||||
} else if (!StorageDrawers.config.userConfig.packsConfig().isForestryPackEnabled()) {
|
||||
LOAD = false;
|
||||
}
|
||||
|
||||
if (!LOAD) return;
|
||||
|
||||
blocks.init();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
if (!StorageDrawers.config.userConfig.packsConfig().isForestryPackEnabled()) {
|
||||
return;
|
||||
}
|
||||
if (!LOAD) return;
|
||||
|
||||
RefinedRelocation.init();
|
||||
for (DataResolver resolver : resolvers) resolver.init();
|
||||
@@ -56,9 +63,7 @@ public class StorageDrawersPack {
|
||||
|
||||
@Mod.EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
if (!StorageDrawers.config.userConfig.packsConfig().isForestryPackEnabled()) {
|
||||
return;
|
||||
}
|
||||
if (!LOAD) return;
|
||||
|
||||
IStorageDrawersApi api = StorageDrawersApi.instance();
|
||||
if (api != null) {
|
||||
|
||||
+13
-8
@@ -7,6 +7,7 @@ import com.jaquadro.minecraft.storagedrawers.packs.natura.core.DataResolver;
|
||||
import com.jaquadro.minecraft.storagedrawers.packs.natura.core.ModBlocks;
|
||||
import com.jaquadro.minecraft.storagedrawers.packs.natura.core.RefinedRelocation;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
@@ -34,20 +35,26 @@ public class StorageDrawersPack {
|
||||
@SidedProxy(clientSide = SOURCE_PATH + "CommonProxy", serverSide = SOURCE_PATH + "CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
public static boolean LOAD = true;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
if (!StorageDrawers.config.userConfig.packsConfig().isNaturaPackEnabled()) {
|
||||
return;
|
||||
if (StorageDrawers.config.userConfig.packsConfig().autoEnablePacks()) {
|
||||
if (!Loader.isModLoaded("Natura")) {
|
||||
LOAD = false;
|
||||
}
|
||||
} else if (!StorageDrawers.config.userConfig.packsConfig().isNaturaPackEnabled()) {
|
||||
LOAD = false;
|
||||
}
|
||||
|
||||
if (!LOAD) return;
|
||||
|
||||
blocks.init();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
if (!StorageDrawers.config.userConfig.packsConfig().isNaturaPackEnabled()) {
|
||||
return;
|
||||
}
|
||||
if (!LOAD) return;
|
||||
|
||||
RefinedRelocation.init();
|
||||
resolver.init();
|
||||
@@ -55,9 +62,7 @@ public class StorageDrawersPack {
|
||||
|
||||
@Mod.EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
if (!StorageDrawers.config.userConfig.packsConfig().isNaturaPackEnabled()) {
|
||||
return;
|
||||
}
|
||||
if (!LOAD) return;
|
||||
|
||||
IStorageDrawersApi api = StorageDrawersApi.instance();
|
||||
if (api != null) {
|
||||
|
||||
Reference in new issue
Block a user