Skip to content

Commit 7e5f652

Browse files
committed
correctly pack chunkpos
1 parent 2da144e commit 7e5f652

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/bin/src/systems/listeners/digging_system.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ fn break_block(
285285
.0
286286
.clone()
287287
.terrain_generator
288-
.generate_chunk(BlockPos::from(position.clone()).chunk())
288+
.generate_chunk(pos.chunk())
289289
.map_err(BinaryError::WorldGen)?
290290
}
291291
};

src/lib/world/src/pos.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ impl ChunkPos {
154154
}
155155

156156
pub fn pack(&self) -> u64 {
157-
(self.pos.y as u64) << (32 - 8) | self.pos.x as u64 >> 4
157+
(((self.z() as u64) & ((1 << 22) - 1)) << 22) | ((self.x() as u64) & ((1 << 22) - 1))
158158
}
159159
}
160160

0 commit comments

Comments
 (0)