Merge pull request #44 from makeoo/dev

Dev
This commit is contained in:
makeoo committed 2016-01-12 23:55:40 +01:00
commit 052d0e5cf5
5 files changed
+26 -4

No files matched your search

+1 -1
View File
@@ -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"
@@ -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";
@@ -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) {
@@ -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 extends Enchantment> T registerEnchantment(Class<T> enchClass) {
int id = ModConfig.loadEnchantmentId(enchClass.getSimpleName());
if(id == -1) {
@@ -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 extends Potion> T registerPotion(Class<T> potionClass) {