Commit Graph

51 Commits

Author SHA1 Message Date
ice_iix 3d1bea85fe Fix clippy::needless_borrow 2021-08-01 06:19:48 -07:00
terrarier2111 44fd1f933c
screen: fixed a focusing bug in the settings (#565)
The game was previously focused after clicking the done button in the individual settings, which would cause the game to be focused while still in the main settings menu.
2021-07-31 18:56:06 -07:00
iceiix 352f1965af
Update rand to 0.8.0, add getrandom js for web (#450)
* Add getrandom with js feature for JavaScript web compatibility

* Update to rand 0.8.0, closes #440

* Update to rand_pcg 0.3.0, closes #434

* Update rsa_public_encrypt_pkcs1 to 0.3.0, updates rand 0.8.0
2020-12-27 16:14:11 -08:00
iceiix 503a98d7a8
Use instant over std::time, for wasm compat (#449)
Replace std::time with the `instant` crate, which bridges to std::time on
native but on wasm calls performance.now() instead of panicking.

A step towards 🕸️ Web support #446

* logo: replace SystemTime/UNIX_EPOCH with Instant
2020-12-27 15:06:03 -08:00
iceiix 1fabc0c5bf
server_list: implement server deletion, fixes #355 (#361)
Adds a delete_server screen to delete servers, handled by clicking
the "X" button on the server list, similar to the "E" button for edit_server.
2020-07-04 17:42:17 -07:00
ice_iix 64fc29796d server_list: fix pre-1.13 favicon data, #353 (#354)
The server list ping response contains a base64-encoded favicon image,
which in pre-1.13 servers can have embedded newlines:
https://wiki.vg/Server_List_Ping#Response

> The favicon should be a PNG image that is Base64 encoded (without
> newlines: \n, new lines no longer work since 1.13) and prepended
> with data:image/png;base64,.

If this was the case, base64 decode would fail with a DecodeError,
similar to Invalid byte (76, 10). We now strip the whitespace, so the
base64 favicon can be decoded properly.
2020-07-03 16:07:36 -07:00
ice_iix 7f5ab06c34 Use !is_empty instead of length check (len_zero) 2020-07-02 17:25:55 -07:00
ice_iix fe5cb47d40 Fix redundant field names in struct initialization (redundant_field_names) 2020-06-29 18:07:12 -07:00
ice_iix c3038f82ce Remove redundant imports (single_component_path_imports) 2020-06-29 18:01:02 -07:00
iceiix 518b6a07f8
Reformat all source with cargo fmt (#335) 2020-06-21 12:17:24 -07:00
ice_iix 49f2582a50 Fix warning: `...` range patterns are deprecated 2019-11-02 15:46:10 -07:00
ice_iix c88631b124 Fix bare trait objects warning, add explicit `dyn` 2019-11-02 15:46:06 -07:00
iceiix 836ab9f126
wasm: Fix operation not supported on std::fs. Closes #115 (#166)
* Add new web-based std::fs replacement, localstoragefs:

https://github.com/iceiix/localstoragefs

* Add std_or_web to switch between std::fs (native) or localstoragefs (web)

* Update www readme for new missing glutin/winit links, opens issue #171
2019-05-29 08:21:56 -07:00
iceiix 327efcf043 Add Forge handshake support. Closes #88 (#134)
Adds support for connecting to 1.7.10 modded servers using the FML|HS protocol:
https://wiki.vg/Minecraft_Forge_Handshake

* Handle client-bound plugin message packets

* Parse FML|HS plugin channel messages

* Add ModList serialization using Mod serializable, LenPrefixed<VarInt, Mod>

* Save forge_mods from server ping and send in FML|HS ModList packet

* Show Forge mod count in server ping listing

* Send acknowledgements, completing the handshake

* Add VarShort to custom payload len prefix replaces i16, fixes OOM on large modded servers

* Add custom CoFHLib's SendUUID packet -26

See explanation at https://github.com/SpigotMC/BungeeCord/issues/1437
This packet is defined by CoFHLib in https://github.com/CoFH/CoFHLib/blob/1.7.10/src/main/java/cofh/lib/util/helpers/SecurityHelper.java#L40
Fixes thread '' panicked at 'bad packet id 0xffffffe6 in Clientbound Play' with FTB:IE
2019-05-05 18:39:58 -07:00
ice_iix 6322cf8b21 Re-ping server on connect to detect protocol version
Previously, the server protocol was detected in the server listing GUI,
and saved for each server in a server_versions.json file. connect_to()
would read this file to get the version to use, an ugly hack/workaround
for threading/intercommunication challenges, and a questionable attempt
at avoiding another round-trip exchange.

Now, the server is re-pinged in connect_to() to get the protocol version
to use. This is a blocking ping so it may somewhat slow down server
connecting, but avoids the race conditions with the server list, and
undesirable intertwining the GUI with the server connection logic.

This hack was present since the original multiprotocol support (#18),
but it was blocking other enhancements, about time to remove it.
2019-05-04 17:21:58 -07:00
iceiix 2f2f35848a
Add support for compiling WebAssembly wasm32-unknown-unknown target (#92)
Note this only is the first step in web support, although the project compiles, it doesn't run!

Merging now to avoid branch divergence, until dependencies can be updated for wasm support.

* Add instructions to build for wasm32-unknown-unknown with wasm-pack in www/

* Update to rust-clipboard fork to compile with emscripten

https://github.com/aweinstock314/rust-clipboard/pull/62

* Exclude reqwest dependency in wasm32

* Exclude compiling clipboard pasting on wasm32

* Exclude reqwest-using code from wasm32

* Install wasm target with rustup in Travis CI

* Update to collision 0.19.0

Fixes wasm incompatibility in deprecated rustc-serialize crate: https://github.com/rustgd/collision-rs/issues/106

error[E0046]: not all trait items implemented, missing: `encode`
    --> github.com-1ecc6299db9ec823/rustc-serialize-0.3.24/src/serialize.rs:1358:1

* Increase travis_wait time even further, try 120 minutes

* Set RUST_BACKTRACE=1 in main

* Remove unused unneeded bzip2 features in zip crate

To fix wasm32-unknown-unknown target compile error:
error[E0432]: unresolved imports `libc::c_int`, `libc::c_uint`, `libc::c_void`, `libc::c_char`
 --> src/github.com-1ecc6299db9ec823/bzip2-sys-0.1.7/lib.rs:5:12
  |
5 | use libc::{c_int, c_uint, c_void, c_char};
  |            ^^^^^  ^^^^^^  ^^^^^^  ^^^^^^ no `c_char` in the root
  |            |      |       |
  |            |      |       no `c_void` in the root
  |            |      no `c_uint` in the root
  |            no `c_int` in the root

* flate2 use Rust backend

* Add console_error_panic_hook module for wasm backtraces

* Build using wasm-pack, wasm-bindgen, run with wasm-app

* Update to miniz_oxide 0.2.1, remove patch for https://github.com/Frommi/miniz_oxide/issues/42

* Update to official clipboard crate since https://github.com/aweinstock314/rust-clipboard/pull/62 was merged, but git revision pending release

* Update to branch of glutin attempting to build for wasm

https://github.com/iceiix/glutin/pull/1

* Update winit dependency of glutin to git master

https://github.com/iceiix/winit/pull/2

* Update to glutin branch with working (compiles, doesn't run) wasm_stub

* Add app name in title on web page

* Add wasm to Travis-CI test matrix

* Update glutin to fix Windows EGL compilation on AppVeyor

97797352b5
2019-03-03 08:32:36 -08:00
iceiix e1769edae8
Update base64, serde_json, and serde (#76)
* Update to base64 0.10.0, use standard base64 config. Closes https://github.com/iceiix/steven/pull/52

* Update to serde_json 1.0.34. Closes https://github.com/iceiix/steven/pull/73

* Update to serde 1.0.84. Closes https://github.com/iceiix/steven/pull/74
2019-01-05 19:55:27 -08:00
iceiix d03f102bb8
Multiprotocol support: 1.12.2 and 1.11.2 (#54)
Adds support for connecting to both 1.12.2 and 1.11.2 (protocols 340 and 316) servers

https://github.com/iceiix/steven/issues/18 Enhance protocol support
Closes https://github.com/iceiix/steven/pull/48 1.11.2 protocol support (316)

* Restore create_ids!() macro in packet identifiers

* Add translate_packet_id() function to map external 1.12.2 packet ids to internal sequential ids

* Implement translate_internal_packet_id() from a new protocol_packet_ids! macro

* Move packet IDs to separate file, v1_12_2.rs

* Change supported protocols constant to an array

* Add v1_11_2 protocol packet IDs (from https://github.com/iceiix/steven/pull/48)

* Add keep alive packet variants: _i64 (>=1.12.2) and _VarInt (<=1.11.2)

* Abstract protocol versions, can now connect to both 1.12.2 and 1.11.2

* Send protocol version in handshake packet

* Restore 1.11 (315) protocol support as in original (https://github.com/thinkofname/steven) Steven
2018-12-03 14:22:47 -08:00
iceiix d80eca3940
Get the protocol version to send from the ping packet (#20)
The first step of https://github.com/iceiix/steven/issues/18 Enhance protocol support,
instead of hardcoding a fixed version, the client now matches whatever the server sent.

* Get the protocol version to send from the ping packet

* Save/load server protocol versions to disk, server_versions.json

* Fallback to default SUPPORTED_PROTOCOL if no ping response
2018-11-30 16:41:27 -08:00
ice_iix 77cd4ecf35 Use field init shorthand, instead of x:x, just x,
https://rust-lang-nursery.github.io/edition-guide/rust-2018/data-types/field-init-shorthand.html

find src -name '*.rs' -exec perl -pe 's/\b(\w+): \1,/$1,/g' -i {} \;
2018-11-04 13:43:30 -08:00
ice_iix a40cd43a2e Update to use crate:: for current crate, for Rust 2018 edition
From `cargo fix --edition`, see https://rust-lang-nursery.github.io/edition-guide/print.html#the-crate-keyword-refers-to-the-current-crate
2018-11-04 12:06:00 -08:00
iceiix de6cd2044e
Update to serde_json 1.0 (#6)
* Replace find() with get()

* Update for renamed as_string->as_str and as_boolean->as_bool

https://github.com/serde-rs/json/releases/tag/v0.8.0
Value::as_string() has been renamed to as_str() and Value::as_boolean() has been renamed to as_bool() to improve consistency
https://github.com/serde-rs/json/issues/126

* No serde_json::Value::I64/U64/F64 anymore, only Number

* Update from lookup() to pointer(), using JSON pointer syntax

https://github.com/iceiix/steven/pull/6#issuecomment-432472123

* Remove unused and removed ObjectBuilder import

* Use into_iter().collect() to convert BTreeMap to serde_json::Map

* Change parse_rules to accept serde_json::Map instead of BTreeMap

* Remove unused serde_json macro_use

* Update Cargo.lock
2018-10-23 18:47:21 -07:00
ice_iix d2b59fbd10 Update to rand 0.5.5 for https://github.com/iceiix/steven/issues/4
Useful guide: https://github.com/rust-random/rand/blob/master/UPDATING.md
2018-09-30 19:05:20 -07:00
ice_iix e988c64376 Use base64 crate for base64 instead of deprecated rustc-serialize, for https://github.com/iceiix/steven/issues/4 2018-09-30 17:58:40 -07:00
ice_iix 9677f8ae9c Use std::time for server ping, getting closer to eliminating use of 'time' crate, https://github.com/iceiix/steven/issues/3 2018-09-29 22:57:55 -07:00
llogiq 5e0c041a71 Fixed another batch of clippy warnings
Those are mostly readability-related. Also did a cargo update.
2016-09-15 15:15:52 +01:00
Thinkofname 6e33c3cc36 Fix the text boxes in the server edit screen not being focusable 2016-04-26 00:31:47 +01:00
Thinkofname f23c16bff2 Update client url and add an in-game progress bar for the download (Fixes #22) 2016-04-24 23:22:10 +01:00
Thinkofname 88d43c615a Move the disconnected message to the foreground 2016-04-24 14:05:21 +01:00
Thinkofname a7caa50b6f Rewrite the UI system (Closes #12) 2016-04-24 12:29:25 +01:00
Thinkofname edf6f34a0b Separate the console and console vars. Removes the need to lock on the console to read vars 2016-04-21 11:40:50 +01:00
Thinkofname 380a844272 Implement a background for the option menus 2016-04-21 11:00:05 +01:00
Thinkofname 380f549454 Fix a large number of warnings 2016-04-16 21:44:05 +01:00
Thinkofname bb82798ab8 Disable ticking completely when disconnected from a server 2016-04-09 11:43:44 +01:00
TheUnnamedDude 4c590f8184 Add a options/pause menu (Closes #4) 2016-04-09 09:56:55 +01:00
Thinkofname 0cad9508aa Allow adding and editing servers 2016-04-02 00:46:39 +01:00
Thinkofname 93bcd1e083 Rework the dynamic texture system to be less stupid 2016-03-28 19:06:10 +01:00
Thinkofname 70ccd5cd3d Tidy up chunk rendering 2016-03-24 21:13:24 +00:00
Thinkofname ae2703418b Fully implement the login screen (Closes #6) 2016-03-20 23:43:31 +00:00
Thinkofname b418625a48 Work on login screen, added ui buttons and textboxes (plus tab fixes) 2016-03-20 20:17:21 +00:00
Thinkofname fd4df88c32 Initial work on connecting to servers 2016-03-20 12:04:02 +00:00
Thinkofname 72712e4d42 Transparent rendering work 2016-03-18 15:19:50 +00:00
Thinkofdeath 70b6738d87 Update copyright 2016-03-16 18:25:35 +00:00
Thinkofdeath 3704b9eeb8 Reformat using rustfmt 2015-10-07 19:36:59 +01:00
Thinkofdeath bdfc002e99 Clean up 2015-09-28 23:37:14 +01:00
Thinkofdeath db1c687c53 Split up the ui system using include!
Not the nicest system but it works
2015-09-27 22:18:49 +01:00
Thinkofdeath 8a2c24796c Minor changes 2015-09-27 19:38:58 +01:00
Thinkofdeath fcacd91e3a Clean up 2015-09-25 15:20:55 +01:00
Thinkofdeath 0d3ff98ad5 Implement the refresh button 2015-09-25 14:48:35 +01:00
Thinkofdeath 3bcfc6aa4c Kinda functional server list 2015-09-25 14:00:49 +01:00
Thinkofdeath 93edfa3828 Base of server list 2015-09-23 20:16:25 +01:00