Skip to content
LeviMC
English
AutoLightDark
LeviLamina
Loading...
Searching...
No Matches
BlockDescriptor.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/string/HashedString.h"
7#include "mc/deps/shared_types/legacy/BlockDescriptor.h"
8#include "mc/molang/MolangVersion.h"
9#include "mc/platform/threading/SpinLockImpl.h"
10
11// auto generated forward declare list
12// clang-format off
13class Block;
14class BlockState;
15class CompoundTag;
16class ExpressionNode;
17namespace SharedTypes::Legacy { struct BlockDescriptor; }
18namespace cereal { struct ReflectionCtx; }
19// clang-format on
20
21class BlockDescriptor {
22public:
23 // BlockDescriptor inner types declare
24 // clang-format off
25 class ResolveHelper;
26 class ResolvedState;
27 struct State;
28 // clang-format on
29
30 // BlockDescriptor inner types define
31 enum class CompareType : int {
32 AnyTag = 0,
33 BlockName = 1,
34 States = 2,
35 Unknown = 3,
36 };
37
38 class ResolveHelper {
39 public:
40 // member variables
41 // NOLINTBEGIN
42 ::ll::TypedStorage<8, 8, ::BlockDescriptor&> mBlockDescriptor;
43 // NOLINTEND
44
45 public:
46 // prevent constructor by default
47 ResolveHelper& operator=(ResolveHelper const&);
48 ResolveHelper(ResolveHelper const&);
49 ResolveHelper();
50
51 public:
52 // member functions
53 // NOLINTBEGIN
54 MCAPI void resolve(bool logInvalidBlocks);
55 // NOLINTEND
56 };
57
59 public:
60 // member variables
61 // NOLINTBEGIN
62 ::ll::TypedStorage<8, 8, ::gsl::not_null<::BlockState const*>> mBlockState;
63 ::ll::TypedStorage<4, 4, int> mValue;
64 // NOLINTEND
65 };
66
67 struct State {
68 public:
69 // member variables
70 // NOLINTBEGIN
71 ::ll::TypedStorage<8, 48, ::HashedString> mName;
72 ::ll::TypedStorage<8, 40, ::SharedTypes::Legacy::BlockDescriptor::Compound> mState;
73 // NOLINTEND
74
75 public:
76 // prevent constructor by default
77 State();
78
79 public:
80 // member functions
81 // NOLINTBEGIN
83
84 MCNAPI State(::HashedString name, ::std::string const& stringState);
85
86 MCNAPI ~State();
87 // NOLINTEND
88
89 public:
90 // constructor thunks
91 // NOLINTBEGIN
93
94 MCNAPI void* $ctor(::HashedString name, ::std::string const& stringState);
95 // NOLINTEND
96
97 public:
98 // destructor thunk
99 // NOLINTBEGIN
100 MCNAPI void $dtor();
101 // NOLINTEND
102 };
103
105
106public:
107 // member variables
108 // NOLINTBEGIN
109 ::ll::TypedStorage<8, 8, ::BlockDescriptor::ResolveHelper> mResolveHelper;
110 ::ll::TypedStorage<8, 48, ::HashedString> mBlockName;
111 ::ll::TypedStorage<1, 1, bool> mIsComplexAlias;
112 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::ExpressionNode>> mTags;
113 ::ll::TypedStorage<8, 24, ::std::vector<::BlockDescriptor::State>> mRawStates;
114 ::ll::TypedStorage<8, 24, ::std::vector<::BlockDescriptor::ResolvedState>> mResolvedStates;
115 ::ll::TypedStorage<4, 4, ::BlockDescriptor::CompareType> mCompareType;
116 ::ll::TypedStorage<1, 1, bool> mContentLogOnError;
117 ::ll::TypedStorage<8, 8, ::Block const*> mBlock;
118 ::ll::TypedStorage<1, 1, bool> mValid;
119 ::ll::TypedStorage<1, 1, bool> mIsDeferred;
120 ::ll::TypedStorage<8, 24, ::SpinLockImpl> mLock;
121 // NOLINTEND
122
123public:
124 static bool anyMatch(::std::vector<::BlockDescriptor> const& blockDescriptors, ::Block const& block) {
125 return std::ranges::any_of(blockDescriptors, [&block](auto&& des) { return des.matches(block); });
126 }
127
128public:
129 // prevent constructor by default
130 BlockDescriptor();
131
132public:
133 // member functions
134 // NOLINTBEGIN
136
137 MCAPI explicit BlockDescriptor(::HashedString const& fullName);
138
139 MCAPI BlockDescriptor(::BlockDescriptor&& rhs);
140
141 MCAPI BlockDescriptor(::BlockDescriptor const& rhs);
142
143 MCNAPI BlockDescriptor(::std::string const& name, ::std::vector<::BlockDescriptor::State>&& states);
144
145 MCNAPI bool _anyTagsMatch(::Block const& block) const;
146
147 MCNAPI bool _statesMatch(::Block const& block) const;
148
149 MCAPI ::Block const& getBlockOrUnknownBlock() const;
150
151 MCNAPI ::BlockDescriptor::CompareType const& getCompareType() const;
152
153 MCNAPI ::std::string const& getFullName() const;
154
155 MCNAPI bool isValid() const;
156
157 MCAPI bool matches(::Block const& block) const;
158
159 MCNAPI bool matches(::BlockDescriptor const& otherDescriptor) const;
160
161 MCNAPI void operator=(::BlockDescriptor&& rhs);
162
163 MCNAPI void operator=(::BlockDescriptor const& rhs);
164
165 MCNAPI ::std::unique_ptr<::CompoundTag> toCompoundTag() const;
166
167 MCAPI ::Block const* tryGetBlock() const;
168
169 MCNAPI ::Block const* tryGetBlockNoLogging() const;
170
171 MCAPI ~BlockDescriptor();
172 // NOLINTEND
173
174public:
175 // static functions
176 // NOLINTBEGIN
178
179 MCNAPI static ::BlockDescriptor fromCompoundTag(::CompoundTag const& tag);
180
181 MCNAPI static ::BlockDescriptor
182 fromTagExpression(::std::string const& tagExpression, ::MolangVersion molangVersion);
183
184 MCNAPI static ::SharedTypes::Legacy::BlockDescriptor toSharedTypes(::BlockDescriptor const& instance);
185 // NOLINTEND
186
187public:
188 // static variables
189 // NOLINTBEGIN
190 MCNAPI static ::std::add_lvalue_reference_t<char const[]> JSON_NAME_FIELD();
191
192 MCNAPI static ::std::add_lvalue_reference_t<char const[]> JSON_STATES_FIELD();
193
194 MCNAPI static ::std::add_lvalue_reference_t<char const[]> JSON_TAGS_FIELD();
195 // NOLINTEND
196
197public:
198 // constructor thunks
199 // NOLINTBEGIN
201
202 MCAPI void* $ctor(::HashedString const& fullName);
203
204 MCAPI void* $ctor(::BlockDescriptor&& rhs);
205
206 MCAPI void* $ctor(::BlockDescriptor const& rhs);
207
208 MCNAPI void* $ctor(::std::string const& name, ::std::vector<::BlockDescriptor::State>&& states);
209 // NOLINTEND
210
211public:
212 // destructor thunk
213 // NOLINTBEGIN
214 MCAPI void $dtor();
215 // NOLINTEND
216};
Definition BlockDescriptor.h:38
Definition BlockDescriptor.h:58
MCAPI void operator=(::BlockDescriptor &&rhs)
MCAPI bool _statesMatch(::Block const &block) const
static MCAPI ::BlockDescriptor fromCompoundTag(::CompoundTag const &tag)
MCAPI void * $ctor(::std::string const &name, ::std::vector<::BlockDescriptor::State > &&states)
MCAPI bool matches(::BlockDescriptor const &otherDescriptor) const
MCAPI::Block const * tryGetBlockNoLogging() const
MCAPI void * $ctor(::SharedTypes::Legacy::BlockDescriptor desc)
MCAPI bool isValid() const
static MCAPI ::std::add_lvalue_reference_t< char const[]> JSON_STATES_FIELD()
static MCAPI ::BlockDescriptor fromTagExpression(::std::string const &tagExpression, ::MolangVersion molangVersion)
MCAPI ::std::unique_ptr<::CompoundTag > toCompoundTag() const
MCAPI void operator=(::BlockDescriptor const &rhs)
MCAPI::BlockDescriptor::CompareType const & getCompareType() const
MCAPI BlockDescriptor(::SharedTypes::Legacy::BlockDescriptor desc)
MCAPI BlockDescriptor(::std::string const &name, ::std::vector<::BlockDescriptor::State > &&states)
MCAPI bool _anyTagsMatch(::Block const &block) const
static MCAPI ::SharedTypes::Legacy::BlockDescriptor toSharedTypes(::BlockDescriptor const &instance)
static MCAPI ::std::add_lvalue_reference_t< char const[]> JSON_TAGS_FIELD()
MCAPI::std::string const & getFullName() const
static MCAPI void bindType(::cereal::ReflectionCtx &ctx)
static MCAPI ::std::add_lvalue_reference_t< char const[]> JSON_NAME_FIELD()
Definition BlockState.h:14
Definition Block.h:42
Definition CompoundTag.h:18
Definition ExpressionNode.h:35
Definition HashedString.h:5
Definition BlockDescriptor.h:67
MCAPI void * $ctor(::HashedString name, ::std::string const &stringState)
MCAPI State(::HashedString name, ::std::string const &stringState)
MCAPI void * $ctor(::HashedString name, ::SharedTypes::Legacy::BlockDescriptor::Compound state)
MCAPI State(::HashedString name, ::SharedTypes::Legacy::BlockDescriptor::Compound state)
Definition BlockDescriptor.h:20
Definition BlockDescriptor.h:12
Definition ReflectionCtx.h:11
Definition ctx.h:5