chore(bedrock): send chat messages with xuid

now you can mute people etc in bedrock
This commit is contained in:
Alexander Medvedev 2026-08-10 14:32:11 +02:00
parent 2122f2effb
commit b17096d96b
3 changed files with 47 additions and 8 deletions

View File

@ -39,6 +39,16 @@ impl SText<'_> {
impl SText<'static> {
#[must_use]
pub fn new(message: String, source_name: String) -> Self {
Self::chat_with_xuid(message, source_name, String::new(), None)
}
#[must_use]
pub fn chat_with_xuid(
message: String,
source_name: String,
xuid: String,
filtered_message: Option<String>,
) -> Self {
Self {
needs_translation: false,
r#type: TextPacketType::Chat,
@ -49,9 +59,9 @@ impl SText<'static> {
message
}),
parameters: Vec::new(),
xuid: Cow::Borrowed(""),
xuid: Cow::Owned(xuid),
platform_chat_id: Cow::Borrowed(""),
filtered_message: None,
filtered_message: filtered_message.map(Cow::Owned),
}
}

View File

@ -1066,8 +1066,11 @@ impl BedrockClient {
false,
);
let be_packet = SText::new(
message, gameprofile.name.clone()
let be_packet = SText::chat_with_xuid(
message,
gameprofile.name.clone(),
packet.xuid.into_owned(),
packet.filtered_message.map(std::borrow::Cow::into_owned),
);
entity.world.load().broadcast_editioned(&je_packet, &be_packet).await;

View File

@ -451,14 +451,14 @@ pub enum DisconnectReason {
IncompatiblePack = 59,
OutOfStorage = 60,
InvalidLevel = 61,
DisconnectPacketDeprecated = 62,
DisconnectPacket = 62,
BlockMismatch = 63,
InvalidHeights = 64,
InvalidWidths = 65,
ConnectionLostDeprecated = 66,
ConnectionLost = 66,
ZombieConnection = 67,
Shutdown = 68,
ReasonNotSetDeprecated = 69,
ReasonNotSet = 69,
LoadingStateTimeout = 70,
ResourcePackLoadingFailed = 71,
SearchingForSessionLoadingScreenFailed = 72,
@ -478,7 +478,7 @@ pub enum DisconnectReason {
NetherNetNegotiationTimeout = 86,
NetherNetInactivityTimeout = 87,
StaleConnectionBeingReplaced = 88,
RealmsSessionNotFoundDeprecated = 89,
RealmsSessionNotFound = 89,
BadPacket = 90,
NetherNetFailedToCreateOffer = 91,
NetherNetFailedToCreateAnswer = 92,
@ -511,6 +511,32 @@ pub enum DisconnectReason {
RealmsTimelineRequired = 119,
GuestWithoutHost = 120,
FailedToJoinExperience = 121,
NetherNetDataChannelClosed = 122,
DiscoveryEnvironmentMismatch = 123,
HostWithoutKeys = 124,
HostSignedOut = 125,
ScriptWatchdogException = 126,
ScriptMemoryLimitExceeded = 127,
StorageLowDuringGameplay = 128,
StorageFullDuringGameplay = 129,
LevelStorageCorruption = 130,
EditionMismatchVanillaToEdu = 131,
EditionMismatchEduToVanilla = 132,
EditorMismatchEditorToVanilla = 133,
EditorMismatchVanillaToEditor = 134,
DenyListed = 135,
NonceMissing = 136,
NonceNotFound = 137,
NonceExpired = 138,
NonceNotValid = 139,
HostDisconnected = 140,
EditorJoinIntentPolicyFailure = 141,
NetherNetIdentityNotAllowed = 142,
InvalidName = 143,
ExpiredToken = 144,
HostAcceptsNoTypeOfAuth = 145,
NotAuthenticatedFastFail = 146,
EditorNotAllowed = 147,
}
#[cfg(test)]