Cuberite
A lightweight, fast and extensible game server for Minecraft
ItemCookedFish.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 cItemCookedFishHandler(int a_ItemType):
18  Super(a_ItemType, FoodInfo(0, 0))
19  {
20  }
21 
22  virtual FoodInfo GetFoodInfo(const cItem * a_Item) const override
23  {
24  static const FoodInfo CookedFishInfos[] =
25  {
26  FoodInfo(5, 6.0), // Cooked fish
27  FoodInfo(6, 9.6), // Cooked salmon
28  };
29 
30  if (a_Item->m_ItemDamage >= static_cast<short>(ARRAYCOUNT(CookedFishInfos)))
31  {
32  LOGWARNING("Unknown cooked fish type '%d'", a_Item->m_ItemDamage);
33  return FoodInfo(0, 0);
34  }
35  return CookedFishInfos[a_Item->m_ItemDamage];
36  }
37 
38 };
#define ARRAYCOUNT(X)
Evaluates to the number of elements in an array (compile-time!)
Definition: Globals.h:231
void LOGWARNING(std::string_view a_Format, const Args &... args)
Definition: LoggerSimple.h:67
Definition: Item.h:37
short m_ItemDamage
Definition: Item.h:165
virtual FoodInfo GetFoodInfo(const cItem *a_Item) const override
Returns the FoodInfo for this item.
constexpr cItemCookedFishHandler(int a_ItemType)
constexpr cItemFoodHandler(int a_ItemType, FoodInfo a_FoodInfo)
Definition: ItemFood.h:17