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