Skip to content

Commit

Permalink
1.17.1 (756) protocol (#605)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
iceiix authored Sep 5, 2021
1 parent 83bbb9f commit cfcc7d2
Show file tree
Hide file tree
Showing 29 changed files with 607 additions and 158 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ jobs:
- name: Install wasm-pack
uses: jetli/wasm-pack-action@v0.3.0
with:
version: 'latest'
version: 'v0.10.0'
- name: Build binary
run: |
rustup target add wasm32-unknown-unknown
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Discussion forum: [https://github.com/iceiix/stevenarella/discussions](https://g

| Game version | Protocol version | Supported? |
| ------ | --- | --- |
| 1.17.1 | 756 ||
| 1.16.5 | 754 ||
| 1.16.4 | 754 ||
| 1.16.3 | 753 ||
Expand Down
4 changes: 2 additions & 2 deletions protocol/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions protocol/src/protocol/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ use std::io::{Read, Write};
use std::net::TcpStream;
use std::sync::atomic::{AtomicBool, AtomicI32, Ordering};

pub const SUPPORTED_PROTOCOLS: [i32; 24] = [
754, 753, 751, 736, 735, 578, 575, 498, 490, 485, 480, 477, 452, 451, 404, 340, 316, 315, 210,
109, 107, 74, 47, 5,
pub const SUPPORTED_PROTOCOLS: [i32; 25] = [
756, 754, 753, 751, 736, 735, 578, 575, 498, 490, 485, 480, 477, 452, 451, 404, 340, 316, 315,
210, 109, 107, 74, 47, 5,
];

static CURRENT_PROTOCOL_VERSION: AtomicI32 = AtomicI32::new(SUPPORTED_PROTOCOLS[0]);
Expand Down
282 changes: 243 additions & 39 deletions protocol/src/protocol/packet.rs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions protocol/src/protocol/versions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ mod v1_14_4;
mod v1_15;
mod v1_16_1;
mod v1_16_4;
mod v1_17_1;
mod v1_7_10;
mod v1_8_9;
mod v1_9;
Expand All @@ -26,6 +27,7 @@ mod v1_9_2;
pub fn protocol_name_to_protocol_version(s: String) -> i32 {
match s.as_ref() {
"" => SUPPORTED_PROTOCOLS[0],
"1.17.1" => 756,
"1.16.5" => 754,
"1.16.4" => 754,
"1.16.3" => 753,
Expand Down Expand Up @@ -69,6 +71,7 @@ pub fn translate_internal_packet_id_for_version(
to_internal: bool,
) -> i32 {
match version {
756 => v1_17_1::translate_internal_packet_id(state, dir, id, to_internal),
754 | 753 | 751 => v1_16_4::translate_internal_packet_id(state, dir, id, to_internal),
736 => v1_16_1::translate_internal_packet_id(state, dir, id, to_internal),
735 => v1_16_1::translate_internal_packet_id(state, dir, id, to_internal),
Expand Down
8 changes: 4 additions & 4 deletions protocol/src/protocol/versions/v15w39c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ protocol_packet_ids!(
0x11 => ConfirmTransaction
0x12 => WindowClose
0x13 => WindowOpen
0x14 => WindowItems
0x14 => WindowItems_i16
0x15 => WindowProperty
0x16 => WindowSetSlot
0x17 => SetCooldown
0x18 => PluginMessageClientbound
0x19 => Disconnect
0x1a => EntityAction
0x1b => Explosion
0x1b => Explosion_i32
0x1c => ChunkUnload
0x1d => SetCompression
0x1e => ChangeGameState
Expand Down Expand Up @@ -103,14 +103,14 @@ protocol_packet_ids!(
0x3f => ScoreboardObjective
0x40 => Teams_u8
0x41 => UpdateScore
0x42 => SpawnPosition
0x42 => SpawnPosition_NoAngle
0x43 => TimeUpdate
0x44 => Title_notext_component
0x45 => UpdateSign
0x46 => PlayerListHeaderFooter
0x47 => CollectItem_nocount
0x48 => EntityTeleport_i32
0x49 => EntityProperties
0x49 => EntityProperties_VarInt
0x4a => EntityEffect
}
}
Expand Down
14 changes: 7 additions & 7 deletions protocol/src/protocol/versions/v18w50a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protocol_packet_ids!(
0x08 => ClickWindow
0x09 => CloseWindow
0x0a => PluginMessageServerbound
0x0b => EditBook
0x0b => EditBook_Item
0x0c => QueryEntityNBT
0x0d => UseEntity_Hand
0x0e => KeepAliveServerbound_i64
Expand Down Expand Up @@ -74,7 +74,7 @@ protocol_packet_ids!(
0x12 => ConfirmTransaction
0x13 => WindowClose
0x14 => WindowOpen
0x15 => WindowItems
0x15 => WindowItems_i16
0x16 => WindowProperty
0x17 => WindowSetSlot
0x18 => SetCooldown
Expand All @@ -83,13 +83,13 @@ protocol_packet_ids!(
0x1b => Disconnect
0x1c => EntityAction
0x1d => NBTQueryResponse
0x1e => Explosion
0x1e => Explosion_i32
0x1f => ChunkUnload
0x20 => ChangeGameState
0x21 => KeepAliveClientbound_i64
0x22 => ChunkData_HeightMap
0x23 => Effect
0x24 => Particle_VarIntArray
0x24 => Particle_f32
0x25 => JoinGame_i32
0x26 => Maps_NoLocked
0x27 => Entity
Expand Down Expand Up @@ -127,7 +127,7 @@ protocol_packet_ids!(
0x47 => SetPassengers
0x48 => Teams_u8
0x49 => UpdateScore
0x4a => SpawnPosition
0x4a => SpawnPosition_NoAngle
0x4b => TimeUpdate
0x4d => StopSound
0x4e => SoundEffect
Expand All @@ -136,10 +136,10 @@ protocol_packet_ids!(
0x51 => CollectItem
0x52 => EntityTeleport_f64
0x53 => Advancements
0x54 => EntityProperties
0x54 => EntityProperties_VarInt
0x55 => EntityEffect
0x56 => DeclareRecipes
0x57 => TagsWithEntities
0x57 => Tags_WithEntities
0x58 => UpdateLight_NoTrust
}
}
Expand Down
14 changes: 7 additions & 7 deletions protocol/src/protocol/versions/v19w02a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protocol_packet_ids!(
0x08 => ClickWindow
0x09 => CloseWindow
0x0a => PluginMessageServerbound
0x0b => EditBook
0x0b => EditBook_Item
0x0c => QueryEntityNBT
0x0d => UseEntity_Hand
0x0e => KeepAliveServerbound_i64
Expand Down Expand Up @@ -74,7 +74,7 @@ protocol_packet_ids!(
0x12 => ConfirmTransaction
0x13 => WindowClose
0x14 => WindowOpenHorse
0x15 => WindowItems
0x15 => WindowItems_i16
0x16 => WindowProperty
0x17 => WindowSetSlot
0x18 => SetCooldown
Expand All @@ -83,13 +83,13 @@ protocol_packet_ids!(
0x1b => Disconnect
0x1c => EntityAction
0x1d => NBTQueryResponse
0x1e => Explosion
0x1e => Explosion_i32
0x1f => ChunkUnload
0x20 => ChangeGameState
0x21 => KeepAliveClientbound_i64
0x22 => ChunkData_HeightMap
0x23 => Effect
0x24 => Particle_Data13
0x24 => Particle_f32
0x25 => JoinGame_i32
0x26 => Maps
0x27 => Entity
Expand Down Expand Up @@ -127,7 +127,7 @@ protocol_packet_ids!(
0x47 => SetPassengers
0x48 => Teams_u8
0x49 => UpdateScore
0x4a => SpawnPosition
0x4a => SpawnPosition_NoAngle
0x4b => TimeUpdate
0x4d => StopSound
0x4e => SoundEffect
Expand All @@ -136,10 +136,10 @@ protocol_packet_ids!(
0x51 => CollectItem
0x52 => EntityTeleport_f64
0x53 => Advancements
0x54 => EntityProperties
0x54 => EntityProperties_VarInt
0x55 => EntityEffect
0x56 => DeclareRecipes
0x57 => TagsWithEntities
0x57 => Tags_WithEntities
0x58 => UpdateLight_NoTrust
0x59 => WindowOpen_VarInt
0x5a => TradeList_WithoutRestock // TODO: without 1.14 added fields
Expand Down
8 changes: 4 additions & 4 deletions protocol/src/protocol/versions/v1_10_2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ protocol_packet_ids!(
0x11 => ConfirmTransaction
0x12 => WindowClose
0x13 => WindowOpen
0x14 => WindowItems
0x14 => WindowItems_i16
0x15 => WindowProperty
0x16 => WindowSetSlot
0x17 => SetCooldown
0x18 => PluginMessageClientbound
0x19 => NamedSoundEffect
0x1a => Disconnect
0x1b => EntityAction
0x1c => Explosion
0x1c => Explosion_i32
0x1d => ChunkUnload
0x1e => ChangeGameState
0x1f => KeepAliveClientbound_VarInt
Expand Down Expand Up @@ -107,14 +107,14 @@ protocol_packet_ids!(
0x40 => SetPassengers
0x41 => Teams_u8
0x42 => UpdateScore
0x43 => SpawnPosition
0x43 => SpawnPosition_NoAngle
0x44 => TimeUpdate
0x45 => Title_notext
0x46 => SoundEffect
0x47 => PlayerListHeaderFooter
0x48 => CollectItem_nocount
0x49 => EntityTeleport_f64
0x4a => EntityProperties
0x4a => EntityProperties_VarInt
0x4b => EntityEffect
}
}
Expand Down
8 changes: 4 additions & 4 deletions protocol/src/protocol/versions/v1_11_2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ protocol_packet_ids!(
0x11 => ConfirmTransaction
0x12 => WindowClose
0x13 => WindowOpen
0x14 => WindowItems
0x14 => WindowItems_i16
0x15 => WindowProperty
0x16 => WindowSetSlot
0x17 => SetCooldown
0x18 => PluginMessageClientbound
0x19 => NamedSoundEffect
0x1a => Disconnect
0x1b => EntityAction
0x1c => Explosion
0x1c => Explosion_i32
0x1d => ChunkUnload
0x1e => ChangeGameState
0x1f => KeepAliveClientbound_VarInt
Expand Down Expand Up @@ -107,14 +107,14 @@ protocol_packet_ids!(
0x40 => SetPassengers
0x41 => Teams_u8
0x42 => UpdateScore
0x43 => SpawnPosition
0x43 => SpawnPosition_NoAngle
0x44 => TimeUpdate
0x45 => Title
0x46 => SoundEffect
0x47 => PlayerListHeaderFooter
0x48 => CollectItem
0x49 => EntityTeleport_f64
0x4a => EntityProperties
0x4a => EntityProperties_VarInt
0x4b => EntityEffect
}
}
Expand Down
8 changes: 4 additions & 4 deletions protocol/src/protocol/versions/v1_12_2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ protocol_packet_ids!(
0x11 => ConfirmTransaction
0x12 => WindowClose
0x13 => WindowOpen
0x14 => WindowItems
0x14 => WindowItems_i16
0x15 => WindowProperty
0x16 => WindowSetSlot
0x17 => SetCooldown
0x18 => PluginMessageClientbound
0x19 => NamedSoundEffect
0x1a => Disconnect
0x1b => EntityAction
0x1c => Explosion
0x1c => Explosion_i32
0x1d => ChunkUnload
0x1e => ChangeGameState
0x1f => KeepAliveClientbound_i64
Expand Down Expand Up @@ -113,15 +113,15 @@ protocol_packet_ids!(
0x43 => SetPassengers
0x44 => Teams_u8
0x45 => UpdateScore
0x46 => SpawnPosition
0x46 => SpawnPosition_NoAngle
0x47 => TimeUpdate
0x48 => Title
0x49 => SoundEffect
0x4a => PlayerListHeaderFooter
0x4b => CollectItem
0x4c => EntityTeleport_f64
0x4d => Advancements
0x4e => EntityProperties
0x4e => EntityProperties_VarInt
0x4f => EntityEffect
}
}
Expand Down
12 changes: 6 additions & 6 deletions protocol/src/protocol/versions/v1_13_2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protocol_packet_ids!(
0x08 => ClickWindow
0x09 => CloseWindow
0x0a => PluginMessageServerbound
0x0b => EditBook
0x0b => EditBook_Item
0x0c => QueryEntityNBT
0x0d => UseEntity_Hand
0x0e => KeepAliveServerbound_i64
Expand Down Expand Up @@ -74,7 +74,7 @@ protocol_packet_ids!(
0x12 => ConfirmTransaction
0x13 => WindowClose
0x14 => WindowOpen
0x15 => WindowItems
0x15 => WindowItems_i16
0x16 => WindowProperty
0x17 => WindowSetSlot
0x18 => SetCooldown
Expand All @@ -83,13 +83,13 @@ protocol_packet_ids!(
0x1b => Disconnect
0x1c => EntityAction
0x1d => NBTQueryResponse
0x1e => Explosion
0x1e => Explosion_i32
0x1f => ChunkUnload
0x20 => ChangeGameState
0x21 => KeepAliveClientbound_i64
0x22 => ChunkData
0x23 => Effect
0x24 => Particle_Data13
0x24 => Particle_f32
0x25 => JoinGame_i32
0x26 => Maps_NoLocked
0x27 => Entity
Expand Down Expand Up @@ -126,15 +126,15 @@ protocol_packet_ids!(
0x46 => SetPassengers
0x47 => Teams_VarInt
0x48 => UpdateScore
0x49 => SpawnPosition
0x49 => SpawnPosition_NoAngle
0x4a => TimeUpdate
0x4c => StopSound
0x4d => SoundEffect
0x4e => PlayerListHeaderFooter
0x4f => CollectItem
0x50 => EntityTeleport_f64
0x51 => Advancements
0x52 => EntityProperties
0x52 => EntityProperties_VarInt
0x53 => EntityEffect
0x54 => DeclareRecipes
0x55 => Tags
Expand Down
Loading

0 comments on commit cfcc7d2

Please sign in to comment.