Update to Minecraft 1.19.3

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot
2022-12-08 03:13:00 +11:00
parent 6ea8b24628
commit 7a87d86241
30 changed files with 831 additions and 40 deletions

View File

@@ -0,0 +1,14 @@
package org.bukkit.inventory;
import org.bukkit.block.ChiseledBookshelf;
import org.jetbrains.annotations.Nullable;
/**
* Interface to the inventory of a chiseled bookshelf.
*/
public interface ChiseledBookshelfInventory extends Inventory {
@Nullable
@Override
public ChiseledBookshelf getHolder();
}

View File

@@ -5,6 +5,7 @@ import java.util.Collections;
import org.bukkit.Keyed;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.inventory.recipe.CookingBookCategory;
import org.jetbrains.annotations.NotNull;
/**
@@ -18,6 +19,7 @@ public abstract class CookingRecipe<T extends CookingRecipe> implements Recipe,
private float experience;
private int cookingTime;
private String group = "";
private CookingBookCategory category = CookingBookCategory.MISC;
/**
* Create a cooking recipe to craft the specified ItemStack.
@@ -167,7 +169,31 @@ public abstract class CookingRecipe<T extends CookingRecipe> implements Recipe,
* null.
*/
public void setGroup(@NotNull String group) {
Preconditions.checkArgument(group != null, "group");
Preconditions.checkArgument(group != null, "group cannot be null");
this.group = group;
}
/**
* Gets the category which this recipe will appear in the recipe book under.
*
* Defaults to {@link CookingBookCategory#MISC} if not set.
*
* @return recipe book category
*/
@NotNull
public CookingBookCategory getCategory() {
return category;
}
/**
* Sets the category which this recipe will appear in the recipe book under.
*
* Defaults to {@link CookingBookCategory#MISC} if not set.
*
* @param category recipe book category
*/
public void setCategory(@NotNull CookingBookCategory category) {
Preconditions.checkArgument(category != null, "category cannot be null");
this.category = category;
}
}

View File

@@ -7,6 +7,7 @@ import java.util.Map;
import org.bukkit.Keyed;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.inventory.recipe.CraftingBookCategory;
import org.bukkit.material.MaterialData;
import org.jetbrains.annotations.NotNull;
@@ -19,6 +20,7 @@ public class ShapedRecipe implements Recipe, Keyed {
private String[] rows;
private Map<Character, RecipeChoice> ingredients = new HashMap<>();
private String group = "";
private CraftingBookCategory category = CraftingBookCategory.MISC;
@Deprecated
public ShapedRecipe(@NotNull ItemStack result) {
@@ -221,7 +223,31 @@ public class ShapedRecipe implements Recipe, Keyed {
* null.
*/
public void setGroup(@NotNull String group) {
Preconditions.checkArgument(group != null, "group");
Preconditions.checkArgument(group != null, "group cannot be null");
this.group = group;
}
/**
* Gets the category which this recipe will appear in the recipe book under.
*
* Defaults to {@link CraftingBookCategory#MISC} if not set.
*
* @return recipe book category
*/
@NotNull
public CraftingBookCategory getCategory() {
return category;
}
/**
* Sets the category which this recipe will appear in the recipe book under.
*
* Defaults to {@link CraftingBookCategory#MISC} if not set.
*
* @param category recipe book category
*/
public void setCategory(@NotNull CraftingBookCategory category) {
Preconditions.checkArgument(category != null, "category cannot be null");
this.category = category;
}
}

View File

@@ -8,6 +8,7 @@ import java.util.List;
import org.bukkit.Keyed;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.inventory.recipe.CraftingBookCategory;
import org.bukkit.material.MaterialData;
import org.jetbrains.annotations.NotNull;
@@ -20,6 +21,7 @@ public class ShapelessRecipe implements Recipe, Keyed {
private final ItemStack output;
private final List<RecipeChoice> ingredients = new ArrayList<>();
private String group = "";
private CraftingBookCategory category = CraftingBookCategory.MISC;
@Deprecated
public ShapelessRecipe(@NotNull ItemStack result) {
@@ -308,7 +310,31 @@ public class ShapelessRecipe implements Recipe, Keyed {
* null.
*/
public void setGroup(@NotNull String group) {
Preconditions.checkArgument(group != null, "group");
Preconditions.checkArgument(group != null, "group cannot be null");
this.group = group;
}
/**
* Gets the category which this recipe will appear in the recipe book under.
*
* Defaults to {@link CraftingBookCategory#MISC} if not set.
*
* @return recipe book category
*/
@NotNull
public CraftingBookCategory getCategory() {
return category;
}
/**
* Sets the category which this recipe will appear in the recipe book under.
*
* Defaults to {@link CraftingBookCategory#MISC} if not set.
*
* @param category recipe book category
*/
public void setCategory(@NotNull CraftingBookCategory category) {
Preconditions.checkArgument(category != null, "category cannot be null");
this.category = category;
}
}

View File

@@ -121,7 +121,7 @@ public class StonecuttingRecipe implements Recipe, Keyed {
* null.
*/
public void setGroup(@NotNull String group) {
Preconditions.checkArgument(group != null, "group");
Preconditions.checkArgument(group != null, "group cannot be null");
this.group = group;
}
}

View File

@@ -0,0 +1,11 @@
package org.bukkit.inventory.recipe;
/**
* Represents categories within the cooking recipe book.
*/
public enum CookingBookCategory {
FOOD,
BLOCKS,
MISC;
}

View File

@@ -0,0 +1,12 @@
package org.bukkit.inventory.recipe;
/**
* Represents categories within the crafting recipe book.
*/
public enum CraftingBookCategory {
BUILDING,
REDSTONE,
EQUIPMENT,
MISC;
}

View File

@@ -0,0 +1,4 @@
/**
* New location for recipe-related classes.
*/
package org.bukkit.inventory.recipe;