Skip to content
LeviMC
Home
Projects
Docs
6
LeviLamina
Mod loader for Minecraft Bedrock Edition
LegacyScriptEngine
Runs LLSE script plugins on LeviLamina
lip
General package installer
LeviLauncher
Bedrock launcher for Windows and Android
Be.D.D.
Scripted client input for mod tests
bedboo
Bedrock bots with a mineflayer-compatible API
All repositories on GitHub
Mods
Blog
Community
About
English
English
简体中文
繁體中文
Auto
Light
Dark
Auto
Light
Dark
LeviLamina
User Guides
Developer Guides
API Guides
API Reference
Maintainer Guides
Resources
LeviLamina on GitHub
LeviMC
Home
Projects
Docs
6
LeviLamina
Mod loader for Minecraft Bedrock Edition
LegacyScriptEngine
Runs LLSE script plugins on LeviLamina
lip
General package installer
LeviLauncher
Bedrock launcher for Windows and Android
Be.D.D.
Scripted client input for mod tests
bedboo
Bedrock bots with a mineflayer-compatible API
All repositories on GitHub
Mods
Blog
Community
About
API Reference
On this page
LeviLamina
User Guides
Developer Guides
API Guides
API Reference
Maintainer Guides
Search
Ctrl
K
Loading...
Searching...
No Matches
ChunkPos.h
1
#pragma once
2
3
#include "ll/api/utils/HashUtils.h"
4
#include "mc/_HeaderOutputPredefine.h"
5
#include "mc/deps/core/math/Vec3.h"
6
#include "mc/world/level/BlockPos.h"
7
8
// clang-format off
9
class
BlockPos
;
10
class
Vec3
;
11
// clang-format on
12
13
class
alignas(uint64) ChunkPos :
public
ll::math::intN2<ChunkPos> {
14
public
:
15
template
<std::
float
ing_po
int
T0, std::
float
ing_po
int
T1>
16
[[nodiscard]]
constexpr
ChunkPos(T0 x, T1 z)
17
: intN2((
static_cast<
int
>
(std::floor(x)) >> 4), (
static_cast<
int
>
(std::floor(z)) >> 4)) {}
18
19
using
intN2::intN2;
20
21
ChunkPos(
BlockPos
const
& bp) {
22
x = bp.x >> 4;
23
z = bp.z >> 4;
24
}
25
26
ChunkPos(
Vec3
const
& pos) {
27
x =
static_cast<
int
>
(floorf(pos.x)) >> 4;
28
z =
static_cast<
int
>
(floorf(pos.z)) >> 4;
29
}
30
31
public
:
32
// static variables
33
// NOLINTBEGIN
34
MCNAPI static ::ChunkPos
const
&
INVALID
();
35
36
MCNAPI static ::ChunkPos
const
&
MAX
();
37
38
MCNAPI static ::ChunkPos
const
&
MIN
();
39
40
MCNAPI static ::ChunkPos
const
&
ONE
();
41
// NOLINTEND
42
};
43
44
namespace
std
{
45
template
<>
46
struct
hash<
ChunkPos
> {
47
size_t
operator()(
ChunkPos
const
& pos)
const
noexcept
{
48
return
ll::hash_utils::HashCombiner{}.add(pos.x).add(pos.z);
49
}
50
};
51
}
// namespace std
BlockPos
Definition
BlockPos.h:14
ChunkPos
Definition
ChunkPos.h:13
ChunkPos::MIN
static MCAPI ::ChunkPos const & MIN()
ChunkPos::INVALID
static MCAPI ::ChunkPos const & INVALID()
ChunkPos::ONE
static MCAPI ::ChunkPos const & ONE()
ChunkPos::MAX
static MCAPI ::ChunkPos const & MAX()
Vec3
Definition
Vec3.h:10
std
STL namespace.
src
mc
world
level
ChunkPos.h
Generated on
for LeviLamina by
1.16.1