Skip to content

Commit 0fbcb19

Browse files
authored
1.14.2 protocol support (485) (#170)
* Add protocol 1.14.2 (485) * Copy v1_14_2 from v1_14_1 * Update readme for protocol support
1 parent 836ab9f commit 0fbcb19

File tree

4 files changed

+184
-2
lines changed

4 files changed

+184
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ Join with your favorite IRC client or [Matrix](https://matrix.to/#/#_espernet_#s
2323

2424
| Game version | Protocol version | Supported? |
2525
| ------ | --- | --- |
26+
| 1.14.2 | 485 ||
2627
| 1.14.1 | 480 ||
27-
| 1.14.1 | 477 ||
2828
| 1.14 | 477 ||
2929
| 19w02a | 452 ||
3030
| 18w50a | 451 ||

src/protocol/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ use std::time::{Instant, Duration};
4141
use crate::shared::Position;
4242
use log::debug;
4343

44-
pub const SUPPORTED_PROTOCOLS: [i32; 14] = [480, 477, 452, 451, 404, 340, 316, 315, 210, 109, 107, 74, 47, 5];
44+
pub const SUPPORTED_PROTOCOLS: [i32; 15] = [485, 480, 477, 452, 451, 404, 340, 316, 315, 210, 109, 107, 74, 47, 5];
4545

4646
// TODO: switch to using thread_local storage?, see https://doc.rust-lang.org/std/macro.thread_local.html
4747
pub static mut CURRENT_PROTOCOL_VERSION: i32 = SUPPORTED_PROTOCOLS[0];

src/protocol/versions.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use super::*;
22

3+
mod v1_14_2;
34
mod v1_14_1;
45
mod v1_14;
56
mod v19w02a;
@@ -20,6 +21,7 @@ mod v1_7_10;
2021
pub fn protocol_name_to_protocol_version(s: String) -> i32 {
2122
match s.as_ref() {
2223
"" => SUPPORTED_PROTOCOLS[0],
24+
"1.14.2" => 485,
2325
"1.14.1" => 480,
2426
"1.14" => 477,
2527
"19w02a" => 452,
@@ -46,6 +48,7 @@ pub fn protocol_name_to_protocol_version(s: String) -> i32 {
4648

4749
pub fn translate_internal_packet_id_for_version(version: i32, state: State, dir: Direction, id: i32, to_internal: bool) -> i32 {
4850
match version {
51+
485 => v1_14_2::translate_internal_packet_id(state, dir, id, to_internal),
4952
480 => v1_14_1::translate_internal_packet_id(state, dir, id, to_internal),
5053
477 => v1_14::translate_internal_packet_id(state, dir, id, to_internal),
5154
452 => v19w02a::translate_internal_packet_id(state, dir, id, to_internal),

src/protocol/versions/v1_14_2.rs

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
protocol_packet_ids!(
2+
handshake Handshaking {
3+
serverbound Serverbound {
4+
0x00 => Handshake
5+
}
6+
clientbound Clientbound {
7+
}
8+
}
9+
play Play {
10+
serverbound Serverbound {
11+
0x00 => TeleportConfirm
12+
0x01 => QueryBlockNBT
13+
0x02 => SetDifficulty
14+
0x03 => ChatMessage
15+
0x04 => ClientStatus
16+
0x05 => ClientSettings
17+
0x06 => TabComplete
18+
0x07 => ConfirmTransactionServerbound
19+
0x08 => ClickWindowButton
20+
0x09 => ClickWindow
21+
0x0a => CloseWindow
22+
0x0b => PluginMessageServerbound
23+
0x0c => EditBook
24+
0x0d => QueryEntityNBT
25+
0x0e => UseEntity
26+
0x0f => KeepAliveServerbound_i64
27+
0x10 => LockDifficulty
28+
0x11 => PlayerPosition
29+
0x12 => PlayerPositionLook
30+
0x13 => PlayerLook
31+
0x14 => Player
32+
0x15 => VehicleMove
33+
0x16 => SteerBoat
34+
0x17 => PickItem
35+
0x18 => CraftRecipeRequest
36+
0x19 => ClientAbilities
37+
0x1a => PlayerDigging
38+
0x1b => PlayerAction
39+
0x1c => SteerVehicle
40+
0x1d => CraftingBookData
41+
0x1e => NameItem
42+
0x1f => ResourcePackStatus
43+
0x20 => AdvancementTab
44+
0x21 => SelectTrade
45+
0x22 => SetBeaconEffect
46+
0x23 => HeldItemChange
47+
0x24 => UpdateCommandBlock
48+
0x25 => UpdateCommandBlockMinecart
49+
0x26 => CreativeInventoryAction
50+
0x27 => UpdateJigsawBlock
51+
0x28 => UpdateStructureBlock
52+
0x29 => SetSign
53+
0x2a => ArmSwing
54+
0x2b => SpectateTeleport
55+
0x2c => PlayerBlockPlacement_f32
56+
0x2d => UseItem
57+
}
58+
clientbound Clientbound {
59+
0x00 => SpawnObject
60+
0x01 => SpawnExperienceOrb
61+
0x02 => SpawnGlobalEntity
62+
0x03 => SpawnMob
63+
0x04 => SpawnPainting
64+
0x05 => SpawnPlayer_f64
65+
0x06 => Animation
66+
0x07 => Statistics
67+
0x08 => BlockBreakAnimation
68+
0x09 => UpdateBlockEntity
69+
0x0a => BlockAction
70+
0x0b => BlockChange_VarInt
71+
0x0c => BossBar
72+
0x0d => ServerDifficulty_Locked
73+
0x0e => ServerMessage
74+
0x0f => MultiBlockChange_VarInt
75+
0x10 => TabCompleteReply
76+
0x11 => DeclareCommands
77+
0x12 => ConfirmTransaction
78+
0x13 => WindowClose
79+
0x14 => WindowItems
80+
0x15 => WindowProperty
81+
0x16 => WindowSetSlot
82+
0x17 => SetCooldown
83+
0x18 => PluginMessageClientbound
84+
0x19 => NamedSoundEffect
85+
0x1a => Disconnect
86+
0x1b => EntityAction
87+
0x1c => Explosion
88+
0x1d => ChunkUnload
89+
0x1e => ChangeGameState
90+
0x1f => WindowOpenHorse
91+
0x20 => KeepAliveClientbound_i64
92+
0x21 => ChunkData_HeightMap
93+
0x22 => Effect
94+
0x23 => Particle_Data
95+
0x24 => UpdateLight
96+
0x25 => JoinGame_i32_ViewDistance
97+
0x26 => Maps
98+
0x27 => TradeList
99+
0x28 => EntityMove_i16
100+
0x29 => EntityLookAndMove_i16
101+
0x2a => EntityLook_VarInt
102+
0x2b => Entity
103+
0x2c => VehicleTeleport
104+
0x2d => OpenBook
105+
0x2e => WindowOpen_VarInt
106+
0x2f => SignEditorOpen
107+
0x30 => CraftRecipeResponse
108+
0x31 => PlayerAbilities
109+
0x32 => CombatEvent
110+
0x33 => PlayerInfo
111+
0x34 => FacePlayer
112+
0x35 => TeleportPlayer_WithConfirm
113+
0x36 => UnlockRecipes_WithSmelting
114+
0x37 => EntityDestroy
115+
0x38 => EntityRemoveEffect
116+
0x39 => ResourcePackSend
117+
0x3a => Respawn
118+
0x3b => EntityHeadLook
119+
0x3c => SelectAdvancementTab
120+
0x3d => WorldBorder
121+
0x3e => Camera
122+
0x3f => SetCurrentHotbarSlot
123+
0x40 => UpdateViewPosition
124+
0x41 => UpdateViewDistance
125+
0x42 => ScoreboardDisplay
126+
0x43 => EntityMetadata
127+
0x44 => EntityAttach
128+
0x45 => EntityVelocity
129+
0x46 => EntityEquipment
130+
0x47 => SetExperience
131+
0x48 => UpdateHealth
132+
0x49 => ScoreboardObjective
133+
0x4a => SetPassengers
134+
0x4b => Teams
135+
0x4c => UpdateScore
136+
0x4d => SpawnPosition
137+
0x4e => TimeUpdate
138+
0x4f => Title
139+
0x50 => EntitySoundEffect
140+
0x51 => SoundEffect
141+
0x52 => StopSound
142+
0x53 => PlayerListHeaderFooter
143+
0x54 => NBTQueryResponse
144+
0x55 => CollectItem
145+
0x56 => EntityTeleport_f64
146+
0x57 => Advancements
147+
0x58 => EntityProperties
148+
0x59 => EntityEffect
149+
0x5a => DeclareRecipes
150+
0x5b => TagsWithEntities
151+
}
152+
}
153+
login Login {
154+
serverbound Serverbound {
155+
0x00 => LoginStart
156+
0x01 => EncryptionResponse
157+
0x02 => LoginPluginResponse
158+
}
159+
clientbound Clientbound {
160+
0x00 => LoginDisconnect
161+
0x01 => EncryptionRequest
162+
0x02 => LoginSuccess
163+
0x03 => SetInitialCompression
164+
0x04 => LoginPluginRequest
165+
}
166+
}
167+
status Status {
168+
serverbound Serverbound {
169+
0x00 => StatusRequest
170+
0x01 => StatusPing
171+
}
172+
clientbound Clientbound {
173+
0x00 => StatusResponse
174+
0x01 => StatusPong
175+
}
176+
}
177+
);
178+
179+

0 commit comments

Comments
 (0)