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

Implementing Partial Data Packets and Types #45

Merged
merged 24 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
9 changes: 9 additions & 0 deletions crates/proto/src/gamepacket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ use crate::packets::set_local_player_as_initialized::SetLocalPlayerAsInitialized
use crate::packets::set_title_packet::SetTitlePacket;
use crate::packets::start_game::StartGamePacket;
use crate::packets::text_message::TextMessagePacket;
use crate::packets::toast_request_packet::ToastRequestPacket;
use bedrockrs_core::int::VAR;
use bedrockrs_proto_core::error::ProtoCodecError;
use bedrockrs_proto_core::ProtoCodec;
Expand Down Expand Up @@ -185,6 +186,7 @@ pub enum GamePacket {
SubChunkPacket(),
SubChunkRequestPacket(),
DimensionData(),
ToastRequestPacket(ToastRequestPacket),
RequestNetworkSettings(NetworkSettingsRequestPacket),
AlexEntityAnimation(),
}
Expand Down Expand Up @@ -336,6 +338,7 @@ impl GamePacket {
const SubChunkPacketID: u16 = 174;
const SubChunkRequestPacketID: u16 = 175;
const DimensionDataID: u16 = 180;
const ccID: u16 = 186;
banchen19 marked this conversation as resolved.
Show resolved Hide resolved
const RequestNetworkSettingsID: u16 = 193;
const AlexEntityAnimationID: u16 = 224;
}
Expand Down Expand Up @@ -834,6 +837,9 @@ impl GamePacket {
GamePacket::DimensionData() => {
unimplemented!()
}
GamePacket::ToastRequestPacket(pk) => {
ser_packet!(stream, GamePacket::ToastRequestPackeID, pk)
}
GamePacket::RequestNetworkSettings(pk) => {
ser_packet!(stream, GamePacket::RequestNetworkSettingsID, pk)
}
Expand Down Expand Up @@ -1295,6 +1301,9 @@ impl GamePacket {
GamePacket::DimensionDataID => {
unimplemented!()
}
GamePacket::ToastRequestPackeID => {
GamePacket::ToastRequestPacket(de_packet!(stream, ToastRequestPacket))
}
GamePacket::RequestNetworkSettingsID => {
GamePacket::RequestNetworkSettings(de_packet!(stream, NetworkSettingsRequestPacket))
}
Expand Down
1 change: 0 additions & 1 deletion crates/proto/src/login/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use crate::login::play_status::play_status_login;
use crate::login::provider::{LoginProviderClient, LoginProviderServer};
use crate::login::start_game::start_game;

use super::add_actor::add_actor;
use super::set_title::set_title;

pub async fn login_to_server(
Expand Down
1 change: 1 addition & 0 deletions crates/proto/src/packets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ pub mod set_local_player_as_initialized;
pub mod set_title_packet;
pub mod start_game;
pub mod text_message;
pub mod toast_request_packet;
7 changes: 7 additions & 0 deletions crates/proto/src/packets/toast_request_packet.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
use bedrockrs_proto_derive::ProtoCodec;

#[derive(ProtoCodec, Debug, Clone)]
pub struct ToastRequestPacket {
pub title: String,
pub content: String,
}