From 5284a581b3f46da9da3d95b7b1e7a1f1a9e7370e Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Wed, 8 Nov 2023 11:55:03 +1000 Subject: [PATCH] Handle new 1.20.2 map markers --- .../BlockItemPacketRewriter1_20_2.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20to1_20_2/rewriter/BlockItemPacketRewriter1_20_2.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20to1_20_2/rewriter/BlockItemPacketRewriter1_20_2.java index 3734693f..8a26b967 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20to1_20_2/rewriter/BlockItemPacketRewriter1_20_2.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20to1_20_2/rewriter/BlockItemPacketRewriter1_20_2.java @@ -75,6 +75,25 @@ public final class BlockItemPacketRewriter1_20_2 extends ItemRewriter { + wrapper.passthrough(Type.VAR_INT); // Map id + wrapper.passthrough(Type.BYTE); // Scale + wrapper.passthrough(Type.BOOLEAN); // Locked + if (wrapper.passthrough(Type.BOOLEAN)) { + final int icons = wrapper.passthrough(Type.VAR_INT); + for (int i = 0; i < icons; i++) { + // Map new marker types to red marker + final byte markerType = wrapper.read(Type.BYTE); + wrapper.write(Type.BYTE, markerType < 27 ? markerType : 2); + + wrapper.passthrough(Type.BYTE); // X + wrapper.passthrough(Type.BYTE); // Y + wrapper.passthrough(Type.BYTE); // Rotation + wrapper.passthrough(Type.OPTIONAL_COMPONENT); // Display name + } + } + }); + protocol.registerClientbound(ClientboundPackets1_20_2.NBT_QUERY, wrapper -> { wrapper.passthrough(Type.VAR_INT); // Transaction id wrapper.write(Type.NAMED_COMPOUND_TAG, wrapper.read(Type.COMPOUND_TAG));