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
10// auto generated forward declare list
11// clang-format off
12class BaseGameVersion;
13class Block;
14class BlockLegacy;
18class Experiments;
19class HashedString;
20class SemVersion;
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 MCFOLD 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
75
76 public:
77 // member functions
78 // NOLINTBEGIN
79 MCAPI ::Block const* operator()(int data) const;
80
81 MCAPI ::BlockTypeRegistry::BlockComplexAliasContent& operator=(::BlockTypeRegistry::BlockComplexAliasContent&&);
82
84 // NOLINTEND
85
86 public:
87 // destructor thunk
88 // NOLINTBEGIN
89 MCAPI void $dtor();
90 // NOLINTEND
91 };
92
93 using BlockComplexAliasLookupMap = ::entt::dense_map<::HashedString, ::BlockTypeRegistry::BlockComplexAliasContent>;
94
96 public:
97 // member variables
98 // NOLINTBEGIN
99 ::ll::TypedStorage<8, 8, ::WeakPtr<::BlockLegacy const>> mBlockLegacy;
100 ::ll::TypedStorage<8, 8, ::Block const*> mBlock;
101 // NOLINTEND
102
103 public:
104 // member functions
105 // NOLINTBEGIN
106 MCAPI LookupByNameImplReturnType(::Block const* block, bool resolveBlockLegacy);
107
109
110 MCAPI LookupByNameImplReturnType(::WeakPtr<::BlockLegacy const> blockLegacy, int data, bool resolveBlock);
111 // NOLINTEND
112
113 public:
114 // constructor thunks
115 // NOLINTBEGIN
116 MCAPI void* $ctor(::Block const* block, bool resolveBlockLegacy);
117
118 MCAPI void* $ctor(::WeakPtr<::BlockLegacy const> blockLegacy, ::Block const* block);
119
120 MCAPI void* $ctor(::WeakPtr<::BlockLegacy const> blockLegacy, int data, bool resolveBlock);
121 // NOLINTEND
122 };
123
124 using BlockComplexAliasPostSplitBlockNames = ::std::vector<::std::reference_wrapper<::HashedString const>>;
125
126 using BlockComplexAliasPostSplitBlockNamesList =
127 ::std::vector<::std::vector<::std::reference_wrapper<::HashedString const>>>;
128
129 using BlockComplexAliasPostSplitBlockNamesLookupMap = ::entt::dense_map<uint64, uint64>;
130
131 using BlockNameHashToHashedStringMap = ::entt::dense_map<uint64, ::HashedString>;
132
134 public:
135 // member variables
136 // NOLINTBEGIN
137 ::ll::TypedStorage<8, 8, ::BlockLegacy const&> mAirBlock;
138 // NOLINTEND
139 };
140
141 enum class LookupByNameImplResolve : int {
142 BlockLegacy = 0,
143 Block = 1,
144 };
145
146public:
147 // static functions
148 // NOLINTBEGIN
149 MCAPI static ::BlockTypeRegistryReadLock _lockAgainstRegistryModifications();
150
151 MCAPI static ::BlockTypeRegistryModificationsLock _lockForRegistryModifications();
152
153 MCAPI static ::BlockTypeRegistry::LookupByNameImplReturnType _lookupByNameImpl(
154 ::HashedString const& name,
155 int data,
156 ::BlockTypeRegistry::LookupByNameImplResolve resolve,
157 bool logNotFound = false
158 );
159
160 MCAPI static void checkBlockPermutationCap();
161
162 MCAPI static uint64 computeBlockTypeRegistryChecksum(::BaseGameVersion const& worldBaseGameVersion);
163
164 MCAPI static void finalizeBlockComponentStorage();
165
166 MCAPI static void finalizeBlockCustomComponentEvents(::ServerScriptManager const& scriptManager);
167
168 MCAPI static void forEachBlock(::std::function<bool(::BlockLegacy const&)> callback);
169
170 MCAPI static ::HashedString const& getBlockNameFromNameHash(uint64 hash);
171
172 MCAPI static ::std::vector<::std::reference_wrapper<::HashedString const>> const&
173 getComplexAliasPostSplitBlockNames(::HashedString const& oldName);
174
175 MCAPI static ::Block const& getDefaultBlockState(::HashedString const& name, bool logNotFound = false);
176
177 MCAPI static ::BlockTypeRegistry::DirectAccessBlocks const& getDirectAccessBlocks();
178
179 MCAPI static void initHardCodedBlockComponents(::Experiments const& experiments);
180
181 MCAPI static bool isComplexAliasBlock(::HashedString const& blockName);
182
183 MCAPI static ::WeakPtr<::BlockLegacy> lookupByName(::HashedString const& name, bool logNotFound = false);
184
185 MCAPI static void prepareBlocks(uint latestUpdaterVersion);
186
187 MCAPI static void registerAlias(::HashedString const& alias, ::HashedString const& name);
188
189 MCAPI static void registerComplexAlias(
190 ::HashedString const& alias,
191 ::std::function<::Block const*(int)> callback,
192 ::std::vector<::std::reference_wrapper<::HashedString const>> const& postSplitBlockNames,
193 ::BaseGameVersion const& minRequiredVersion,
194 ::SemVersion const& blocksJsonFormatVersion,
195 ::HashedString defaultNewBlockName,
196 int startVariant
197 );
198
199 MCAPI static void setupDirectAccessBlocks();
200
201 MCAPI static void unregisterBlock(::HashedString const& name);
202
203 MCAPI static void unregisterBlocks();
204 // NOLINTEND
205
206public:
207 // static variables
208 // NOLINTBEGIN
209 MCAPI static ::std::unordered_map<::HashedString, ::HashedString>& mBlockAliasLookupMap();
210
211 MCAPI static ::entt::dense_map<::HashedString, ::BlockTypeRegistry::BlockComplexAliasContent>&
212 mBlockComplexAliasLookupMap();
213
214 MCAPI static ::std::vector<::std::vector<::std::reference_wrapper<::HashedString const>>>&
215 mBlockComplexAliasPostSplitBlockNamesList();
216
217 MCAPI static ::entt::dense_map<uint64, uint64>& mBlockComplexAliasPostSplitBlockNamesLookupMap();
218
219 MCAPI static ::std::map<::HashedString, ::HashedString>& mBlockComplexAliasPreSplitBlockNamesLookupMap();
220
221 MCAPI static ::std::map<::HashedString, ::SharedPtr<::BlockLegacy>>& mBlockLookupMap();
222
223 MCAPI static ::entt::dense_map<uint64, ::HashedString>& mBlockNameHashToStringMap();
224
225 MCAPI static ::std::unique_ptr<::BlockTypeRegistry::DirectAccessBlocks>& mDirectAccessBlocks();
226
227 MCAPI static ::std::set<::std::string>& mKnownNamespaces();
228
229 MCAPI static ::std::shared_ptr<::BlockTypeRegistryRWLock>& mRWLock();
230 // NOLINTEND
231};
Definition BaseGameVersion.h:13
Definition BlockLegacy.h:88
Definition BlockTypeRegistryModificationsLock.h:5
Definition BlockTypeRegistryRWLock.h:5
Definition BlockTypeRegistryReadLock.h:5
Definition BlockTypeRegistry.h:61
Definition BlockTypeRegistry.h:24
Definition Block.h:36
Definition Experiments.h:14
Definition HashedString.h:5
Definition SemVersion.h:15
Definition ServerScriptManager.h:67
Definition WeakPtr.h:10
Definition BlockTypeRegistry.h:39
Definition BlockTypeRegistry.h:133
Definition BlockTypeRegistry.h:95