Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-27 08:30:12 +01:00
Update EmotePacket creation for 1.20 (#3841)
Include xuid and platformId in EmotePacket
Dieser Commit ist enthalten in:
Ursprung
ab577f66ac
Commit
53d002656f
@ -1949,8 +1949,10 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EmotePacket packet = new EmotePacket();
|
EmotePacket packet = new EmotePacket();
|
||||||
packet.setEmoteId(emoteId);
|
|
||||||
packet.setRuntimeEntityId(entity.getGeyserId());
|
packet.setRuntimeEntityId(entity.getGeyserId());
|
||||||
|
packet.setXuid("");
|
||||||
|
packet.setPlatformId(""); // BDS sends empty
|
||||||
|
packet.setEmoteId(emoteId);
|
||||||
sendUpstreamPacket(packet);
|
sendUpstreamPacket(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,21 +56,38 @@ public class BedrockEmoteTranslator extends PacketTranslator<EmotePacket> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int javaId = session.getPlayerEntity().getEntityId();
|
int javaId = session.getPlayerEntity().getEntityId();
|
||||||
|
String xuid = session.getAuthData().xuid();
|
||||||
|
String emote = packet.getEmoteId();
|
||||||
for (GeyserSession otherSession : session.getGeyser().getSessionManager().getSessions().values()) {
|
for (GeyserSession otherSession : session.getGeyser().getSessionManager().getSessions().values()) {
|
||||||
if (otherSession != session) {
|
if (otherSession != session) {
|
||||||
if (otherSession.isClosed()) continue;
|
if (otherSession.isClosed()) continue;
|
||||||
if (otherSession.getEventLoop().inEventLoop()) {
|
if (otherSession.getEventLoop().inEventLoop()) {
|
||||||
playEmote(otherSession, javaId, packet.getEmoteId());
|
playEmote(otherSession, javaId, xuid, emote);
|
||||||
} else {
|
} else {
|
||||||
otherSession.executeInEventLoop(() -> playEmote(otherSession, javaId, packet.getEmoteId()));
|
otherSession.executeInEventLoop(() -> playEmote(otherSession, javaId, xuid, emote));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void playEmote(GeyserSession otherSession, int javaId, String emoteId) {
|
/**
|
||||||
Entity otherEntity = otherSession.getEntityCache().getEntityByJavaId(javaId); // Must be ran on same thread
|
* Play an emote by an emoter to the given session.
|
||||||
if (!(otherEntity instanceof PlayerEntity otherPlayer)) return;
|
* This method must be called within the session's event loop.
|
||||||
otherSession.showEmote(otherPlayer, emoteId);
|
*
|
||||||
|
* @param session the session to show the emote to
|
||||||
|
* @param emoterJavaId the java id of the emoter
|
||||||
|
* @param emoterXuid the xuid of the emoter
|
||||||
|
* @param emoteId the emote to play
|
||||||
|
*/
|
||||||
|
private static void playEmote(GeyserSession session, int emoterJavaId, String emoterXuid, String emoteId) {
|
||||||
|
Entity emoter = session.getEntityCache().getEntityByJavaId(emoterJavaId); // Must be ran on same thread
|
||||||
|
if (emoter instanceof PlayerEntity) {
|
||||||
|
EmotePacket packet = new EmotePacket();
|
||||||
|
packet.setRuntimeEntityId(emoter.getGeyserId());
|
||||||
|
packet.setXuid(emoterXuid);
|
||||||
|
packet.setPlatformId(""); // BDS sends empty
|
||||||
|
packet.setEmoteId(emoteId);
|
||||||
|
session.sendUpstreamPacket(packet);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren