From 6b96e1a8e2b8c7f10b16662e8a291b9aef6edbf4 Mon Sep 17 00:00:00 2001 From: KennyTV Date: Mon, 6 Jul 2020 14:57:14 +0200 Subject: [PATCH] Fix 1.12->1.11 title json null Fixes #217 --- .../Protocol1_11_1To1_12.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_11_1to1_12/Protocol1_11_1To1_12.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_11_1to1_12/Protocol1_11_1To1_12.java index 6863ea52..c91f8885 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_11_1to1_12/Protocol1_11_1To1_12.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_11_1to1_12/Protocol1_11_1To1_12.java @@ -18,11 +18,15 @@ import nl.matsv.viabackwards.protocol.protocol1_11_1to1_12.packets.ChatPackets1_ import nl.matsv.viabackwards.protocol.protocol1_11_1to1_12.packets.EntityPackets1_12; import nl.matsv.viabackwards.protocol.protocol1_11_1to1_12.packets.SoundPackets1_12; import us.myles.ViaVersion.api.data.UserConnection; +import us.myles.ViaVersion.api.remapper.PacketRemapper; +import us.myles.ViaVersion.api.type.Type; import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.ClientboundPackets1_12; import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.ServerboundPackets1_12; import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3; import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3; import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; +import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9To1_8; +import us.myles.viaversion.libs.gson.JsonElement; public class Protocol1_11_1To1_12 extends BackwardsProtocol { @@ -40,6 +44,19 @@ public class Protocol1_11_1To1_12 extends BackwardsProtocol { + int action = wrapper.passthrough(Type.VAR_INT); + if (action >= 0 && action <= 2) { + JsonElement component = wrapper.read(Type.COMPONENT); + wrapper.write(Type.COMPONENT, Protocol1_9To1_8.fixJson(component.toString())); + } + }); + } + }); + cancelOutgoing(ClientboundPackets1_12.ADVANCEMENTS); cancelOutgoing(ClientboundPackets1_12.UNLOCK_RECIPES); cancelOutgoing(ClientboundPackets1_12.SELECT_ADVANCEMENTS_TAB);