3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-26 00:00:33 +01:00

Fix recipe removal

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-11-26 18:16:12 +01:00
Ursprung 5347820c28
Commit fb328d4753
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F

Datei anzeigen

@ -40,8 +40,8 @@ public final class RecipeStorage implements StorableObject {
// Pairs of open + filtering for: Crafting, furnace, blast furnace, smoker // Pairs of open + filtering for: Crafting, furnace, blast furnace, smoker
public static final int RECIPE_BOOK_SETTINGS = 4 * 2; public static final int RECIPE_BOOK_SETTINGS = 4 * 2;
private static final String[] EMPTY_STRINGS = new String[0]; private static final String[] EMPTY_STRINGS = new String[0];
private final List<Recipe> recipes = new ArrayList<>(); private final List<Recipe> recipes = new ArrayList<>(); // Recipes, excluding stone cutter recipes, in the order they were received
private final List<Recipe> tempRecipes = new ArrayList<>(); private final List<Recipe> tempRecipes = new ArrayList<>(); // Recipes received in the current batch
private final List<StoneCutterRecipe> stoneCutterRecipes = new ArrayList<>(); private final List<StoneCutterRecipe> stoneCutterRecipes = new ArrayList<>();
private boolean[] recipeBookSettings = new boolean[RECIPE_BOOK_SETTINGS]; private boolean[] recipeBookSettings = new boolean[RECIPE_BOOK_SETTINGS];
private final Protocol1_21_2To1_21 protocol; private final Protocol1_21_2To1_21 protocol;
@ -58,7 +58,6 @@ public final class RecipeStorage implements StorableObject {
private Integer group; private Integer group;
private int category; private int category;
private boolean highlight; private boolean highlight;
private boolean locked;
abstract void write(PacketWrapper wrapper); abstract void write(PacketWrapper wrapper);
@ -142,7 +141,7 @@ public final class RecipeStorage implements StorableObject {
public void lockRecipes(final PacketWrapper wrapper, final int[] ids) { public void lockRecipes(final PacketWrapper wrapper, final int[] ids) {
for (final int id : ids) { for (final int id : ids) {
recipes.get(id).locked = true; recipes.removeIf(recipe -> recipe.index == id);
} }
wrapper.write(Types.VAR_INT, 2); // Remove recipes wrapper.write(Types.VAR_INT, 2); // Remove recipes