3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-20 06:50:09 +01:00

send system chat overlay and actionbar as jukebox_popup messages (#3941)

* send actionbar and systemchat overlay messages as jukebox text to avoid clashes with armor/air UI

* add explaining comment
Dieser Commit ist enthalten in:
chris 2023-07-30 01:51:16 +02:00 committet von GitHub
Ursprung 3949fb1988
Commit d147ee37dc
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 11 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -52,7 +52,7 @@ public class JavaSystemChatTranslator extends PacketTranslator<ClientboundSystem
textPacket.setPlatformChatId(""); textPacket.setPlatformChatId("");
textPacket.setSourceName(""); textPacket.setSourceName("");
textPacket.setXuid(session.getAuthData().xuid()); textPacket.setXuid(session.getAuthData().xuid());
textPacket.setType(packet.isOverlay() ? TextPacket.Type.TIP : TextPacket.Type.SYSTEM); textPacket.setType(packet.isOverlay() ? TextPacket.Type.JUKEBOX_POPUP : TextPacket.Type.SYSTEM);
textPacket.setNeedsTranslation(false); textPacket.setNeedsTranslation(false);
textPacket.setMessage(MessageTranslator.convertMessage(packet.getContent(), session.locale())); textPacket.setMessage(MessageTranslator.convertMessage(packet.getContent(), session.locale()));

Datei anzeigen

@ -26,7 +26,7 @@
package org.geysermc.geyser.translator.protocol.java.title; package org.geysermc.geyser.translator.protocol.java.title;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.title.ClientboundSetActionBarTextPacket; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.title.ClientboundSetActionBarTextPacket;
import org.cloudburstmc.protocol.bedrock.packet.SetTitlePacket; import org.cloudburstmc.protocol.bedrock.packet.TextPacket;
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;
@ -44,11 +44,14 @@ public class JavaSetActionBarTextTranslator extends PacketTranslator<Clientbound
text = MessageTranslator.convertMessage(packet.getText(), session.locale()); text = MessageTranslator.convertMessage(packet.getText(), session.locale());
} }
SetTitlePacket titlePacket = new SetTitlePacket(); // Type seems wrong, but is intentional to avoid collisions with armor/remaining air bars
titlePacket.setType(SetTitlePacket.Type.ACTIONBAR); TextPacket textPacket = new TextPacket();
titlePacket.setText(text); textPacket.setType(TextPacket.Type.JUKEBOX_POPUP);
titlePacket.setXuid(""); textPacket.setNeedsTranslation(false);
titlePacket.setPlatformOnlineId(""); textPacket.setSourceName("");
session.sendUpstreamPacket(titlePacket); textPacket.setMessage(text);
textPacket.setXuid("");
textPacket.setPlatformChatId("");
session.sendUpstreamPacket(textPacket);
} }
} }