Skip to content

Commit

Permalink
Fix recipe removal
Browse files Browse the repository at this point in the history
  • Loading branch information
kennytv committed Nov 26, 2024
1 parent 5347820 commit fb328d4
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public final class RecipeStorage implements StorableObject {
// Pairs of open + filtering for: Crafting, furnace, blast furnace, smoker
public static final int RECIPE_BOOK_SETTINGS = 4 * 2;
private static final String[] EMPTY_STRINGS = new String[0];
private final List<Recipe> recipes = new ArrayList<>();
private final List<Recipe> tempRecipes = 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<>(); // Recipes received in the current batch
private final List<StoneCutterRecipe> stoneCutterRecipes = new ArrayList<>();
private boolean[] recipeBookSettings = new boolean[RECIPE_BOOK_SETTINGS];
private final Protocol1_21_2To1_21 protocol;
Expand All @@ -58,7 +58,6 @@ abstract static class Recipe {
private Integer group;
private int category;
private boolean highlight;
private boolean locked;

abstract void write(PacketWrapper wrapper);

Expand Down Expand Up @@ -142,7 +141,7 @@ private static String identifier(final int recipeIndex) {

public void lockRecipes(final PacketWrapper wrapper, final int[] 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
Expand Down

0 comments on commit fb328d4

Please sign in to comment.