aboutsummaryrefslogtreecommitdiff
path: root/azalea-world/src/chunk_storage.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-06-11 16:55:33 +1100
committermat <git@matdoes.dev>2025-06-11 16:55:33 +1100
commit9b0bd29db4faa9d94df0cec472346b814e7efcb9 (patch)
tree4f681b5143eb5ebe69a0b5b53125ea7509f8026a /azalea-world/src/chunk_storage.rs
parent2a6ac0764fe9975f9b16d495ce773e4ae1f097e0 (diff)
downloadazalea-drasl-9b0bd29db4faa9d94df0cec472346b814e7efcb9.tar.xz
take BlockPos instead of &BlockPos in all function arguments
Diffstat (limited to 'azalea-world/src/chunk_storage.rs')
-rw-r--r--azalea-world/src/chunk_storage.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/azalea-world/src/chunk_storage.rs b/azalea-world/src/chunk_storage.rs
index a6e33739..2efd002d 100644
--- a/azalea-world/src/chunk_storage.rs
+++ b/azalea-world/src/chunk_storage.rs
@@ -155,7 +155,7 @@ impl PartialChunkStorage {
pub fn set_block_state(
&self,
- pos: &BlockPos,
+ pos: BlockPos,
state: BlockState,
chunk_storage: &ChunkStorage,
) -> Option<BlockState> {
@@ -293,26 +293,26 @@ impl ChunkStorage {
self.map.get(pos).and_then(|chunk| chunk.upgrade())
}
- pub fn get_block_state(&self, pos: &BlockPos) -> Option<BlockState> {
+ pub fn get_block_state(&self, pos: BlockPos) -> Option<BlockState> {
let chunk_pos = ChunkPos::from(pos);
let chunk = self.get(&chunk_pos)?;
let chunk = chunk.read();
chunk.get_block_state(&ChunkBlockPos::from(pos), self.min_y)
}
- pub fn get_fluid_state(&self, pos: &BlockPos) -> Option<FluidState> {
+ pub fn get_fluid_state(&self, pos: BlockPos) -> Option<FluidState> {
let block_state = self.get_block_state(pos)?;
Some(FluidState::from(block_state))
}
- pub fn get_biome(&self, pos: &BlockPos) -> Option<Biome> {
+ pub fn get_biome(&self, pos: BlockPos) -> Option<Biome> {
let chunk_pos = ChunkPos::from(pos);
let chunk = self.get(&chunk_pos)?;
let chunk = chunk.read();
- chunk.get_biome(&ChunkBiomePos::from(pos), self.min_y)
+ chunk.get_biome(ChunkBiomePos::from(pos), self.min_y)
}
- pub fn set_block_state(&self, pos: &BlockPos, state: BlockState) -> Option<BlockState> {
+ pub fn set_block_state(&self, pos: BlockPos, state: BlockState) -> Option<BlockState> {
if pos.y < self.min_y || pos.y >= (self.min_y + self.height as i32) {
return None;
}
@@ -404,7 +404,7 @@ impl Chunk {
}
}
- pub fn get_biome(&self, pos: &ChunkBiomePos, min_y: i32) -> Option<Biome> {
+ pub fn get_biome(&self, pos: ChunkBiomePos, min_y: i32) -> Option<Biome> {
if pos.y < min_y {
// y position is out of bounds
return None;
@@ -580,27 +580,27 @@ mod tests {
);
assert!(
chunk_storage
- .get_block_state(&BlockPos { x: 0, y: 319, z: 0 })
+ .get_block_state(BlockPos { x: 0, y: 319, z: 0 })
.is_some()
);
assert!(
chunk_storage
- .get_block_state(&BlockPos { x: 0, y: 320, z: 0 })
+ .get_block_state(BlockPos { x: 0, y: 320, z: 0 })
.is_none()
);
assert!(
chunk_storage
- .get_block_state(&BlockPos { x: 0, y: 338, z: 0 })
+ .get_block_state(BlockPos { x: 0, y: 338, z: 0 })
.is_none()
);
assert!(
chunk_storage
- .get_block_state(&BlockPos { x: 0, y: -64, z: 0 })
+ .get_block_state(BlockPos { x: 0, y: -64, z: 0 })
.is_some()
);
assert!(
chunk_storage
- .get_block_state(&BlockPos { x: 0, y: -65, z: 0 })
+ .get_block_state(BlockPos { x: 0, y: -65, z: 0 })
.is_none()
);
}