From 19a802fd686d12b3f8f058facf26fea2e75e8935 Mon Sep 17 00:00:00 2001 From: mezz Date: Thu, 24 Sep 2015 00:49:26 -0700 Subject: [PATCH] #750 Make sure recipes with NBT do not match items with no NBT --- .../java/forestry/core/utils/ShapedRecipeCustom.java | 12 +++++++++++- .../forestry/core/utils/ShapelessRecipeCustom.java | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/main/java/forestry/core/utils/ShapedRecipeCustom.java b/src/main/java/forestry/core/utils/ShapedRecipeCustom.java index bac052769..9903846d1 100755 --- a/src/main/java/forestry/core/utils/ShapedRecipeCustom.java +++ b/src/main/java/forestry/core/utils/ShapedRecipeCustom.java @@ -77,7 +77,17 @@ public class ShapedRecipeCustom implements IDescriptiveRecipe { @Override public boolean matches(InventoryCrafting inventoryCrafting, World world) { - return matches((IInventory) inventoryCrafting, world); + if (!matches((IInventory) inventoryCrafting, world)) { + return false; + } + + if (preserveNBT) { + if (RecipeUtil.getCraftingNbt(inventoryCrafting) == null) { + return false; + } + } + + return true; } public boolean matches(IInventory inventoryCrafting, World world) { diff --git a/src/main/java/forestry/core/utils/ShapelessRecipeCustom.java b/src/main/java/forestry/core/utils/ShapelessRecipeCustom.java index db0355e83..f5fb241c8 100644 --- a/src/main/java/forestry/core/utils/ShapelessRecipeCustom.java +++ b/src/main/java/forestry/core/utils/ShapelessRecipeCustom.java @@ -73,7 +73,17 @@ public class ShapelessRecipeCustom implements IRecipe { } } - return arraylist.isEmpty(); + if (!arraylist.isEmpty()) { + return false; + } + + if (preservesNbt) { + if (RecipeUtil.getCraftingNbt(inventoryCrafting) == null) { + return false; + } + } + + return true; } @Override