Skip to content

Commit

Permalink
make mc display version dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
theaddonn committed Sep 17, 2024
1 parent bd57c7e commit b6f2f11
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
1 change: 0 additions & 1 deletion crates/proto/src/info.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
pub const RAKNET_GAME_PACKET_ID: u8 = 0xfe;
pub const PROTOCOL_VERSION: i32 = 685;
pub const MINECRAFT_VERSION: &'static str = "1.21.0";
pub const MINECRAFT_EDITION_MOTD: &'static str = "MCPE";

pub const MAGIC: [u8; 16] = [
Expand Down
19 changes: 10 additions & 9 deletions crates/proto/src/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ pub struct Listener {
listener: TransportLaterListener,
name: String,
sub_name: String,
player_count_max: u32,
player_count_current: u32,
player_max: u32,
player_count: u32,
socket_addr: SocketAddr,
guid: u64,
}
Expand All @@ -23,8 +23,9 @@ impl Listener {
pub async fn new_raknet(
name: String,
sub_name: String,
player_count_max: u32,
player_count_current: u32,
display_version: String,
player_max: u32,
player_count: u32,
socket_addr: SocketAddr,
nintendo_limited: bool,
) -> Result<Self, ListenerError> {
Expand All @@ -47,11 +48,11 @@ impl Listener {
// Setup the motd
rak_listener.motd = Motd {
edition: String::from(MINECRAFT_EDITION_MOTD),
version: String::from(MINECRAFT_VERSION),
version: display_version,
name: name.clone(),
sub_name: sub_name.clone(),
player_max: player_count_max,
player_count: player_count_current,
player_max,
player_count,
protocol: PROTOCOL_VERSION as u16,
server_guid: guid,
gamemode: Gamemode::Survival,
Expand All @@ -64,8 +65,8 @@ impl Listener {
listener: TransportLaterListener::RaknetUDP(rak_listener),
name,
sub_name,
player_count_max,
player_count_current,
player_max,
player_count,
socket_addr,
guid,
})
Expand Down

0 comments on commit b6f2f11

Please sign in to comment.