Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-26 16:12:46 +01:00
Ursprung
3108ea726c
Commit
05d74ebd3e
@ -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.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundSignUpdatePacket;
|
||||||
import com.nukkitx.nbt.NbtMap;
|
import com.nukkitx.nbt.NbtMap;
|
||||||
import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket;
|
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.session.GeyserSession;
|
||||||
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
||||||
import org.geysermc.geyser.translator.protocol.Translator;
|
import org.geysermc.geyser.translator.protocol.Translator;
|
||||||
@ -40,6 +41,7 @@ public class BedrockBlockEntityDataTranslator extends PacketTranslator<BlockEnti
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(GeyserSession session, BlockEntityDataPacket packet) {
|
public void translate(GeyserSession session, BlockEntityDataPacket packet) {
|
||||||
|
System.out.println(packet);
|
||||||
NbtMap tag = packet.getData();
|
NbtMap tag = packet.getData();
|
||||||
String id = tag.getString("id");
|
String id = tag.getString("id");
|
||||||
if (id.equals("Sign")) {
|
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
|
// 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
|
// 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
|
// 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);
|
session.setLastSignMessage(text);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren