stevenarella/src
iceiix c8e13c38bd Fix movement fixed-point packets, misplaced players on 1.7/8 (#140)
Movement packets were handled incorrectly, because although the fields are specified as integers they are actually fixed-point values, which need to be converted to floating-point before use. These fields were converted with `as f64`, but they actually need to be scaled. To fix this add several new types, FixedPoint5 for 5-bit fractional fixed-point and FixedPoint12 for 12-bit. Both are parameterized by an integer type: FixedPoint5<i32> and FixedPoint5<i8> for 1.7.10/1.8.9, FixedPoint12<i16> for 1.9+. This moves the calculation into the packet field parsing, so it no longer has to be calculated in src/server/mod.rs since the scaling is taken care of as part of the field type. This fixes the long-standing invisible or actually misplaced players bug on 1.7.10 and 1.8.9, closes #139.

* Add new FixedPoint5<T> type for 1.7/8, https://wiki.vg/Data_types#Fixed-point_numbers

* Add FixedPoint12<i16> for 1.9+, moving type conversion into packet type

https://wiki.vg/index.php?title=Protocol#Entity_Relative_Move

* Add num-traits 0.2.6 dependency for NumCast to use instead of From

* Use FixedPoint5<i32> in spawn object, experience orb, global entity, mob, player, teleport

* Use FixedPoint5<i8> and FixedPoint12<i16> in entity move, look and move

* Update packet handling bouncer functions, using f64::from for each conversion
2019-05-11 13:28:25 -07:00
..
console Use field init shorthand, instead of x:x, just x, 2018-11-04 13:43:30 -08:00
ecs Use field init shorthand, instead of x:x, just x, 2018-11-04 13:43:30 -08:00
entity Add double-jump to toggle creative flight. Closes #46 2019-01-26 13:00:19 -08:00
gl Update for glutin wasm_stub branch tracking Rust 2018 changes 2019-03-03 11:50:52 -08:00
model Update to rand 0.6.5 and migrate off deprecated methods. Closes #81 2019-05-08 19:32:05 -07:00
nbt 1.12.2 protocol support (340) (#40) 2018-12-02 19:37:41 -08:00
protocol Fix movement fixed-point packets, misplaced players on 1.7/8 (#140) 2019-05-11 13:28:25 -07:00
render Add support for compiling WebAssembly wasm32-unknown-unknown target (#92) 2019-03-03 08:32:36 -08:00
screen Add Forge handshake support. Closes #88 (#134) 2019-05-05 18:39:58 -07:00
server Fix movement fixed-point packets, misplaced players on 1.7/8 (#140) 2019-05-11 13:28:25 -07:00
types 1.14 protocol support (477) (#132). Closes #72 2019-05-04 16:04:19 -07:00
ui Update to rand 0.6.5 and migrate off deprecated methods. Closes #81 2019-05-08 19:32:05 -07:00
world Add 18w50a (451) multiprotocol support (#79) 2019-01-10 17:21:19 -08:00
auth.rs Update to use crate:: for current crate, for Rust 2018 edition 2018-11-04 12:06:00 -08:00
chunk_builder.rs Update to rand 0.6.5 and migrate off deprecated methods. Closes #81 2019-05-08 19:32:05 -07:00
format.rs Recognize translate text components, instead of showing "UNHANDLED" 2018-12-02 19:25:11 -08:00
item.rs 1.13.2 (404) multiprotocol support (#67) 2018-12-28 21:22:58 -08:00
macros.rs Base implementation for worlds/blocks 2016-03-18 22:24:30 +00:00
main.rs Add command-line option to change default protocol version 2019-05-06 16:00:01 -07:00
resources.rs Add support for compiling WebAssembly wasm32-unknown-unknown target (#92) 2019-03-03 08:32:36 -08:00
settings.rs Add double-jump to toggle creative flight. Closes #46 2019-01-26 13:00:19 -08:00