mirror of
https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
synced 2025-09-18 21:45:12 +00:00
SPIGOT-5802: Add SmithingRecipe API
This commit is contained in:
parent
32fcd349d4
commit
aec8ec33fc
1 changed files with 63 additions and 0 deletions
63
src/main/java/org/bukkit/inventory/SmithingRecipe.java
Normal file
63
src/main/java/org/bukkit/inventory/SmithingRecipe.java
Normal 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;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue