// Path: src/main/java/com/gmail/jannyboy11/customrecipes/api/crafting/CraftingIngredient.java
// @FunctionalInterface
// public interface CraftingIngredient extends Predicate<ItemStack>, ConfigurationSerializable {
// 	
// 	/**
// 	 * Tests whether an ItemStack matches as an ingredient for the associated crafting recipe.
// 	 * 
// 	 * @param itemStack the ItemSack to test
// 	 * @return whether the ItemStack is an ingredient
// 	 */
// 	public boolean isIngredient(ItemStack itemStack);
// 	
// 	/**
// 	 * Convenience method to make CraftingIngredient fit in functions that take a Predicate<ItemStack>.
// 	 * The default implementation delegates to {@link CraftingIngredient#isIngredient}.
// 	 */
// 	public default boolean test(ItemStack itemStack) {
// 		return isIngredient(itemStack);
// 	}
// 	
// 	/**
// 	 * Serialize method for ConfigurationSerializable interface.
// 	 * The default implementation returns an empty map.
// 	 */
// 	public default Map<String, Object> serialize() {
// 		return Collections.emptyMap();
// 	}
// 
// }
// 
// Path: src/main/java/com/gmail/jannyboy11/customrecipes/api/SerializableKey.java
// public class SerializableKey implements ConfigurationSerializable, Keyed {
//     
//     protected final NamespacedKey key;
//     
//     public SerializableKey(String namespace, String key) {
//         this(new NamespacedKey(namespace, key));
//     }
//     
//     public SerializableKey(NamespacedKey namespacedKey) {
//         this.key = Objects.requireNonNull(namespacedKey);
//     }
// 
//     @Override
//     public Map<String, Object> serialize() {
//         Map<String, Object> map = new HashMap<>();
//         map.put("namespace", key.getNamespace());
//         map.put("key", key.getKey());
//         return map;
//     }
//     
//     public static SerializableKey deserialize(Map<String, Object> map) {
//         String namespace = String.valueOf(map.get("namespace"));
//         String key = String.valueOf(map.get("key"));
//         return new SerializableKey(namespace, key);
//     }
//     
//     @Override
//     public NamespacedKey getKey() {
//         return key;
//     }
// 
// }


import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.bukkit.NamespacedKey;
import org.bukkit.inventory.ItemStack;
import com.gmail.jannyboy11.customrecipes.api.crafting.CraftingIngredient;
import com.gmail.jannyboy11.customrecipes.api.SerializableKey;
package com.gmail.jannyboy11.customrecipes.api.furnace;




/**
 * Represents a simple unregistered furnace recipe POJO.
 * 
 * @author Jan
 */
public final class SimpleFurnaceRecipe implements FurnaceRecipe {
	
    private final NamespacedKey key;
	private CraftingIngredient ingredient;
	private ItemStack result;
	private float xp;
	
	public SimpleFurnaceRecipe(NamespacedKey key, CraftingIngredient ingredient, ItemStack result) {
        this.key = Objects.requireNonNull(key, "key cannot be null.");
        this.ingredient = Objects.requireNonNull(ingredient, "ingredient cannot be null.");
        this.result = Objects.requireNonNull(result, "result cannot be null.");
    }
	
	public SimpleFurnaceRecipe(NamespacedKey key, CraftingIngredient ingredient, ItemStack result, float xp) {
	    this(key, ingredient, result);
	    this.xp = xp;
	}
	
	public SimpleFurnaceRecipe(Map<String, Object> map) {
	    this.key = ((SerializableKey) map.get("key")).getKey();
		this.ingredient = (CraftingIngredient) map.get("ingredient");
		this.result = (ItemStack) map.get("result");
		if (map.containsKey("xp")) xp = Float.valueOf(map.get("xp").toString());
	}
	
