LeviLamina
Loading...
Searching...
No Matches
ItemStackBase.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4#include "mc/world/level/Tick.h"
5
6// auto generated inclusion list
7#include "mc/common/WeakPtr.h"
8#include "mc/deps/shared_types/legacy/actor/ArmorSlot.h"
9#include "mc/world/level/Tick.h"
10
11// auto generated forward declare list
12// clang-format off
13class Actor;
14class Block;
15class BlockLegacy;
16class ComponentItem;
17class CompoundTag;
20class HashedString;
21class Item;
22class ItemDescriptor;
23class ItemEnchants;
24class ItemInstance;
26class RenderParams;
27class SaveContext;
28class Vec3;
29struct ItemTag;
30namespace Bedrock::Safety { class RedactableString; }
31namespace Json { class Value; }
32namespace mce { class Color; }
33// clang-format on
34
36public:
37 // ItemStackBase inner types declare
38 // clang-format off
39 struct ComparisonOptions;
40 // clang-format on
41
42 // ItemStackBase inner types define
44 public:
45 // member variables
46 // NOLINTBEGIN
47 ::ll::TypedStorage<1, 1, bool> mCompareAux;
48 ::ll::TypedStorage<1, 1, bool> mCompareRelevantUserData;
49 ::ll::TypedStorage<1, 1, bool> mCompareDamage;
50 // NOLINTEND
51 };
52
53public:
54 LLNDAPI std::string getTypeName() const;
55 LLNDAPI std::string getDescriptionName() const;
56
57public:
58 // member variables
59 // NOLINTBEGIN
61 ::std::unique_ptr<::CompoundTag> mUserData;
62 ::Block const* mBlock;
63 short mAuxValue;
64 uchar mCount;
65 bool mValid_DeprecatedSeeComment;
66 bool mShowPickUp;
67 bool mWasPickedUp;
68 ::std::chrono::steady_clock::time_point mPickupTime;
69 ::std::vector<::BlockLegacy const*> mCanPlaceOn;
70 uint64 mCanPlaceOnHash;
71 ::std::vector<::BlockLegacy const*> mCanDestroy;
72 uint64 mCanDestroyHash;
73 ::Tick mBlockingTick;
74 ::std::unique_ptr<::ItemInstance> mChargedItem;
75 // NOLINTEND
76
77public:
78 // virtual functions
79 // NOLINTBEGIN
80 // vIndex: 0
81 virtual ~ItemStackBase();
82
83 // vIndex: 3
84 virtual void reinit(::Item const& item, int count, int auxValue);
85
86 // vIndex: 2
87 virtual void reinit(::BlockLegacy const& block, int count);
88
89 // vIndex: 1
90 virtual void reinit(::std::string_view const name, int count, int auxValue);
91
92 // vIndex: 4
93 virtual void setNull(::std::optional<::std::string> reason);
94
95 // vIndex: 5
96 virtual ::std::string toString() const;
97
98 // vIndex: 6
99 virtual ::std::string toDebugString() const;
100 // NOLINTEND
101
102public:
103 // member functions
104 // NOLINTBEGIN
105 MCAPI ItemStackBase();
106
107 MCAPI explicit ItemStackBase(::RecipeIngredient const& ingredient);
108
109 MCAPI ItemStackBase(::ItemStackBase const& rhs);
110
111 MCAPI ItemStackBase(::BlockLegacy const& block, int count);
112
113 MCAPI ItemStackBase(::Block const& block, int count = 1, ::CompoundTag const* _userData = nullptr);
114
115 MCAPI
116 ItemStackBase(::std::string_view name, int count = 1, int auxValue = 0, ::CompoundTag const* _userData = nullptr);
117
118 MCAPI void _addCustomUserDataCommon(::std::unique_ptr<::CompoundTag>&& tag);
119
120 MCAPI void _checkForItemWorldCompatibility();
121
122 MCAPI ::std::string _getHoverFormattingPrefix() const;
123
124 MCAPI void _loadComponents(::CompoundTag const& compoundTag);
125
126 MCAPI void _loadItem(::CompoundTag const& compoundTag);
127
128 MCAPI void _setChargedItem(::ItemInstance const& item);
129
130 MCAPI bool _setItem(int id, bool doRemap);
131
132 MCAPI void _setItemFromBlockName(::HashedString const& blockName);
133
134 MCAPI void _updateCompareHashes();
135
136 MCAPI bool addComponents(::Json::Value const& root, ::std::string& errorMsg);
137
138 MCAPI void addCustomUserData(::ContainerComponent const& containerComponent);
139
140 MCAPI void clearChargedItem();
141
142 MCAPI void clearCustomLore();
143
144 MCAPI ::ItemEnchants constructItemEnchantsFromUserData() const;
145
146 MCAPI ::SharedTypes::Legacy::ArmorSlot getArmorSlot() const;
147
148 MCAPI short getAuxValue() const;
149
150 MCAPI int getBaseRepairCost() const;
151
152 MCAPI ::mce::Color getColor() const;
153
154 MCAPI ::ComponentItem const* getComponentItem() const;
155
156 MCAPI ::std::vector<::std::string> getCustomLore() const;
157
158 MCAPI ::std::string getCustomName() const;
159
160 MCAPI short getDamageValue() const;
161
162 MCAPI ::std::string getDescriptionId() const;
163
164 MCAPI ::ItemDescriptor getDescriptor() const;
165
166 MCAPI ::std::unique_ptr<::DynamicProperties> getDynamicProperties() const;
167
168 MCAPI ::std::optional<::std::variant<double, float, bool, ::std::string, ::Vec3>>
169 getDynamicProperty(::std::string const& key, ::std::string const& collectionName) const;
170
171 MCAPI ::HashedString const& getFullNameHash() const;
172
173 MCAPI short getId() const;
174
175 MCAPI int getIdAux() const;
176
177 MCAPI ::Item const* getItem() const;
178
179 MCAPI ::WeakPtr<::BlockLegacy const> const& getLegacyBlock() const;
180
181 MCAPI short getMaxDamage() const;
182
183 MCAPI uchar getMaxStackSize() const;
184
185 MCAPI ::std::string getName() const;
186
187 MCAPI ::std::unique_ptr<::CompoundTag> getNetworkUserData() const;
188
189 MCAPI ::HashedString const& getRawNameHash() const;
190
191 MCAPI ::std::string getRawNameId() const;
192
193 MCAPI ::Bedrock::Safety::RedactableString getRedactedCustomName() const;
194
195 MCAPI ::Bedrock::Safety::RedactableString getRedactedHoverName() const;
196
197 MCAPI ::Bedrock::Safety::RedactableString getRedactedName() const;
198
199 MCAPI bool hasContainerData() const;
200
201 MCAPI bool hasCustomHoverName() const;
202
203 MCAPI bool hasSameAuxValue(::ItemStackBase const& other) const;
204
205 MCAPI bool hasSameUserData(::ItemStackBase const& other) const;
206
207 MCAPI bool hasTag(::ItemTag const& string) const;
208
209 MCAPI bool hurtAndBreak(int deltaDamage, ::Actor* owner);
210
211 MCAPI void init(::BlockLegacy const& block, int count);
212
213 MCAPI void init(int id, int count_, int aux_, bool doRemap);
214
215 MCAPI void init(::Item const& item, int count, int auxValue, ::CompoundTag const* userData, bool doRemap);
216
217 MCAPI bool isArmorItem() const;
218
219 MCAPI bool isBlock() const;
220
221 MCAPI bool isDamageableItem() const;
222
223 MCAPI bool isDamaged() const;
224
225 MCAPI bool isEnchanted() const;
226
227 MCAPI bool isEnchantingBook() const;
228
229 MCAPI bool isFullStack() const;
230
231 MCAPI bool isGlint() const;
232
233 MCAPI bool isHorseArmorItem() const;
234
235 MCAPI bool isHumanoidArmorItem() const;
236
237 MCAPI bool isHumanoidWearableBlockItem() const;
238
239 MCAPI bool isInstance(::HashedString const& itemName, bool useItemLookup) const;
240
241 MCAPI bool isNull() const;
242
243 MCAPI bool
244 isOneOfBlockInstances(::std::vector<::std::reference_wrapper<::HashedString const>> const& blockTypeIds) const;
245
246 MCAPI bool isOneOfInstances(
247 ::std::initializer_list<::std::reference_wrapper<::HashedString const>> items,
248 bool useItemLookup
249 ) const;
250
251 MCAPI bool isPotionItem() const;
252
253 MCAPI bool isStackable() const;
254
255 MCAPI bool isStackable(::ItemStackBase const& other) const;
256
257 MCAPI bool isStackedByData() const;
258
259 MCFOLD bool matches(::ItemStackBase const& other) const;
260
261 MCAPI bool matchesEitherWearableCase(::CompoundTag const* userData) const;
262
263 MCAPI bool matchesItem(::ItemStackBase const& other) const;
264
265 MCAPI explicit operator bool() const;
266
267 MCAPI bool operator!=(::ItemStackBase const& rhs) const;
268
269 MCAPI ::ItemStackBase& operator=(::ItemStackBase const& rhs);
270
271 MCFOLD bool operator==(::ItemStackBase const& rhs) const;
272
273 MCAPI void remove(int inCount);
274
275 MCAPI void removeEnchants();
276
277 MCAPI void resetHoverName();
278
279 MCAPI bool sameItem(int itemId, int auxValue) const;
280
281 MCAPI ::std::unique_ptr<::CompoundTag> save(::SaveContext const& saveContext) const;
282
283 MCAPI void saveEnchantsToUserData(::ItemEnchants const& enchant);
284
285 MCAPI bool sendEventTriggered(::std::string const& event, ::RenderParams const& params);
286
287 MCAPI void set(int inCount);
288
289 MCAPI void setChargedItem(::ItemInstance const& instance, bool isSwapping);
290
291 MCAPI void setCustomLore(::std::vector<::std::string> const& lore);
292
293 MCAPI void setCustomName(::Bedrock::Safety::RedactableString const& name);
294
295 MCAPI void setDamageValue(short newDamage);
296
297 MCAPI void setDynamicProperty(
298 ::std::string const& key,
299 ::std::variant<double, float, bool, ::std::string, ::Vec3> const& value,
300 ::std::string const& collectionName
301 );
302
303 MCAPI void setRepairCost(int cost);
304
305 MCAPI void setUserData(::std::unique_ptr<::CompoundTag> tag);
306
307 MCAPI bool updateComponent(::std::string const& name, ::Json::Value const& data);
308 // NOLINTEND
309
310public:
311 // static functions
312 // NOLINTBEGIN
313 MCAPI static bool
314 _loadBlocksForCanPlaceOnCanDestroy(::std::vector<::BlockLegacy const*>& blockList, ::std::string const& blockName);
315 // NOLINTEND
316
317public:
318 // static variables
319 // NOLINTBEGIN
320 MCAPI static ::std::string const& TAG_CAN_DESTROY();
321
322 MCAPI static ::std::string const& TAG_CAN_PLACE_ON();
323
324 MCAPI static ::std::string const& TAG_CHARGED_ITEM();
325
326 MCAPI static ::std::string const& TAG_DISPLAY();
327
328 MCAPI static ::std::string const& TAG_DISPLAY_FILTERED_NAME();
329
330 MCAPI static ::std::string const& TAG_DISPLAY_NAME();
331
332 MCAPI static ::std::string const& TAG_ENCHANTS();
333
334 MCAPI static ::std::string const& TAG_LORE();
335
336 MCAPI static ::std::string const& TAG_REPAIR_COST();
337
338 MCAPI static ::std::string const& TAG_STORE_CAN_DESTROY();
339
340 MCAPI static ::std::string const& TAG_STORE_CAN_PLACE_ON();
341 // NOLINTEND
342
343public:
344 // constructor thunks
345 // NOLINTBEGIN
346 MCAPI void* $ctor();
347
348 MCAPI void* $ctor(::RecipeIngredient const& ingredient);
349
350 MCAPI void* $ctor(::ItemStackBase const& rhs);
351
352 MCAPI void* $ctor(::BlockLegacy const& block, int count);
353
354 MCAPI void* $ctor(::Block const& block, int count, ::CompoundTag const* _userData);
355
356 MCAPI void* $ctor(::std::string_view name, int count, int auxValue, ::CompoundTag const* _userData);
357 // NOLINTEND
358
359public:
360 // destructor thunk
361 // NOLINTBEGIN
362 MCAPI void $dtor();
363 // NOLINTEND
364
365public:
366 // virtual function thunks
367 // NOLINTBEGIN
368 MCFOLD void $reinit(::Item const& item, int count, int auxValue);
369
370 MCFOLD void $reinit(::BlockLegacy const& block, int count);
371
372 MCFOLD void $reinit(::std::string_view const name, int count, int auxValue);
373
374 MCAPI void $setNull(::std::optional<::std::string> reason);
375
376 MCAPI ::std::string $toString() const;
377
378 MCAPI ::std::string $toDebugString() const;
379 // NOLINTEND
380
381public:
382 // vftables
383 // NOLINTBEGIN
384 MCNAPI static void** $vftable();
385 // NOLINTEND
386};
Definition Actor.h:103
Definition RedactableString.h:10
Definition BlockLegacy.h:88
Definition Block.h:38
Definition ComponentItem.h:53
Definition CompoundTag.h:13
Definition ContainerComponent.h:28
Definition DynamicProperties.h:12
Definition HashedString.h:5
Definition ItemDescriptor.h:22
Definition ItemEnchants.h:17
Definition ItemInstance.h:16
Definition ItemStackBase.h:35
static MCAPI void ** $vftable()
Definition Item.h:65
Definition Value.h:16
Definition RecipeIngredient.h:17
Definition RenderParams.h:30
Definition SaveContext.h:5
Definition Vec3.h:10
Definition WeakPtr.h:10
Definition ItemStackBase.h:43
Definition ItemTag.h:8
Definition Tick.h:5