From b17096d96b1165994511a2445145b8c726ab09a8 Mon Sep 17 00:00:00 2001 From: Alexander Medvedev Date: Mon, 10 Aug 2026 14:32:11 +0200 Subject: [PATCH] chore(bedrock): send chat messages with xuid now you can mute people etc in bedrock --- .../src/bedrock/server/text.rs | 14 ++++++-- crates/pumpkin/src/net/bedrock/play.rs | 7 ++-- crates/pumpkin/src/net/mod.rs | 34 ++++++++++++++++--- 3 files changed, 47 insertions(+), 8 deletions(-) diff --git a/crates/pumpkin-protocol/src/bedrock/server/text.rs b/crates/pumpkin-protocol/src/bedrock/server/text.rs index cebbbbdf4..1ecb9451d 100644 --- a/crates/pumpkin-protocol/src/bedrock/server/text.rs +++ b/crates/pumpkin-protocol/src/bedrock/server/text.rs @@ -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, + ) -> 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), } } diff --git a/crates/pumpkin/src/net/bedrock/play.rs b/crates/pumpkin/src/net/bedrock/play.rs index a05bda6b3..95bf64cc4 100644 --- a/crates/pumpkin/src/net/bedrock/play.rs +++ b/crates/pumpkin/src/net/bedrock/play.rs @@ -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; diff --git a/crates/pumpkin/src/net/mod.rs b/crates/pumpkin/src/net/mod.rs index 1b0d68883..52a9194ff 100644 --- a/crates/pumpkin/src/net/mod.rs +++ b/crates/pumpkin/src/net/mod.rs @@ -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)]