Cuberite
A lightweight, fast and extensible game server for Minecraft
ItemMilk.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 
5 
6 
7 
8 class cItemMilkHandler final:
9  public cItemHandler
10 {
12 
13 public:
14 
15  using Super::Super;
16 
17  virtual bool IsDrinkable(short a_ItemDamage) const override
18  {
19  UNUSED(a_ItemDamage);
20  return true;
21  }
22 
23  virtual bool EatItem(cPlayer * a_Player, cItem * a_Item) const override
24  {
25  UNUSED(a_Item);
26  a_Player->ClearEntityEffects();
27 
28  if (!a_Player->IsGameModeCreative())
29  {
31  }
32  return true;
33  }
34 };
@ E_ITEM_BUCKET
Definition: BlockType.h:369
#define UNUSED
Definition: Globals.h:72
void ClearEntityEffects(void)
Removes all currently applied entity effects (used when drinking milk)
Definition: Pawn.cpp:245
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 cItemHandler(int a_ItemType)
Definition: ItemHandler.h:37
friend class cItem
Definition: ItemHandler.h:25
virtual bool EatItem(cPlayer *a_Player, cItem *a_Item) const override
Lets the player eat a selected item.
Definition: ItemMilk.h:23
virtual bool IsDrinkable(short a_ItemDamage) const override
Indicates if this item is drinkable.
Definition: ItemMilk.h:17