Added failsafe null checks to NEI integration. Closes #843

This commit is contained in:
Lizbeth Rika committed 2015-04-30 13:35:28 +01:00
1 parent c4abc083a6
commit 2e81845446
6 files changed
+22 -18

No files matched your search

@@ -29,6 +29,9 @@ public class RecipeHandlerBrewery extends TemplateRecipeHandler {
public int mana;
public CachedBreweryRecipe(RecipeBrew recipe, ItemStack vial) {
if(recipe == null)
return;
setIngredients(recipe.getInputs());
ItemStack toVial;
if (vial == null)
@@ -32,6 +32,9 @@ public class RecipeHandlerElvenTrade extends TemplateRecipeHandler {
public PositionedStack output;
public CachedElvenTradeRecipe(RecipeElvenTrade recipe) {
if(recipe == null)
return;
setIngredients(recipe.getInputs());
output = new PositionedStack(recipe.getOutput(), 107, 46);
}
@@ -22,8 +22,7 @@ public class RecipeHandlerFloatingFlowers extends TemplateRecipeHandler {
public List<PositionedStack> inputs = new ArrayList<PositionedStack>();
public PositionedStack output;
public CachedFloatingFlowerRecipe(ItemStack floatingFlower,
ItemStack specialFlower, ItemStack output) {
public CachedFloatingFlowerRecipe(ItemStack floatingFlower, ItemStack specialFlower, ItemStack output) {
inputs.add(new PositionedStack(floatingFlower, 25, 6));
inputs.add(new PositionedStack(specialFlower, 43, 6));
this.output = new PositionedStack(output, 119, 24);
@@ -49,8 +48,7 @@ public class RecipeHandlerFloatingFlowers extends TemplateRecipeHandler {
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18),
"crafting"));
transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "crafting"));
}
@Override
@@ -60,29 +58,23 @@ public class RecipeHandlerFloatingFlowers extends TemplateRecipeHandler {
@Override
public void loadCraftingRecipes(ItemStack result) {
if (Block.getBlockFromItem(result.getItem()) instanceof BlockFloatingSpecialFlower) {
ItemStack floatingFlower = new ItemStack(ModBlocks.floatingFlower,
1, OreDictionary.WILDCARD_VALUE);
if(Block.getBlockFromItem(result.getItem()) instanceof BlockFloatingSpecialFlower) {
ItemStack floatingFlower = new ItemStack(ModBlocks.floatingFlower, 1, OreDictionary.WILDCARD_VALUE);
ItemStack specialFlower = new ItemStack(ModBlocks.specialFlower);
specialFlower.setTagCompound((NBTTagCompound) result
.getTagCompound().copy());
specialFlower.setTagCompound((NBTTagCompound) result.getTagCompound().copy());
arecipes.add(new CachedFloatingFlowerRecipe(floatingFlower,
specialFlower, result.copy()));
arecipes.add(new CachedFloatingFlowerRecipe(floatingFlower, specialFlower, result.copy()));
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
if (Block.getBlockFromItem(ingredient.getItem()) instanceof BlockSpecialFlower) {
ItemStack floatingFlower = new ItemStack(ModBlocks.floatingFlower,
1, OreDictionary.WILDCARD_VALUE);
if(Block.getBlockFromItem(ingredient.getItem()) instanceof BlockSpecialFlower) {
ItemStack floatingFlower = new ItemStack(ModBlocks.floatingFlower, 1, OreDictionary.WILDCARD_VALUE);
ItemStack result = new ItemStack(ModBlocks.floatingSpecialFlower);
result.setTagCompound((NBTTagCompound) ingredient.getTagCompound()
.copy());
result.setTagCompound((NBTTagCompound) ingredient.getTagCompound().copy());
arecipes.add(new CachedFloatingFlowerRecipe(floatingFlower,
ingredient.copy(), result));
arecipes.add(new CachedFloatingFlowerRecipe(floatingFlower, ingredient.copy(), result));
}
}
@@ -34,6 +34,8 @@ public class RecipeHandlerManaPool extends TemplateRecipeHandler {
public int mana;
public CachedManaPoolRecipe(RecipeManaInfusion recipe) {
if(recipe == null)
return;
inputs.add(new PositionedStack(new ItemStack(ModBlocks.pool, 1, recipe.getOutput().getItem() == Item.getItemFromBlock(ModBlocks.pool) ? 2 : 0), 71, 37));
if(recipe.getInput() instanceof String)
@@ -34,6 +34,8 @@ public class RecipeHandlerPureDaisy extends TemplateRecipeHandler {
public List<PositionedStack> otherStacks = new ArrayList<PositionedStack>();
public CachedPureDaisyRecipe(RecipePureDaisy recipe) {
if(recipe == null)
return;
inputs.add(new PositionedStack(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_PUREDAISY), 71, 23));
if(recipe.getInput() instanceof String)
@@ -20,6 +20,8 @@ public class RecipeHandlerRunicAltar extends RecipeHandlerPetalApothecary {
public CachedRunicAltarRecipe(RecipeRuneAltar recipe) {
super(recipe, false);
if(recipe == null)
return;
manaUsage = recipe.getManaUsage();
inputs.add(new PositionedStack(new ItemStack(ModBlocks.runeAltar), 73, 55));
}