1.10.2: Fixed Nullpointers with bloodmagic and JEI on multiplayer (#492)

* Fixed Nullpointers with JEI on multiplayer

* Version bump
This commit is contained in:
BloodWorkXGaming 2017-06-27 20:41:39 +02:00 committed by Jared
parent 8b49478813
commit 65ef2d3d72
3 changed files with 96 additions and 83 deletions

View file

@ -1,3 +1,3 @@
minecraft.version=1.10.2
forge.version=1.10.2-12.18.3.2254
mod.version=2.0.12
mod.version=2.0.13

View file

@ -79,6 +79,7 @@ public class AlchemyTable {
if(!list.remove(recipe)) {
LogHelper.logError(String.format("Error removing %s Recipe for %s", name, this.getRecipeInfo(recipe)));
} else {
if (JEIAddonPlugin.recipeRegistry != null) {
List<AlchemyTableRecipeJEI> wrappers = JEIAddonPlugin.recipeRegistry.getRecipeWrappers(JEIAddonPlugin.recipeRegistry.getRecipeCategories(Arrays.asList("BloodMagic:salchemyTable")).get(0));
final AlchemyTableRecipeJEI[] recipeToRemove = {null};
wrappers.forEach(wrap -> {
@ -104,6 +105,7 @@ public class AlchemyTable {
});
MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(recipeToRemove[0]);
}
}
} else {
LogHelper.logError(String.format("Error removing %s Recipe: null object", name));
@ -179,6 +181,7 @@ public class AlchemyTable {
if(recipe != null) {
if(this.list.remove(recipe)) {
successful.add(recipe);
if (JEIAddonPlugin.recipeRegistry != null) {
List<AlchemyTableRecipeJEI> wrappers = JEIAddonPlugin.recipeRegistry.getRecipeWrappers(JEIAddonPlugin.recipeRegistry.getRecipeCategories(Arrays.asList("BloodMagic:salchemyTable")).get(0));
final AlchemyTableRecipeJEI[] recipeToRemove = {null};
wrappers.forEach(wrap -> {
@ -204,6 +207,7 @@ public class AlchemyTable {
});
MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(recipeToRemove[0]);
}
} else {
LogHelper.logError(String.format("Error removing %s Recipe for %s", name, getRecipeInfo(recipe)));
}

View file

@ -114,6 +114,8 @@ public class Altar
LogHelper.logError(String.format("Error removing %s Recipe: null object", name));
}else {
successful.put(key, value);
if (JEIAddonPlugin.recipeRegistry != null) {
List<AltarRecipeJEI> list = JEIAddonPlugin.recipeRegistry.getRecipeWrappers(JEIAddonPlugin.recipeRegistry.getRecipeCategories(Arrays.asList("BloodMagic:altar")).get(0));
final AltarRecipeJEI[] recipe = {null};
list.forEach(rec -> {
@ -127,6 +129,7 @@ public class Altar
MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(recipe[0]);
}
}
}
for(Entry<List<ItemStackWrapper>, AltarRecipe> entry : overwritten.entrySet()) {
List<ItemStackWrapper> key = entry.getKey();
@ -196,8 +199,10 @@ public class Altar
AltarRecipe oldValue = map.remove(key);
if(oldValue != null) {
successful.put(key, oldValue);
if (JEIAddonPlugin.recipeRegistry != null) {
List<AltarRecipeJEI> list = JEIAddonPlugin.recipeRegistry.getRecipeWrappers(JEIAddonPlugin.recipeRegistry.getRecipeCategories(Arrays.asList("BloodMagic:altar")).get(0));
final AltarRecipeJEI[] recipe = {null};
list.forEach(rec -> {
ItemStack input = ((List<ItemStack>) ReflectionHelper.getFinalObject(rec, "input")).get(0);
ItemStack output = ReflectionHelper.getFinalObject(rec, "output");
@ -207,6 +212,10 @@ public class Altar
});
if (recipe[0] != null)
MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(recipe[0]);
}
} else {
LogHelper.logError(String.format("Error removing %s Recipe : null object", name));
}