Legacy ping support (#4062)

* Detection of protocol versions before 18w47b

* Refactor old_protocol_versions into protocol_version

* Ping servers closer to how a client of an instance's version would ping a server

* Allow pinging legacy servers from a modern profile in the same way a modern client would

* Ping 1.4.2 through 1.5.2 like a Vanilla client in those versions would when in such an instance
This commit is contained in:
Josiah Glosson
2025-07-28 07:44:34 -07:00
committed by GitHub
parent 13103b4950
commit 175b90be5a
14 changed files with 705 additions and 45 deletions

View File

@@ -32,7 +32,7 @@ pub struct Profile {
pub icon_path: Option<String>,
pub game_version: String,
pub protocol_version: Option<i32>,
pub protocol_version: Option<u32>,
pub loader: ModLoader,
pub loader_version: Option<String>,
@@ -320,7 +320,7 @@ impl TryFrom<ProfileQueryResult> for Profile {
name: x.name,
icon_path: x.icon_path,
game_version: x.game_version,
protocol_version: x.protocol_version.map(|x| x as i32),
protocol_version: x.protocol_version.map(|x| x as u32),
loader: ModLoader::from_string(&x.mod_loader),
loader_version: x.mod_loader_version,
groups: serde_json::from_value(x.groups).unwrap_or_default(),