3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-14 20:10:05 +01:00

Add back RecipeIterator fixes patch (#10887)

Dieser Commit ist enthalten in:
Aya 2024-06-15 20:49:08 +01:00 committet von Bjarne Koll
Ursprung c1aefeecc6
Commit d41636f445
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 27F6CCCF55D2EE62
28 geänderte Dateien mit 42 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -82,7 +82,7 @@ index ed1d3d30404dfc6303e746f31295b6b1aa40f204..8d7565eda4536e8aa42dd3dcbcfac38c
set.add(string);
} else {
diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
index b068a31c8052091840956e26ef6547a1a3595e4c..ac99aa7a275b7c2e91d51f952dbf0a1ce44e02d5 100644
index 3270bb6fe1c8b08411e6cad14d48cec886085ee7..407f3c1938b5b5d893b09705fe4930dbdafa3c8e 100644
--- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
@@ -79,7 +79,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener {

Datei anzeigen

@ -0,0 +1,41 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake <jake.m.potrebic@gmail.com>
Date: Sat, 15 Jun 2024 18:50:18 +0100
Subject: [PATCH] Fix removing recipes from RecipeIterator
== AT ==
public net.minecraft.world.item.crafting.RecipeManager byName
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java b/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java
index 78a2afa981407de793ac940d6eb7315c5cd53b8f..33cd12d55786356dc89ab9d3872b2f7d266c3de2 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java
@@ -9,6 +9,7 @@ import org.bukkit.inventory.Recipe;
public class RecipeIterator implements Iterator<Recipe> {
private final Iterator<Map.Entry<RecipeType<?>, RecipeHolder<?>>> recipes;
+ private Recipe currentRecipe; // Paper - fix removing recipes from RecipeIterator
public RecipeIterator() {
this.recipes = MinecraftServer.getServer().getRecipeManager().byType.entries().iterator();
@@ -21,11 +22,19 @@ public class RecipeIterator implements Iterator<Recipe> {
@Override
public Recipe next() {
- return this.recipes.next().getValue().toBukkitRecipe();
+ // Paper start - fix removing recipes from RecipeIterator
+ this.currentRecipe = this.recipes.next().getValue().toBukkitRecipe();
+ return this.currentRecipe;
+ // Paper end - fix removing recipes from RecipeIterator
}
@Override
public void remove() {
+ // Paper start - fix removing recipes from RecipeIterator
+ if (this.currentRecipe instanceof org.bukkit.Keyed keyed) {
+ MinecraftServer.getServer().getRecipeManager().byName.remove(org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(keyed.getKey()));
+ }
+ // Paper end - fix removing recipes from RecipeIterator
this.recipes.remove();
}
}