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