-
Notifications
You must be signed in to change notification settings - Fork 41
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 #155 from ferrumc-rs/feature/see-other-players
As long as you come back and fix the conditional viewing thing, LGTM
- Loading branch information
Showing
13 changed files
with
227 additions
and
17 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
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,3 +1,3 @@ | ||
pub mod do_action; | ||
pub mod see_other_players; | ||
pub mod head_rot; | ||
pub mod update_player_position; |
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
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
26 changes: 26 additions & 0 deletions
26
src/lib/net/src/packets/outgoing/update_entity_position.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,26 @@ | ||
use ferrumc_ecs::entities::Entity; | ||
use ferrumc_macros::{packet, NetEncode}; | ||
use ferrumc_net_codec::net_types::var_int::VarInt; | ||
use std::io::Write; | ||
|
||
#[derive(NetEncode)] | ||
#[packet(packet_id = 0x2E)] | ||
pub struct UpdateEntityPositionPacket { | ||
pub entity_id: VarInt, | ||
pub delta_x: i16, | ||
pub delta_y: i16, | ||
pub delta_z: i16, | ||
pub on_ground: bool, | ||
} | ||
|
||
impl UpdateEntityPositionPacket { | ||
pub fn new(entity_id: Entity, delta_positions: (i16, i16, i16), on_ground: bool) -> Self { | ||
Self { | ||
entity_id: VarInt::new(entity_id as i32), | ||
delta_x: delta_positions.0, | ||
delta_y: delta_positions.1, | ||
delta_z: delta_positions.2, | ||
on_ground, | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/lib/net/src/packets/outgoing/update_entity_position_and_rotation.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,37 @@ | ||
use ferrumc_core::transform::rotation::Rotation; | ||
use ferrumc_ecs::entities::Entity; | ||
use ferrumc_macros::{packet, NetEncode}; | ||
use ferrumc_net_codec::net_types::angle::NetAngle; | ||
use ferrumc_net_codec::net_types::var_int::VarInt; | ||
use std::io::Write; | ||
|
||
#[derive(NetEncode)] | ||
#[packet(packet_id = 0x2F)] | ||
pub struct UpdateEntityPositionAndRotationPacket { | ||
pub entity_id: VarInt, | ||
pub delta_x: i16, | ||
pub delta_y: i16, | ||
pub delta_z: i16, | ||
pub yaw: NetAngle, | ||
pub pitch: NetAngle, | ||
pub on_ground: bool, | ||
} | ||
|
||
impl UpdateEntityPositionAndRotationPacket { | ||
pub fn new( | ||
entity_id: Entity, | ||
delta_positions: (i16, i16, i16), | ||
new_rot: &Rotation, | ||
on_ground: bool, | ||
) -> Self { | ||
Self { | ||
entity_id: VarInt::new(entity_id as i32), | ||
delta_x: delta_positions.0, | ||
delta_y: delta_positions.1, | ||
delta_z: delta_positions.2, | ||
yaw: NetAngle::from_degrees(new_rot.yaw as f64), | ||
pitch: NetAngle::from_degrees(new_rot.pitch as f64), | ||
on_ground, | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/lib/net/src/packets/outgoing/update_entity_rotation.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,25 @@ | ||
use ferrumc_core::transform::rotation::Rotation; | ||
use ferrumc_ecs::entities::Entity; | ||
use ferrumc_macros::{packet, NetEncode}; | ||
use ferrumc_net_codec::net_types::angle::NetAngle; | ||
use ferrumc_net_codec::net_types::var_int::VarInt; | ||
use std::io::Write; | ||
|
||
#[derive(NetEncode)] | ||
#[packet(packet_id = 0x30)] | ||
pub struct UpdateEntityRotationPacket { | ||
pub entity_id: VarInt, | ||
pub yaw: NetAngle, | ||
pub pitch: NetAngle, | ||
pub on_ground: bool, | ||
} | ||
impl UpdateEntityRotationPacket { | ||
pub fn new(entity_id: Entity, new_rot: &Rotation, on_ground: bool) -> Self { | ||
Self { | ||
entity_id: VarInt::new(entity_id as i32), | ||
yaw: NetAngle::from_degrees(new_rot.yaw as f64), | ||
pitch: NetAngle::from_degrees(new_rot.pitch as f64), | ||
on_ground, | ||
} | ||
} | ||
} |
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