LeviLamina
Loading...
Searching...
No Matches
FoodItemComponent.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/utility/pub_sub/Connector.h"
7#include "mc/deps/core/utility/pub_sub/Publisher.h"
8#include "mc/deps/core/utility/pub_sub/Subscription.h"
9#include "mc/world/item/ItemDescriptor.h"
10#include "mc/world/item/ItemUseMethod.h"
11#include "mc/world/item/components/IFoodItemComponent.h"
12#include "mc/world/item/components/NetworkedItemComponent.h"
13#include "mc/world/level/storage/AllExperiments.h"
14
15// auto generated forward declare list
16// clang-format off
17class Actor;
18class ComponentItem;
19class HashedString;
20class Item;
21class ItemStack;
22class Level;
23class Player;
24class SemVersion;
25namespace Bedrock::PubSub::ThreadModel { struct MultiThreaded; }
26namespace cereal { struct ReflectionCtx; }
27// clang-format on
28
29class FoodItemComponent : public ::NetworkedItemComponent<::FoodItemComponent>, public ::IFoodItemComponent {
30public:
31 // FoodItemComponent inner types define
32 using ConsumeSignature = void(::ItemStack const&, ::ItemStack&, ::Actor&);
33
34public:
35 // member variables
36 // NOLINTBEGIN
37 ::ll::TypedStorage<4, 4, int> mNutrition;
38 ::ll::TypedStorage<4, 4, float> mSaturationModifier;
39 ::ll::TypedStorage<8, 16, ::ItemDescriptor> mUsingConvertsTo;
40 ::ll::TypedStorage<1, 1, bool> mCanAlwaysEat;
41 ::ll::TypedStorage<
42 8,
43 8,
44 ::std::unique_ptr<::Bedrock::PubSub::Publisher<
45 void(::ItemStack const&, ::ItemStack&, ::Actor&),
47 0>>>
48 mOnConsumePublisher;
49 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mOnUseTimeDepletedSubscription;
50 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mOnUseSubscription;
51 // NOLINTEND
52
53public:
54 // virtual functions
55 // NOLINTBEGIN
56 virtual ~FoodItemComponent() /*override*/ = default;
57
58 virtual void _initializeComponent(::ComponentItem& owner) /*override*/;
59
60 virtual int getNutrition() const /*override*/;
61
62 virtual float getSaturationModifier() const /*override*/;
63
64 virtual bool canAlwaysEat() const /*override*/;
65
66 virtual ::Item const* eatItem(::ItemStack& instance, ::Actor& actor, ::Level& level) /*override*/;
67
68 virtual void use(bool& result, ::ItemStack& instance, ::Player& player) /*override*/;
69
70 virtual ::Item const* useTimeDepleted(
71 ::ItemUseMethod& itemUseMethod,
72 ::ItemStack const& initialInstance,
73 ::ItemStack& instance,
74 ::Player& player,
75 ::Level& level
76 ) /*override*/;
77 // NOLINTEND
78
79public:
80 // member functions
81 // NOLINTBEGIN
82 MCAPI ::Bedrock::PubSub::Connector<void(::ItemStack const&, ::ItemStack&, ::Actor&)>& onConsume();
83 // NOLINTEND
84
85public:
86 // static functions
87 // NOLINTBEGIN
88 MCAPI static void bindType(
90 ::std::vector<::AllExperiments> const& requiredToggles,
91 ::std::optional<::SemVersion> releasedMinFormatVersion
92 );
93
94 MCAPI static ::HashedString const& getIdentifier();
95 // NOLINTEND
96
97public:
98 // virtual function thunks
99 // NOLINTBEGIN
100 MCAPI void $_initializeComponent(::ComponentItem& owner);
101
102 MCFOLD int $getNutrition() const;
103
104 MCFOLD float $getSaturationModifier() const;
105
106 MCFOLD bool $canAlwaysEat() const;
107
108 MCAPI ::Item const* $eatItem(::ItemStack& instance, ::Actor& actor, ::Level& level);
109
110 MCAPI void $use(bool& result, ::ItemStack& instance, ::Player& player);
111
112 MCAPI ::Item const* $useTimeDepleted(
113 ::ItemUseMethod& itemUseMethod,
114 ::ItemStack const& initialInstance,
115 ::ItemStack& instance,
116 ::Player& player,
117 ::Level& level
118 );
119
120
121 // NOLINTEND
122
123public:
124 // vftables
125 // NOLINTBEGIN
126 MCNAPI static void** $vftableForNetworkedItemComponent();
127
128 MCNAPI static void** $vftableForIFoodItemComponent();
129 // NOLINTEND
130};
Definition Actor.h:106
Definition Publisher.h:8
Definition ComponentItem.h:54
Definition FoodItemComponent.h:29
static MCAPI void ** $vftableForIFoodItemComponent()
static MCAPI void ** $vftableForNetworkedItemComponent()
Definition HashedString.h:5
Definition IFoodItemComponent.h:17
Definition ItemStack.h:26
Definition Item.h:68
Definition Level.h:250
Definition NetworkedItemComponent.h:7
Definition Player.h:129
Definition SemVersion.h:15
Definition MultiThreaded.h:12
Definition ReflectionCtx.h:11
Definition ctx.h:5