mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00: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
This commit is contained in:
parent
3949fb1988
commit
d147ee37dc
2 changed files with 11 additions and 8 deletions
|
@ -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()));
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue