LeviLamina
Loading...
Searching...
No Matches
BlockTypeRegistry.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4#include "mc/deps/core/string/HashedString.h"
5
6// auto generated inclusion list
7#include "mc/common/SharedPtr.h"
8#include "mc/common/WeakPtr.h"
9#include "mc/deps/core/sem_ver/SemVersion.h"
10#include "mc/deps/core/string/HashedString.h"
11#include "mc/resources/BaseGameVersion.h"
12
13// auto generated forward declare list
14// clang-format off
15class Block;
16class BlockLegacy;
20class Experiments;
22// clang-format on
23
25public:
26 // BlockTypeRegistry inner types declare
27 // clang-format off
30 struct DirectAccessBlocks;
32 // clang-format on
33
34 // BlockTypeRegistry inner types define
35 using BlockLookupMap = ::std::map<::HashedString, ::SharedPtr<::BlockLegacy>>;
36
37 using BlockAliasLookupMap = ::std::unordered_map<::HashedString, ::HashedString>;
38
40 public:
41 BlockComplexAliasBlockState(HashedString const& stateName, int value) noexcept
42 : stateName(stateName),
43 value(value) {}
44
45 public:
46 // member variables
47 // NOLINTBEGIN
48 ::HashedString stateName;
49 int value;
50 // NOLINTEND
51
52 public:
53 // destructor thunk
54 // NOLINTBEGIN
55 MCNAPI void $dtor();
56 // NOLINTEND
57 };
58
59 using BlockComplexAliasCallback = ::std::function<::Block const*(int)>;
60
62 public:
63 // member variables
64 // NOLINTBEGIN
65 ::ll::TypedStorage<8, 64, ::std::function<::Block const*(int)>> mCallback;
66 ::ll::TypedStorage<8, 32, ::BaseGameVersion> mMinRequiredVersion;
67 ::ll::TypedStorage<8, 24, ::SemVersion> mFlattenedInBlocksJsonVersion;
68 ::ll::TypedStorage<4, 4, int> mStartVariant;
69 // NOLINTEND
70
71 public:
72 // prevent constructor by default
76
77 public:
78 // member functions
79 // NOLINTBEGIN
80 MCNAPI ::Block const* operator()(int data) const;
81
82 MCNAPI ::BlockTypeRegistry::BlockComplexAliasContent&
84
86 // NOLINTEND
87
88 public:
89 // destructor thunk
90 // NOLINTBEGIN
91 MCNAPI void $dtor();
92 // NOLINTEND
93 };
94
95 using BlockComplexAliasLookupMap = ::entt::dense_map<::HashedString, ::BlockTypeRegistry::BlockComplexAliasContent>;
96
98 public:
99 // member variables
100 // NOLINTBEGIN
101 ::ll::TypedStorage<8, 8, ::WeakPtr<::BlockLegacy const>> mBlockLegacy;
102 ::ll::TypedStorage<8, 8, ::Block const*> mBlock;
103 // NOLINTEND
104
105 public:
106 // prevent constructor by default
108
109 public:
110 // member functions
111 // NOLINTBEGIN
112 MCNAPI LookupByNameImplReturnType(::Block const* block, bool resolveBlockLegacy);
113
115
116 MCNAPI LookupByNameImplReturnType(::WeakPtr<::BlockLegacy const> blockLegacy, int data, bool resolveBlock);
117 // NOLINTEND
118
119 public:
120 // constructor thunks
121 // NOLINTBEGIN
122 MCNAPI void* $ctor(::Block const* block, bool resolveBlockLegacy);
123
124 MCNAPI void* $ctor(::WeakPtr<::BlockLegacy const> blockLegacy, ::Block const* block);
125
126 MCNAPI void* $ctor(::WeakPtr<::BlockLegacy const> blockLegacy, int data, bool resolveBlock);
127 // NOLINTEND
128 };
129
130 using BlockComplexAliasPostSplitBlockNames = ::std::vector<::std::reference_wrapper<::HashedString const>>;
131
132 using BlockComplexAliasPostSplitBlockNamesList =
133 ::std::vector<::std::vector<::std::reference_wrapper<::HashedString const>>>;
134
135 using BlockComplexAliasPostSplitBlockNamesLookupMap = ::entt::dense_map<uint64, uint64>;
136
137 using BlockNameHashToHashedStringMap = ::entt::dense_map<uint64, ::HashedString>;
138
140 public:
141 // member variables
142 // NOLINTBEGIN
143 ::ll::TypedStorage<8, 8, ::BlockLegacy const&> mAirBlock;
144 // NOLINTEND
145
146 public:
147 // prevent constructor by default
148 DirectAccessBlocks& operator=(DirectAccessBlocks const&);
151 };
152
153 enum class LookupByNameImplResolve : int {
154 BlockLegacy = 0,
155 Block = 1,
156 };
157
158public:
159 // static functions
160 // NOLINTBEGIN
161 MCAPI static ::BlockTypeRegistryReadLock _lockAgainstRegistryModifications();
162
163 MCAPI static ::BlockTypeRegistryModificationsLock _lockForRegistryModifications();
164
165 MCAPI static ::BlockTypeRegistry::LookupByNameImplReturnType _lookupByNameImpl(
166 ::HashedString const& name,
167 int data,
168 ::BlockTypeRegistry::LookupByNameImplResolve resolve,
169 bool logNotFound = false
170 );
171
172 MCAPI static void checkBlockPermutationCap();
173
174 MCAPI static uint64 computeBlockTypeRegistryChecksum(::BaseGameVersion const& worldBaseGameVersion);
175
176 MCAPI static void finalizeBlockComponentStorage();
177
178 MCAPI static void finalizeBlockCustomComponentEvents(::ServerScriptManager const& scriptManager);
179
180 MCAPI static void forEachBlock(::std::function<bool(::BlockLegacy const&)> callback);
181
182 MCAPI static ::HashedString const& getBlockNameFromNameHash(uint64 hash);
183
184 MCAPI static ::std::vector<::std::reference_wrapper<::HashedString const>> const&
185 getComplexAliasPostSplitBlockNames(::HashedString const& oldName);
186
187 MCAPI static ::Block const& getDefaultBlockState(::HashedString const& name, bool logNotFound = false);
188
189 MCAPI static ::BlockTypeRegistry::DirectAccessBlocks const& getDirectAccessBlocks();
190
191 MCAPI static void initHardCodedBlockComponents(::Experiments const& experiments);
192
193 MCAPI static bool isComplexAliasBlock(::HashedString const& blockName);
194
195 MCAPI static ::WeakPtr<::BlockLegacy> lookupByName(::HashedString const& name, bool logNotFound = false);
196
197 MCAPI static void prepareBlocks(uint latestUpdaterVersion);
198
199 MCAPI static void registerAlias(::HashedString const& alias, ::HashedString const& name);
200
201 MCAPI static void registerComplexAlias(
202 ::HashedString const& alias,
203 ::std::function<::Block const*(int)> callback,
204 ::std::vector<::std::reference_wrapper<::HashedString const>> const& postSplitBlockNames,
205 ::BaseGameVersion const& minRequiredVersion,
206 ::SemVersion const& blocksJsonFormatVersion,
207 ::HashedString defaultNewBlockName,
208 int startVariant
209 );
210
211 MCAPI static void setupDirectAccessBlocks();
212
213 MCAPI static void unregisterBlock(::HashedString const& name);
214
215 MCAPI static void unregisterBlocks();
216 // NOLINTEND
217
218public:
219 // static variables
220 // NOLINTBEGIN
221 MCAPI static ::std::unordered_map<::HashedString, ::HashedString>& mBlockAliasLookupMap();
222
223 MCAPI static ::entt::dense_map<::HashedString, ::BlockTypeRegistry::BlockComplexAliasContent>&
224 mBlockComplexAliasLookupMap();
225
226 MCAPI static ::std::vector<::std::vector<::std::reference_wrapper<::HashedString const>>>&
227 mBlockComplexAliasPostSplitBlockNamesList();
228
229 MCAPI static ::entt::dense_map<uint64, uint64>& mBlockComplexAliasPostSplitBlockNamesLookupMap();
230
231 MCAPI static ::std::map<::HashedString, ::HashedString>& mBlockComplexAliasPreSplitBlockNamesLookupMap();
232
233 MCAPI static ::std::map<::HashedString, ::SharedPtr<::BlockLegacy>>& mBlockLookupMap();
234
235 MCAPI static ::entt::dense_map<uint64, ::HashedString>& mBlockNameHashToStringMap();
236
237 MCAPI static ::std::unique_ptr<::BlockTypeRegistry::DirectAccessBlocks>& mDirectAccessBlocks();
238
239 MCAPI static ::std::set<::std::string>& mKnownNamespaces();
240
241 MCAPI static ::std::shared_ptr<::BlockTypeRegistryRWLock>& mRWLock();
242 // NOLINTEND
243};
Definition BaseGameVersion.h:8
Definition BlockLegacy.h:88
Definition BlockTypeRegistryModificationsLock.h:5
Definition BlockTypeRegistryRWLock.h:5
Definition BlockTypeRegistryReadLock.h:5
Definition BlockTypeRegistry.h:61
MCAPI::Block const * operator()(int data) const
MCAPI::BlockTypeRegistry::BlockComplexAliasContent & operator=(::BlockTypeRegistry::BlockComplexAliasContent &&)
Definition BlockTypeRegistry.h:24
Definition Block.h:38
Definition Experiments.h:14
Definition HashedString.h:5
Definition SemVersion.h:15
Definition ServerScriptManager.h:70
Definition WeakPtr.h:10
Definition BlockTypeRegistry.h:39
Definition BlockTypeRegistry.h:139
Definition BlockTypeRegistry.h:97
MCAPI LookupByNameImplReturnType(::WeakPtr<::BlockLegacy const > blockLegacy, ::Block const *block)
MCAPI LookupByNameImplReturnType(::Block const *block, bool resolveBlockLegacy)
MCAPI void * $ctor(::WeakPtr<::BlockLegacy const > blockLegacy, int data, bool resolveBlock)
MCAPI LookupByNameImplReturnType(::WeakPtr<::BlockLegacy const > blockLegacy, int data, bool resolveBlock)
MCAPI void * $ctor(::WeakPtr<::BlockLegacy const > blockLegacy, ::Block const *block)
MCAPI void * $ctor(::Block const *block, bool resolveBlockLegacy)