-
Notifications
You must be signed in to change notification settings - Fork 13
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 #45 from banchen19/main
Implementing Partial Data Packets and Types
- Loading branch information
Showing
37 changed files
with
1,041 additions
and
62 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,3 +27,5 @@ flate2 = "1.0" | |
snap = "1.1" | ||
|
||
x509-cert = "0.2" | ||
|
||
bitflags = "2.6.0" |
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,63 @@ | ||
use bedrockrs_core::{int::LE, Vec2, Vec3}; | ||
use bedrockrs_shared::{actor_runtime_id::ActorRuntimeID, actor_unique_id::ActorUniqueID}; | ||
|
||
use crate::{ | ||
connection::ConnectionShard, | ||
error::LoginError, | ||
gamepacket::GamePacket, | ||
packets::add_actor_packet::AddActorPacket, | ||
types::{ | ||
actor_type::ActorType, | ||
property_sync_data::{FloatEntriesList, IntEntriesList, PropertySyncData}, | ||
}, | ||
}; | ||
|
||
use super::provider::LoginProviderServer; | ||
|
||
pub async fn add_actor( | ||
conn: &mut ConnectionShard, | ||
provider: &mut impl LoginProviderServer, | ||
) -> Result<(), LoginError> { | ||
////////////////////////////////////// | ||
// todo: AddActorPacket | ||
////////////////////////////////////// | ||
|
||
let add_actor = AddActorPacket { | ||
target_actor_id: ActorUniqueID(610), | ||
target_runtime_id: ActorRuntimeID(403), | ||
actor_type: ActorType::Pig.to_string(), | ||
position: Vec3 { | ||
x: LE::new(4.0), | ||
y: LE::new(8.0), | ||
z: LE::new(7.0), | ||
}, | ||
velocity: Vec3 { | ||
x: LE::new(4.0), | ||
y: LE::new(8.0), | ||
z: LE::new(7.0), | ||
}, | ||
rotation: Vec2 { | ||
x: LE::new(270.0), | ||
y: LE::new(90.0), | ||
}, | ||
y_head_rotation: LE::new(45.0), | ||
y_body_rotation: LE::new(90.0), | ||
attributes: vec![], | ||
actor_data: vec![], | ||
synched_properties: PropertySyncData { | ||
int: IntEntriesList { entries: vec![] }, | ||
float: FloatEntriesList { entries: vec![] }, | ||
}, | ||
actor_links: vec![], | ||
}; | ||
|
||
conn.send(GamePacket::AddEntity(add_actor)) | ||
.await | ||
.map_err(|e| LoginError::ConnectionError(e))?; | ||
|
||
conn.flush() | ||
.await | ||
.map_err(|e| LoginError::ConnectionError(e))?; | ||
|
||
Ok(()) | ||
} |
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,12 @@ | ||
pub use handle::*; | ||
|
||
mod add_actor; | ||
pub mod handle; | ||
mod handshake; | ||
mod login; | ||
mod network_settings; | ||
mod packs; | ||
mod play_status; | ||
pub mod provider; | ||
mod set_title; | ||
mod start_game; |
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
Oops, something went wrong.