From 5c5ff54857502bcd7796806e4a644622c1d7600e Mon Sep 17 00:00:00 2001 From: ice_iix Date: Sat, 11 May 2019 18:31:28 -0700 Subject: [PATCH 1/5] Add new Forge 1.13 server list ping JSON mod parsing --- src/protocol/mod.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/protocol/mod.rs b/src/protocol/mod.rs index 13be61a5..8e5bee01 100644 --- a/src/protocol/mod.rs +++ b/src/protocol/mod.rs @@ -1204,6 +1204,23 @@ impl Conn { } } } + // Forge 1.13+ + 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 { From 0f72acb49675100337eac3924c6d7cc8816718b5 Mon Sep 17 00:00:00 2001 From: ice_iix Date: Sat, 11 May 2019 19:00:10 -0700 Subject: [PATCH 2/5] Add sent bytes logging --- src/protocol/mod.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/protocol/mod.rs b/src/protocol/mod.rs index 8e5bee01..d5886903 100644 --- a/src/protocol/mod.rs +++ b/src/protocol/mod.rs @@ -1041,10 +1041,22 @@ impl Conn { } pub fn write_packet(&mut self, packet: T) -> Result<(), Error> { + let network_debug = unsafe { NETWORK_DEBUG }; + + /* TODO: debug printing packets to send + if network_debug { + println!("about to send {:?}", packet); + } + */ + let mut buf = Vec::new(); VarInt(packet.packet_id(self.protocol_version)).write_to(&mut buf)?; packet.write(&mut buf)?; + if network_debug { + println!("sent bytes {:?}", buf); + } + let mut extra = if self.compression_threshold >= 0 { 1 } else { From 01eef9f60930ea6e8aec5377e801a15023139b99 Mon Sep 17 00:00:00 2001 From: ice_iix Date: Fri, 10 Jan 2020 16:37:39 -0800 Subject: [PATCH 3/5] Fix network debug compiling on master due to #267 --- src/protocol/mod.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/protocol/mod.rs b/src/protocol/mod.rs index d5886903..921557f0 100644 --- a/src/protocol/mod.rs +++ b/src/protocol/mod.rs @@ -1041,10 +1041,8 @@ impl Conn { } pub fn write_packet(&mut self, packet: T) -> Result<(), Error> { - let network_debug = unsafe { NETWORK_DEBUG }; - - /* TODO: debug printing packets to send - if network_debug { + /* TODO: fix Packet doesn't implement std::fmt::Debug + if is_network_debug() { println!("about to send {:?}", packet); } */ @@ -1053,7 +1051,7 @@ impl Conn { VarInt(packet.packet_id(self.protocol_version)).write_to(&mut buf)?; packet.write(&mut buf)?; - if network_debug { + if is_network_debug() { println!("sent bytes {:?}", buf); } From 3209a8f0d54d1757c37b8873d1f65f61d318081d Mon Sep 17 00:00:00 2001 From: ice_iix Date: Sun, 21 Jun 2020 11:56:41 -0700 Subject: [PATCH 4/5] Remove network debug changes --- protocol/src/protocol/mod.rs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/protocol/src/protocol/mod.rs b/protocol/src/protocol/mod.rs index 921557f0..8e5bee01 100644 --- a/protocol/src/protocol/mod.rs +++ b/protocol/src/protocol/mod.rs @@ -1041,20 +1041,10 @@ impl Conn { } pub fn write_packet(&mut self, packet: T) -> Result<(), Error> { - /* TODO: fix Packet doesn't implement std::fmt::Debug - if is_network_debug() { - println!("about to send {:?}", packet); - } - */ - let mut buf = Vec::new(); VarInt(packet.packet_id(self.protocol_version)).write_to(&mut buf)?; packet.write(&mut buf)?; - if is_network_debug() { - println!("sent bytes {:?}", buf); - } - let mut extra = if self.compression_threshold >= 0 { 1 } else { From b139d494cd1505d9c556d1939d8a9140a0a29365 Mon Sep 17 00:00:00 2001 From: ice_iix Date: Sun, 21 Jun 2020 11:58:52 -0700 Subject: [PATCH 5/5] Add todo --- protocol/src/protocol/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol/src/protocol/mod.rs b/protocol/src/protocol/mod.rs index 8e5bee01..24cc79ba 100644 --- a/protocol/src/protocol/mod.rs +++ b/protocol/src/protocol/mod.rs @@ -1204,7 +1204,7 @@ impl Conn { } } } - // Forge 1.13+ + // 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 {