API-facing methods for removing recipes (#1152)

This commit is contained in:
Nicholas Ignoffo 2017-06-01 22:16:24 -07:00
parent 95634f01c3
commit f7b8dc0d84
6 changed files with 25 additions and 8 deletions

View file

@ -5,7 +5,9 @@ import java.util.Iterator;
import java.util.List;
import com.google.common.collect.ImmutableList;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@ -13,6 +15,8 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
@EqualsAndHashCode
@ToString
public class AlchemyTableRecipe
{
protected ItemStack output = ItemStack.EMPTY;

View file

@ -1,6 +1,8 @@
package WayofTime.bloodmagic.api.recipe;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@ -12,6 +14,8 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@EqualsAndHashCode
@ToString
public class TartaricForgeRecipe
{
protected ItemStack output = null;

View file

@ -74,13 +74,7 @@ public class AlchemyArrayRecipeRegistry
}
}
if (circleRenderer == null)
{
recipes.put(input, new AlchemyArrayRecipe(input, catalystStack, arrayEffect, defaultRenderer));
} else
{
recipes.put(input, new AlchemyArrayRecipe(input, catalystStack, arrayEffect, circleRenderer));
}
recipes.put(input, new AlchemyArrayRecipe(input, catalystStack, arrayEffect, circleRenderer == null ? defaultRenderer : circleRenderer));
}
public static AlchemyArrayEffect getAlchemyArrayEffect(String key)
@ -116,7 +110,7 @@ public class AlchemyArrayRecipeRegistry
}
/**
* @param Output
* @param stack
* of the recipe
* @return an array of two ItemStacks - first index is the input stack,
* second is the catalyst stack. Returns {null, null} if no recipe

View file

@ -22,6 +22,11 @@ public class AlchemyTableRecipeRegistry
registerRecipe(new AlchemyTableRecipe(outputStack, lpDrained, ticksRequired, tierRequired, objects));
}
public static void removeRecipe(AlchemyTableRecipe recipe)
{
recipeList.remove(recipe);
}
public static AlchemyTableRecipe getMatchingRecipe(List<ItemStack> itemList, World world, BlockPos pos)
{
for (AlchemyTableRecipe recipe : recipeList)

View file

@ -42,6 +42,11 @@ public class AltarRecipeRegistry
registerRecipe(new AltarRecipe(orbStack, orbStack, tier, maxForOrb, consumeRate, drainRate, true));
}
public static void removeRecipe(AltarRecipe altarRecipe)
{
recipes.remove(altarRecipe.getInput());
}
/**
* Gets the recipe that the provided input is registered to.
*

View file

@ -22,6 +22,11 @@ public class TartaricForgeRecipeRegistry
registerRecipe(new TartaricForgeRecipe(outputStack, minimulSouls, drain, objects));
}
public static void removeRecipe(TartaricForgeRecipe recipe)
{
recipeList.remove(recipe);
}
public static TartaricForgeRecipe getMatchingRecipe(List<ItemStack> itemList, World world, BlockPos pos)
{
for (TartaricForgeRecipe recipe : recipeList)