Cuberite
A lightweight, fast and extensible game server for Minecraft
ItemRawChicken.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "ItemFood.h"
5 
6 
7 
8 
9 
11  public cItemFoodHandler
12 {
14 
15 public:
16 
17  constexpr cItemRawChickenHandler(int a_ItemType):
18  Super(a_ItemType, FoodInfo(2, 1.2))
19  {
20  }
21 
22  virtual bool EatItem(cPlayer * a_Player, cItem * a_Item) const override
23  {
24  if (!Super::EatItem(a_Player, a_Item))
25  {
26  return false;
27  }
28 
29  if (GetRandomProvider().RandBool(0.3))
30  {
31  a_Player->AddEntityEffect(cEntityEffect::effHunger, 600, 0);
32  }
33 
34  return true;
35  }
36 
37 };
MTRand & GetRandomProvider()
Returns the current thread's random number source.
Definition: FastRandom.cpp:12
void AddEntityEffect(cEntityEffect::eType a_EffectType, int a_EffectDurationTicks, short a_EffectIntensity, double a_DistanceModifier=1)
Applies an entity effect.
Definition: Pawn.cpp:186
Definition: Player.h:29
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 override
Lets the player eat a selected item.
Definition: ItemFood.h:35
virtual bool EatItem(cPlayer *a_Player, cItem *a_Item) const override
Lets the player eat a selected item.
constexpr cItemRawChickenHandler(int a_ItemType)