-
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make world send rate changable via command
- Loading branch information
1 parent
7c49162
commit ac316a4
Showing
9 changed files
with
96 additions
and
15 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,24 @@ | ||
use crate::plot_data::{ChunkData, PlotData, Tps, WorldSendRate}; | ||
use mchprs_world::TickEntry; | ||
use serde::Deserialize; | ||
|
||
#[derive(Deserialize)] | ||
pub struct PreSendratePlotData<const NUM_CHUNK_SECTIONS: usize> { | ||
pub tps: Tps, | ||
pub chunk_data: Vec<ChunkData<NUM_CHUNK_SECTIONS>>, | ||
pub pending_ticks: Vec<TickEntry>, | ||
} | ||
|
||
pub fn try_fix<const NUM_SECTIONS: usize>(data: &[u8]) -> Option<PlotData<NUM_SECTIONS>> { | ||
// Skip magic and version header | ||
let data = &data[12..data.len()]; | ||
let old_data: PreSendratePlotData<NUM_SECTIONS> = bincode::deserialize(data).ok()?; | ||
|
||
let data = PlotData { | ||
tps: old_data.tps, | ||
world_send_rate: WorldSendRate::default(), | ||
chunk_data: old_data.chunk_data, | ||
pending_ticks: old_data.pending_ticks, | ||
}; | ||
Some(data) | ||
} |