summary refs log tree commit diff
path: root/src/World/ChunkRegistry.cpp
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2023-08-06 01:54:27 +0200
committerMel <einebeere@gmail.com>2023-08-06 01:54:27 +0200
commite6f5f9e03f673db796f1babb308609ca2576db2f (patch)
treefbc7d9451ec943a107f0ab54b3de7a7bd25e656d /src/World/ChunkRegistry.cpp
parenta627fb7038c94de9be9709ea88dcd1dddc95c5a3 (diff)
downloadmeowcraft-e6f5f9e03f673db796f1babb308609ca2576db2f.tar.zst
meowcraft-e6f5f9e03f673db796f1babb308609ca2576db2f.zip
Improve MC::Position and remove some redundant code
Diffstat (limited to 'src/World/ChunkRegistry.cpp')
-rw-r--r--src/World/ChunkRegistry.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/World/ChunkRegistry.cpp b/src/World/ChunkRegistry.cpp
index 41fd1b0..97896fe 100644
--- a/src/World/ChunkRegistry.cpp
+++ b/src/World/ChunkRegistry.cpp
@@ -15,14 +15,11 @@ ChunkRegistry::Data& ChunkRegistry::get(ChunkIndex index) {
 }
 
 ChunkRegistry::Data& ChunkRegistry::find(Position::BlockWorld pos) {
-    return get({
-        static_cast<I32>(pos.x() / Chunk::Width),
-        static_cast<I32>(pos.z() / Chunk::Width)
-    });
+    return get(ChunkIndex::from_position(pos));
 }
 
-ChunkRegistry::Data& ChunkRegistry::find(ChunkIndex chunk, Position::BlockLocal pos) {
-    return find(chunk.world(pos));
+ChunkRegistry::Data& ChunkRegistry::find(Position::World pos) {
+    return find(pos.round_to_block());
 }
 
 }
\ No newline at end of file