2019-05-25 15:22:46 -04:00
|
|
|
use super::*;
|
2018-12-03 17:22:47 -05:00
|
|
|
|
2020-06-21 15:17:24 -04:00
|
|
|
mod v15w39c;
|
2019-01-10 20:21:19 -05:00
|
|
|
mod v18w50a;
|
2020-06-21 15:17:24 -04:00
|
|
|
mod v19w02a;
|
2018-12-03 18:04:39 -05:00
|
|
|
mod v1_10_2;
|
2020-06-21 15:17:24 -04:00
|
|
|
mod v1_11_2;
|
|
|
|
mod v1_12_2;
|
|
|
|
mod v1_13_2;
|
|
|
|
mod v1_14;
|
|
|
|
mod v1_14_1;
|
|
|
|
mod v1_14_2;
|
|
|
|
mod v1_14_3;
|
|
|
|
mod v1_14_4;
|
2020-06-27 17:44:22 -04:00
|
|
|
mod v1_15;
|
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 21:39:59 -04:00
|
|
|
mod v1_16_1;
|
2020-11-24 13:30:30 -05:00
|
|
|
mod v1_16_4;
|
2021-09-05 16:30:32 -04:00
|
|
|
mod v1_17_1;
|
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-15 22:56:54 -05:00
|
|
|
mod v1_7_10;
|
2020-06-21 15:17:24 -04:00
|
|
|
mod v1_8_9;
|
|
|
|
mod v1_9;
|
|
|
|
mod v1_9_2;
|
2018-12-03 17:22:47 -05:00
|
|
|
|
2019-05-13 19:35:39 -04:00
|
|
|
// https://wiki.vg/Protocol_History
|
|
|
|
// https://wiki.vg/Protocol_version_numbers#Versions_after_the_Netty_rewrite
|
|
|
|
|
|
|
|
pub fn protocol_name_to_protocol_version(s: String) -> i32 {
|
|
|
|
match s.as_ref() {
|
|
|
|
"" => SUPPORTED_PROTOCOLS[0],
|
2021-09-05 16:30:32 -04:00
|
|
|
"1.17.1" => 756,
|
2021-01-17 20:13:23 -05:00
|
|
|
"1.16.5" => 754,
|
2020-11-24 13:30:30 -05:00
|
|
|
"1.16.4" => 754,
|
|
|
|
"1.16.3" => 753,
|
|
|
|
"1.16.2" => 751,
|
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 21:39:59 -04:00
|
|
|
"1.16.1" => 736,
|
|
|
|
"1.16" => 735,
|
2020-06-27 17:44:22 -04:00
|
|
|
"1.15.2" => 578,
|
2019-12-29 18:55:19 -05:00
|
|
|
"1.15.1" => 575,
|
2019-08-11 20:26:20 -04:00
|
|
|
"1.14.4" => 498,
|
2019-07-07 17:58:49 -04:00
|
|
|
"1.14.3" => 490,
|
2019-05-29 11:22:45 -04:00
|
|
|
"1.14.2" => 485,
|
2019-05-13 19:44:31 -04:00
|
|
|
"1.14.1" => 480,
|
2019-05-13 19:35:39 -04:00
|
|
|
"1.14" => 477,
|
|
|
|
"19w02a" => 452,
|
|
|
|
"18w50a" => 451,
|
|
|
|
"1.13.2" => 404,
|
|
|
|
"1.12.2" => 340,
|
|
|
|
"1.11.2" => 316,
|
|
|
|
"1.11" => 315,
|
|
|
|
"1.10.2" => 210,
|
|
|
|
"1.9.2" => 109,
|
|
|
|
"1.9" => 107,
|
|
|
|
"15w39c" => 74,
|
|
|
|
"1.8.9" => 47,
|
|
|
|
"1.7.10" => 5,
|
|
|
|
_ => {
|
|
|
|
if let Ok(n) = s.parse::<i32>() {
|
|
|
|
n
|
|
|
|
} else {
|
|
|
|
panic!("Unrecognized protocol name: {}", s)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-21 15:17:24 -04:00
|
|
|
pub fn translate_internal_packet_id_for_version(
|
|
|
|
version: i32,
|
|
|
|
state: State,
|
|
|
|
dir: Direction,
|
|
|
|
id: i32,
|
|
|
|
to_internal: bool,
|
|
|
|
) -> i32 {
|
2018-12-03 17:22:47 -05:00
|
|
|
match version {
|
2021-09-05 16:30:32 -04:00
|
|
|
756 => v1_17_1::translate_internal_packet_id(state, dir, id, to_internal),
|
2020-11-24 13:30:30 -05:00
|
|
|
754 | 753 | 751 => v1_16_4::translate_internal_packet_id(state, dir, id, to_internal),
|
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 21:39:59 -04:00
|
|
|
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),
|
2020-06-27 17:44:22 -04:00
|
|
|
578 => v1_15::translate_internal_packet_id(state, dir, id, to_internal),
|
|
|
|
575 => v1_15::translate_internal_packet_id(state, dir, id, to_internal),
|
2019-08-11 20:26:20 -04:00
|
|
|
498 => v1_14_4::translate_internal_packet_id(state, dir, id, to_internal),
|
2019-07-07 17:58:49 -04:00
|
|
|
490 => v1_14_3::translate_internal_packet_id(state, dir, id, to_internal),
|
2019-05-29 11:22:45 -04:00
|
|
|
485 => v1_14_2::translate_internal_packet_id(state, dir, id, to_internal),
|
2019-05-13 19:44:31 -04:00
|
|
|
480 => v1_14_1::translate_internal_packet_id(state, dir, id, to_internal),
|
2019-05-04 19:01:28 -04:00
|
|
|
477 => v1_14::translate_internal_packet_id(state, dir, id, to_internal),
|
2019-01-10 20:47:07 -05:00
|
|
|
452 => v19w02a::translate_internal_packet_id(state, dir, id, to_internal),
|
2019-01-10 20:21:19 -05:00
|
|
|
451 => v18w50a::translate_internal_packet_id(state, dir, id, to_internal),
|
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-29 00:11:42 -05:00
|
|
|
404 => v1_13_2::translate_internal_packet_id(state, dir, id, to_internal),
|
2018-12-03 17:22:47 -05:00
|
|
|
340 => v1_12_2::translate_internal_packet_id(state, dir, id, to_internal),
|
|
|
|
316 => v1_11_2::translate_internal_packet_id(state, dir, id, to_internal),
|
|
|
|
315 => v1_11_2::translate_internal_packet_id(state, dir, id, to_internal),
|
2018-12-03 18:04:39 -05:00
|
|
|
210 => v1_10_2::translate_internal_packet_id(state, dir, id, to_internal),
|
2018-12-03 18:40:57 -05:00
|
|
|
109 => v1_9_2::translate_internal_packet_id(state, dir, id, to_internal),
|
2018-12-03 19:06:20 -05:00
|
|
|
107 => v1_9::translate_internal_packet_id(state, dir, id, to_internal),
|
2018-12-03 22:29:02 -05:00
|
|
|
74 => v15w39c::translate_internal_packet_id(state, dir, id, to_internal),
|
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 15:03:55 -05:00
|
|
|
47 => v1_8_9::translate_internal_packet_id(state, dir, id, to_internal),
|
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-15 22:56:54 -05:00
|
|
|
5 => v1_7_10::translate_internal_packet_id(state, dir, id, to_internal),
|
2019-05-13 19:35:39 -04:00
|
|
|
_ => panic!("unsupported protocol version: {}", version),
|
2018-12-03 17:22:47 -05:00
|
|
|
}
|
|
|
|
}
|