Cuberite
A lightweight, fast and extensible game server for Minecraft
FurnaceRecipe.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 
5 
6 
7 
8 class cItem;
9 
10 
11 
12 
13 
15 {
16 public:
17  cFurnaceRecipe(void);
19 
20  void ReloadRecipes(void);
21 
22  struct cFuel
23  {
24  cItem * In;
25  int BurnTime;
26  };
27 
28  struct cRecipe
29  {
30  cItem * In;
32  int CookTime;
33  float Reward;
34  };
35 
37  const cRecipe * GetRecipeFrom(const cItem & a_Ingredient) const;
38 
40  bool IsFuel(const cItem & a_Item) const;
41 
43  int GetBurnTime(const cItem & a_Fuel) const;
44 
45 private:
46  void ClearRecipes(void);
47 
50  void AddFuelFromLine(const AString & a_Line, unsigned int a_LineNum);
51 
54  void AddRecipeFromLine(const AString & a_Line, unsigned int a_LineNum);
55 
57  bool ParseItem(const AString & a_String, cItem & a_Item);
58 
59  struct sFurnaceRecipeState;
61 };
62 
63 
64 
65 
std::string AString
Definition: StringUtils.h:11
const cRecipe * GetRecipeFrom(const cItem &a_Ingredient) const
Returns a recipe for the specified input, nullptr if no recipe found.
void ReloadRecipes(void)
int GetBurnTime(const cItem &a_Fuel) const
Returns the amount of time that the specified fuel burns, in ticks.
void ClearRecipes(void)
bool ParseItem(const AString &a_String, cItem &a_Item)
Parses an item string in the format "<ItemType>[: <Damage>][, <Amount>]", returns true if successful.
sFurnaceRecipeState * m_pState
Definition: FurnaceRecipe.h:59
bool IsFuel(const cItem &a_Item) const
Returns true if the item is a fuel, false if not.
void AddRecipeFromLine(const AString &a_Line, unsigned int a_LineNum)
Parses the recipe contained in the line, adds it to m_pState's recipes.
void AddFuelFromLine(const AString &a_Line, unsigned int a_LineNum)
Parses the fuel contained in the line, adds it to m_pState's fuels.
int BurnTime
How long this fuel burns, in ticks.
Definition: FurnaceRecipe.h:25
int CookTime
How long this recipe takes to smelt, in ticks.
Definition: FurnaceRecipe.h:32
float Reward
Experience reward for creating 1 of this item.
Definition: FurnaceRecipe.h:33
Definition: Item.h:37