Config for ICompatibility

This commit is contained in:
Nick 2015-12-02 13:28:50 -08:00
parent 349efbd510
commit 72d4c5e135
5 changed files with 22 additions and 2 deletions

View file

@ -40,7 +40,7 @@ repositories {
}
dependencies {
deobfCompile "mezz.jei:jei_1.8.8:2.1.0.8"
deobfCompile "mezz.jei:jei_1.8.8:2.1.2.10"
}
minecraft {

View file

@ -87,6 +87,9 @@ public class ConfigHandler {
public static boolean vanillaPotionHealthBoostEnabled;
public static boolean vanillaPotionAbsorptionEnabled;
// Compat
public static boolean compatibilityJustEnoughItems;
public static void init(File file) {
config = new Configuration(file);
syncConfig();
@ -171,6 +174,10 @@ public class ConfigHandler {
config.addCustomCategoryComment(category, "General settings");
BloodMagicAPI.setLoggingEnabled(config.getBoolean("enableLogging", category, true, "Allows logging information to the console. Fatal errors will bypass this"));
category = "Compatibility";
config.addCustomCategoryComment(category, "Compatibility settings");
compatibilityJustEnoughItems = config.getBoolean("compatibilityJustEnoughItems", category, true, "Enables the JEI recipe categories for specialized recipes.");
config.save();
}

View file

@ -14,4 +14,11 @@ public interface ICompatibility {
* The {@code modid} of the mod we are adding compatibility for.
*/
String getModId();
/**
* Whether or not compatibility should be loaded even if the mod were to be found.
*
* Generally a determined by a config option.
*/
boolean enableCompat();
}

View file

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.compat.jei;
import WayofTime.bloodmagic.ConfigHandler;
import WayofTime.bloodmagic.compat.ICompatibility;
import mezz.jei.api.JEIManager;
@ -14,4 +15,9 @@ public class CompatibilityJustEnoughItems implements ICompatibility {
public String getModId() {
return "JEI";
}
@Override
public boolean enableCompat() {
return ConfigHandler.compatibilityJustEnoughItems;
}
}

View file

@ -14,7 +14,7 @@ public class ModCompatibility {
compatibilities.add(new CompatibilityJustEnoughItems());
for (ICompatibility compat : compatibilities) {
if (Loader.isModLoaded(compat.getModId()))
if (compat.enableCompat() && Loader.isModLoaded(compat.getModId()))
compat.loadCompatibility();
}
}