-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from OmniacDev/proto_rework
impl packets 51-100 for v662
- Loading branch information
Showing
59 changed files
with
1,035 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,29 @@ | ||
use bedrockrs_macros::ProtoCodec; | ||
|
||
#[derive(ProtoCodec)] | ||
#[enum_repr(i8)] | ||
#[repr(i8)] | ||
pub enum BookEditAction { | ||
ReplacePage = 0, | ||
AddPage = 1, | ||
DeletePage = 2, | ||
SwapPages = 3, | ||
Finalize = 4, | ||
ReplacePage { | ||
page_index: i8, | ||
text_a: String, | ||
text_b: String, | ||
} = 0, | ||
AddPage { | ||
page_index: i8, | ||
text_a: String, | ||
text_b: String, | ||
} = 1, | ||
DeletePage { | ||
page_index: i8, | ||
} = 2, | ||
SwapPages { | ||
page_index_a: i8, | ||
page_index_b: i8, | ||
} = 3, | ||
Finalize { | ||
text_a: String, | ||
text_b: String, | ||
xuid: String, | ||
} = 4, | ||
} |
49 changes: 41 additions & 8 deletions
49
crates/proto/src/version/v662/enums/boss_event_update_type.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,47 @@ | ||
use bedrockrs_macros::ProtoCodec; | ||
use crate::version::v662::types::ActorUniqueID; | ||
|
||
#[derive(ProtoCodec)] | ||
#[enum_repr(i32)] | ||
#[enum_endianness(le)] | ||
#[repr(i32)] | ||
pub enum BossEventUpdateType { | ||
Add = 0, | ||
PlayerAdded = 1, | ||
Add { | ||
name: String, | ||
#[endianness(le)] | ||
health_percent: f32, | ||
#[endianness(le)] | ||
darken_screen: u16, | ||
} = 0, | ||
PlayerAdded { | ||
player_id: ActorUniqueID, | ||
} = 1, | ||
Remove = 2, | ||
PlayerRemoved = 3, | ||
UpdatePercent = 4, | ||
UpdateName = 5, | ||
UpdateProperties = 6, | ||
UpdateStyle = 7, | ||
Query = 8, | ||
PlayerRemoved { | ||
player_id: ActorUniqueID, | ||
} = 3, | ||
UpdatePercent { | ||
#[endianness(le)] | ||
health_percent: f32, | ||
} = 4, | ||
UpdateName { | ||
name: String, | ||
} = 5, | ||
UpdateProperties { | ||
#[endianness(le)] | ||
darken_screen: u16, | ||
#[endianness(var)] | ||
color: u32, | ||
#[endianness(var)] | ||
overlay: u32, | ||
} = 6, | ||
UpdateStyle { | ||
#[endianness(var)] | ||
color: u32, | ||
#[endianness(var)] | ||
overlay: u32, | ||
} = 7, | ||
Query { | ||
player_id: ActorUniqueID, | ||
} = 8, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
use bedrockrs_macros::ProtoCodec; | ||
|
||
#[derive(ProtoCodec)] | ||
#[enum_repr(i8)] | ||
#[repr(i8)] | ||
pub enum CommandOutputType { | ||
None = 0, | ||
LastOutput = 1, | ||
Silent = 2, | ||
AllOutput = 3, | ||
DataSet = 4, | ||
DataSet(String) = 4, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 31 additions & 2 deletions
33
crates/proto/src/version/v662/enums/player_list_packet_type.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,36 @@ | ||
use uuid::Uuid; | ||
use bedrockrs_macros::ProtoCodec; | ||
use crate::version::v662::enums::BuildPlatform; | ||
use crate::version::v662::types::{ActorUniqueID, SerializedSkin}; | ||
|
||
#[derive(ProtoCodec)] | ||
struct AddPlayerListEntry { | ||
pub uuid: Uuid, | ||
pub target_actor_id: ActorUniqueID, | ||
pub player_name: String, | ||
pub xbl_xuid: String, | ||
pub platform_chat_id: String, | ||
pub build_platform: BuildPlatform, | ||
pub serialized_skin: SerializedSkin, | ||
pub is_teacher: bool, | ||
pub is_host: bool, | ||
pub is_sub_client: bool, | ||
|
||
} | ||
|
||
#[derive(ProtoCodec)] | ||
#[enum_repr(i8)] | ||
#[repr(i8)] | ||
pub enum PlayerListPacketType { | ||
Add = 0, | ||
Remove = 1, | ||
Add { | ||
#[vec_repr(u32)] | ||
#[vec_endianness(var)] | ||
add_player_list: Vec<AddPlayerListEntry>, | ||
is_trusted_skin: bool, | ||
} = 0, | ||
Remove { | ||
#[vec_repr(u32)] | ||
#[vec_endianness(var)] | ||
remove_player_list: Vec<Uuid> | ||
} = 1, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
crates/proto/src/version/v662/enums/show_store_offer_redirect_type.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
use bedrockrs_macros::{gamepacket, ProtoCodec}; | ||
|
||
#[gamepacket(id = 89)] | ||
#[derive(ProtoCodec)] | ||
pub struct AddBehaviourTreePacket { | ||
pub json_behaviour_tree_structure: String, | ||
} |
8 changes: 8 additions & 0 deletions
8
crates/proto/src/version/v662/packets/automation_client_connect.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
use bedrockrs_macros::{gamepacket, ProtoCodec}; | ||
use crate::version::v662::types::WebSocketPacketData; | ||
|
||
#[gamepacket(id = 95)] | ||
#[derive(ProtoCodec)] | ||
pub struct AutomationClientConnectPacket { | ||
pub web_socket_data: WebSocketPacketData, | ||
} |
97 changes: 97 additions & 0 deletions
97
crates/proto/src/version/v662/packets/available_commands.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
use bedrockrs_macros::{gamepacket, ProtoCodec}; | ||
use crate::version::v662::enums::CommandPermissionLevel; | ||
|
||
#[derive(ProtoCodec)] | ||
struct EnumDataEntry { | ||
name: String, | ||
values: Vec<u32>, // TODO: weird varint. Needs custom proto | ||
} | ||
|
||
#[derive(ProtoCodec)] | ||
struct SubCommandValues { | ||
#[endianness(le)] | ||
pub sub_command_first_value: u16, | ||
#[endianness(le)] | ||
pub sub_command_second_value: u16, | ||
} | ||
|
||
#[derive(ProtoCodec)] | ||
struct ParameterDataEntry { | ||
pub name: String, | ||
#[endianness(le)] | ||
pub parse_symbol: u32, | ||
pub is_optional: bool, | ||
pub options: i8, | ||
} | ||
|
||
#[derive(ProtoCodec)] | ||
struct OverloadsEntry { | ||
pub is_chaining: bool, | ||
#[vec_repr(u32)] | ||
#[vec_endianness(var)] | ||
pub parameter_data: Vec<ParameterDataEntry>, | ||
} | ||
|
||
#[derive(ProtoCodec)] | ||
struct CommandsEntry { | ||
pub name: String, | ||
pub description: String, | ||
#[endianness(le)] | ||
pub flags: u16, | ||
pub permission_level: CommandPermissionLevel, | ||
#[endianness(le)] | ||
pub alias_enum: i32, | ||
#[vec_repr(u32)] | ||
#[vec_endianness(var)] | ||
pub chained_sub_command_indices: Vec<u16>, // TODO: custom proto impl | ||
#[vec_repr(u32)] | ||
#[vec_endianness(var)] | ||
pub overloads: Vec<OverloadsEntry>, | ||
} | ||
|
||
#[derive(ProtoCodec)] | ||
struct SoftEnumsEntry { | ||
pub enum_name: String, | ||
#[vec_repr(u32)] | ||
#[vec_endianness(var)] | ||
pub enum_options: Vec<String>, | ||
} | ||
|
||
#[derive(ProtoCodec)] | ||
struct ConstraintsEntry { | ||
#[endianness(le)] | ||
pub enum_value_symbol: u32, | ||
#[endianness(le)] | ||
pub enum_symbol: u32, | ||
#[vec_repr(u32)] | ||
#[vec_endianness(var)] | ||
pub constraint_indices: Vec<i8> | ||
} | ||
|
||
#[gamepacket(id = 76)] | ||
#[derive(ProtoCodec)] | ||
pub struct AvailableCommandsPacket { | ||
#[vec_repr(u32)] | ||
#[vec_endianness(var)] | ||
pub enum_values: Vec<String>, | ||
#[vec_repr(u32)] | ||
#[vec_endianness(var)] | ||
pub post_fixes: Vec<String>, | ||
#[vec_repr(u32)] | ||
#[vec_endianness(var)] | ||
pub enum_data: Vec<EnumDataEntry>, | ||
#[vec_repr(u32)] | ||
#[vec_endianness(var)] | ||
pub chained_sub_command_data: Vec<Vec<SubCommandValues>>, | ||
#[vec_repr(u32)] | ||
#[vec_endianness(var)] | ||
pub commands: Vec<Vec<SubCommandValues>>, | ||
#[vec_repr(u32)] | ||
#[vec_endianness(var)] | ||
pub soft_enums: Vec<SoftEnumsEntry>, | ||
#[vec_repr(u32)] | ||
#[vec_endianness(var)] | ||
pub constraints: Vec<ConstraintsEntry>, | ||
} | ||
|
||
// TODO: custom proto impl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use bedrockrs_macros::{gamepacket, ProtoCodec}; | ||
use crate::version::v662::types::{CompoundTag, NetworkBlockPosition}; | ||
|
||
#[gamepacket(id = 56)] | ||
#[derive(ProtoCodec)] | ||
pub struct BlockActorDataPacket { | ||
pub block_position: NetworkBlockPosition, | ||
pub actor_data_tags: CompoundTag, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use bedrockrs_macros::{gamepacket, ProtoCodec}; | ||
use crate::version::v662::enums::BookEditAction; | ||
|
||
#[gamepacket(id = 97)] | ||
#[derive(ProtoCodec)] | ||
pub struct BookEditPacket { | ||
pub action: BookEditAction, | ||
pub book_slot: i8, | ||
} | ||
|
||
// TODO: custom proto impl, enum variants |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use bedrockrs_macros::{gamepacket, ProtoCodec}; | ||
use crate::version::v662::enums::BossEventUpdateType; | ||
use crate::version::v662::types::ActorUniqueID; | ||
|
||
#[gamepacket(id = 74)] | ||
#[derive(ProtoCodec)] | ||
pub struct BossEventPacket { | ||
pub target_actor_id: ActorUniqueID, | ||
pub event_type: BossEventUpdateType | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use bedrockrs_macros::{gamepacket, ProtoCodec}; | ||
use crate::version::v662::types::ActorUniqueID; | ||
|
||
#[gamepacket(id = 73)] | ||
#[derive(ProtoCodec)] | ||
pub struct CameraPacket { | ||
pub camera_id: ActorUniqueID, | ||
pub target_player_id: ActorUniqueID, | ||
} |
Oops, something went wrong.