From 7279f4177e20550cbb0f4322d38c9161c2246895 Mon Sep 17 00:00:00 2001 From: iceiix <43691553+iceiix@users.noreply.github.com> Date: Sun, 21 Jun 2020 12:01:31 -0700 Subject: [PATCH] 1.13.2: add untested Forge protocol handshake support (#145) Initial support for the new Forge 1.1+3 server list ping JSON mod parsing --- protocol/src/protocol/mod.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/protocol/src/protocol/mod.rs b/protocol/src/protocol/mod.rs index 13be61a..24cc79b 100644 --- a/protocol/src/protocol/mod.rs +++ b/protocol/src/protocol/mod.rs @@ -1204,6 +1204,23 @@ impl Conn { } } } + // Forge 1.13+ TODO: update for 1.14+ and test + if let Some(forge_data) = val.get("forgeData") { + if let Some(mods) = forge_data.get("mods") { + if let Value::Array(items) = mods { + for item in items { + if let Value::Object(obj) = item { + let modid = obj.get("modId").unwrap().as_str().unwrap().to_string(); + let modmarker = obj.get("modmarker").unwrap().as_str().unwrap().to_string(); + + let version = modmarker; + + forge_mods.push(crate::protocol::forge::ForgeMod { modid, version }); + } + } + } + } + } Ok((Status { version: StatusVersion {