Cuberite
A lightweight, fast and extensible game server for Minecraft
ItemSoup.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "ItemFood.h"
5 #include "../World.h"
6 
7 
8 
9 
10 
11 class cItemSoupHandler final:
12  public cItemFoodHandler
13 {
15 
16 public:
17 
18  constexpr cItemSoupHandler(int a_ItemType, FoodInfo a_FoodInfo):
19  Super(a_ItemType, a_FoodInfo)
20  {
21 
22  }
23 
24  virtual bool EatItem(cPlayer * a_Player, cItem * a_Item) const override
25  {
26  // Skip over food handler, which does removal for us.
27  if (!cItemHandler::EatItem(a_Player, a_Item))
28  {
29  return false;
30  }
31 
32  if (!a_Player->IsGameModeCreative())
33  {
35  }
36 
37  return true;
38  }
39 
40 };
@ E_ITEM_BOWL
Definition: BlockType.h:325
Definition: Player.h:29
bool IsGameModeCreative(void) const
Returns true if the player is in Creative mode, either explicitly, or by inheriting from current worl...
Definition: Player.cpp:1025
void ReplaceOneEquippedItemTossRest(const cItem &)
Removes one item from the the current equipped item stack, and attempts to add the specified item sta...
Definition: Player.cpp:1745
Definition: Item.h:37
constexpr cItemFoodHandler(int a_ItemType, FoodInfo a_FoodInfo)
Definition: ItemFood.h:17
virtual bool EatItem(cPlayer *a_Player, cItem *a_Item) const
Lets the player eat a selected item.
friend class cItem
Definition: ItemHandler.h:25
constexpr cItemSoupHandler(int a_ItemType, FoodInfo a_FoodInfo)
Definition: ItemSoup.h:18
virtual bool EatItem(cPlayer *a_Player, cItem *a_Item) const override
Lets the player eat a selected item.
Definition: ItemSoup.h:24