Commit Graph

752 Commits

Author SHA1 Message Date
ice_iix dbca7464bd Enable static CRT (in git), closes #318 2020-07-05 11:20:34 -07:00
ice_iix f5f61e071e Update flate2, serde_json, wasm-bindgen; +gl/protocol
Bump flate2 to 1.0.16, closes #350
Bump serde_json to 1.0.56, closes #349
Bump wasm-bindgen to 0.2.64, closes #348
gl: Bump libc to 0.2.71
protocol: Bump hex to 0.4.2
protocol: Bump aes to 0.4.0
protocol: Bump cfb8 to 0.4.0
protocol: Bump num-traits to 0.2.12
2020-07-05 08:45:34 -07:00
ice_iix 759cef1255 protocol: commit Cargo.lock 2020-07-05 08:25:50 -07:00
ice_iix d362f136f1 1.15.1+: handle SpawnPlayer variant, fixes #357 2020-07-05 00:21:26 -07: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 4e9cda2929 protocol: add missing minecraft:uuid CommandNode property
Fixes thread '<unnamed>' panicked at 'unsupported command node parser minecraft:uuid', protocol/src/protocol/packet.rs:3098:22
This was added in https://wiki.vg/index.php?title=Command_Data&diff=15659&oldid=14622
2020-07-04 14:48:33 -07:00
ice_iix eb703f0776 protocol: log bad format color codes, fixes #353 2020-07-03 16:33:23 -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
iceiix 301dfdc200
Merge pull request #347 from iceiix/clippy
Fix clippy warnings
2020-07-03 10:53:59 -07:00
ice_iix bb6d856879 Azure: fail on clippy all (deny) 2020-07-02 18:22:41 -07:00
ice_iix 337ee74b22 Allow verbose bit mask because this is in a performance-critical path, tick(), and it is faster on Intel according to https://rust-lang.github.io/rust-clippy/master/index.html#verbose_bit_mask 2020-07-02 18:11:52 -07:00
ice_iix 9cfb686528 Use cmp match to replace if chain (comparison_chain) 2020-07-02 17:58:12 -07:00
ice_iix 476d46cac6 Use into_*(self) convention, fixes wrong_self_convention 2020-07-02 17:51:51 -07:00
ice_iix 5ce06c3067 Suppress type_complexity, would not be clarified by using a type definition 2020-07-02 17:49:04 -07:00
ice_iix 7ef173416a Suppress needless_range_loop in chunk loading for clarity -- it will always be 16, and this value is not from block_types, blocks_meta, blocks_add, but must be consistent with all variables and is part of the wire protocol 2020-07-02 17:47:12 -07:00
ice_iix 0d1e86a233 Box block update sign text to reduce enum size from 268 bytes (large_enum_variant)
warning: large size difference between variants
  --> src/world/mod.rs:54:5
   |
54 | /     UpdateSignText(
55 | |         Position,
56 | |         format::Component,
57 | |         format::Component,
58 | |         format::Component,
59 | |         format::Component,
60 | |     ),
   | |_____^ this variant is 268 bytes
   |
   = note: `#[warn(clippy::large_enum_variant)]` on by default
note: and the second-largest variant is 12 bytes:
  --> src/world/mod.rs:53:5
   |
53 |     Remove(Position),
   |     ^^^^^^^^^^^^^^^^
help: consider boxing the large fields to reduce the total size of the enum
  --> src/world/mod.rs:54:5
   |
54 | /     UpdateSignText(
55 | |         Position,
56 | |         format::Component,
57 | |         format::Component,
58 | |         format::Component,
59 | |         format::Component,
60 | |     ),
   | |_____^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#large_enum_variant
