Commit Graph

106 Commits

Author SHA1 Message Date
iceiix 6ad43b3ccb
Merge pull request #731 from nathanruiz/digging
Add the ability to break blocks
2022-10-30 16:10:45 -07:00
Nathan Ruiz ee8e6cb9f3 Fix formatting 2022-10-30 21:46:21 +00:00
Nathan Ruiz 18b2641d66 Send correct dig packet for each version 2022-10-24 16:04:30 +00:00
Nathan Ruiz ddd9eb26e4 Fix formatting issues 2022-10-24 09:21:33 +00:00
Nathan Ruiz 700a31013f Add digging to ECS 2022-09-27 07:07:22 +00:00
Nathan Ruiz 7edc7ee4fa Parse light values in 1.18 2022-09-18 04:45:00 +00:00
iceiix bbbe58a112
Update to Rust 1.59.0 (#718)
* Update to Rust 1.59.0

* Fix clippy::single_char_pattern in console, ui/logo

* Fix clippy::needless_late_init in load_block_entities
2022-08-28 08:27:39 -07:00
iceiix 1f183ed76e
1.18.1 protocol (757) (#640)
https://wiki.vg/index.php?title=Protocol&oldid=17203 1.18.1
https://wiki.vg/index.php?title=Protocol&type=revision&diff=17203&oldid=16918 1.18.1 vs 1.17.1

* protocol: add UpdateSimulationDistance packet and update IDs
* protocol: add JoinGame_WorldNames_IsHard_SimDist packet variant
* protocol: add UpdateBlockEntity_VarInt packet variant
* protocol: start adding ChunkData_AndLight, combining ChunkData + UpdateLight
* protocol: ChunkData_AndLight: add struct BlockEntityAtPackedLocation

* server: handle JoinGame_WorldNames_IsHard_SimDist packet variant
* server: handle combined chunk data and light packet
* server: on_chunk_data_and_light: set all bits in now-removed bitmask

* bit map: add derived std::fmt::Debug implementation
* bit map: allow creating, but not accessing, zero-length bit maps

* world: sanity check chunk bit_size, failing earlier
* world: read biome data bits after palette
* world: support single-valued palettes
* world: handle single-valued biomes
* world: add checks for direct palettes; update comments
* world: parse dimension tags
* world: load dimension type tags: min_y
* world: skip chunk sections underneath y<0
* world: force filling sky on 1.18+ for now, workaround until mask/fill_sky can be calculated correctly wrt min_y

* readme: add 1.18.1 (757)
2022-08-06 16:32:40 -07:00
iceiix cfcc7d2a1f
1.17.1 (756) protocol (#605)
https://wiki.vg/index.php?title=Protocol&oldid=16918

New and changed packets:
* 1.17.1 packet id shifts, new clientbound packets
* Add WindowPong new packet serverbound
* Add Tags_Nested packet variant
* Add TeleportPlayer_WithDismount packet variant
* Add ChunkData_Biomes3D_Bitmasks packet variant 
* Add WindowItems_StateCarry variant, split WindowItems_i16
* Add WindowSetSlot_State packet variant
* Add Explosion_VarInt packet variant
* Add UpdateLight_Arrays variant
* Add ResourcePackSend_Prompt variant
* Add SpawnPosition_Angle variant
* Add EntityProperties_VarIntVarInt variant, using VarInts in both fields 
* Add ClientSettings_Filtering variant
* Add ClickWindow_State variant
* Add EditBook packet variant 
* Fix many Particle packet variant definitions

* server: handle TeleportPlayer_WithDismount
* server: handle ChunkData_Biomes3D_Bitmasks

* world: add num_sections to self.load_chunk19_or_115
* world: load_chunk19_to_117: accept 64-bit mask

* metadata: add PoseData::LongJumping 

* protocol: update Cargo.lock for serde_json 1.0.130
* build: pin to wasm-pack 0.10.0
2021-09-05 13:30:32 -07:00
ice_iix 3d1bea85fe Fix clippy::needless_borrow 2021-08-01 06:19:48 -07:00
ice_iix 53a0bc9fb6 Fix clippy::manual_flatten, use flatten() 2021-06-18 19:32:26 -07:00
Kezi 8cecbb37e3
server: fix block placement in 1.16 (#512)
* fix block placement in 1.16

* fmt
2021-03-03 19:34:36 -08:00
ice_iix d7b7216315 server: thread_rng is a CSPRNG, closes #508 2021-03-03 19:11:56 -08:00
iceiix 3e3bcdc5da
protocol, console, server: receive chat messages (#479)
Implements support for receiving chat messages from the server, the
first step towards #63 chat support. Long way to go, but is a start.

* server: handle ServerMessage_* packets, on_servermessage

* format: get the with arguments of translations
* format: hardcode chat types
* format: support bare strings, used in chat.type.text
* format: use extra text if present, fixes missing username on 1.16.5

* console/main/server: activate on receiving chat messages
2021-01-24 17:41:16 -08:00
iceiix 6b961622aa
forge: add FML2 protocol support (1.13.2-1.16.5+), fixes #400 (#494)
Allows connecting to newer Forge servers, 1.13.2 to 1.16.5 at least, which use
the FML2 handshake protocol:

https://wiki.vg/Minecraft_Forge_Handshake#FML2_protocol_.281.13_-_Current.29

Tested with a modded 1.16.5 server

Extends #88 #134 Forge FML (v1, for 1.7.10 - 1.12.2)

* protocol: update Cargo.lock
* protocol: send FML2 on fmlNetworkVersion: 2
* protocol: factor out read_raw_packet_from()
* protocol: move plugin message writing from Server to Conn; add write_fml2_handshake_plugin_message
* protocol: CommandNode: add forge:modid, forge:enum
* forge: add fml2 handshake packets
* server: handle fml:loginwrapper fml::handshake packets
2021-01-23 13:47:30 -08:00
iceiix 0b4c56b803
1.7.10: populate player info on spawn, fixes #141 (#485)
PlayerInfo post-1.7.10 has the UUID, so it populates the self.players map,
in 1.7.10 there is only enough information for the client <tab> list. To fix
this, instead populate self.players in SpawnPlayer, for the 1.7.10 variant.

Fixes player name tags showing as "MISSING" on 1.7.10 servers.
2021-01-18 13:53:09 -08:00
iceiix 8ca12a69ce
blocks: versioned block states, fixes world on fire #467 (#469)
Since the unflattening in 1.13.x, block IDs are no longer stable across versions, and
can be shifted by the addition of new block states. To get the right block IDs across
multiple protocol versions, add a new `offsets` token to `define_blocks!`, which
is similar to `offset` (used post-flattening, compare to `data` used pre-flattening),
but accepts a protocol_version argument to enable block states _per-version_:

* Add 'offsets' for protocol_version-specific blockstates

As part of this change, by_vanilla_id is now a method of a VanillaIDMap instance,
instead of a method of Block, so it can know the protocol version. Previously, the
ID map was lazily computed statically, once, but this change allows it to be
computed based on protocol version:

* Move by_vanilla_id to VanillaIDMap instance

Tools to help debug blocks:

* Add DEBUG_BLOCKS environment variable to dump block states
* Add dump_block command-line tool

The block `offset`s were previously only correct for 1.13.2, to take advantage of
the new version-specific `offsets` capability, blocks were updated for 1.14.x:

1.14+ (protocol_version >= 477):
* Add NoteBlock instruments
* Add FlowerPot and RedFlowerVariant cornflower, wither rose, lily of the valley
* Add StandingSign wood variants
* Add WallSign tree variants
* Add StoneSlab smooth stone, cut sandstone, cut red sandstone

This fixes #467, where grass was misinterpreted as fire on 1.14+ because of the
ID shifts caused by NoteBlock, among other block misassignments (though not 100%).
2021-01-13 19:50:05 -08:00
ice_iix 80887eec91 1.16.2+: fix Respawn dimension field, closes #452 2020-12-27 18:13:51 -08:00
ice_iix 71121bd572 load_block_entities: check for missing id, fixes #445 2020-12-27 17:49:22 -08:00
iceiix 4a757656ab 1.16.4 (754) / 1.16.3 (753) / 1.16.2 (751) protocol (#390)
Adds support for 1.16.4 (754) / 1.16.3 (753) / 1.16.2 (751) protocols

* Update packet IDs and readme

* Add and handle ChunkData_Biomes3D_VarInt variant

* Support world chunk data padded bit map array

* Add and handle JoinGame_WorldNames_IsHard variant

* Add and handle MultiBlockChange_Packed variant

* Add UnlockRecipes_WithBlastSmoker variant

* Add SetDisplayedRecipe and SetRecipeBookState packets
2020-11-24 19:01:57 -08:00
ice_iix d362f136f1 1.15.1+: handle SpawnPlayer variant, fixes #357 2020-07-05 00:21:26 -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 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 d496eaf3bb Use is_*() instead of if let x(_), fixes redundant_pattern_matching 2020-06-30 18:50:46 -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 55856ccf1b Allow TeleportFlag enum variant names Rel..., Rel..., as they are all relative 2020-06-29 18:26:29 -07:00
ice_iix c3038f82ce Remove redundant imports (single_component_path_imports) 2020-06-29 18:01:02 -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 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
iceiix 518b6a07f8
Reformat all source with cargo fmt (#335) 2020-06-21 12:17:24 -07:00
ice_iix 643de31073 protocol: atomics replace unsafe for version/debug. Closes #261 2020-01-08 18:57:57 -08:00
ice_iix 20bcddfb13 Replace into_iter() -> iter() for arrays, fixes 1.42-nightly warning
warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added.
   --> src/entity/player.rs:363:11
    |
363 |         ].into_iter().enumerate() {
    |           ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter`
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145>
2020-01-04 19:33:05 -08:00
ice_iix 2daca512b0 1.15.1 protocol support (575) (#252)
* Add v1_15_1 for protocol 575

* Update for shifted packet IDs

https://wiki.vg/index.php?title=Pre-release_protocol&oldid=15213#Packets
https://wiki.vg/Pre-release_protocol

* Add SpawnMob packet variant, no metadata

* Add SpawnPlayer packet variant, no metadata

* Add block update actions comments, including beehive

* Add particle packet variant with 64-bit floats

* Add and handle join game and respawn packet variants, with hashed seeds

* Add chunk data packet variant with 3D biomes

https://wiki.vg/index.php?title=Pre-release_protocol&oldid=15213#Chunk_Data
"1024 biome IDs, ordered by x then z then d, in 4×4×4 blocks. Not
present if full chunk is false."

This is a fixed-size array of integers, but Rust doesn't yet support
generics over integers, so the 1024-element array doesn't support
fmt::Debug, hence we wrap it and implement fmt::Debug ourselves.

* Add load_chunk115 to not read chunk data structure biomes

https://wiki.vg/index.php?title=Pre-release_protocol&oldid=15213#Data_structure
2019-12-29 15:55:19 -08:00
ice_iix 19948ff397 Fix redundant imports on rustc 0.35.0. Fixes #175 2019-05-30 18:13:54 -07:00
ice_iix fd028d41b0 Replace println! with log crate facade macros info!, debug!, etc. 2019-05-22 16:01:14 -07:00
iceiix e9b336192a Add support for a modded block: rockwool from Thermal Expansion (#153)
The first in support for modded content, a simple custom block: "rockwool" from the Thermal Expansion and Thermal Foundation mods for Forge:

https://ftb.gamepedia.com/Rockwool_(Thermal_Expansion_3)

This makes use of the Forge handshake (#88 #134 #144), matching the mod block names from the negotiation to numeric identifiers in the world to steven_blocks. Rockwool was chosen due to ease of implementation, it looks like wool from vanilla (except is fire-proof), and by supporting it the groundwork necessary is laid for more sophisticated mod support.

Tested with Thermal Expansion on 1.7.10, 1.10.2 (FTB Beyond), and 1.12.2 Forge servers.

* Add `modid` macro token, skipped from vanilla mappings

* Add ThermalExpansionRockwool block (1.7.10)

* Register modded blocks by modid->[data], and lookup block metadata

* Save block IDs from ModIdData/RegistryData to World modded_block_ids

* Add namespaced mod ids for ModIdData, \u{1}=block \u{2}=item

* Add ThermalFoundation's Rockwool (1.12.2)
2019-05-15 12:49:57 -07:00
iceiix 0cd02fd2da
Forge 1.8.9-1.12.2 handshake protocol support (#144)
Adds support for connecting to Forge servers from 1.8.9 up to 1.12.2.
(1.7.10 was already supported with #134 #88)

Tested on:

- 1.8.9 + forge 11.15.1.2318 + ironchest
- 1.10.2 + forge 12.18.3.2511 + ironchest
- 1.11.2 + forge 13.20.1.2588 + ironchest
- 1.12.2 + forge 14.23.5.2837 + ironchest

Changes:

* Parse and handle FmlHs::RegistryData packet for 1.8+

* Fix RegistryData acknowledgement phase WaitingServerComplete

* Fix acknowledgement phase for 1.7.10 ModIdData too, somehow it worked accidentally

* Append \0FML\0 to end of server hostname if Forge mods detected

https://wiki.vg/Minecraft_Forge_Handshake#Connection_to_a_forge_server
2019-05-11 18:37:33 -07:00
ice_iix ba4a7a9d85 1.7.10: Fix player position too high on login. Closes #87
Adds a new TeleportPlayer_NoGround packet, which is subtly different
from TeleportPlayer_NoConfirm. The flags u8 is replaced with an
on_ground bool, but more importantly the Y position is the eyes
position, so we have to translate to feet position for the client.

1.7.10: https://wiki.vg/index.php?title=Protocol&oldid=6003#Player_Position_And_Look
1.8.9: https://wiki.vg/index.php?title=Protocol&oldid=7368#Player_Position_And_Look
2019-05-11 14:53:42 -07:00
ice_iix a159355751 1.7.10: Fix sending head/feet player position, #87
1.8+ removes the player head position, and sends only the feet position.
We store the feet position internally in the client, so the head
position has to be calculated, normally 1.62 units higher. Previously
the calculation was reversed, which caused the client to show its
position as 1.62 units higher than the server, and the server would
correct the position when the client descends to the ground.

1.7.10: https://wiki.vg/index.php?title=Protocol&oldid=6003#Player_Position
1.8.9: https://wiki.vg/index.php?title=Protocol&oldid=7368#Player_Position
2019-05-11 14:24:41 -07:00
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
ice_iix 06cab07ae6 Log plugin messages only if -n/--network-debug enabled 2019-05-08 19:11:23 -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 eca9b8ae00 1.14 protocol support (477) (#132). Closes #72
Adds 1.14 (477) protocol support, based on:

https://wiki.vg/index.php?title=Pre-release_protocol&oldid=14723

* New packets: SetDifficulty, LockDifficulty, UpdateJigsawBlock, UpdateViewPosition, UpdateViewDistance

* New metadata: Optional VarInt (17) and Pose (18)

* Add new join game variant with view distance, without difficulty

* Add new server difficulty variant, with locked boolean

* Implement recipe parsing changes, add stonecutting recipe type
2019-05-04 16:04:19 -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 9adf589436
Add 18w50a (451) multiprotocol support (#79)
Adds 18w50a (451) multiprotocol support, last snapshot of 2018
Reference: https://wiki.vg/index.php?title=Pre-release_protocol&oldid=14491

* Use v18w50a module for protocol

* Add blasting, smoking, and suspicious stew recipe types

* Add entity tags to tags packet

* Add chunk data packet variant with height map

* Add update light packet

* Add chunk format parsing with block_count, without skylights, conditionalize on protocol_version >= 451

* Add villager data entity metadata type parsing

https://wiki.vg/Pre-release_protocol#Entity_Metadata

* Add open book and entity sound effect packets
2019-01-10 17:21:19 -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 11f2d2ae13 1.13.2 (404) multiprotocol support (#67)
Adds support for 1.13.2 protocol (404)
Expands https://github.com/iceiix/steven/issues/18 Enhance protocol support

Metadata:

* Support 1.13.2 slot data format, bool and varint item id, optional damage (moved to NBT)

https://wiki.vg/index.php?title=Slot_Data&type=revision&diff=14363&oldid=7835

Packets:

* Add 1.13.2 packets, and implement all the command data parsers

https://wiki.vg/Command_Data#Parsers

* Send new plugin channel minecraft:brand

https://wiki.vg/Plugin_channels#minecraft:brand

* Add 1.13.2 metadata format, with shifted IDs

https://wiki.vg/Entity_metadata#Entity_Metadata_Format

* Implement particle entity metadata

* Add structures for 16 new packets

Blocks: The Flattening:

* Assign flattened IDs in correct order using new 'offset' macro token

* Assign hierarchical (pre-flattening) block IDs sequentially by counting Some data

* Split VANILLA_ID_MAP into flat/hier struct, to support before and after the flattening

* Extend travis build time to 20 minutes because the blocks macro takes a long time

* Support both flat/hier blocks by passing protocol_version to by_vanilla_id

Add block states and offsets for all blocks, replacing metadata for 1.13+:

* Add stripped logs and what was Log2 to Log
* Add the Wood blocks, should be called bark, previously Axis::None Log
* Add leaves distance and offset
* Add jungle/acacia to Leaves moved from Leaves2
* Add dispenser offsets, direction
* Add note block states
* Add offset None to Missing253 and Missing254, no holes in block states of 1.13.2
* Add bed colors
* Add seagrass, tall seagrass, remove redundant deadgrass, and piston offset
* Add torch, TNT, fire offsets, remove slabs
* Add furnance offset, merges lit into a property
* Add pressure plate offsets, new pressure plates, redstone ore/lit merged
* Add lever offsets, new directions from ceiling/floor, rename LeverDirections
* Add redstone torch offsets, new blocks since lit/unlit is now merged, and standing/wall is split
* Change lever to split face/facing, rm LeverDirection, add AttachedFace
* Add stone button offsets, face/facing similar to lever
* Move face/facing data and variant to AttachedFace, reuse for lever/stonebutton
* Add data_with_facing_and_powered() to AttachedFace, for lever/stonebutton
* Add wooden button offsets each wood
* Add pumpkin without a face
* Add carved pumpkin, portal offsets
* Add lit pumpkin (as jack-o-lantern) offsets after carved pumpkin
* Add repeater offsets, merged into Repeater
* Change brown mushroom block to booleans instead of MushroomVariant
* Add mushroom block offsets, red/brown mushroom blocks, and a new mushroom stem block
* Add command block, cobblestone walls, and flower pot offsets
Empty flower pot, and potted plants including saplings. Rename
variant DarkOak to DarkOakSaplings because it is a sapling, and
remove the duplicate Dandelion variant which causes duplicate blocks.
* Increase recursion limit in steven_blocks
* Add colored banner offsets
* Add wooden slab including double slab, in a different position for pre-1.13 and 1.13
* StoneSlabVariant::Wood -> StoneSlabVariant::PetrifiedWood
* Add fence_gate_offset() for wooden fence gates
* Add frosted ice age, offset
* Add new blocks: kelp, turtle egg, coral, coral fans, sea pickle, blue ice, smooth stone
* Add new blocks: conduit, void air, cave aid, bubble column, last of the 1.13 blocks
2018-12-28 21:22:58 -08:00
iceiix 2b641c9af3 1.7.10 (5) multiprotocol support (#64)
Adds 1.7.10 protocol version 5 support, a major update with significant changes.
Expands https://github.com/iceiix/steven/issues/18 Enhance protocol support

* Add v1_7_10 protocol packet structures and IDs

* EncryptionRequest/Response i16 variant in login protocol

* 1.7.10 slot NBT data parsing

* Support both 1.7/1.8+ item::Stack in read_from, using if protocol_verson

* 1.7.10 chunk format support, ChunkDataBulk_17 and ChunkData_17

* Extract dirty_chunks_by_bitmask from load_chunks17/18/19

* Implement keepalive i32 handler

* Send PlayerPositionLook_HeadY

* Send PlayerBlockPlacement_u8_Item_u8y

* Handle JoinGame_i8_NoDebug

* Handle SpawnPlayer_i32_HeldItem_String

* BlockChange_u8, MultiBlockChange_i16, UpdateBlockEntity_Data, EntityMove_i8_i32_NoGround, EntityLook_i32_NoGround, EntityLookAndMove_i8_i32_NoGround

* UpdateSign_u16, PlayerInfo_String, EntityDestroy_u8, EntityTeleport_i32_i32_NoGround

* Send feet_y = head_y - 1.62, fixes Illegal stance

https://wiki.vg/index.php?title=Protocol&oldid=6003#Player_Position

> Updates the players XYZ position on the server. If HeadY - FeetY is less than 0.1 or greater than 1.65, the stance is illegal and the client will be kicked with the message “Illegal Stance”.

> Absolute feet position, normally HeadY - 1.62. Used to modify the players bounding box when going up stairs, crouching, etc…

* Set on_ground = true in entity teleport, fixes bouncing

* Implement block change, fix metadata/id packing, bounce _u8 through on_block_change

* Implement on_multi_block_change_u16, used with explosions
2018-12-17 15:59:17 -08:00
ice_iix 46999f59bb Add protocol version global mutable to merge Metadata18/19 into one
Cleans up https://github.com/iceiix/steven/pull/57 1.8.9 (47) multiprotocol support
which added too much code duplication, Metadata19 vs Metadata18, and
different packets for each, the only difference being how it was parsed.

Instead, switch back to using only one Metadata implementation, but with
parsing conditionalized on a new global mutable: SUPPORTED_PROTOCOL_VERSION.
Accessing global mutable state is unsafe but it is only set when
initializing the connection, and only read when deep enough in the code
where it is not feasible to pass otherwise. More elegant, worth it.
2018-12-11 18:18:25 -08:00
ice_iix 1cb671093d 1.8.9 (47) multiprotocol support (#57)
Protocol 47 (1.8.9-1.8) is the biggest multiprotocol (https://github.com/iceiix/steven/issues/18) change yet:

* New chunk format (load_chunk18)
* New metadata format (Metadata18)
* New packets and changes to 13 packets

References:

http://wiki.vg/index.php?title=Protocol&oldid=7368
https://wiki.vg/Protocol_version_numbers#Versions_after_the_Netty_rewrite
https://wiki.vg/Protocol_History#1.8
https://github.com/PrismarineJS/minecraft-data/blob/master/data/pc/1.8/protocol.json
1.8 chunk format: https://wiki.vg/index.php?title=Chunk_Format&oldid=6124
1.9 chunk format: https://wiki.vg/index.php?title=Chunk_Format&oldid=7411
1.8 vs 1.9: https://wiki.vg/index.php?title=Chunk_Format&diff=7411&oldid=6124
https://github.com/PrismarineJS/prismarine-chunk/blob/master/src/pc/1.8/section.js
https://github.com/PrismarineJS/prismarine-chunk/blob/master/src/pc/1.8/chunk.js

Details:

* Add 1.8.9 packet IDs from https://github.com/iceiix/steven/pull/37

* Add ChunkDataBulk, parse the ChunkMeta and save data in Vec<u8>

* Add EntityEquipment u16 variant, EntityStatus, ChunkData u16 variants

* SpawnPlayer with added held item

https://wiki.vg/Protocol_History#15w31a Removed Current Item short from Spawn Player (0x0C)

* SpawnObject no UUID and optional velocity

https://wiki.vg/index.php?title=Protocol&oldid=7368#Spawn_Object
https://wiki.vg/Protocol_History#15w31a
Added Entity UUID after entity ID to Spawn Object (0x0E)
Spawn Object always sends velocity, even if data is 0

* SpawnMob no UUID variant

https://wiki.vg/Protocol_History#15w31a
Added Entity UUID after entity ID to Spawn Mob (0x0F)

* Maps packet without tracking position boolean

https://wiki.vg/index.php?title=Protocol&oldid=7368#Map
https://wiki.vg/Protocol_History#15w34a
Added tracking position boolean to Map (0x34)

* Update Entity NBT was removed and Bossbar added (both 0x49) >1.8

https://wiki.vg/index.php?title=Protocol&oldid=7368#Update_Entity_NBT
https://wiki.vg/Protocol_History#15w31a
Removed Update Entity NBT Packet (0x49)
Added Boss Bar packet (0x4

* Use entity without hands

https://wiki.vg/index.php?title=Protocol&oldid=7368#Use_Entity
https://wiki.vg/Protocol_History#15w31a
Added VarInt enum for selected hand in Use Entity (0x02); only sent if type is interact or interact at

* Player block placement, held item stack and face byte variant

https://wiki.vg/index.php?title=Protocol&oldid=7368#Player_Block_Placement
https://wiki.vg/Protocol_History#15w31a
Face for Player Block Placement is now a VarInt enum instead of a byte
Replaced held item (slot) with VarInt enum selected hand in Player Block Placement

* Arm swing without hands, a packet with no fields, uses a ZST

https://wiki.vg/index.php?title=Protocol&oldid=7368#Animation_2
https://github.com/iceiix/steven/pull/57#issuecomment-444289008
https://doc.rust-lang.org/nomicon/exotic-sizes.html

* ClickWindow uses u8 mode, same as in 15w39c

* ClientSettings without hands

* SpectateTeleport is added before ResourcePackStatus

* Copy load_chunk to load_chunk19 and load_chunk18

* 1.8 chunk reading implementation, load_chunk18

* Support both metadata formats, Metadata18/Metadata19

* Remove fmt::Debug

* Implement formatting in MetadataBase and bounce through fmt::Debug
2018-12-09 12:03:55 -08:00
iceiix 3f5024d4ec
Add 15w39c (74) multiprotocol support (#56)
Closes https://github.com/iceiix/steven/pull/17
This is the biggest multi-protocol change yet, adding many new packet variants and implementing the most, necessitating a respectable amount of refactoring. The last of the "easy" protocols (already implemented, and cribbed from Steven commit history).
For https://github.com/iceiix/steven/issues/18 Enhance protocol support

* Add 15w39c packet IDs

* Add 15w39c packet changes

* Implement EntityMove i16 and i8 packet variants

* Implement EntityLookAndMove i16 and i8 packet variants

* Implement TeleportPlayer no confirm / with confirm packet variants

* Implement EntityTeleport f64 and i32 packet variants

* Implement SpawnPlayer f64 and i32 packet variants
2018-12-03 19:29:02 -08:00
ice_iix b6de7103a7 Add 1.9 (107) multiprotocol support
Closes https://github.com/iceiix/steven/pull/16
Enhances https://github.com/iceiix/steven/issues/18
2018-12-03 16:06:20 -08:00
ice_iix 166079ab06 Add 1.9.2 (109) multiprotocol support
Closes https://github.com/iceiix/steven/pull/15
Enhances https://github.com/iceiix/steven/issues/18
2018-12-03 15:40:57 -08:00
ice_iix 7e54e68d72 Add 1.10.2 (210) multiprotocol support
Closes https://github.com/iceiix/steven/pull/14
Enhances https://github.com/iceiix/steven/issues/18
2018-12-03 15:04:39 -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 411e4f69a6 Remove unnecessary 'extern crate's in Rust 2018 edition, import macros
https://rust-lang-nursery.github.io/edition-guide/print.html#no-more-extern-crate
https://rust-lang-nursery.github.io/edition-guide/rust-2018/macros/macro-changes.html
https://github.com/iceiix/steven/pull/13#issuecomment-435702507
2018-11-04 12:39:23 -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
ice_iix db02f9e790 Update try!() to new ? syntax for Rust 2018 edition
Not automatically updated, see https://users.rust-lang.org/t/why-does-cargo-fix-replace-try-with-r-try-instead-of/21972/3
There are other tools to replace it, btu this is what I used:
find src -name '*.rs' -exec perl -MRegexp::Common -0777 -pe'$bp=$RE{balanced}{-parens=>"()"}; s/try\!($bp)/substr($1, 1, length($1) - 2) . "?"/ges' -i {} \;
2018-11-04 11:48:51 -08:00
iceiix 1589a29685
Remove use of OpenSSL for RSA PKCS1 encryption (#12). Closes #2
* Add handwritten RSA PKCS1 encryption using num-bigint and simple_asn1

* Add more logging to compare OpenSSL with/without side-by-side

* Log message and ciphertext in hex

* Print N and e as hexadecimal integers

* Fix bad encryption caused by zeros in PKCS1 padding

PS field in https://tools.ietf.org/html/rfc8017#section-7.2.1
Must be nonzero

* Use rand fill instead of rand_bytes

* Remove OpenSSL!

* Update CI scripts and docs to not install OpenSSL

* Remove copying OpenSSL DLLs (libeay and ssleay) in AppVeyor script

* Change rsa_public_encrypt_pkcs1 to return a Result<Vec<u8>, String>

* Add error checking, returning Err<String> on failure; RFC comments

* Add the required message representative range checking

* Use expect() instead of unwrap() on from_der

* Map the ASN.1 error to a String to return it from rsa_public_encrypt_pkcs1() instead of panicking

* Move RSA to a new crate, rsa_public_encrypt_pkcs1

https://github.com/iceiix/rsa_public_encrypt_pkcs1

* Update to rsa_public_encrypt_pkcs1 with simple_asn 0.1.0

https://github.com/iceiix/rsa_public_encrypt_pkcs1/issues/1

* Update to published version of rsa_public_encrypt_pkcs1, 0.1.0

* Remove unnecessarily added blank line

* Remove libssl-dev from .travis.yml
2018-11-04 09:40:51 -08:00
ice_iix 51a5e3ed5c Update to rust-openssl 0.10.15 (from 0.7.8)
Major API change, the last of the outdated dependencies
Closes https://github.com/iceiix/steven/issues/4

Note: would still like to replace the last usages of the OpenSSL crate
https://github.com/iceiix/steven/issues/2 but it is needed for CFB8
until a replacement is available (maybe https://github.com/RustCrypto/stream-ciphers/issues/4)
2018-10-27 19:56:34 -07:00
ice_iix 80c740c1c5 Update to cgmath 0.16.1, collision 0.18.0
https://github.com/iceiix/steven/issues/4
2018-10-27 18:11:26 -07: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 562ab9dbc4 Remove unused username field in Server. Closes https://github.com/iceiix/steven/issues/1 2018-09-30 00:25:07 -07:00
Techcable 1e8c3582ed Update to Minecraft 1.11 (Fixes #63) 2016-12-09 14:32:02 +00: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
Techcable 555b646696 Update to minecraft 1.10.2 2016-07-10 12:23:59 +01:00
Thinkofname b0c54a3561 Don't leak the block targeting model when disconnecting from a server 2016-04-22 00:01:38 +01:00
Thinkofname 9c816c7ea1 Implement interaction with blocks 2016-04-21 20:25:58 +01:00
Thinkofname 98422678a3 Add block targeting 2016-04-21 19:53:47 +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 ebc11224e7 Fix the player's body glitching when moving 2016-04-20 22:16:40 +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 e35a122305 Rework movement to improve compatibility with servers using NoCheatPlus (Fixes #35) 2016-04-09 00:40:35 +01:00
Thinkofname 1df78ad1c9 Fix handling of pitch for teleports/moves 2016-04-08 22:33:35 +01:00
Thinkofname 1f91a10678 Fix teleports having the look direction inverted 2016-04-08 21:35:08 +01:00
Thinkofname fc82b62a04 Send a MC|Brand plugin message when joining servers 2016-04-08 18:30:05 +01:00
Scetch 64ec2e4d3b Cleaning up blocks a little bit. 2016-04-08 11:30:41 -04:00
Thinkofname d8b90b74bc Support being kicked from servers 2016-04-08 01:41:26 +01:00
Thinkofname 548c98edf8 Add basic nameplates to players 2016-04-07 21:30:20 +01:00
Thinkofname e157daecaf Implement player entities 2016-04-07 20:44:21 +01:00
Thinkofname 8469b32061 Initial skin support 2016-04-07 15:55:03 +01:00
Thinkofname 0bbb10918e Store the client's UUID and username when logging in 2016-04-06 22:50:31 +01:00
Thinkofname f8e2d0333e Drop steven_openssl in favor of using the openssl crate (Closes #31) 2016-04-05 19:36:59 +01:00
Thinkofname 40170953eb Track player list information 2016-04-05 18:50:53 +01:00
Thinkofname 830f1e55a6 Support legacy color codes on signs 2016-04-04 23:08:01 +01:00
Thinkofname c117f28b2a Block entity support, implement signs 2016-04-04 22:08:24 +01:00
Thinkofname 10b32c03c5 Add trees to the main menu 2016-04-03 21:45:09 +01:00
Thinkofname d2e1eba8f9 Make the main menu look nicer 2016-04-03 21:17:02 +01:00
Thinkofname 98ecd348c6 Replace usages of x,y,z for block positions with Position 2016-04-03 20:53:40 +01:00