    @Override
    public Map<String, Object> serialize() {
        Map<String, Object> map = new HashMap<>();
        map.put("key", new SerializableKey(key));
        map.put("ingredient", ingredient);
        map.put("result", result);
// Path: src/main/java/com/gmail/jannyboy11/customrecipes/api/crafting/CraftingIngredient.java
// @FunctionalInterface
// public interface CraftingIngredient extends Predicate<ItemStack>, ConfigurationSerializable {
// 	
// 	/**
// 	 * Tests whether an ItemStack matches as an ingredient for the associated crafting recipe.
// 	 * 
// 	 * @param itemStack the ItemSack to test
// 	 * @return whether the ItemStack is an ingredient
// 	 */
// 	public boolean isIngredient(ItemStack itemStack);
// 	
// 	/**
// 	 * Convenience method to make CraftingIngredient fit in functions that take a Predicate<ItemStack>.
// 	 * The default implementation delegates to {@link CraftingIngredient#isIngredient}.
// 	 */
// 	public default boolean test(ItemStack itemStack) {
// 		return isIngredient(itemStack);
// 	}
// 	
// 	/**
// 	 * Serialize method for ConfigurationSerializable interface.
// 	 * The default implementation returns an empty map.
// 	 */
// 	public default Map<String, Object> serialize() {
// 		return Collections.emptyMap();
// 	}
// 
// }
// 
// Path: src/main/java/com/gmail/jannyboy11/customrecipes/api/SerializableKey.java
// public class SerializableKey implements ConfigurationSerializable, Keyed {
//     
//     protected final NamespacedKey key;
//     
//     public SerializableKey(String namespace, String key) {
//         this(new NamespacedKey(namespace, key));
//     }
//     
//     public SerializableKey(NamespacedKey namespacedKey) {
//         this.key = Objects.requireNonNull(namespacedKey);
//     }
// 
//     @Override
//     public Map<String, Object> serialize() {
//         Map<String, Object> map = new HashMap<>();
//         map.put("namespace", key.getNamespace());
//         map.put("key", key.getKey());
//         return map;
//     }
//     
//     public static SerializableKey deserialize(Map<String, Object> map) {
//         String namespace = String.valueOf(map.get("namespace"));
//         String key = String.valueOf(map.get("key"));
//         return new SerializableKey(namespace, key);
//     }
//     
//     @Override
//     public NamespacedKey getKey() {
//         return key;
//     }
// 
// }


// Path: src/main/java/com/gmail/jannyboy11/customrecipes/api/furnace/SimpleFurnaceRecipe.java
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.bukkit.NamespacedKey;
import org.bukkit.inventory.ItemStack;
import com.gmail.jannyboy11.customrecipes.api.crafting.CraftingIngredient;
import com.gmail.jannyboy11.customrecipes.api.SerializableKey;

package com.gmail.jannyboy11.customrecipes.api.furnace;




/**
 * Represents a simple unregistered furnace recipe POJO.
 * 
 * @author Jan
 */
public final class SimpleFurnaceRecipe implements FurnaceRecipe {
	
    private final NamespacedKey key;
	private CraftingIngredient ingredient;
	private ItemStack result;
	private float xp;
	
	public SimpleFurnaceRecipe(NamespacedKey key, CraftingIngredient ingredient, ItemStack result) {
        this.key = Objects.requireNonNull(key, "key cannot be null.");
        this.ingredient = Objects.requireNonNull(ingredient, "ingredient cannot be null.");
        this.result = Objects.requireNonNull(result, "result cannot be null.");
    }
	
	public SimpleFurnaceRecipe(NamespacedKey key, CraftingIngredient ingredient, ItemStack result, float xp) {
	    this(key, ingredient, result);
	    this.xp = xp;
	}
	
	public SimpleFurnaceRecipe(Map<String, Object> map) {
	    this.key = ((SerializableKey) map.get("key")).getKey();
		this.ingredient = (CraftingIngredient) map.get("ingredient");
		this.result = (ItemStack) map.get("result");
		if (map.containsKey("xp")) xp = Float.valueOf(map.get("xp").toString());
	}
	
    @Override
    public Map<String, Object> serialize() {
        Map<String, Object> map = new HashMap<>();
        map.put("key", new SerializableKey(key));
        map.put("ingredient", ingredient);
        map.put("result", result);
        if (xp > 0F) map.put("xp", xp);