Skip to content
LeviMC
English
AutoLightDark
LeviLamina
Loading...
Searching...
No Matches
ActorUniqueID.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
6public:
7 [[nodiscard]] constexpr bool operator==(ActorUniqueID const& other) const noexcept { return rawID == other.rawID; }
8
9 [[nodiscard]] constexpr std::strong_ordering operator<=>(ActorUniqueID const& other) const noexcept {
10 return rawID <=> other.rawID;
11 }
12
13public:
14 // member variables
15 // NOLINTBEGIN
16 int64 rawID;
17 // NOLINTEND
18
19public:
20 // member functions
21 // NOLINTBEGIN
22 MCNAPI uint64 getHash() const;
23
24 MCNAPI ::std::string toString() const;
25 // NOLINTEND
26
27public:
28 // static variables
29 // NOLINTBEGIN
30 MCAPI static ::ActorUniqueID const& INVALID_ID();
31 // NOLINTEND
32};
33
34namespace std {
35template <>
36struct hash<ActorUniqueID> {
37 size_t operator()(ActorUniqueID const& id) const noexcept {
38 static std::hash<int64> hasher;
39 std::size_t seed = 0;
40 seed ^= hasher(id.rawID >> 32) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
41 seed ^= hasher(id.rawID & 0xffffffff) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
42 return seed;
43 }
44};
45} // namespace std
STL namespace.
Definition ActorUniqueID.h:5
MCAPI uint64 getHash() const
MCAPI::std::string toString() const