-
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.
Sends chunk when player goes away by a certain threshold distance.
- Loading branch information
1 parent
dff458f
commit 36ab769
Showing
5 changed files
with
67 additions
and
8 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use ferrumc_macros::{Component, Constructor, Getter}; | ||
|
||
#[derive(Debug, Default, Component, Getter, Constructor)] | ||
pub struct LastChunkTxPos { | ||
pub x: i32, | ||
pub z: i32, | ||
} | ||
|
||
impl LastChunkTxPos { | ||
pub fn set_last_chunk_tx_pos(&mut self, x: i32, z: i32) { | ||
self.x = x; | ||
self.z = z; | ||
} | ||
|
||
pub fn distance_to(&self, x: i32, z: i32) -> f64 { | ||
let dx = self.x - x; | ||
let dz = self.z - z; | ||
|
||
((dx * dx + dz * dz) as f64).sqrt() | ||
} | ||
} |
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 |
---|---|---|
|
@@ -2,3 +2,4 @@ pub mod grounded; | |
pub mod keep_alive; | ||
pub mod player; | ||
pub mod rotation; | ||
pub mod last_chunk_tx_pos; |