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

@@ -419,7 +419,7 @@ pub async fn install_minecraft(
pub async fn read_protocol_version_from_jar(
path: PathBuf,
) -> crate::Result<Option<i32>> {
) -> crate::Result<Option<u32>> {
let zip = async_zip::tokio::read::fs::ZipFileReader::new(path).await?;
let Some(entry_index) = zip
.file()
@@ -432,7 +432,7 @@ pub async fn read_protocol_version_from_jar(
#[derive(Deserialize, Debug)]
struct VersionData {
protocol_version: Option<i32>,
protocol_version: Option<u32>,
}
let mut data = vec![];