3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-07-30 09:08:09 +02:00

Fix signs for Bedrock 1.18.30

Fixes #2944
Dieser Commit ist enthalten in:
Camotoy 2022-04-21 22:23:00 -04:00
Ursprung 3108ea726c
Commit 05d74ebd3e
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F

Datei anzeigen

@ -30,6 +30,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.Ser
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundSignUpdatePacket;
import com.nukkitx.nbt.NbtMap;
import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket;
import com.nukkitx.protocol.bedrock.v503.Bedrock_v503;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.translator.protocol.PacketTranslator;
import org.geysermc.geyser.translator.protocol.Translator;
@ -40,6 +41,7 @@ public class BedrockBlockEntityDataTranslator extends PacketTranslator<BlockEnti
@Override
public void translate(GeyserSession session, BlockEntityDataPacket packet) {
System.out.println(packet);
NbtMap tag = packet.getData();
String id = tag.getString("id");
if (id.equals("Sign")) {
@ -47,7 +49,9 @@ public class BedrockBlockEntityDataTranslator extends PacketTranslator<BlockEnti
// This is the reason why this all works - Bedrock sends packets every time you update the sign, Java only wants the final packet
// But Bedrock sends one final packet when you're done editing the sign, which should be equal to the last message since there's no edits
// So if the latest update does not match the last cached update then it's still being edited
if (!text.equals(session.getLastSignMessage())) {
// TODO check 1.19:
// Bedrock only sends one packet as of 1.18.30. I (Camotoy) am suspicious this is a bug, but if it's permanent then we don't need the lastSignMessage variable.
if (session.getUpstream().getProtocolVersion() < Bedrock_v503.V503_CODEC.getProtocolVersion() && !text.equals(session.getLastSignMessage())) {
session.setLastSignMessage(text);
return;
}