SPIGOT-5802: Add SmithingRecipe API

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot 2020-06-25 12:41:13 +10:00
parent fbf78c9b5a
commit 996e9de16b

View file

@ -0,0 +1,63 @@
package org.bukkit.inventory;
import org.bukkit.Keyed;
import org.bukkit.NamespacedKey;
import org.jetbrains.annotations.NotNull;
/**
* Represents a smithing recipe.
*/
public class SmithingRecipe implements Recipe, Keyed {
private final NamespacedKey key;
private final ItemStack result;
private final RecipeChoice base;
private final RecipeChoice addition;
/**
* Create a smithing recipe to produce the specified result ItemStack.
*
* @param key The unique recipe key
* @param result The item you want the recipe to create.
* @param base The base ingredient
* @param addition The addition ingredient
*/
public SmithingRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result, @NotNull RecipeChoice base, @NotNull RecipeChoice addition) {
this.key = key;
this.result = result;
this.base = base;
this.addition = addition;
}
/**
* Get the base recipe item.
*
* @return base choice
*/
@NotNull
public RecipeChoice getBase() {
return base.clone();
}
/**
* Get the addition recipe item.
*
* @return addition choice
*/
@NotNull
public RecipeChoice getAddition() {
return addition.clone();
}
@NotNull
@Override
public ItemStack getResult() {
return result.clone();
}
@NotNull
@Override
public NamespacedKey getKey() {
return this.key;
}
}