2015-11-02 20:39:44 +00:00
|
|
|
package WayofTime.bloodmagic.api.registry;
|
2015-10-30 03:22:14 +00:00
|
|
|
|
2015-11-02 20:39:44 +00:00
|
|
|
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
|
|
|
import WayofTime.bloodmagic.api.altar.AltarRecipe;
|
2015-10-30 03:22:14 +00:00
|
|
|
import com.google.common.collect.BiMap;
|
|
|
|
import com.google.common.collect.HashBiMap;
|
|
|
|
import lombok.Getter;
|
2015-11-28 01:15:19 +00:00
|
|
|
import net.minecraft.item.ItemStack;
|
2015-10-30 03:22:14 +00:00
|
|
|
|
|
|
|
public class AltarRecipeRegistry {
|
|
|
|
|
|
|
|
@Getter
|
2015-11-28 01:15:19 +00:00
|
|
|
private static BiMap<ItemStack, AltarRecipe> recipes = HashBiMap.create();
|
2015-10-30 03:22:14 +00:00
|
|
|
|
|
|
|
public static void registerRecipe(AltarRecipe recipe) {
|
|
|
|
if (!recipes.containsValue(recipe))
|
|
|
|
recipes.put(recipe.input, recipe);
|
|
|
|
else
|
2015-11-02 20:39:44 +00:00
|
|
|
BloodMagicAPI.getLogger().error("Error adding recipe for " + recipe.input.getDisplayName() + (recipe.output == null ? "" : " -> " + recipe.output.getDisplayName()) + ". Recipe already exists.");
|
2015-10-30 03:22:14 +00:00
|
|
|
}
|
|
|
|
|
2015-11-28 01:15:19 +00:00
|
|
|
public static AltarRecipe getRecipeForInput(ItemStack input) {
|
2015-11-03 18:00:40 +00:00
|
|
|
return recipes.get(input);
|
2015-10-30 03:22:14 +00:00
|
|
|
}
|
|
|
|
}
|