mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-19 03:39:17 +00:00
Added a bunch of null checks to the NEI integration to try to fix the weird crash that's been going around. Closes #961, for now, I guess.
This commit is contained in:
1 parent
cf30dae374
commit
30bc2e8fd4
5 files changed
+75
-33
No files matched your search
@@ -98,34 +98,42 @@ public class RecipeHandlerBrewery extends TemplateRecipeHandler {
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if (outputId.equals("botania.brewery"))
|
||||
for (RecipeBrew recipe : BotaniaAPI.brewRecipes)
|
||||
if(outputId.equals("botania.brewery"))
|
||||
for(RecipeBrew recipe : BotaniaAPI.brewRecipes)
|
||||
arecipes.add(new CachedBreweryRecipe(recipe));
|
||||
else
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
else super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
if (result.getItem() instanceof IBrewItem)
|
||||
for (RecipeBrew recipe : BotaniaAPI.brewRecipes)
|
||||
if (((IBrewItem) result.getItem()).getBrew(result) == recipe.getBrew())
|
||||
if(result.getItem() instanceof IBrewItem)
|
||||
for(RecipeBrew recipe : BotaniaAPI.brewRecipes) {
|
||||
if(recipe == null)
|
||||
continue;
|
||||
|
||||
if(((IBrewItem) result.getItem()).getBrew(result) == recipe.getBrew())
|
||||
arecipes.add(new CachedBreweryRecipe(recipe));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
if (ingredient.getItem() instanceof IBrewContainer) {
|
||||
if(ingredient.getItem() instanceof IBrewContainer) {
|
||||
for(RecipeBrew recipe : BotaniaAPI.brewRecipes) {
|
||||
if(recipe == null)
|
||||
continue;
|
||||
|
||||
if(recipe.getOutput(ingredient) != null)
|
||||
arecipes.add(new CachedBreweryRecipe(recipe, ingredient));
|
||||
}
|
||||
} else
|
||||
for (RecipeBrew recipe : BotaniaAPI.brewRecipes) {
|
||||
CachedBreweryRecipe crecipe = new CachedBreweryRecipe(recipe);
|
||||
if (crecipe.contains(crecipe.inputs, ingredient))
|
||||
arecipes.add(crecipe);
|
||||
}
|
||||
} else for(RecipeBrew recipe : BotaniaAPI.brewRecipes) {
|
||||
if(recipe == null)
|
||||
continue;
|
||||
|
||||
CachedBreweryRecipe crecipe = new CachedBreweryRecipe(recipe);
|
||||
if(crecipe.contains(crecipe.inputs, ingredient))
|
||||
arecipes.add(crecipe);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -111,36 +111,41 @@ public class RecipeHandlerElvenTrade extends TemplateRecipeHandler {
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if (outputId.equals("botania.elvenTrade") && hasElvenKnowledge()) {
|
||||
if (hasElvenKnowledge()) {
|
||||
for (RecipeElvenTrade recipe : BotaniaAPI.elvenTradeRecipes) {
|
||||
if(outputId.equals("botania.elvenTrade") && hasElvenKnowledge()) {
|
||||
if(hasElvenKnowledge()) {
|
||||
for(RecipeElvenTrade recipe : BotaniaAPI.elvenTradeRecipes) {
|
||||
if(recipe == null)
|
||||
continue;
|
||||
|
||||
arecipes.add(new CachedElvenTradeRecipe(recipe));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
} else super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
if (hasElvenKnowledge()) {
|
||||
for (RecipeElvenTrade recipe : BotaniaAPI.elvenTradeRecipes) {
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result)) {
|
||||
if(hasElvenKnowledge()) {
|
||||
for(RecipeElvenTrade recipe : BotaniaAPI.elvenTradeRecipes) {
|
||||
if(recipe == null)
|
||||
continue;
|
||||
|
||||
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result))
|
||||
arecipes.add(new CachedElvenTradeRecipe(recipe));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
if (hasElvenKnowledge()) {
|
||||
for (RecipeElvenTrade recipe : BotaniaAPI.elvenTradeRecipes) {
|
||||
if(hasElvenKnowledge()) {
|
||||
for(RecipeElvenTrade recipe : BotaniaAPI.elvenTradeRecipes) {
|
||||
if(recipe == null)
|
||||
continue;
|
||||
|
||||
CachedElvenTradeRecipe crecipe = new CachedElvenTradeRecipe(recipe);
|
||||
if (crecipe.contains(crecipe.inputs, ingredient)) {
|
||||
if(crecipe.contains(crecipe.inputs, ingredient))
|
||||
arecipes.add(crecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,21 +121,32 @@ public class RecipeHandlerManaPool extends TemplateRecipeHandler {
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if(outputId.equals("botania.manaPool")) {
|
||||
for(RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes)
|
||||
for(RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) {
|
||||
if(recipe == null)
|
||||
continue;
|
||||
|
||||
arecipes.add(new CachedManaPoolRecipe(recipe));
|
||||
}
|
||||
} else super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for(RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes)
|
||||
for(RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) {
|
||||
if(recipe == null)
|
||||
continue;
|
||||
|
||||
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result))
|
||||
arecipes.add(new CachedManaPoolRecipe(recipe));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
for(RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) {
|
||||
if(recipe == null)
|
||||
continue;
|
||||
|
||||
CachedManaPoolRecipe crecipe = new CachedManaPoolRecipe(recipe);
|
||||
if(crecipe.contains(crecipe.getIngredients(), ingredient) || crecipe.contains(crecipe.getOtherStacks(), ingredient))
|
||||
arecipes.add(crecipe);
|
||||
|
||||
+8
-1
@@ -117,14 +117,21 @@ public class RecipeHandlerPetalApothecary extends TemplateRecipeHandler {
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for(RecipePetals recipe : getRecipes())
|
||||
for(RecipePetals recipe : getRecipes()){
|
||||
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)
|
||||
arecipes.add(getCachedRecipe(recipe));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
for(RecipePetals recipe : getRecipes()) {
|
||||
if(recipe == null)
|
||||
continue;
|
||||
|
||||
CachedPetalApothecaryRecipe crecipe = getCachedRecipe(recipe);
|
||||
if(crecipe.contains(crecipe.inputs, ingredient) && recipe.getOutput().getItem() != Items.skull)
|
||||
arecipes.add(crecipe);
|
||||
|
||||
@@ -101,21 +101,32 @@ public class RecipeHandlerPureDaisy extends TemplateRecipeHandler {
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if(outputId.equals("botania.pureDaisy")) {
|
||||
for(RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes)
|
||||
for(RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) {
|
||||
if(recipe == null)
|
||||
continue;
|
||||
|
||||
arecipes.add(new CachedPureDaisyRecipe(recipe));
|
||||
}
|
||||
} else super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for(RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes)
|
||||
for(RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) {
|
||||
if(recipe == null)
|
||||
continue;
|
||||
|
||||
if(NEIServerUtils.areStacksSameTypeCrafting(new ItemStack(recipe.getOutput()), result))
|
||||
arecipes.add(new CachedPureDaisyRecipe(recipe));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
for(RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) {
|
||||
if(recipe == null)
|
||||
continue;
|
||||
|
||||
CachedPureDaisyRecipe crecipe = new CachedPureDaisyRecipe(recipe);
|
||||
if(crecipe.contains(crecipe.getIngredients(), ingredient) || crecipe.contains(crecipe.getOtherStacks(), ingredient))
|
||||
arecipes.add(crecipe);
|
||||
|
||||
Reference in new issue
Block a user