Swallow the NPE caused when other mods add recipes with null inputs
Also swallows the NPE caused by players adding a dead and outdated mod to their instance. Read as: Screw you BiblioWoods Forestry.
This commit is contained in:
parent
6e54f83ebd
commit
b38db9ae7a
|
@ -3,6 +3,7 @@ package WayofTime.alchemicalWizardry.common.compress;
|
|||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
|
@ -26,7 +27,7 @@ public class StorageBlockCraftingManager
|
|||
{
|
||||
this.recipes = new StorageBlockCraftingRecipeAssimilator().getPackingRecipes();
|
||||
|
||||
System.out.println("Total number of compression recipes: " + this.recipes.size());
|
||||
AlchemicalWizardry.logger.info("Total number of compression recipes: " + this.recipes.size());
|
||||
// List<IRecipe> tempRecipeList = new LinkedList();
|
||||
//
|
||||
// World world = DimensionManager.getWorld(0);
|
||||
|
|
|
@ -21,6 +21,11 @@ import net.minecraftforge.oredict.ShapedOreRecipe;
|
|||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
|
||||
public class StorageBlockCraftingRecipeAssimilator {
|
||||
|
||||
public static String[] problemMods = {
|
||||
"BiblioWoodsForestry"
|
||||
};
|
||||
|
||||
public List<IRecipe> getPackingRecipes() {
|
||||
// grab all recipes potentially suitable for packing or unpacking
|
||||
|
||||
|
@ -220,12 +225,26 @@ public class StorageBlockCraftingRecipeAssimilator {
|
|||
}
|
||||
|
||||
private boolean areInputsIdentical(ItemStack a, ItemStack b) {
|
||||
if (a.getItem() != b.getItem()) return false;
|
||||
|
||||
int dmgA = a.getItemDamage();
|
||||
int dmgB = b.getItemDamage();
|
||||
try {
|
||||
if (a.getItem() != b.getItem())
|
||||
return false;
|
||||
|
||||
return dmgA == dmgB || dmgA == OreDictionary.WILDCARD_VALUE || dmgB == OreDictionary.WILDCARD_VALUE;
|
||||
int dmgA = a.getItemDamage();
|
||||
int dmgB = b.getItemDamage();
|
||||
|
||||
return dmgA == dmgB || dmgA == OreDictionary.WILDCARD_VALUE || dmgB == OreDictionary.WILDCARD_VALUE;
|
||||
} catch (NullPointerException e) {
|
||||
|
||||
AlchemicalWizardry.logger.error("A mod in this instance has registered an item with a null input. Known problem mods are:");
|
||||
|
||||
String err = "";
|
||||
for (String problem : problemMods)
|
||||
err += (err.length() > 0 ? ", " : "") + problem;
|
||||
AlchemicalWizardry.logger.error(err);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static class PackingRecipe {
|
||||
|
|
Loading…
Reference in a new issue