feat: show credits on exiting end
This commit is contained in:
1 parent
c7be511fbc
commit
21e7f1418a
3 files changed
+51
No files matched your search
@@ -39,6 +39,7 @@ pub mod set_health;
|
|||||||
pub mod set_player_gamemode;
|
pub mod set_player_gamemode;
|
||||||
pub mod set_time;
|
pub mod set_time;
|
||||||
pub mod set_title;
|
pub mod set_title;
|
||||||
|
pub mod show_credits;
|
||||||
pub mod start_game;
|
pub mod start_game;
|
||||||
pub mod take_item_actor;
|
pub mod take_item_actor;
|
||||||
pub mod transfer;
|
pub mod transfer;
|
||||||
@@ -87,6 +88,7 @@ pub use set_health::*;
|
|||||||
pub use set_player_gamemode::*;
|
pub use set_player_gamemode::*;
|
||||||
pub use set_time::*;
|
pub use set_time::*;
|
||||||
pub use set_title::*;
|
pub use set_title::*;
|
||||||
|
pub use show_credits::*;
|
||||||
pub use start_game::*;
|
pub use start_game::*;
|
||||||
pub use take_item_actor::*;
|
pub use take_item_actor::*;
|
||||||
pub use transfer::*;
|
pub use transfer::*;
|
||||||
|
|||||||
@@ -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,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -131,6 +131,33 @@ impl PortalType {
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// Leaving the End through the exit portal: return to overworld spawn
|
// 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();
|
let info = dest_world.level_info.load();
|
||||||
Some(TeleportTransition {
|
Some(TeleportTransition {
|
||||||
new_world: dest_world,
|
new_world: dest_world,
|
||||||
|
|||||||
Reference in new issue
Block a user