summary refs log tree commit diff
path: root/src/World/Position.hpp
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2023-08-06 04:27:07 +0200
committerMel <einebeere@gmail.com>2023-08-06 04:27:07 +0200
commit5a1b126f1f6d55226c2b5068d0c17c428fd29ba8 (patch)
tree3acc0240cd8dedd0764eeae6df04e134b04584c8 /src/World/Position.hpp
parente6f5f9e03f673db796f1babb308609ca2576db2f (diff)
downloadmeowcraft-5a1b126f1f6d55226c2b5068d0c17c428fd29ba8.tar.zst
meowcraft-5a1b126f1f6d55226c2b5068d0c17c428fd29ba8.zip
Create separate Player entity and add bad collision system
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()};
     }
 };