From e6f5f9e03f673db796f1babb308609ca2576db2f Mon Sep 17 00:00:00 2001 From: Mel Date: Sun, 6 Aug 2023 01:54:27 +0200 Subject: Improve MC::Position and remove some redundant code --- src/World/ChunkRegistry.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/World/ChunkRegistry.cpp') 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(pos.x() / Chunk::Width), - static_cast(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 -- cgit 1.4.1