SPIGOT-7924: Registering a ShapelessRecipe throws an IndexOutOfBoundsException

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2024-10-24 06:53:07 +11:00
parent 1236b98371
commit 0821d18951

View file

@ -41,8 +41,8 @@ public class CraftShapelessRecipe extends ShapelessRecipe implements CraftRecipe
public void addToCraftingManager() {
List<org.bukkit.inventory.RecipeChoice> ingred = this.getChoiceList();
List<RecipeItemStack> data = new ArrayList<>(ingred.size());
for (int i = 0; i < ingred.size(); i++) {
data.set(i, toNMS(ingred.get(i), true));
for (org.bukkit.inventory.RecipeChoice i : ingred) {
data.add(toNMS(i, true));
}
MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftRecipe.toMinecraft(this.getKey()), new ShapelessRecipes(this.getGroup(), CraftRecipe.getCategory(this.getCategory()), CraftItemStack.asNMSCopy(this.getResult()), data)));