From c0b8fffc405d7290cb98c35276eed19060472c42 Mon Sep 17 00:00:00 2001 From: miozune Date: Sat, 19 Feb 2022 12:17:10 +0900 Subject: [PATCH] Fix irrelevant flowers show up in NEI --- .../nei/recipe/RecipeHandlerBrewery.java | 2 +- .../nei/recipe/RecipeHandlerElvenTrade.java | 4 ++-- .../nei/recipe/RecipeHandlerManaPool.java | 23 ++----------------- .../recipe/RecipeHandlerPetalApothecary.java | 4 ++-- .../nei/recipe/RecipeHandlerPureDaisy.java | 15 ++---------- 5 files changed, 9 insertions(+), 39 deletions(-) diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerBrewery.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerBrewery.java index 2a6e8659e..af5546385 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerBrewery.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerBrewery.java @@ -131,7 +131,7 @@ public class RecipeHandlerBrewery extends TemplateRecipeHandler { continue; CachedBreweryRecipe crecipe = new CachedBreweryRecipe(recipe); - if(crecipe.contains(crecipe.inputs, ingredient)) + if(crecipe.containsWithNBT(crecipe.inputs, ingredient)) arecipes.add(crecipe); } } diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java index 02aaebef0..a417ab01b 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java @@ -131,7 +131,7 @@ public class RecipeHandlerElvenTrade extends TemplateRecipeHandler { if(recipe == null) continue; - if(NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result)) + if(NEIServerUtils.areStacksSameTypeCraftingWithNBT(recipe.getOutput(), result)) arecipes.add(new CachedElvenTradeRecipe(recipe)); } } @@ -145,7 +145,7 @@ public class RecipeHandlerElvenTrade extends TemplateRecipeHandler { continue; CachedElvenTradeRecipe crecipe = new CachedElvenTradeRecipe(recipe); - if(crecipe.contains(crecipe.inputs, ingredient)) + if(crecipe.containsWithNBT(crecipe.inputs, ingredient)) arecipes.add(crecipe); } } diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java index 8084b4d87..ff96da617 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java @@ -66,25 +66,6 @@ public class RecipeHandlerManaPool extends TemplateRecipeHandler { return otherStacks; } - @Override - public boolean contains(Collection ingredients, ItemStack ingredient) { - if(ingredients == inputs) { - boolean skippedPool = false; - - for(PositionedStack stack : ingredients) { - if(!skippedPool) { - skippedPool = true; - continue; - } - - if(stack.contains(ingredient)) - return true; - } - } - - return super.contains(ingredients, ingredient); - } - } @Override @@ -136,7 +117,7 @@ public class RecipeHandlerManaPool extends TemplateRecipeHandler { if(recipe == null) continue; - if(NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result)) + if(NEIServerUtils.areStacksSameTypeCraftingWithNBT(recipe.getOutput(), result)) arecipes.add(new CachedManaPoolRecipe(recipe)); } } @@ -148,7 +129,7 @@ public class RecipeHandlerManaPool extends TemplateRecipeHandler { continue; CachedManaPoolRecipe crecipe = new CachedManaPoolRecipe(recipe); - if(crecipe.contains(crecipe.getIngredients(), ingredient) || crecipe.contains(crecipe.getOtherStacks(), ingredient)) + if(crecipe.containsWithNBT(crecipe.getIngredients(), ingredient) || crecipe.containsWithNBT(crecipe.getOtherStacks(), ingredient)) arecipes.add(crecipe); } } diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java index d3d3fc96b..7dd5439c4 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java @@ -121,7 +121,7 @@ public class RecipeHandlerPetalApothecary extends TemplateRecipeHandler { if(recipe == null) continue; - if(recipe.getOutput().stackTagCompound != null && NEIServerUtils.areStacksSameType(recipe.getOutput(), result) || recipe.getOutput().stackTagCompound == null && NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result) && recipe.getOutput().getItem() != Items.skull) + if(recipe.getOutput().stackTagCompound != null && NEIServerUtils.areStacksSameTypeWithNBT(recipe.getOutput(), result) || recipe.getOutput().stackTagCompound == null && NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result) && recipe.getOutput().getItem() != Items.skull) arecipes.add(getCachedRecipe(recipe)); } } @@ -133,7 +133,7 @@ public class RecipeHandlerPetalApothecary extends TemplateRecipeHandler { continue; CachedPetalApothecaryRecipe crecipe = getCachedRecipe(recipe); - if(crecipe.contains(crecipe.inputs, ingredient) && recipe.getOutput().getItem() != Items.skull) + if(crecipe.containsWithNBT(crecipe.inputs, ingredient) && recipe.getOutput().getItem() != Items.skull) arecipes.add(crecipe); } } diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPureDaisy.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPureDaisy.java index 47cbedb63..1b5b867cd 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPureDaisy.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPureDaisy.java @@ -57,17 +57,6 @@ public class RecipeHandlerPureDaisy extends TemplateRecipeHandler { return otherStacks; } - @Override - public boolean contains(Collection ingredients, ItemStack ingredient) { - if(ingredients == inputs) { - for(PositionedStack stack : ingredients) - if(stack.contains(ingredient)) - return true; - } - - return super.contains(ingredients, ingredient); - } - } @Override @@ -117,7 +106,7 @@ public class RecipeHandlerPureDaisy extends TemplateRecipeHandler { if(recipe == null) continue; - if(NEIServerUtils.areStacksSameTypeCrafting(new ItemStack(recipe.getOutput()), result)) + if(NEIServerUtils.areStacksSameTypeCraftingWithNBT(new ItemStack(recipe.getOutput()), result)) arecipes.add(new CachedPureDaisyRecipe(recipe)); } } @@ -129,7 +118,7 @@ public class RecipeHandlerPureDaisy extends TemplateRecipeHandler { continue; CachedPureDaisyRecipe crecipe = new CachedPureDaisyRecipe(recipe); - if(crecipe.contains(crecipe.getIngredients(), ingredient) || crecipe.contains(crecipe.getOtherStacks(), ingredient)) + if(crecipe.containsWithNBT(crecipe.getIngredients(), ingredient) || crecipe.containsWithNBT(crecipe.getOtherStacks(), ingredient)) arecipes.add(crecipe); } }