2020-07-02 17:39:40 -07:00
ice_iix f88036ea4e Use byte literal b"" instead of as_bytes (string_lit_as_bytes) 2020-07-02 17:29:16 -07:00
ice_iix 7f5ab06c34 Use !is_empty instead of length check (len_zero) 2020-07-02 17:25:55 -07:00
ice_iix 113abefd80 Fix unnecessary use of match with if let (single_match) 2020-07-02 17:22:24 -07:00
ice_iix deb35db895 Use more descriptive name to fix blacklisted_name 'bar' (as in foobar) 2020-07-02 17:17:51 -07:00
ice_iix 2e2c82eae4 Use if let pattern match to fix unnecessary_wrap 2020-07-02 17:14:49 -07:00
ice_iix 9939eae361 Use values_mut() to iterate map values (for_kv_map) 2020-07-02 17:07:48 -07:00
ice_iix 35f29705b3 Use question mark operator idiom (question_mark) 2020-07-02 16:53:27 -07:00
ice_iix c27425750d Change set_float_multi_raw to unsafe because it dereferences a raw pointer argument (not_unsafe_ptr_arg_deref); fix typo 2020-07-02 16:51:50 -07:00
ice_iix 0f9dcd2515 Use unwrap_or_else to fix two or_fun_call and suppress one 2020-06-30 19:09:15 -07:00
ice_iix 07fd4788e1 Use += to fix assign_op_pattern 2020-06-30 19:03:59 -07:00
ice_iix bffb33297f Allow float_cmp since we use it to check if floating point values changed from the last value assigned, not compare two different floating point values; downgrade not_unsafe_ptr_arg_deref to warning 2020-06-30 19:01:17 -07:00
ice_iix c4690bba32 Use add(x) instead of offset(x as isize), fixes ptr_offset_with_cast 2020-06-30 18:56:08 -07:00
ice_iix 8a0936faac Disable clippy::let_and_return for now in src/render/mod.rs 2020-06-30 18:53:33 -07:00
ice_iix d496eaf3bb Use is_*() instead of if let x(_), fixes redundant_pattern_matching 2020-06-30 18:50:46 -07:00
ice_iix b4aa23ecf5 Use if let instead of map, fixes option_map_unit_fn 2020-06-30 18:48:25 -07:00
ice_iix 3aaa14eb80 steven_gl: suppress clippy warnings in gl-generated code 2020-06-30 18:36:20 -07:00
M*C*O 6b13fa3aab
Add CD via Github Actions (#351). Closes #93
* Add first action

* Install libxcb-composite0-dev, fix job name

* Use apt-get instead of apt, more descriptive names for os-specific steps

* Also match .exe, thanks windows

* use upload-artifact v2

* Specifically pick out the binary for upload

* Fix step name

* Name binary after target os
2020-06-30 17:51:29 -07:00
ice_iix 98dff0b390 Fix redundant clones 2020-06-29 18:48:07 -07:00
ice_iix 8fb5491e15 Add missing default implementations (new_without_default) 2020-06-29 18:42:07 -07:00
ice_iix 9d88168d0e Fix collapsible_if in lighting update 2020-06-29 18:26:53 -07:00
ice_iix 55856ccf1b Allow TeleportFlag enum variant names Rel..., Rel..., as they are all relative 2020-06-29 18:26:29 -07:00
ice_iix e8c066cd26 Clippy: allow too_many_arguments, many_single_char_names 2020-06-29 18:17:16 -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 132b40c19e Fix collapsible_if in main game loop 2020-06-29 18:06:51 -07:00
ice_iix c2e3ddb805 Fix write_with_newline, use writeln 2020-06-29 18:06:35 -07:00
ice_iix c3038f82ce Remove redundant imports (single_component_path_imports) 2020-06-29 18:01:02 -07:00
ice_iix 6267509cbe resources: use writeln macro, fixing write_with_newline 2020-06-29 17:50:08 -07:00
ice_iix cb8681a615 protocol: use mutable iterator populating Biomes3D (needless_range_loop) 2020-06-29 17:43:49 -07:00
ice_iix 66a787a535 protocol: change UUID from_str to implement FromStr trait (should_implement_trait) 2020-06-29 17:43:49 -07:00
ice_iix 783e437397 protocol: fix manually copying, use clone_from_slice, thanks clippy! (manual_memcpy) 2020-06-28 18:39:57 -07:00
ice_iix 72f0595111 protocol: fix wildcard_in_or_patterns 2020-06-28 18:36:16 -07:00
ice_iix 2f1c7b3c60 protocol: fix redundant_clone in access token 2020-06-28 18:34:42 -07:00
ice_iix 77394f0536 protocol: use and_then, ok_or_else; option_map_or_none and or_fun_call 2020-06-28 18:33:32 -07:00
ice_iix 07fed441f3 protocol: fix redundant_field_names 2020-06-28 18:28:09 -07:00
ice_iix 853f76b24a protocol: fix redundant_static_lifetimes 2020-06-28 18:27:30 -07:00
ice_iix 9621b235c4 protocol: fix redundant imports, single_component_path_imports 2020-06-28 18:26:52 -07:00
ice_iix 6747ae176e blocks: fix redundant_field_names in macro 2020-06-28 18:24:28 -07:00
ice_iix af9aa0efc1 Merge branch 'master' into clippy 2020-06-28 18:19:03 -07:00
ice_iix ad52d5cb67 gl: update cargo fmt from previous commit 2020-06-28 18:18:48 -07:00
ice_iix d64316e8c8 blocks: fix clippy::precedence use + not | 2020-06-28 18:14:09 -07:00
ice_iix c255edd944 blocks: allow clippy::collapsible_if, represents data flow 2020-06-28 17:50:55 -07:00
ice_iix d9a7015dc8 blocks: fix useless_format, use .as_string() 2020-06-28 17:49:07 -07:00
ice_iix f69b27ce74 blocks: allow clippy::identity_op because 1 << 0 is self-documenting bitfield 2020-06-28 17:48:18 -07:00
ice_iix 842b4d8a54 blocks: fix missing panic_params in TreeVariant 2020-06-28 17:46:49 -07:00
ice_iix ac1dad12df blocks: fix redundant_field_names
cat src/lib.rs|perl -pe's/\b(\w+): \1\b/$1/g'|sponge src/lib.rs
2020-06-28 17:45:15 -07:00
ice_iix e9d2e4691c Fix temporary_cstring_as_ptr lint, using freed memory 2020-06-28 17:09:45 -07:00
iceiix 297cfd0448
Azure Pipelines configuration (#346)
Add a new CI system for Linux/macOS/Windows, Azure Pipelines
Configuration based on https://github.com/crate-ci/azure-pipelines

Since crate-ci defaults to failing the build on clippy errors, forked to:
https://github.com/iceiix/azure-pipelines/tree/clippy
with configurable clippy parameters, to allow disabling the hard failures
(until the underlying causes for the warnings can be fixed).

* Allow erroring clippy float_cmp and unsafe ptrs

* Relax allowed clippy warnings

* Install xcb libraries for -lxcb-shape, -lxcb-xfixes
2020-06-28 16:47:35 -07:00
ice_iix 3db08a3fc5 Fix to_string shadowing fmt::Display fmt (found by clippy)
https://rust-lang.github.io/rust-clippy/master/index.html#inherent_to_string_shadow_display
2020-06-28 14:37:08 -07:00
ice_iix 287fb3feca Update sha-1 dependency to 0.9.1. Closes #342
* Remove unused top-level sha-1 dependency since it was moved to the
protocol crate
2020-06-28 09:15:01 -07:00
ice_iix c167d70aea Update serde and base64 dependencies
Update to serde 1.0.114, closes #340
Update to base64 0.12.3, closes #341
2020-06-28 09:02:38 -07:00
ice_iix 0894c8d693 Remove nonfunctional matrix-irc bridge, closes #336 2020-06-28 08:52:26 -07:00
ice_iix 0626888197 1.16.1 protocol support (736) (#345)
* Update shifted packet ids

* Add new smithing recipe type

* Also support 1.16 (735), same packets as 1.16.1 (736)

New packets:

* GenerateStructure

New packet variants:

* UseEntity_Sneakflag, split from UseEntity_Hand

* ClientAbilities_u8, split from ClientAbilities_f32

* UpdateJigsawBlock_Joint, split from UpdateJigsawBlock_Type

* ServerMessage_Sender, split from ServerMessage_Position

* ChunkData_Biomes3D_bool, split from ChunkData_Biomes3D

* JoinGame_WorldNames, split from JoinGame_HashedSeed_Respawn

* Respawn_WorldName, split from Respawn_Gamemode

* EntityEquipment_VarInt renamed

* UpdateLight_WithTrust, split from UpdateLight_NoTrust

* LoginSuccess_UUID, split from LoginSuccess_String
2020-06-27 18:39:59 -07:00
ice_iix 0670e76e0c Reformat with cargo fmt, updates #301 #343 2020-06-27 18:09:05 -07:00
iceiix 85b9774f21
1.15.2 (578) protocol support (#338)
v1_15 is now used for both 1.15.1 and 1.15.2.

No protocol changes except ChangeGameState reason code values
2020-06-27 14:44:22 -07:00
Kezi e0d5d205c1
protocol: pub fields in struct Stack (#344) 2020-06-27 14:16:25 -07:00
Kezi dde28b48b7
Misc protocol fixes: position (fixes #301), 1.14+ block place, spawn object (#343)
* some protocol fixes

* remove newline
2020-06-27 14:08:33 -07:00
ice_iix 3f35673c77 Add rustfmt backup files to .gitignore, from #337 2020-06-21 12:32:11 -07:00
iceiix 518b6a07f8
Reformat all source with cargo fmt (#335) 2020-06-21 12:17:24 -07:00
iceiix 7279f4177e
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
2020-06-21 12:01:31 -07:00
ice_iix 55ff26409a Update to Rust stable 1.44.1, closes #258 2020-06-21 11:35:20 -07:00
Mèir Noordermeer b26500e1b2
Fix crash when window gets minimized (#332). Fixes #275
* Make sure aspect ratio is always valid

* Do not render while window has an invalid size (e.g. window is minimized)
2020-06-21 12:24:41 +02:00
ice_iix 0dd21a0a20 Update readme with contributions guidelines, open open source 2020-06-20 16:47:25 -07:00
ice_iix 41f8be6b90 Update to image 0.23.6, closes #333 2020-06-20 15:04:59 -07:00
Martin Kröning 54763da22d Get scale_factor from window instead of monitor
Fixes #316
2020-06-20 14:27:00 -07:00
iceiix a6bff21de8
Update to glutin 0.22.0 and winit 0.20.0 release (#268)
Thanks to @mwkroening (#317) and @martijnberger (#323) for helping fix this update.

* Update to glutin 0.22.0 and winit 0.20.0 release, removing alpha pinning

* scale_factor() replaces hidpi_factor()

* Listen for ScaleFactorChanged, separate from Resized event

* Fix getting physical size of window

* Fix logical mouse event coordinates
2020-06-20 13:55:45 -07:00
ice_iix a42d9a6761 Update dependencies with cargo update 2020-06-20 12:04:23 -07:00
ice_iix 852624f68a www: npm audit fix, closes #300, closes #324 2020-06-20 11:58:36 -07:00
ice_iix 9b2147c895 Update structopt, base64, zip, serde_json, reqwest, flate2, byteorder
Update to structopt 0.3.15, closes #330
Update to base64 0.12.2, closes #329
Update to zip 0.5.6, closes #328
Update to serde_json 1.0.55, closes #327
Update to reqwest 0.10.6, closes #321
Update to flate2 1.0.14, closes #303
Update to byteorder 1.3.4, closes #285
2020-06-20 11:49:21 -07:00
Kezi 3e96d2e03b
Add --username option to set offline username (#290) 2020-06-20 10:41:08 -07:00
Mèir Noordermeer 50befb5a0f
Do not redraw until main events are cleared (#315). Fixes #282
Fixes unresponsiveness to input
2020-06-20 10:26:47 -07:00
ice_iix a06928e6da www: npm audit fix to update deps, fixing GHSA-h9rv-jmmf-4pgx
https://github.com/advisories/GHSA-h9rv-jmmf-4pgx
https://github.com/iceiix/stevenarella/network/alert/www/package-lock.json/serialize-javascript/open
2020-02-02 09:08:46 -08:00
ice_iix 472208cc8c www: update README to remove wasm-pack; use cargo web start
wasm-pack is more broken, see https://github.com/iceiix/stevenarella/issues/171#issuecomment-581151711
cargo web start is still broken (#171) but less so
2020-02-02 09:07:51 -08:00
ice_iix dece047cd7 Remove clipboard crate git dependency, back to 0.5.0
The git dependency was only for wasm32-unknown-emscripten support:
https://github.com/aweinstock314/rust-clipboard/pull/62
but #92 changes to using wasm32-unknown-unknown instead, a better
supported path (though still incomplete in this project, see #171)
2020-02-02 08:29:20 -08:00
ice_iix ed7f06b1a8 Update deps: serde_json, structopt, image, rand, num-traits, reqwest
Closes #276 Bump serde_json from 1.0.44 to 1.0.45
Closes #274 Bump structopt from 0.3.7 to 0.3.8
Closes #273 Bump image from 0.22.3 to 0.22.4
Closes #272 Bump rand from 0.7.2 to 0.7.3
Closes #270 Bump num-traits from 0.2.10 to 0.2.11
Closes #269 Bump reqwest from 0.10.0 to 0.10.1
2020-02-02 08:19:15 -08:00
ice_iix bda0009a6f Add Cargo.toml for new steven_protocol crate. Closes #167 (#278)
Completes the move of the protocol implementation into a new
crate, named steven_protocol, in the protocol/ subdirectory.

* Add Cargo.toml for steven_protocol

* Add steven_protocol entrypoint in protocol/src/lib.rs

* Use steven_protocol in main

* Remove protocol in main, replaced by steven_protocol

* Remove unused dependencies moved into steven_protocol
2020-02-02 07:47:11 -08:00
iceiix fb7f47c70b
Add protocol implementation in subdirectory for #167 (#277)
Adds the protocol submodule, and required dependencies, in a new subdirectory
protocol/ for a separate crate in #167. This merge preserves the commit history
(without requiring --follow to view) using filter-branch as follows:

git checkout master
git checkout -b protocol_subtree
git filter-branch -f --prune-empty --subdirectory-filter src/protocol @
git filter-branch -f --prune-empty --tree-filter 'mkdir -p protocol/src/protocol; mv * protocol/src/protocol 1>/dev/null 2>/dev/null; true' @

git checkout master
git checkout -b protocol_deps_subtree
git filter-branch --index-filter 'git rm --cached -qr --ignore-unmatch -- . && git reset -q $GIT_COMMIT -- src/format.rs src/item.rs src/macros.rs src/nbt src/types' --prune-empty --
git filter-branch -f --prune-empty --tree-filter 'mkdir -p protocol/src; mv * protocol 1>/dev/null 2>/dev/null; true' @

git checkout protocol_subtree
git merge --allow-unrelated-histories protocol_deps_subtree

git checkout master
git checkout -b protocol_crate2
git merge --allow-unrelated-histories protocol_subtree
2020-02-02 07:36:23 -08:00
ice_iix baefa0a8de Add protocol in protocol/ subdirectory for #167 2020-02-02 05:52:26 -08:00
ice_iix 3baba519c8 Add protocol dependencies for #167 2020-02-02 05:50:17 -08:00
iceiix 87e0726f3f
blocks: split macro into multiple functions, fast! (#267)
Improves fix for #184, whereas #255 reduced optimizations,
we now address the underlying compiler limitation and split out
the one massive lazy_static! initialization function, into
one function per block in the block_registration_functions module.

Previous build time, with opt-level=1:

% time cargo build --release
   Compiling steven_blocks v0.0.1
    Finished release [optimized] target(s) in 21.24s
cargo build --release  31.80s user 0.71s system 152% cpu 21.276 total

With this change, opt-level=3 and the function splitting fix:

% time cargo build --release
   Compiling steven_blocks v0.0.1
    Finished release [optimized] target(s) in 30.80s
cargo build --release  40.26s user 0.86s system 133% cpu 30.850 total

Full optimizations are expectedly slightly slower, but this is still
much much _much_ faster than before this refactoring, where this crate
would take up to an unbelievable 5 hours (and tens of GB of RAM). Long
story short, we're now back to full optimizations and stable Rust.

Thanks to dtolnay on the Rust programming language forum for suggesting
this technique, https://users.rust-lang.org/t/5-hours-to-compile-macro-what-can-i-do/36508/2
2020-01-09 20:08:28 -08:00
ice_iix b563ca4394 protocol: atomics replace unsafe for version/debug. Closes #261 2020-01-08 18:57:57 -08:00
ice_iix e834ee2f53 protocol: atomics replace unsafe for version/debug. Closes #261 2020-01-08 18:57:57 -08:00
ice_iix 643de31073 protocol: atomics replace unsafe for version/debug. Closes #261 2020-01-08 18:57:57 -08:00
ice_iix 90f7d9afd9 Update sha-1 and zip dependencies
Closes #263 Bump sha-1 from 0.8.1 to 0.8.2
Closes #265 Bump zip from 0.5.3 to 0.5.4
2020-01-07 19:31:10 -08:00
ice_iix 15499ee95e steven_gl: update gl_generator, khronos_api, libc 2020-01-05 18:45:00 -08:00