LeviLamina
Loading...
Searching...
No Matches
ItemDescriptor.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/common/WeakPtr.h"
7#include "mc/molang/MolangVersion.h"
8
9// auto generated forward declare list
10// clang-format off
11class BinaryStream;
12class Block;
13class BlockType;
14class CompoundTag;
15class Item;
17struct ItemTag;
18namespace Json { class Value; }
19namespace SharedTypes::Legacy { struct ItemDescriptor; }
20namespace cereal { struct ReflectionCtx; }
21// clang-format on
22
23class ItemDescriptor {
24public:
25 // ItemDescriptor inner types declare
26 // clang-format off
27 struct ItemEntry;
28 struct BaseDescriptor;
29 // clang-format on
30
31 // ItemDescriptor inner types define
32 enum class InternalType : uchar {
33 Invalid = 0,
34 Default = 1,
35 Molang = 2,
36 ItemTag = 3,
37 Deferred = 4,
38 ComplexAlias = 5,
39 };
40
41 struct ItemEntry {
42 public:
43 // member variables
44 // NOLINTBEGIN
45 ::ll::TypedStorage<8, 8, ::Item const*> mItem;
46 ::ll::TypedStorage<2, 2, short> mAuxValue;
47 // NOLINTEND
48
49 public:
50 // member functions
51 // NOLINTBEGIN
52 MCAPI ::Block const* getBlock() const;
53 // NOLINTEND
54 };
55
57 public:
58 // virtual functions
59 // NOLINTBEGIN
60 virtual ::std::unique_ptr<::ItemDescriptor::BaseDescriptor> clone() const = 0;
61
62 virtual bool sameItems(::ItemDescriptor::BaseDescriptor const& otherDescriptor, bool compareAux) const;
63
64 virtual bool sameItem(::ItemDescriptor::ItemEntry const&, bool) const = 0;
65
66 virtual ::std::string getFullName() const;
67
68 virtual ::std::string toString() const;
69
70 virtual ::ItemDescriptor::ItemEntry getItem() const;
71
72 virtual bool forEachItemUntil(::std::function<bool(::Item const&, short)> func) const;
73
74 virtual ::std::map<::std::string, ::std::string> toMap() const = 0;
75
76 virtual ::std::optional<::CompoundTag> save() const = 0;
77
78 virtual void serialize(::Json::Value& val) const;
79
80 virtual void serialize(::BinaryStream&) const = 0;
81
82 virtual ::ItemDescriptor::InternalType getType() const = 0;
83
84 virtual bool isValid() const;
85
86 virtual uint64 getHash() const = 0;
87
88 virtual bool shouldResolve() const;
89
90 virtual ::std::unique_ptr<::ItemDescriptor::BaseDescriptor> resolve() const;
91
92 virtual ~BaseDescriptor();
93 // NOLINTEND
94
95 public:
96 // destructor thunk
97 // NOLINTBEGIN
98 MCAPI void $dtor();
99 // NOLINTEND
100
101 public:
102 // virtual function thunks
103 // NOLINTBEGIN
104 MCAPI bool $sameItems(::ItemDescriptor::BaseDescriptor const& otherDescriptor, bool compareAux) const;
105
106 MCFOLD ::std::string $getFullName() const;
107
108 MCAPI ::std::string $toString() const;
109
110 MCFOLD ::ItemDescriptor::ItemEntry $getItem() const;
111
112 MCAPI bool $forEachItemUntil(::std::function<bool(::Item const&, short)> func) const;
113
114 MCAPI void $serialize(::Json::Value& val) const;
115
116 MCFOLD bool $isValid() const;
117
118 MCFOLD bool $shouldResolve() const;
119
120 MCFOLD ::std::unique_ptr<::ItemDescriptor::BaseDescriptor> $resolve() const;
121
122
123 // NOLINTEND
124
125 public:
126 // vftables
127 // NOLINTBEGIN
128 MCNAPI static void** $vftable();
129 // NOLINTEND
130 };
131
132public:
133 // member variables
134 // NOLINTBEGIN
135 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ItemDescriptor::BaseDescriptor>> mImpl;
136 // NOLINTEND
137
138public:
139 // prevent constructor by default
140 ItemDescriptor(ItemDescriptor const&);
141 ItemDescriptor();
142
143public:
144 // virtual functions
145 // NOLINTBEGIN
146 virtual ~ItemDescriptor();
147
148 virtual void serialize(::Json::Value& val) const;
149
150 virtual void serialize(::BinaryStream& stream) const;
151 // NOLINTEND
152
153public:
154 // member functions
155 // NOLINTBEGIN
156 MCAPI explicit ItemDescriptor(::Block const& block);
157
158 MCAPI explicit ItemDescriptor(::BlockType const& block);
159
160 MCAPI explicit ItemDescriptor(::ItemTag const& itemTag);
161
162 MCAPI explicit ItemDescriptor(::ReadOnlyBinaryStream& stream);
163
164 MCAPI ItemDescriptor(::std::string_view fullName, int itemAux);
165
166 MCAPI ItemDescriptor(::Item const& item, int auxValue);
167
168 MCAPI ItemDescriptor(::Json::Value const& val, ::MolangVersion molangVersion);
169
170 MCAPI void _resolve() const;
171
172 MCAPI bool forEachItemUntil(::std::function<bool(::Item const&, short)> func) const;
173
174 MCAPI short getAuxValue() const;
175
176 MCAPI ::Block const* getBlock() const;
177
178 MCAPI ::WeakPtr<::BlockType const> const& getBlockType() const;
179
180 MCAPI ::std::string getFullName() const;
181
182 MCAPI short getId() const;
183
184 MCAPI int getIdAux() const;
185
186 MCAPI ::Item const* getItem() const;
187
188 MCAPI ::std::string getRawNameId() const;
189
190 MCAPI ::std::string getSerializedNameAndAux() const;
191
192 MCAPI bool isNull() const;
193
194 MCAPI bool isValid(bool shouldResolve) const;
195
196 MCAPI void operator=(::ItemDescriptor&& rhs);
197
198 MCAPI void operator=(::ItemDescriptor const& rhs);
199
200 MCAPI bool sameItem(::ItemDescriptor const& otherItemDescriptor, bool compareAux) const;
201
202 MCAPI ::std::optional<::CompoundTag> save() const;
203 // NOLINTEND
204
205public:
206 // static functions
207 // NOLINTBEGIN
208 MCAPI static void bindType(::cereal::ReflectionCtx& ctx);
209
210 MCAPI static void fromSharedTypes(::ItemDescriptor& instance, ::SharedTypes::Legacy::ItemDescriptor const& desc);
211
212 MCAPI static ::std::optional<::ItemDescriptor> fromTag(::CompoundTag const* tag);
213
214 MCAPI static ::SharedTypes::Legacy::ItemDescriptor toSharedTypes(::ItemDescriptor const& id);
215 // NOLINTEND
216
217public:
218 // constructor thunks
219 // NOLINTBEGIN
220 MCAPI void* $ctor(::Block const& block);
221
222 MCAPI void* $ctor(::BlockType const& block);
223
224 MCAPI void* $ctor(::ItemTag const& itemTag);
225
226 MCAPI void* $ctor(::ReadOnlyBinaryStream& stream);
227
228 MCAPI void* $ctor(::std::string_view fullName, int itemAux);
229
230 MCAPI void* $ctor(::Item const& item, int auxValue);
231
232 MCAPI void* $ctor(::Json::Value const& val, ::MolangVersion molangVersion);
233 // NOLINTEND
234
235public:
236 // destructor thunk
237 // NOLINTBEGIN
238 MCFOLD void $dtor();
239 // NOLINTEND
240
241public:
242 // virtual function thunks
243 // NOLINTBEGIN
244 MCAPI void $serialize(::Json::Value& val) const;
245
246 MCAPI void $serialize(::BinaryStream& stream) const;
247
248
249 // NOLINTEND
250
251public:
252 // vftables
253 // NOLINTBEGIN
254 MCAPI static void** $vftable();
255 // NOLINTEND
256};
Definition BinaryStream.h:11
Definition BlockType.h:84
Definition Block.h:43
Definition CompoundTag.h:23
Definition Item.h:69
Definition Value.h:16
Definition ReadOnlyBinaryStream.h:8
Definition ItemDescriptor.h:56
static MCAPI void ** $vftable()
Definition ItemDescriptor.h:41
Definition ItemTag.h:8
Definition ItemDescriptor.h:15
Definition ReflectionCtx.h:11
Definition ctx.h:5