From d0d01714aa9cbdf8e186d80359709c3d72643532 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Wed, 9 Mar 2022 23:09:48 -0500 Subject: [PATCH] Remove unlockedRecipes storage This has been unused, and for the time being we aren't going the packet route that would use these. --- .../geyser/session/GeyserSession.java | 2 - .../protocol/java/JavaRecipeTranslator.java | 53 ------------------- .../java/JavaUpdateRecipesTranslator.java | 1 - 3 files changed, 56 deletions(-) delete mode 100644 core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaRecipeTranslator.java diff --git a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java index 6452803b5..fe63b0b0c 100644 --- a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java +++ b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java @@ -349,7 +349,6 @@ public class GeyserSession implements GeyserConnection, CommandSender { @Setter private Int2ObjectMap craftingRecipes; - private final Set unlockedRecipes; private final AtomicInteger lastRecipeNetId; /** @@ -527,7 +526,6 @@ public class GeyserSession implements GeyserConnection, CommandSender { this.playerInventory = new PlayerInventory(); this.openInventory = null; this.craftingRecipes = new Int2ObjectOpenHashMap<>(); - this.unlockedRecipes = new ObjectOpenHashSet<>(); this.lastRecipeNetId = new AtomicInteger(1); this.spawned = false; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaRecipeTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaRecipeTranslator.java deleted file mode 100644 index da35da60e..000000000 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaRecipeTranslator.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2019-2022 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/Geyser - */ - -package org.geysermc.geyser.translator.protocol.java; - -import com.github.steveice10.mc.protocol.data.game.UnlockRecipesAction; -import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundRecipePacket; -import org.geysermc.geyser.session.GeyserSession; -import org.geysermc.geyser.translator.protocol.PacketTranslator; -import org.geysermc.geyser.translator.protocol.Translator; - -import java.util.Collections; - -/** - * Used to list recipes that we can definitely use the recipe book for (and therefore save on packet usage) - */ -@Translator(packet = ClientboundRecipePacket.class) -public class JavaRecipeTranslator extends PacketTranslator { - - @Override - public void translate(GeyserSession session, ClientboundRecipePacket packet) { - if (packet.getAction() == UnlockRecipesAction.REMOVE) { - for (String identifier : packet.getRecipes()) { - session.getUnlockedRecipes().remove(identifier); - } - } else { - Collections.addAll(session.getUnlockedRecipes(), packet.getRecipes()); - } - } -} - diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaUpdateRecipesTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaUpdateRecipesTranslator.java index 4d7a1617a..722ce988e 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaUpdateRecipesTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaUpdateRecipesTranslator.java @@ -201,7 +201,6 @@ public class JavaUpdateRecipesTranslator extends PacketTranslator