Fixed NPE when calling canBrew

Oversight on my part,

If the ingredient doesn't return true in Item.isPotionIngredient, Items.potionitem.getEffects(stack) returns null, causing an NPE to be thrown later on.

This invalidates #1947.
This commit is contained in:
ganymedes01 2015-06-18 13:32:21 -03:00
parent f2eec981ff
commit 953ddae475

View file

@ -40,7 +40,7 @@ public class VanillaBrewingRecipe implements IBrewingRecipe {
@Override
public ItemStack getOutput(ItemStack input, ItemStack ingredient)
{
if (ingredient != null && input != null && input.getItem() instanceof ItemPotion)
if (ingredient != null && input != null && input.getItem() instanceof ItemPotion && isIngredient(ingredient))
{
int inputMeta = input.getMetadata();
int outputMeta = PotionHelper.applyIngredient(inputMeta, ingredient.getItem().getPotionEffect(ingredient));
@ -72,4 +72,4 @@ public class VanillaBrewingRecipe implements IBrewingRecipe {
return null;
}
}
}