From 953ddae4756f5edf65d0f124daa3642d25d24b45 Mon Sep 17 00:00:00 2001 From: ganymedes01 Date: Thu, 18 Jun 2015 13:32:21 -0300 Subject: [PATCH] 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. --- .../minecraftforge/common/brewing/VanillaBrewingRecipe.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minecraftforge/common/brewing/VanillaBrewingRecipe.java b/src/main/java/net/minecraftforge/common/brewing/VanillaBrewingRecipe.java index cf94bc16c2..ead5c93b2b 100644 --- a/src/main/java/net/minecraftforge/common/brewing/VanillaBrewingRecipe.java +++ b/src/main/java/net/minecraftforge/common/brewing/VanillaBrewingRecipe.java @@ -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; } -} \ No newline at end of file +}