mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-06 23:22:10 -07:00
SPIGOT-7899: Smithing recipes don't require inputs
By: md_5 <git@md-5.net>
This commit is contained in:
@@ -3,6 +3,7 @@ package org.bukkit.inventory;
|
||||
import org.bukkit.Keyed;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Represents a smithing recipe.
|
||||
@@ -27,7 +28,7 @@ public class SmithingRecipe implements Recipe, Keyed {
|
||||
* added to the server.
|
||||
*/
|
||||
@Deprecated
|
||||
public SmithingRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result, @NotNull RecipeChoice base, @NotNull RecipeChoice addition) {
|
||||
public SmithingRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result, @Nullable RecipeChoice base, @Nullable RecipeChoice addition) {
|
||||
this.key = key;
|
||||
this.result = result;
|
||||
this.base = base;
|
||||
@@ -39,9 +40,9 @@ public class SmithingRecipe implements Recipe, Keyed {
|
||||
*
|
||||
* @return base choice
|
||||
*/
|
||||
@NotNull
|
||||
@Nullable
|
||||
public RecipeChoice getBase() {
|
||||
return base.clone();
|
||||
return (base != null) ? base.clone() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -49,9 +50,9 @@ public class SmithingRecipe implements Recipe, Keyed {
|
||||
*
|
||||
* @return addition choice
|
||||
*/
|
||||
@NotNull
|
||||
@Nullable
|
||||
public RecipeChoice getAddition() {
|
||||
return addition.clone();
|
||||
return (addition != null) ? addition.clone() : null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
@@ -2,6 +2,7 @@ package org.bukkit.inventory;
|
||||
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Represents a smithing transform recipe.
|
||||
@@ -19,7 +20,7 @@ public class SmithingTransformRecipe extends SmithingRecipe {
|
||||
* @param base The base ingredient
|
||||
* @param addition The addition ingredient
|
||||
*/
|
||||
public SmithingTransformRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result, @NotNull RecipeChoice template, @NotNull RecipeChoice base, @NotNull RecipeChoice addition) {
|
||||
public SmithingTransformRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result, @Nullable RecipeChoice template, @Nullable RecipeChoice base, @Nullable RecipeChoice addition) {
|
||||
super(key, result, base, addition);
|
||||
this.template = template;
|
||||
}
|
||||
@@ -29,8 +30,8 @@ public class SmithingTransformRecipe extends SmithingRecipe {
|
||||
*
|
||||
* @return template choice
|
||||
*/
|
||||
@NotNull
|
||||
@Nullable
|
||||
public RecipeChoice getTemplate() {
|
||||
return template.clone();
|
||||
return (template != null) ? template.clone() : null;
|
||||
}
|
||||
}
|
||||
|
@@ -3,6 +3,7 @@ package org.bukkit.inventory;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Represents a smithing trim recipe.
|
||||
@@ -19,7 +20,7 @@ public class SmithingTrimRecipe extends SmithingRecipe implements ComplexRecipe
|
||||
* @param base The base ingredient
|
||||
* @param addition The addition ingredient
|
||||
*/
|
||||
public SmithingTrimRecipe(@NotNull NamespacedKey key, @NotNull RecipeChoice template, @NotNull RecipeChoice base, @NotNull RecipeChoice addition) {
|
||||
public SmithingTrimRecipe(@NotNull NamespacedKey key, @Nullable RecipeChoice template, @Nullable RecipeChoice base, @Nullable RecipeChoice addition) {
|
||||
super(key, new ItemStack(Material.AIR), base, addition);
|
||||
this.template = template;
|
||||
}
|
||||
@@ -29,8 +30,8 @@ public class SmithingTrimRecipe extends SmithingRecipe implements ComplexRecipe
|
||||
*
|
||||
* @return template choice
|
||||
*/
|
||||
@NotNull
|
||||
@Nullable
|
||||
public RecipeChoice getTemplate() {
|
||||
return template.clone();
|
||||
return (template != null) ? template.clone() : null;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user