fixed crash with reflection

This commit is contained in:
2016-05-13 16:02:05 +02:00
parent bf6fbd1061
commit bf2ef79692
6 changed files with 60 additions and 48 deletions

View File

@@ -43,15 +43,14 @@ public class Blocks {
if (java.lang.reflect.Modifier.isStatic(field.getModifiers())) {
Class<?> targetType = field.getType();
try {
Object newInstance = targetType.newInstance();
BasicBlockOre block = (BasicBlockOre) field.get(newInstance);
Block block = (Block) field.get(targetType);
Utils.registerBlockWithItem(block);
if (block.isOreDict()) {
OreDictionary.registerOre(block.oreDictName, block);
if (block instanceof BasicBlockOre) {
if (((BasicBlockOre) block).isOreDict()) {
OreDictionary.registerOre(((BasicBlockOre) block).getOreDictName(), block);
}
}
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}