mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 03:22:19 +01:00
SPIGOT-4283: Allow setting recipe groups
By: md_5 <git@md-5.net>
This commit is contained in:
parent
ad31113b3e
commit
9d24d601e2
3 changed files with 70 additions and 0 deletions
|
@ -15,6 +15,7 @@ public class FurnaceRecipe implements Recipe, Keyed {
|
|||
private ItemStack ingredient;
|
||||
private float experience;
|
||||
private int cookingTime;
|
||||
private String group = "";
|
||||
|
||||
@Deprecated
|
||||
public FurnaceRecipe(ItemStack result, Material source) {
|
||||
|
@ -152,4 +153,26 @@ public class FurnaceRecipe implements Recipe, Keyed {
|
|||
public NamespacedKey getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the group of this recipe. Recipes with the same group may be grouped
|
||||
* together when displayed in the client.
|
||||
*
|
||||
* @return recipe group. An empty string denotes no group. May not be null.
|
||||
*/
|
||||
public String getGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the group of this recipe. Recipes with the same group may be grouped
|
||||
* together when displayed in the client.
|
||||
*
|
||||
* @param group recipe group. An empty string denotes no group. May not be
|
||||
* null.
|
||||
*/
|
||||
public void setGroup(String group) {
|
||||
Preconditions.checkArgument(group != null, "group");
|
||||
this.group = group;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ public class ShapedRecipe implements Recipe, Keyed {
|
|||
private final ItemStack output;
|
||||
private String[] rows;
|
||||
private Map<Character, ItemStack> ingredients = new HashMap<Character, ItemStack>();
|
||||
private String group = "";
|
||||
|
||||
@Deprecated
|
||||
public ShapedRecipe(ItemStack result) {
|
||||
|
@ -168,4 +169,26 @@ public class ShapedRecipe implements Recipe, Keyed {
|
|||
public NamespacedKey getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the group of this recipe. Recipes with the same group may be grouped
|
||||
* together when displayed in the client.
|
||||
*
|
||||
* @return recipe group. An empty string denotes no group. May not be null.
|
||||
*/
|
||||
public String getGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the group of this recipe. Recipes with the same group may be grouped
|
||||
* together when displayed in the client.
|
||||
*
|
||||
* @param group recipe group. An empty string denotes no group. May not be
|
||||
* null.
|
||||
*/
|
||||
public void setGroup(String group) {
|
||||
Preconditions.checkArgument(group != null, "group");
|
||||
this.group = group;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.bukkit.inventory;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
@ -19,6 +20,7 @@ public class ShapelessRecipe implements Recipe, Keyed {
|
|||
private final NamespacedKey key;
|
||||
private final ItemStack output;
|
||||
private final List<ItemStack> ingredients = new ArrayList<ItemStack>();
|
||||
private String group = "";
|
||||
|
||||
@Deprecated
|
||||
public ShapelessRecipe(ItemStack result) {
|
||||
|
@ -239,4 +241,26 @@ public class ShapelessRecipe implements Recipe, Keyed {
|
|||
public NamespacedKey getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the group of this recipe. Recipes with the same group may be grouped
|
||||
* together when displayed in the client.
|
||||
*
|
||||
* @return recipe group. An empty string denotes no group. May not be null.
|
||||
*/
|
||||
public String getGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the group of this recipe. Recipes with the same group may be grouped
|
||||
* together when displayed in the client.
|
||||
*
|
||||
* @param group recipe group. An empty string denotes no group. May not be
|
||||
* null.
|
||||
*/
|
||||
public void setGroup(String group) {
|
||||
Preconditions.checkArgument(group != null, "group");
|
||||
this.group = group;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue