Skip to content
LeviMC
English
AutoLightDark
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/Publisher.h"
7#include "mc/deps/core/utility/pub_sub/Subscription.h"
8#include "mc/world/item/HandSlot.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 Item;
20class ItemStack;
21class Level;
22class Player;
23class SemVersion;
24struct ItemOnUseResult;
25namespace Bedrock::PubSub::ThreadModel { struct MultiThreaded; }
26namespace SharedTypes::v1_20_50 { struct FoodItemComponent; }
27namespace cereal { struct ReflectionCtx; }
28// clang-format on
29
30class FoodItemComponent : public ::NetworkedItemComponent<::FoodItemComponent>, public ::IFoodItemComponent {
31public:
32 // FoodItemComponent inner types define
33 using ConsumeSignature = void(::ItemStack const&, ::ItemStack&, ::Actor&);
34
35public:
36 // member variables
37 // NOLINTBEGIN
38 ::ll::TypedStorage<4, 4, int> mNutrition;
39 ::ll::TypedStorage<4, 4, float> mSaturationModifier;
40 ::ll::TypedStorage<8, 16, ::ItemDescriptor> mUsingConvertsTo;
41 ::ll::TypedStorage<1, 1, bool> mCanAlwaysEat;
42 ::ll::TypedStorage<
43 8,
44 8,
45 ::std::unique_ptr<::Bedrock::PubSub::Publisher<
46 void(::ItemStack const&, ::ItemStack&, ::Actor&),
48 0>>>
49 mOnConsumePublisher;
50 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mOnUseTimeDepletedSubscription;
51 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mOnUseSubscription;
52 // NOLINTEND
53
54public:
55 // prevent constructor by default
56 FoodItemComponent();
57
58public:
59 // virtual functions
60 // NOLINTBEGIN
61 virtual ~FoodItemComponent() /*override*/ = default;
62
63 virtual void _initializeComponent(::ComponentItem& owner) /*override*/;
64
65 virtual int getNutrition() const /*override*/;
66
67 virtual float getSaturationModifier() const /*override*/;
68
69 virtual bool canAlwaysEat() const /*override*/;
70
71 virtual ::Item const* eatItem(::ItemStack& instance, ::Actor& actor, ::Level& level) /*override*/;
72
73 virtual void
74 use(::ItemOnUseResult& result, ::ItemStack& instance, ::Player& player, ::HandSlot handSlot) /*override*/;
75
76 virtual ::Item const* useTimeDepleted(
77 ::ItemUseMethod& itemUseMethod,
78 ::ItemStack const& initialInstance,
79 ::ItemStack& instance,
80 ::Player& player,
81 ::Level& level
82 ) /*override*/;
83 // NOLINTEND
84
85public:
86 // member functions
87 // NOLINTBEGIN
89 // NOLINTEND
90
91public:
92 // static functions
93 // NOLINTBEGIN
94 MCNAPI static void bindType(
96 ::std::vector<::AllExperiments> const& requiredToggles,
97 ::std::optional<::SemVersion> releasedMinFormatVersion
98 );
99 // NOLINTEND
100
101public:
102 // constructor thunks
103 // NOLINTBEGIN
105 // NOLINTEND
106
107public:
108 // virtual function thunks
109 // NOLINTBEGIN
111
112 MCNAPI int $getNutrition() const;
113
114 MCNAPI float $getSaturationModifier() const;
115
116 MCNAPI bool $canAlwaysEat() const;
117
118 MCAPI ::Item const* $eatItem(::ItemStack& instance, ::Actor& actor, ::Level& level);
119
120 MCNAPI void $use(::ItemOnUseResult& result, ::ItemStack& instance, ::Player& player, ::HandSlot handSlot);
121
122 MCAPI ::Item const* $useTimeDepleted(
123 ::ItemUseMethod& itemUseMethod,
124 ::ItemStack const& initialInstance,
125 ::ItemStack& instance,
126 ::Player& player,
127 ::Level& level
128 );
129
130
131 // NOLINTEND
132
133public:
134 // vftables
135 // NOLINTBEGIN
136 MCNAPI static void** $vftableForNetworkedItemComponent();
137
138 MCNAPI static void** $vftableForIFoodItemComponent();
139 // NOLINTEND
140};
Definition Actor.h:116
Definition Publisher.h:25
Definition ComponentItem.h:52
MCAPI int $getNutrition() const
static MCAPI void bindType(::cereal::ReflectionCtx &ctx, ::std::vector<::AllExperiments > const &requiredToggles, ::std::optional<::SemVersion > releasedMinFormatVersion)
MCAPI void $_initializeComponent(::ComponentItem &owner)
MCAPI void $use(::ItemOnUseResult &result, ::ItemStack &instance, ::Player &player, ::HandSlot handSlot)
static MCAPI void ** $vftableForIFoodItemComponent()
MCAPI void * $ctor(::SharedTypes::v1_20_50::FoodItemComponent component)
MCAPI FoodItemComponent(::SharedTypes::v1_20_50::FoodItemComponent component)
static MCAPI void ** $vftableForNetworkedItemComponent()
MCAPI bool $canAlwaysEat() const
MCAPI float $getSaturationModifier() const
Definition IFoodItemComponent.h:19
Definition ItemStack.h:26
Definition Item.h:73
Definition Level.h:255
Definition NetworkedItemComponent.h:7
Definition Player.h:131
Definition SemVersion.h:15
Definition ItemOnUseResult.h:5
Definition FoodItemComponent.h:15
Definition ReflectionCtx.h:11
Definition ctx.h:5