LeviLamina
Loading...
Searching...
No Matches
ComponentItem.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/deps/core/string/HashedString.h"
8#include "mc/deps/core/utility/NonOwnerPointer.h"
9#include "mc/deps/shared_types/legacy/LevelSoundEvent.h"
10#include "mc/deps/shared_types/legacy/actor/ActorLocation.h"
11#include "mc/resources/JsonBetaState.h"
12#include "mc/world/item/Item.h"
13#include "mc/world/item/ItemUseMethod.h"
14#include "mc/world/item/enchanting/Enchant.h"
15#include "mc/world/level/block/BlockShape.h"
16
17// auto generated forward declare list
18// clang-format off
19class Actor;
20class BaseGameVersion;
21class Block;
22class BlockPos;
23class BlockSource;
24class BlockType;
25class CompoundTag;
26class Container;
27class Experiments;
32class ItemComponent;
33class ItemDescriptor;
34class ItemStack;
35class ItemStackBase;
36class Level;
37class ListTag;
38class Mob;
39class Player;
40class SemVersion;
41class Vec3;
45namespace Bedrock::Safety { class RedactableString; }
46namespace Core { class Path; }
47namespace Json { class Value; }
48namespace PuvLoadData { struct LoadResultWithTiming; }
49namespace cereal { struct ReflectionCtx; }
50namespace mce { class Color; }
51// clang-format on
52
53class ComponentItem : public ::Item {
54public:
55 // member variables
56 // NOLINTBEGIN
57 bool mExcludeUserDataDiffCheck : 1;
58 bool mCanDestroyInCreative : 1;
59 bool mRequiresInteract : 1;
60 bool mIsLiquidClipped : 1;
61 ::ll::TypedStorage<4, 4, float> mSpeed;
62 ::ll::TypedStorage<4, 4, int> mDamage;
63 ::ll::TypedStorage<4, 4, ::Enchant::Slot> mEnchantSlot;
64 ::ll::TypedStorage<4, 4, int> mEnchantValue;
65 ::ll::TypedStorage<8, 24, ::std::vector<::std::string>> mAlias;
66 ::ll::TypedStorage<1, 1, bool> mIsAttachable;
67 ::ll::TypedStorage<8, 16, ::std::map<::HashedString, ::std::shared_ptr<::ItemComponent>>> mItemComponents;
68 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::IconItemComponent>> mIcon;
69 ::ll::TypedStorage<8, 8, ::WeakPtr<::BlockType const>> mBlockTypeForRendering;
70 ::ll::TypedStorage<8, 16, ::std::map<::std::string, ::std::shared_ptr<::ItemComponent>>>
71 mRegisteredCerealComponents;
72 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::cereal::ReflectionCtx const>> mCtx;
73 // NOLINTEND
74
75public:
76 // prevent constructor by default
78
79public:
80 // virtual functions
81 // NOLINTBEGIN
82 // vIndex: 0
83 virtual ~ComponentItem() /*override*/;
84
85 // vIndex: 1
86 virtual ::PuvLoadData::LoadResultWithTiming
87 initServer(::Json::Value const&, ::SemVersion const&, ::IPackLoadContext&, ::JsonBetaState const) /*override*/;
88
89 // vIndex: 2
90 virtual void tearDown() /*override*/;
91
92 // vIndex: 9
93 virtual bool isComponentBased() const /*override*/;
94
95 // vIndex: 10
96 virtual bool isHumanoidArmor() const /*override*/;
97
98 // vIndex: 11
99 virtual bool isBlockPlanterItem() const /*override*/;
100
101 // vIndex: 14
102 virtual bool isDamageable() const /*override*/;
103
104 // vIndex: 15
105 virtual bool isDyeable() const /*override*/;
106
107 // vIndex: 19
108 virtual bool isFood() const /*override*/;
109
110 // vIndex: 20
111 virtual bool isThrowable() const /*override*/;
112
113 // vIndex: 21
114 virtual bool isUseable() const /*override*/;
115
116 // vIndex: 7
117 virtual bool isMusicDisk() const /*override*/;
118
119 // vIndex: 22
120 virtual bool isTrimAllowed() const /*override*/;
121
122 // vIndex: 6
123 virtual ::WeakPtr<::BlockType const> const& getBlockTypeForRendering() const /*override*/;
124
125 // vIndex: 23
126 virtual ::ItemComponent* getComponent(::HashedString const& id) const /*override*/;
127
128 // vIndex: 24
129 virtual ::IFoodItemComponent* getFood() const /*override*/;
130
131 // vIndex: 25
132 virtual ::Item& setMaxDamage(int maxDamage) /*override*/;
133
134 // vIndex: 4
135 virtual ::std::string const& getDescriptionId() const /*override*/;
136
137 // vIndex: 30
138 virtual ::BlockShape getBlockShape() const /*override*/;
139
140 // vIndex: 31
141 virtual bool canBeDepleted() const /*override*/;
142
143 // vIndex: 32
144 virtual bool canDestroySpecial(::Block const& block) const /*override*/;
145
146 // vIndex: 33
147 virtual int getLevelDataForAuxValue(int) const /*override*/;
148
149 // vIndex: 35
150 virtual short getMaxDamage() const /*override*/;
151
152 // vIndex: 36
153 virtual int getAttackDamage() const /*override*/;
154
155 // vIndex: 39
156 virtual bool isGlint(::ItemStackBase const& stack) const /*override*/;
157
158 // vIndex: 46
159 virtual bool canDestroyInCreative() const /*override*/;
160
161 // vIndex: 47
162 virtual bool isDestructive(int) const /*override*/;
163
164 // vIndex: 48
165 virtual bool isLiquidClipItem() const /*override*/;
166
167 // vIndex: 50
168 virtual bool requiresInteract() const /*override*/;
169
170 // vIndex: 52
171 virtual void appendFormattedHovertext(
172 ::ItemStackBase const& stack,
173 ::Level& level,
175 bool const showCategory
176 ) const /*override*/;
177
178 // vIndex: 53
179 virtual bool isValidRepairItem(
180 ::ItemStackBase const& source,
181 ::ItemStackBase const& repairItem,
182 ::BaseGameVersion const& baseGameVersion
183 ) const /*override*/;
184
185 // vIndex: 54
186 virtual int getEnchantSlot() const /*override*/;
187
188 // vIndex: 55
189 virtual int getEnchantValue() const /*override*/;
190
191 // vIndex: 56
192 virtual int getArmorValue() const /*override*/;
193
194 // vIndex: 61
195 virtual int getDamageChance(int unbreaking) const /*override*/;
196
197 // vIndex: 66
198 virtual ::mce::Color getColor(::CompoundTag const* userData, ::ItemDescriptor const& instance) const /*override*/;
199
200 // vIndex: 68
201 virtual bool hasCustomColor(::ItemStackBase const& instance) const /*override*/;
202
203 // vIndex: 69
204 virtual void clearColor(::ItemStackBase& instance) const /*override*/;
205
206 // vIndex: 70
207 virtual void setColor(::ItemStackBase& instance, ::mce::Color const& color) const /*override*/;
208
209 // vIndex: 76
210 virtual ::ItemStack& use(::ItemStack& item, ::Player& player) const /*override*/;
211
212 // vIndex: 77
213 virtual bool canUseAsAttack() const /*override*/;
214
215 // vIndex: 78
216 virtual ::ItemStack& useAsAttack(::ItemStack& item, ::Player& player) const /*override*/;
217
218 // vIndex: 79
219 virtual ::Actor* createProjectileActor(
220 ::BlockSource& region,
221 ::ItemStack const& stack,
222 ::Vec3 const& pos,
223 ::Vec3 const& direction
224 ) const /*override*/;
225
226 // vIndex: 80
227 virtual bool dispense(::BlockSource& region, ::Container& container, int slot, ::Vec3 const& pos, uchar face) const
228 /*override*/;
229
230 // vIndex: 81
231 virtual ::ItemUseMethod useTimeDepleted(::ItemStack& inoutInstance, ::Level* level, ::Player* player) const
232 /*override*/;
233
234 // vIndex: 82
235 virtual void releaseUsing(::ItemStack& item, ::Player* player, int durationLeft) const /*override*/;
236
237 // vIndex: 83
238 virtual float getDestroySpeed(::ItemStackBase const& item, ::Block const& block) const /*override*/;
239
240 // vIndex: 84
241 virtual void hurtActor(::ItemStack& item, ::Actor& actor, ::Mob& attacker) const /*override*/;
242
243 // vIndex: 85
244 virtual void hitActor(::ItemStack& item, ::Actor& actor, ::Mob& attacker) const /*override*/;
245
246 // vIndex: 86
247 virtual void hitBlock(::ItemStack& item, ::Block const& block, ::BlockPos const& blockPos, ::Mob& attacker) const
248 /*override*/;
249
250 // vIndex: 89
251 virtual ::std::string buildDescriptionId(::ItemDescriptor const&, ::CompoundTag const*) const /*override*/;
252
253 // vIndex: 90
254 virtual ::std::string buildEffectDescriptionName(::ItemStackBase const& stack) const /*override*/;
255
256 // vIndex: 93
257 virtual uchar getMaxStackSize(::ItemDescriptor const&) const /*override*/;
258
259 // vIndex: 96
260 virtual ::HashedString const& getCooldownCategory() const /*override*/;
261
262 // vIndex: 97
263 virtual int getCooldownDuration() const /*override*/;
264
265 // vIndex: 103
266 virtual ::SharedTypes::Legacy::ActorLocation getEquipLocation() const /*override*/;
267
268 // vIndex: 104
269 virtual ::SharedTypes::Legacy::LevelSoundEvent getEquipSound() const /*override*/;
270
271 // vIndex: 123
272 virtual bool useVariant(int, int, bool) const;
273
274 // vIndex: 124
275 virtual int getVariant(int, int, bool) const;
276
277 // vIndex: 108
278 virtual ::PuvLoadData::LoadResultWithTiming
279 initClient(::Json::Value const&, ::SemVersion const&, ::JsonBetaState const, ::IPackLoadContext&) /*override*/;
280
281 // vIndex: 111
282 virtual ::std::string getInteractText(::Player const& player) const /*override*/;
283
284 // vIndex: 112
285 virtual int getAnimationFrameFor(::Mob*, bool, ::ItemStack const*, bool) const /*override*/;
286
287 // vIndex: 113
288 virtual bool isEmissive(int auxValue) const /*override*/;
289
290 // vIndex: 110
291 virtual ::ResolvedItemIconInfo
292 getIconInfo(::ItemStackBase const& item, int newAnimationFrame, bool inInventoryPane) const /*override*/;
293
294 // vIndex: 109
295 virtual ::Item& setIconInfo(::std::string const& name, int frame) /*override*/;
296
297 // vIndex: 115
298 virtual bool canBeCharged() const /*override*/;
299
300 // vIndex: 3
301 virtual ::ComponentItem& setDescriptionId(::std::string const& descriptionId) /*override*/;
302
303 // vIndex: 125
304 virtual bool shouldUseJsonForRenderMatrix() const;
305
306 // vIndex: 27
307 virtual ::std::unique_ptr<::CompoundTag> buildNetworkTag() const /*override*/;
308
309 // vIndex: 28
310 virtual void initializeFromNetwork(::CompoundTag const& tag) /*override*/;
311
312 // vIndex: 29
313 virtual ::std::vector<::std::string> validateFromNetwork(::CompoundTag const& tag) /*override*/;
314
315 // vIndex: 119
316 virtual bool
317 _checkUseOnPermissions(::Actor& entity, ::ItemStackBase& item, uchar const& face, ::BlockPos const& pos) const
318 /*override*/;
319
320 // vIndex: 120
321 virtual bool _calculatePlacePos(::ItemStackBase& instance, ::Actor& entity, uchar& face, ::BlockPos& pos) const
322 /*override*/;
323
324 // vIndex: 121
325 virtual bool _shouldAutoCalculatePlacePos() const /*override*/;
326
327 // vIndex: 122
328 virtual ::InteractionResult
329 _useOn(::ItemStack& instance, ::Actor& entity, ::BlockPos pos, uchar face, ::Vec3 const& clickPos) const
330 /*override*/;
331 // NOLINTEND
332
333public:
334 // member functions
335 // NOLINTBEGIN
336 MCAPI ComponentItem(::std::string const& nameId, short id, ::cereal::ReflectionCtx const& ctx);
337
338 MCAPI void _addRegisteredCerealComponent(
339 ::std::pair<::std::string const, ::std::shared_ptr<::ItemComponent>>& cerealComponent
340 );
341
342 MCAPI ::std::unique_ptr<::CompoundTag> _buildItemPropertiesNetworkTag(::cereal::ReflectionCtx const& ctx) const;
343
344 MCAPI ::std::unique_ptr<::ListTag> _buildItemTagsNetworkTag() const;
345
346 MCAPI bool _doesNotTakeDurabilityDamage() const;
347
348 MCAPI void _initializeLoadedComponents(
349 ::std::optional<::SemVersion> documentVersion,
350 ::std::optional<::Experiments> _experiments
351 );
352
353 MCAPI void _loadComponentsFromNetworkTag(
354 ::std::string const& componentName,
355 ::CompoundTag const& componentTag,
357 );
358
359 MCAPI void _loadItemPropertiesNetworkTag(::CompoundTag const& tag, ::cereal::ReflectionCtx const& ctx);
360
361 MCAPI void _loadItemTagsNetworkTag(::ListTag const& listTag);
362
363 MCAPI ::PuvLoadData::LoadResultWithTiming _validateSchemaAndInitItem(
364 ::Json::Value const& itemData,
365 ::SemVersion const& documentVersion,
366 ::JsonBetaState canUseBeta,
367 ::IPackLoadContext& packLoadContext,
368 bool isServer,
370 );
371
372 MCAPI ::std::unique_ptr<::CompoundTag> buildNetworkTag(::cereal::ReflectionCtx const& ctx) const;
373
374 MCAPI void
375 init(::ComponentItemDataAll_Latest&& data, ::SemVersion const& documentVersion, ::Experiments const& experiments);
376 // NOLINTEND
377
378public:
379 // static functions
380 // NOLINTBEGIN
381 MCAPI static void _moveDataToComponentItem(::ComponentItem& item, ::ComponentItemData_Legacy& data);
382
383 MCAPI static void registerItemComponentTypes(::cereal::ReflectionCtx& ctx);
384
385 MCAPI static ::std::pair<bool, ::SemVersion> upgradeJson(
387 ::std::string& document,
388 ::Core::Path const& resourceName,
389 ::std::optional<::SemVersion> minVersion
390 );
391 // NOLINTEND
392
393public:
394 // constructor thunks
395 // NOLINTBEGIN
396 MCAPI void* $ctor(::std::string const& nameId, short id, ::cereal::ReflectionCtx const& ctx);
397 // NOLINTEND
398
399public:
400 // destructor thunk
401 // NOLINTBEGIN
402 MCAPI void $dtor();
403 // NOLINTEND
404
405public:
406 // virtual function thunks
407 // NOLINTBEGIN
408 MCFOLD void $tearDown();
409
410 MCFOLD bool $isComponentBased() const;
411
412 MCAPI bool $isHumanoidArmor() const;
413
414 MCAPI bool $isBlockPlanterItem() const;
415
416 MCAPI bool $isDamageable() const;
417
418 MCAPI bool $isDyeable() const;
419
420 MCFOLD bool $isFood() const;
421
422 MCAPI bool $isThrowable() const;
423
424 MCAPI bool $isUseable() const;
425
426 MCAPI bool $isMusicDisk() const;
427
428 MCAPI bool $isTrimAllowed() const;
429
430 MCAPI ::WeakPtr<::BlockType const> const& $getBlockTypeForRendering() const;
431
432 MCAPI ::ItemComponent* $getComponent(::HashedString const& id) const;
433
434 MCAPI ::IFoodItemComponent* $getFood() const;
435
436 MCAPI ::Item& $setMaxDamage(int maxDamage);
437
438 MCAPI ::std::string const& $getDescriptionId() const;
439
440 MCFOLD ::BlockShape $getBlockShape() const;
441
442 MCAPI bool $canBeDepleted() const;
443
444 MCAPI bool $canDestroySpecial(::Block const& block) const;
445
446 MCFOLD int $getLevelDataForAuxValue(int) const;
447
448 MCAPI short $getMaxDamage() const;
449
450 MCAPI int $getAttackDamage() const;
451
452 MCFOLD bool $isGlint(::ItemStackBase const& stack) const;
453
454 MCAPI bool $canDestroyInCreative() const;
455
456 MCFOLD bool $isDestructive(int) const;
457
458 MCAPI bool $isLiquidClipItem() const;
459
460 MCAPI bool $requiresInteract() const;
461
462 MCAPI void $appendFormattedHovertext(
463 ::ItemStackBase const& stack,
464 ::Level& level,
466 bool const showCategory
467 ) const;
468
469 MCAPI bool $isValidRepairItem(
470 ::ItemStackBase const& source,
471 ::ItemStackBase const& repairItem,
472 ::BaseGameVersion const& baseGameVersion
473 ) const;
474
475 MCAPI int $getEnchantSlot() const;
476
477 MCFOLD int $getEnchantValue() const;
478
479 MCAPI int $getArmorValue() const;
480
481 MCAPI int $getDamageChance(int unbreaking) const;
482
483 MCAPI ::mce::Color $getColor(::CompoundTag const* userData, ::ItemDescriptor const& instance) const;
484
485 MCAPI bool $hasCustomColor(::ItemStackBase const& instance) const;
486
487 MCAPI void $clearColor(::ItemStackBase& instance) const;
488
489 MCAPI void $setColor(::ItemStackBase& instance, ::mce::Color const& color) const;
490
491 MCAPI ::ItemStack& $use(::ItemStack& item, ::Player& player) const;
492
493 MCAPI bool $canUseAsAttack() const;
494
495 MCAPI ::ItemStack& $useAsAttack(::ItemStack& item, ::Player& player) const;
496
497 MCAPI ::Actor* $createProjectileActor(
498 ::BlockSource& region,
499 ::ItemStack const& stack,
500 ::Vec3 const& pos,
501 ::Vec3 const& direction
502 ) const;
503
504 MCAPI bool $dispense(::BlockSource& region, ::Container& container, int slot, ::Vec3 const& pos, uchar face) const;
505
506 MCAPI ::ItemUseMethod $useTimeDepleted(::ItemStack& inoutInstance, ::Level* level, ::Player* player) const;
507
508 MCAPI void $releaseUsing(::ItemStack& item, ::Player* player, int durationLeft) const;
509
510 MCAPI float $getDestroySpeed(::ItemStackBase const& item, ::Block const& block) const;
511
512 MCAPI void $hurtActor(::ItemStack& item, ::Actor& actor, ::Mob& attacker) const;
513
514 MCAPI void $hitActor(::ItemStack& item, ::Actor& actor, ::Mob& attacker) const;
515
516 MCAPI void $hitBlock(::ItemStack& item, ::Block const& block, ::BlockPos const& blockPos, ::Mob& attacker) const;
517
518 MCAPI ::std::string $buildDescriptionId(::ItemDescriptor const&, ::CompoundTag const*) const;
519
520 MCAPI ::std::string $buildEffectDescriptionName(::ItemStackBase const& stack) const;
521
522 MCFOLD uchar $getMaxStackSize(::ItemDescriptor const&) const;
523
524 MCAPI ::HashedString const& $getCooldownCategory() const;
525
526 MCAPI int $getCooldownDuration() const;
527
528 MCFOLD bool $useVariant(int, int, bool) const;
529
530 MCFOLD int $getVariant(int, int, bool) const;
531
532 MCAPI ::std::string $getInteractText(::Player const& player) const;
533
534 MCFOLD int $getAnimationFrameFor(::Mob*, bool, ::ItemStack const*, bool) const;
535
536 MCFOLD bool $isEmissive(int auxValue) const;
537
538 MCAPI ::ResolvedItemIconInfo
539 $getIconInfo(::ItemStackBase const& item, int newAnimationFrame, bool inInventoryPane) const;
540
541 MCAPI ::Item& $setIconInfo(::std::string const& name, int frame);
542
543 MCAPI bool $canBeCharged() const;
544
545 MCAPI ::ComponentItem& $setDescriptionId(::std::string const& descriptionId);
546
547 MCAPI bool $shouldUseJsonForRenderMatrix() const;
548
549 MCAPI ::std::unique_ptr<::CompoundTag> $buildNetworkTag() const;
550
551 MCAPI void $initializeFromNetwork(::CompoundTag const& tag);
552
553 MCAPI ::std::vector<::std::string> $validateFromNetwork(::CompoundTag const& tag);
554
555 MCFOLD bool
556 $_checkUseOnPermissions(::Actor& entity, ::ItemStackBase& item, uchar const& face, ::BlockPos const& pos) const;
557
558 MCAPI bool $_calculatePlacePos(::ItemStackBase& instance, ::Actor& entity, uchar& face, ::BlockPos& pos) const;
559
560 MCAPI bool $_shouldAutoCalculatePlacePos() const;
561
562 MCAPI ::InteractionResult
563 $_useOn(::ItemStack& instance, ::Actor& entity, ::BlockPos pos, uchar face, ::Vec3 const& clickPos) const;
564 // NOLINTEND
565
566public:
567 // vftables
568 // NOLINTBEGIN
569 MCNAPI static void** $vftable();
570 // NOLINTEND
571};
Definition Actor.h:102
Definition BaseGameVersion.h:8
Definition RedactableString.h:10
Definition BlockPos.h:17
Definition BlockSource.h:66
Definition BlockType.h:84
Definition Block.h:37
Definition ComponentItem.h:53
static MCAPI void ** $vftable()
Definition CompoundTag.h:13
Definition Container.h:31
Definition Path.h:11
Definition Experiments.h:14
Definition HashedString.h:5
Definition IFoodItemComponent.h:17
Definition IPackLoadContext.h:20
Definition IconItemComponent.h:19
Definition InteractionResult.h:5
Definition ItemComponent.h:16
Definition ItemDescriptor.h:22
Definition ItemStackBase.h:34
Definition ItemStack.h:23
Definition Item.h:66
Definition Value.h:16
Definition Level.h:243
Definition ListTag.h:12
Definition Mob.h:47
Definition Path.h:16
Definition Player.h:123
Definition SemVersion.h:16
Definition Vec3.h:10
Definition Color.h:13
Definition ComponentItemDataAll_Latest.h:11
Definition ComponentItemData_Legacy.h:17
Definition ResolvedItemIconInfo.h:8
Definition ReflectionCtx.h:11
Definition ctx.h:5