From 21e7f1418af8b63653bc54ad770cd101ffa9f97a Mon Sep 17 00:00:00 2001 From: Alexander Medvedev Date: Wed, 15 Jul 2026 20:50:13 +0200 Subject: [PATCH] feat: show credits on exiting end --- pumpkin-protocol/src/bedrock/client/mod.rs | 2 ++ .../src/bedrock/client/show_credits.rs | 22 +++++++++++++++ pumpkin/src/world/portal/mod.rs | 27 +++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 pumpkin-protocol/src/bedrock/client/show_credits.rs diff --git a/pumpkin-protocol/src/bedrock/client/mod.rs b/pumpkin-protocol/src/bedrock/client/mod.rs index 058b521c6..9a11b84b1 100644 --- a/pumpkin-protocol/src/bedrock/client/mod.rs +++ b/pumpkin-protocol/src/bedrock/client/mod.rs @@ -39,6 +39,7 @@ pub mod set_health; pub mod set_player_gamemode; pub mod set_time; pub mod set_title; +pub mod show_credits; pub mod start_game; pub mod take_item_actor; pub mod transfer; @@ -87,6 +88,7 @@ pub use set_health::*; pub use set_player_gamemode::*; pub use set_time::*; pub use set_title::*; +pub use show_credits::*; pub use start_game::*; pub use take_item_actor::*; pub use transfer::*; diff --git a/pumpkin-protocol/src/bedrock/client/show_credits.rs b/pumpkin-protocol/src/bedrock/client/show_credits.rs new file mode 100644 index 000000000..2a9b54fb4 --- /dev/null +++ b/pumpkin-protocol/src/bedrock/client/show_credits.rs @@ -0,0 +1,22 @@ +use crate::{ + codec::{var_int::VarInt, var_ulong::VarULong}, + serial::PacketWrite, +}; +use pumpkin_macros::packet; + +#[derive(PacketWrite)] +#[packet(75)] +pub struct CShowCredits { + pub player_runtime_id: VarULong, + pub status: VarInt, +} + +impl CShowCredits { + #[must_use] + pub const fn new(player_runtime_id: VarULong, status: VarInt) -> Self { + Self { + player_runtime_id, + status, + } + } +} diff --git a/pumpkin/src/world/portal/mod.rs b/pumpkin/src/world/portal/mod.rs index 40149d55e..8b523c481 100644 --- a/pumpkin/src/world/portal/mod.rs +++ b/pumpkin/src/world/portal/mod.rs @@ -131,6 +131,33 @@ impl PortalType { }) } else { // Leaving the End through the exit portal: return to overworld spawn + if let Some(player) = + current_level.get_player_by_id(caller.get_entity().entity_id) + { + match player.client.as_ref() { + crate::net::ClientPlatform::Java(client) => { + client + .enqueue_packet(&pumpkin_protocol::java::client::play::CGameEvent::new( + pumpkin_protocol::java::client::play::GameEvent::WinGame, + 1.0, + )) + .await; + } + crate::net::ClientPlatform::Bedrock(client) => { + client + .send_game_packet( + &pumpkin_protocol::bedrock::client::CShowCredits::new( + pumpkin_protocol::codec::var_ulong::VarULong( + caller.get_entity().entity_id as u64, + ), + pumpkin_protocol::codec::var_int::VarInt(0), + ), + ) + .await; + } + } + } + let info = dest_world.level_info.load(); Some(TeleportTransition { new_world: dest_world,