Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

impl packets 101-150 for v662 #76

Merged
merged 66 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
f5b64f1
[type] network_block_position.rs
OmniacDev Dec 4, 2024
d9e71c5
[enum] actor_block_sync_message.rs
OmniacDev Dec 4, 2024
52be370
[enum] client_play_mode.rs
OmniacDev Dec 4, 2024
46d6143
[enum] identity_definition.rs
OmniacDev Dec 4, 2024
755f16c
[enum] input_mode.rs
OmniacDev Dec 4, 2024
96cd009
[enum] item_stack_request_action_type.rs
OmniacDev Dec 4, 2024
cc70e8b
[enum] item_use_method.rs
OmniacDev Dec 4, 2024
f95c3bf
[enum] lab_table_reaction_type.rs
OmniacDev Dec 4, 2024
c260e2a
[enum] multiplayer_settings_packet_type.rs
OmniacDev Dec 4, 2024
bbf220a
[enum] new_interaction_model.rs
OmniacDev Dec 4, 2024
8c3ea18
[enum] objective_sort_order.rs
OmniacDev Dec 4, 2024
56eb8c6
[enum] packet_compression_algorithm.rs
OmniacDev Dec 4, 2024
5fea597
[enum] score_packet_type.rs
OmniacDev Dec 4, 2024
99abc33
[enum] scoreboard_identity_packet_type.rs
OmniacDev Dec 4, 2024
770ada5
[enum] soft_enum_update_type.rs
OmniacDev Dec 4, 2024
3e23d45
[enum] structure_template_request_operation.rs
OmniacDev Dec 4, 2024
a2ef237
[enum] structure_template_response_type.rs
OmniacDev Dec 4, 2024
d582a1a
[enum] text_processing_event_origin.rs
OmniacDev Dec 4, 2024
7460ccd
[packet] anvil_damage.rs
OmniacDev Dec 4, 2024
6b8d2d9
[packet] available_actor_identifiers.rs
OmniacDev Dec 4, 2024
a303a07
[packet] biome_definition_list.rs
OmniacDev Dec 4, 2024
d3931f6
[packet] client_cache_blob_status.rs
OmniacDev Dec 4, 2024
f435028
[packet] client_cache_miss_response.rs
OmniacDev Dec 4, 2024
2b939bb
[packet] client_cache_status.rs
OmniacDev Dec 4, 2024
64d5a57
[packet] code_builder.rs
OmniacDev Dec 4, 2024
879edf1
[packet] completed_using_item.rs
OmniacDev Dec 4, 2024
40b26fc
[packet] creative_content.rs
OmniacDev Dec 4, 2024
99bf0ae
[packet] education_settings.rs
OmniacDev Dec 4, 2024
29b2d9f
[packet] emote.rs
OmniacDev Dec 4, 2024
f1b6dc2
[packet] item_stack_request.rs
OmniacDev Dec 4, 2024
bf671ba
[packet] item_stack_response.rs
OmniacDev Dec 4, 2024
356079f
[packet] lab_table.rs
OmniacDev Dec 4, 2024
858f57d
[packet] lectern_update.rs
OmniacDev Dec 4, 2024
c12d345
[packet] level_event_generic.rs
OmniacDev Dec 4, 2024
b47e556
[packet] level_sound_event.rs
OmniacDev Dec 4, 2024
0591296
[packet] level_sound_event_v2.rs
OmniacDev Dec 4, 2024
1b1560d
[packet] map_create_locked_copy.rs
OmniacDev Dec 4, 2024
bd5561b
[packet] mod.rs
OmniacDev Dec 4, 2024
5467225
[packet] modal_form_response.rs
OmniacDev Dec 4, 2024
65416ad
[packet] move_actor_delta.rs
OmniacDev Dec 4, 2024
9c2ab1b
[packet] multiplayer_settings.rs
OmniacDev Dec 4, 2024
c573ea1
[packet] network_chunk_publisher_update.rs
OmniacDev Dec 4, 2024
61bd683
[packet] network_settings.rs
OmniacDev Dec 4, 2024
0aef42a
[packet] network_stack_latency.rs
OmniacDev Dec 4, 2024
e516dc8
[packet] on_screen_texture_animation.rs
OmniacDev Dec 4, 2024
0a9aac8
[packet] player_armor_damage.rs
OmniacDev Dec 4, 2024
07fbbf3
[packet] player_auth_input.rs
OmniacDev Dec 4, 2024
6b9a996
[packet] player_enchant_options.rs
OmniacDev Dec 4, 2024
c5e99b2
[packet] remove_objective.rs
OmniacDev Dec 4, 2024
cdce6eb
[packet] server_settings_request.rs
OmniacDev Dec 4, 2024
69e0c2b
[packet] server_settings_response.rs
OmniacDev Dec 4, 2024
6634618
[packet] set_default_game_type.rs
OmniacDev Dec 4, 2024
8da2138
[packet] set_display_objective.rs
OmniacDev Dec 4, 2024
bc0f7d2
[packet] set_local_player_as_initialized.rs
OmniacDev Dec 4, 2024
4dcdedb
[packet] set_score.rs
OmniacDev Dec 4, 2024
8989c8b
[packet] set_scoreboard_identity.rs
OmniacDev Dec 4, 2024
2369f43
[packet] settings_command.rs
OmniacDev Dec 4, 2024
6ccb62c
[packet] show_profile.rs
OmniacDev Dec 4, 2024
76e16aa
[packet] spawn_particle_effect.rs
OmniacDev Dec 4, 2024
a5838d6
[packet] structure_data_request.rs
OmniacDev Dec 4, 2024
0dc4df2
[packet] structure_data_response.rs
OmniacDev Dec 4, 2024
73c1297
[packet] update_block_synced.rs
OmniacDev Dec 4, 2024
be35f77
[packet] update_soft_enum.rs
OmniacDev Dec 4, 2024
17bf913
Merge branch 'bedrock-crustaceans:proto_rework' into proto_rework
OmniacDev Dec 4, 2024
ee4aa40
[enum] identity_definition.rs
OmniacDev Dec 4, 2024
a46cfe8
Merge remote-tracking branch 'origin/proto_rework' into proto_rework
OmniacDev Dec 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ pub mod ActorBlockSyncMessage {
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(i64)]
#[enum_endianness(var)]
#[repr(i64)]
pub enum MessageId {
NONE = 0,
CREATE = 1,
Expand Down
3 changes: 3 additions & 0 deletions crates/proto/src/version/v662/enums/client_play_mode.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(u32)]
#[enum_endianness(var)]
#[repr(u32)]
pub enum ClientPlayMode {
Normal = 0,
Teaser = 1,
Expand Down
16 changes: 13 additions & 3 deletions crates/proto/src/version/v662/enums/identity_definition.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
pub mod IdentityDefinition {
use bedrockrs_macros::ProtoCodec;
use crate::version::v662::types::ActorUniqueID;

#[derive(ProtoCodec)]
#[enum_repr(i8)]
#[repr(i8)]
pub enum Type {
Invalid = 0,
Player = 1,
Entity = 2,
FakePlayer = 3,
Player {
#[endianness(var)]
player_unique_id: i64,
} = 1,
Entity {
actor_id: ActorUniqueID,
} = 2,
FakePlayer {
fake_player_name: String,
} = 3,
}
}
3 changes: 3 additions & 0 deletions crates/proto/src/version/v662/enums/input_mode.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(u32)]
#[enum_endianness(var)]
#[repr(u32)]
pub enum InputMode {
Undefined = 0,
Mouse = 1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(i8)]
#[repr(i8)]
pub enum ItemStackRequestActionType {
Take = 0,
Place = 1,
Expand Down
4 changes: 3 additions & 1 deletion crates/proto/src/version/v662/enums/item_use_method.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(i32)]
#[enum_endianness(le)]
#[repr(i32)]
pub enum ItemUseMethod {
Unknown = -1,
EquipArmor = 0,
Expand All @@ -19,5 +22,4 @@ pub enum ItemUseMethod {
Dyed = 13,
Traded = 14,
BrushingCompleted = 15,
Count = 16,
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(i8)]
#[repr(i8)]
pub enum LabTableReactionType {
None = 0,
IceBomb = 1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(i32)]
#[enum_endianness(var)]
#[repr(i32)]
pub enum MultiplayerSettingsPacketType {
EnableMultiplayer = 0,
DisableMultiplayer = 1,
RefreshJoincode = 2,
RefreshJoinCode = 2,
}
3 changes: 3 additions & 0 deletions crates/proto/src/version/v662/enums/new_interaction_model.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(i32)]
#[enum_endianness(var)]
#[repr(i32)]
pub enum NewInteractionModel {
Touch = 0,
Crosshair = 1,
Expand Down
2 changes: 2 additions & 0 deletions crates/proto/src/version/v662/enums/objective_sort_order.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(i8)]
#[repr(i8)]
pub enum ObjectiveSortOrder {
Ascending = 0,
Descending = 1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(u16)]
#[enum_endianness(le)]
#[repr(u16)]
pub enum PacketCompressionAlgorithm {
ZLib = 0,
Snappy = 1,
Expand Down
33 changes: 31 additions & 2 deletions crates/proto/src/version/v662/enums/score_packet_type.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,36 @@
use bedrockrs_macros::ProtoCodec;
use crate::version::v662::enums::IdentityDefinition;
use crate::version::v662::types::ScoreboardId;

#[derive(ProtoCodec)]
struct ScorePacketInfoChangeEntry {
pub id: ScoreboardId,
pub objective_name: String,
#[endianness(le)]
pub score_value: i32,
}

#[derive(ProtoCodec)]
struct ScorePacketInfoRemoveEntry {
pub id: ScoreboardId,
pub objective_name: String,
#[endianness(le)]
pub score_value: i32,
pub identity_definition_type: IdentityDefinition::Type,
}

#[derive(ProtoCodec)]
#[enum_repr(i8)]
#[repr(i8)]
pub enum ScorePacketType {
Change = 0,
Remove = 1,
Change {
#[vec_repr(u32)]
#[vec_endianness(var)]
score_packet_info: Vec<ScorePacketInfoChangeEntry>,
} = 0,
Remove {
#[vec_repr(u32)]
#[vec_endianness(var)]
score_packet_info: Vec<ScorePacketInfoRemoveEntry>,
} = 1,
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
use bedrockrs_macros::ProtoCodec;
use crate::version::v662::types::ScoreboardId;

#[derive(ProtoCodec)]
struct IdentityInfoUpdateEntry {
pub scoreboard_id: ScoreboardId,
#[endianness(var)]
pub player_unique_id: i64,
}

#[derive(ProtoCodec)]
#[enum_repr(i8)]
#[repr(i8)]
pub enum ScoreboardIdentityPacketType {
Update = 0,
Remove = 1,
Update {
#[vec_repr(u32)]
#[vec_endianness(var)]
identity_info: Vec<IdentityInfoUpdateEntry>,
} = 0,
Remove {
#[vec_repr(u32)]
#[vec_endianness(var)]
identity_info: Vec<ScoreboardId>,
} = 1,
}
3 changes: 3 additions & 0 deletions crates/proto/src/version/v662/enums/soft_enum_update_type.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(u32)]
#[enum_endianness(le)]
#[repr(u32)]
pub enum SoftEnumUpdateType {
Add = 0,
Remove = 1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(i8)]
#[repr(i8)]
pub enum StructureTemplateRequestOperation {
None = 0,
ExportFromSaveMode = 1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(i8)]
#[repr(i8)]
pub enum StructureTemplateResponseType {
None = 0,
Export = 1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(i32)]
#[enum_endianness(le)]
#[repr(i32)]
pub enum TextProcessingEventOrigin {
Unknown = -1,
ServerChatPublic = 0,
Expand Down
9 changes: 9 additions & 0 deletions crates/proto/src/version/v662/packets/anvil_damage.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use bedrockrs_macros::{gamepacket, ProtoCodec};
use crate::version::v662::types::NetworkBlockPosition;

#[gamepacket(id = 141)]
#[derive(ProtoCodec)]
pub struct AnvilDamagePacket {
pub damage_amount: i8,
pub block_position: NetworkBlockPosition,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
use bedrockrs_macros::{gamepacket, ProtoCodec};
use crate::version::v662::types::CompoundTag;

#[gamepacket(id = 119)]
#[derive(ProtoCodec)]
pub struct AvailableActorIdentifiersPacket {
pub actor_info_list: CompoundTag,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
use bedrockrs_macros::{gamepacket, ProtoCodec};
use crate::version::v662::types::CompoundTag;

#[gamepacket(id = 122)]
#[derive(ProtoCodec)]
pub struct BiomeDefinitionListPacket {
pub biome_definition_data: CompoundTag,
}
14 changes: 14 additions & 0 deletions crates/proto/src/version/v662/packets/client_cache_blob_status.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use bedrockrs_macros::{gamepacket, ProtoCodec};

#[gamepacket(id = 135)]
#[derive(ProtoCodec)]
pub struct ClientCacheBlobStatusPacket {
#[vec_repr(u32)]
#[vec_endianness(var)]
pub missing_blobs: Vec<u64>,
#[vec_repr(u32)]
#[vec_endianness(var)]
pub obtained_blobs: Vec<u64>,
}

// TODO: custom proto impl, both Vec lengths come first in packet, then both their elements, respectfully. (elements are le)
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
use bedrockrs_macros::{gamepacket, ProtoCodec};

#[derive(ProtoCodec)]
struct MissingBlobEntry {
#[endianness(le)]
pub blob_id: u64,
pub blob_data: String,
}

#[gamepacket(id = 136)]
#[derive(ProtoCodec)]
pub struct ClientCacheMissResponsePacket {
#[vec_repr(u32)]
#[vec_endianness(var)]
pub missing_blobs: Vec<MissingBlobEntry>
}
7 changes: 7 additions & 0 deletions crates/proto/src/version/v662/packets/client_cache_status.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
use bedrockrs_macros::{gamepacket, ProtoCodec};

#[gamepacket(id = 129)]
#[derive(ProtoCodec)]
pub struct ClientCacheStatusPacket {
pub is_cache_supported: bool,
}
8 changes: 8 additions & 0 deletions crates/proto/src/version/v662/packets/code_builder.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
use bedrockrs_macros::{gamepacket, ProtoCodec};

#[gamepacket(id = 150)]
#[derive(ProtoCodec)]
pub struct CodeBuilderPacket {
pub url: String,
pub should_open_code_builder: bool,
}
10 changes: 10 additions & 0 deletions crates/proto/src/version/v662/packets/completed_using_item.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use bedrockrs_macros::{gamepacket, ProtoCodec};
use crate::version::v662::enums::ItemUseMethod;

#[gamepacket(id = 142)]
#[derive(ProtoCodec)]
pub struct CompletedUsingItemPacket {
#[endianness(le)]
pub item_id: u16,
pub item_use_method: ItemUseMethod,
}
17 changes: 17 additions & 0 deletions crates/proto/src/version/v662/packets/creative_content.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use bedrockrs_macros::{gamepacket, ProtoCodec};
use crate::version::v662::types::NetworkItemInstanceDescriptor;

#[derive(ProtoCodec)]
struct WriteEntry {
#[endianness(var)]
pub creative_net_id: u32,
pub item_instance: NetworkItemInstanceDescriptor,
}

#[gamepacket(id = 145)]
#[derive(ProtoCodec)]
pub struct CreativeContentPacket {
#[vec_repr(u32)]
#[vec_endianness(var)]
pub write_entries: Vec<WriteEntry>
}
8 changes: 8 additions & 0 deletions crates/proto/src/version/v662/packets/education_settings.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
use bedrockrs_macros::{gamepacket, ProtoCodec};
use crate::version::v662::types::EducationLevelSettings;

#[gamepacket(id = 137)]
#[derive(ProtoCodec)]
pub struct EducationSettingsPacket {
pub education_level_settings: EducationLevelSettings,
}
20 changes: 20 additions & 0 deletions crates/proto/src/version/v662/packets/emote.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use bedrockrs_macros::{gamepacket, ProtoCodec};
use crate::version::v662::types::ActorRuntimeID;

#[derive(ProtoCodec)]
#[enum_repr(i8)]
#[repr(i8)]
enum Flags {
ServerSide = 1 << 0,
MuteEmoteChat = 1 << 1,
}

#[gamepacket(id = 138)]
#[derive(ProtoCodec)]
pub struct EmotePacket {
pub actor_runtime_id: ActorRuntimeID,
pub emote_id: String,
pub xuid: String,
pub platform_id: String,
pub flags: Flags,
}
Loading
Loading