From c57b238b86033f1991fdb956dc0b91424387b336 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Tue, 8 Oct 2024 17:43:23 +0200 Subject: [PATCH] Recipes mostly work now --- .../rewriter/BlockItemPacketRewriter1_21_2.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/rewriter/BlockItemPacketRewriter1_21_2.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/rewriter/BlockItemPacketRewriter1_21_2.java index 64be2e24..92131188 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/rewriter/BlockItemPacketRewriter1_21_2.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/rewriter/BlockItemPacketRewriter1_21_2.java @@ -37,6 +37,7 @@ import com.viaversion.viaversion.protocols.v1_21to1_21_2.packet.ClientboundPacke import com.viaversion.viaversion.protocols.v1_21to1_21_2.packet.ClientboundPackets1_21_2; import com.viaversion.viaversion.rewriter.BlockRewriter; import com.viaversion.viaversion.rewriter.SoundRewriter; +import com.viaversion.viaversion.util.Key; import static com.viaversion.viaversion.protocols.v1_21to1_21_2.rewriter.BlockItemPacketRewriter1_21_2.downgradeItemData; import static com.viaversion.viaversion.protocols.v1_21to1_21_2.rewriter.BlockItemPacketRewriter1_21_2.updateItemData; @@ -224,15 +225,17 @@ public final class BlockItemPacketRewriter1_21_2 extends BackwardsStructuredItem }); protocol.registerClientbound(ClientboundPackets1_21_2.PLACE_GHOST_RECIPE, wrapper -> { this.updateContainerId(wrapper); - wrapper.cancel(); // TODO + wrapper.cancel(); // Full recipe display, this doesn't look mappable }); protocol.registerServerbound(ServerboundPackets1_20_5.PLACE_RECIPE, wrapper -> { this.updateContainerIdServerbound(wrapper); - wrapper.cancel(); // TODO + + final String recipe = Key.stripMinecraftNamespace(wrapper.read(Types.STRING)); + wrapper.write(Types.VAR_INT, Integer.parseInt(recipe)); }); protocol.registerServerbound(ServerboundPackets1_20_5.RECIPE_BOOK_SEEN_RECIPE, wrapper -> { - this.updateContainerIdServerbound(wrapper); - wrapper.cancel(); // TODO + final String recipe = Key.stripMinecraftNamespace(wrapper.read(Types.STRING)); + wrapper.write(Types.VAR_INT, Integer.parseInt(recipe)); }); }