From 3fa50c77848b5e734421ac1e4f4f183cf0f0e494 Mon Sep 17 00:00:00 2001 From: makeo Date: Tue, 12 Jan 2016 23:48:17 +0100 Subject: [PATCH 1/2] Fixed bug that the config did not create the config entries for potions or enchantments --- .../makeo/gadomancy/common/data/config/ModConfig.java | 5 +++++ .../common/registration/RegisteredEnchantments.java | 10 ++++++++++ .../common/registration/RegisteredPotions.java | 11 +++++++++-- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/main/java/makeo/gadomancy/common/data/config/ModConfig.java b/src/main/java/makeo/gadomancy/common/data/config/ModConfig.java index 7886807..8bbf7ef 100644 --- a/src/main/java/makeo/gadomancy/common/data/config/ModConfig.java +++ b/src/main/java/makeo/gadomancy/common/data/config/ModConfig.java @@ -1,5 +1,7 @@ package makeo.gadomancy.common.data.config; +import makeo.gadomancy.common.registration.RegisteredEnchantments; +import makeo.gadomancy.common.registration.RegisteredPotions; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; import thaumcraft.api.aspects.Aspect; @@ -82,6 +84,9 @@ public class ModConfig { config.addCustomCategoryComment("potions", "Use the following if you have problems with conflicting potion ids. If the entry is set to '-1' it will try to automatically find the lowest free potion id."); config.addCustomCategoryComment("enchantments", "Use the following if you have problems with conflicting enchantment ids. If the entry is set to '-1' it will try to automatically find the lowest free enchantment id."); + + RegisteredPotions.createConfigEntries(); + RegisteredEnchantments.createConfigEntries(); } private static String[] refactorAspects(String listOfAspects) { diff --git a/src/main/java/makeo/gadomancy/common/registration/RegisteredEnchantments.java b/src/main/java/makeo/gadomancy/common/registration/RegisteredEnchantments.java index 149e7f0..570ed2a 100644 --- a/src/main/java/makeo/gadomancy/common/registration/RegisteredEnchantments.java +++ b/src/main/java/makeo/gadomancy/common/registration/RegisteredEnchantments.java @@ -6,6 +6,8 @@ import makeo.gadomancy.common.enchantments.EnchantmentRevealer; import makeo.gadomancy.common.utils.Injector; import net.minecraft.enchantment.Enchantment; +import java.lang.reflect.Field; + /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -21,6 +23,14 @@ public class RegisteredEnchantments { revealer = registerEnchantment(EnchantmentRevealer.class); } + public static void createConfigEntries() { + for(Field field : RegisteredEnchantments.class.getFields()) { + if(Enchantment.class.isAssignableFrom(field.getType())) { + ModConfig.loadEnchantmentId(field.getType().getSimpleName()); + } + } + } + public static T registerEnchantment(Class enchClass) { int id = ModConfig.loadEnchantmentId(enchClass.getSimpleName()); if(id == -1) { diff --git a/src/main/java/makeo/gadomancy/common/registration/RegisteredPotions.java b/src/main/java/makeo/gadomancy/common/registration/RegisteredPotions.java index ee7f3e5..6b4ef59 100644 --- a/src/main/java/makeo/gadomancy/common/registration/RegisteredPotions.java +++ b/src/main/java/makeo/gadomancy/common/registration/RegisteredPotions.java @@ -8,6 +8,8 @@ import makeo.gadomancy.common.potions.PotionEldritch; import makeo.gadomancy.common.utils.Injector; import net.minecraft.potion.Potion; +import java.lang.reflect.Field; + /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -17,7 +19,6 @@ import net.minecraft.potion.Potion; * Created by makeo @ 31.10.2015 23:09 */ public class RegisteredPotions { - public static PotionMiningLuck POTION_LUCK; public static PotionBuffGolem BUFF_GOLEM; public static PotionAchromatic ACHROMATIC; @@ -30,8 +31,14 @@ public class RegisteredPotions { ACHROMATIC = registerPotion(PotionAchromatic.class); ELDRITCH = registerPotion(PotionEldritch.class); VIS_DISCOUNT = registerPotion(PotionVisAffinity.class); + } - ModConfig.save(); + public static void createConfigEntries() { + for(Field field : RegisteredPotions.class.getFields()) { + if(Potion.class.isAssignableFrom(field.getType())) { + ModConfig.loadPotionId(field.getType().getSimpleName()); + } + } } private static T registerPotion(Class potionClass) { From 9317dded50624d715d85e38da71efb00966a3230 Mon Sep 17 00:00:00 2001 From: makeo Date: Tue, 12 Jan 2016 23:49:55 +0100 Subject: [PATCH 2/2] Changed version to 1.0.6.1 --- build.gradle | 2 +- src/main/java/makeo/gadomancy/common/Gadomancy.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index f56587d..cf47a10 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { apply plugin: 'forge' -version = "1.7.10-1.0.6" +version = "1.7.10-1.0.6.1" group= "makeo.gadomancy" archivesBaseName = "gadomancy" diff --git a/src/main/java/makeo/gadomancy/common/Gadomancy.java b/src/main/java/makeo/gadomancy/common/Gadomancy.java index b6a307e..85f4a08 100644 --- a/src/main/java/makeo/gadomancy/common/Gadomancy.java +++ b/src/main/java/makeo/gadomancy/common/Gadomancy.java @@ -28,7 +28,7 @@ public class Gadomancy { public static final String MODID = "gadomancy"; public static final String NAME = "Gadomancy"; - public static final String VERSION = "1.0.6"; + public static final String VERSION = "1.0.6.1"; private static final String PROXY_CLIENT = "makeo.gadomancy.client.ClientProxy"; private static final String PROXY_SERVER = "makeo.gadomancy.common.CommonProxy";