mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-20 07:34:48 +01:00
SPIGOT-5802: Add SmithingRecipe API
By: md_5 <git@md-5.net>
This commit is contained in:
parent
fbf78c9b5a
commit
996e9de16b
1 changed files with 63 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue