Introduce ChunkCoords type

This commit is contained in:
Matthias Schiffer 2023-01-27 21:21:09 +01:00
parent 0d8b989c10
commit 48e03aa266
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C
3 changed files with 26 additions and 10 deletions

View file

@ -1,3 +1,5 @@
use std::fmt::Debug;
pub const CHUNKS_PER_REGION: u8 = 32;
/// A chunk X coordinate relative to a region
@ -7,3 +9,16 @@ pub struct ChunkX(pub u8);
/// A chunk Z coordinate relative to a region
#[derive(Debug, Clone, Copy)]
pub struct ChunkZ(pub u8);
/// A pair of chunk coordinates relative to a region
#[derive(Clone, Copy)]
pub struct ChunkCoords {
pub x: ChunkX,
pub z: ChunkZ,
}
impl Debug for ChunkCoords {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "({}, {})", self.x.0, self.z.0)
}
}