LeviLamina
Loading...
Searching...
No Matches
ChunkPos.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4#include "mc/deps/core/math/Vec3.h"
5#include "mc/world/level/BlockPos.h"
6
7// clang-format off
8class BlockPos;
9class Vec3;
10// clang-format on
11
12class alignas(uint64) ChunkPos : public ll::math::intN2<ChunkPos> {
13public:
14 template <std::floating_point T0, std::floating_point T1>
15 [[nodiscard]] constexpr ChunkPos(T0 x, T1 z)
16 : intN2((static_cast<int>(std::floor(x)) >> 4), (static_cast<int>(std::floor(z)) >> 4)) {}
17
18 using intN2::intN2;
19
20 ChunkPos(BlockPos const& bp) {
21 x = bp.x >> 4;
22 z = bp.z >> 4;
23 }
24
25 ChunkPos(Vec3 const& pos) {
26 x = static_cast<int>(floorf(pos.x)) >> 4;
27 z = static_cast<int>(floorf(pos.z)) >> 4;
28 }
29
30public:
31 // static variables
32 // NOLINTBEGIN
33 MCAPI static ::ChunkPos const& INVALID();
34
35 MCAPI static ::ChunkPos const& MAX();
36
37 MCAPI static ::ChunkPos const& MIN();
38
39 MCAPI static ::ChunkPos const& ONE();
40 // NOLINTEND
41};
Definition BlockPos.h:17
Definition Vec3.h:10