summary refs log tree commit diff
path: root/src/World/Position.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/World/Position.hpp')
-rw-r--r--src/World/Position.hpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/World/Position.hpp b/src/World/Position.hpp
index bc874c0..91ec306 100644
--- a/src/World/Position.hpp
+++ b/src/World/Position.hpp
@@ -53,7 +53,7 @@ public:
 
     BlockLocal to_local() const {
         using namespace MC::World::ChunkDimensions;
-        return {Math::mod(x(), Width), y(), Math::mod(z(), Width)};
+        return {Math::mod(x(), Width), std::clamp<I64>(y(), 0, Height), Math::mod(z(), Width)};
     }
 };
 
@@ -73,7 +73,7 @@ public:
     MC_POSITION_MAKE_DEFAULT_CONSTRUCTORS(World, Real)
 
     BlockWorld round_to_block() const {
-        auto rounded = map([](auto x) { return std::round(x); });
+        auto rounded = map([](auto x) { return std::floor(x); });
         return {rounded.x(), rounded.y(), rounded.z()};
     }
 };