-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get the protocol version to send from the ping packet #20
Conversation
This basically works, but there is an implementation problem with saving/getting the version - you have to click refresh to connect with the right version, because it is retrieved here: // TODO: move getting protocol version out of refresh
let server_protocol_versions = self.server_protocol_versions;
backr.add_click_func(move |_, game| {
let protocol_version: i32 = *server_protocol_versions.get(&address).unwrap_or(&protocol::SUPPORTED_PROTOCOL);
println!("self.server_protocol_versions.get = {:?}", self.server_protocol_versions);
game.screen_sys.replace_screen(Box::new(super::connecting::Connecting::new(&address)));
game.connect_to(&address, protocol_version);
true
}); trying to fix this, but if I do something like: let server_protocol_versions = self.server_protocol_versions;
backr.add_click_func(move |_, game| {
let protocol_version: i32 = *server_protocol_versions.get(&address).unwrap_or(&protocol::SUPPORTED_PROTOCOL);
println!("self.server_protocol_versions.get = {:?}", self.server_protocol_versions);
game.screen_sys.replace_screen(Box::new(super::connecting::Connecting::new(&address)));
game.connect_to(&address, protocol_version);
true
}); then:
need to find out how/where to save/load the server to protocol version map, so it can be used on connect. |
Some good news: 1.11 is similar enough to 1.10.2 that this change allows Steven to at least connect to both server versions, even without changing the packets (#19 - though not all packets may be processed correctly) |
The server list is loaded from disk (servers.json), not memory, so the problem arises where to get the ping version from, since the closure is passed to |
6191652
to
8630338
Compare
…rver_protocol_versions" This reverts commit 8630338.
fc42f02
to
db659cd
Compare
Serializing to disk for now (server_versions.json), although not necessarily ideal, this matches the pattern used by src/screen/edit_server.rs (writes to servers.json) and src/screen/server_list.rs (reads servers.json). This also reduces the likelihood that the user will attempt to connect to a server before receiving the ping response, since it is persisted between application launches (although it may still be possible albeit unlikely, if this situation occurs a warning is logged). |
Only a minor update, -1 now indicates no color, so changed u8 to i8: https://wiki.vg/Protocol_History#16w50a https://wiki.vg/index.php?title=Protocol&diff=8543&oldid=8405 https://wiki.vg/index.php?title=Protocol&oldid=8543 and updated version numbers. 1.11.2 uses the same 1.11 assets, which can be found by looking up 1.11.2 in: https://launchermeta.mojang.com/mc/game/version_manifest.json https://launchermeta.mojang.com/v1/packages/6bd228727ed48bd7ac7bdc0088587dad0fb7c02b/1.11.2.json 1.11.2/1.11 is compatible except for the version number, which is now sent matching the server (#20), so no backwards-compatible branch for 1.11 (315) is needed. https://github.com/iceiix/steven/issues/18 Enhance protocol support
for https://github.com/iceiix/steven/issues/18