From 66ae88a2f6952980310f2e2151c7acb955fa3f9f Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 21 Apr 2023 12:56:30 -0400 Subject: [PATCH] Signs work in 1.19.80 --- .../geysermc/geyser/network/GameProtocol.java | 4 ++ .../BedrockBlockEntityDataTranslator.java | 10 +++- .../level/JavaOpenSignEditorTranslator.java | 47 +++++++++++++++++++ 3 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaOpenSignEditorTranslator.java diff --git a/core/src/main/java/org/geysermc/geyser/network/GameProtocol.java b/core/src/main/java/org/geysermc/geyser/network/GameProtocol.java index c19860f49..93251f5fd 100644 --- a/core/src/main/java/org/geysermc/geyser/network/GameProtocol.java +++ b/core/src/main/java/org/geysermc/geyser/network/GameProtocol.java @@ -100,6 +100,10 @@ public final class GameProtocol { return session.getUpstream().getProtocolVersion() >= Bedrock_v567.CODEC.getProtocolVersion(); } + public static boolean supports1_19_80(GeyserSession session) { + return session.getUpstream().getProtocolVersion() >= Bedrock_v582.CODEC.getProtocolVersion(); + } + /** * Gets the {@link PacketCodec} for Minecraft: Java Edition. * diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockEntityDataTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockEntityDataTranslator.java index 61d40c930..145cea805 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockEntityDataTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockEntityDataTranslator.java @@ -30,6 +30,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.Serverb import org.cloudburstmc.math.vector.Vector3i; import org.cloudburstmc.nbt.NbtMap; import org.cloudburstmc.protocol.bedrock.packet.BlockEntityDataPacket; +import org.geysermc.geyser.network.GameProtocol; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -43,7 +44,14 @@ public class BedrockBlockEntityDataTranslator extends PacketTranslator { + + @Override + public void translate(GeyserSession session, ClientboundOpenSignEditorPacket packet) { + if (GameProtocol.supports1_19_80(session)) { + OpenSignPacket openSignPacket = new OpenSignPacket(); + openSignPacket.setPosition(packet.getPosition()); + openSignPacket.setFrontSide(true); // Will be remedied in 1.20 + session.sendUpstreamPacket(openSignPacket); + } + } +}