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