Cuberite
A lightweight, fast and extensible game server for Minecraft
BrewingRecipes.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 
5 
6 
7 
8 #include "Item.h"
9 
10 
11 
12 
13 
15 {
16 public:
17  cBrewingRecipes(void);
18 
19  void ReloadRecipes(void);
20 
21  struct cRecipe
22  {
24  {
25  // These items always have the same type
28  }
29 
33  };
34 
36  const cRecipe * GetRecipeFrom(const cItem & a_Input, const cItem & a_Ingredient) const;
37 
39  bool IsIngredient(const cItem & a_Ingredient) const;
40 
42  bool IsBottle(const cItem & a_Item) const;
43 
45  bool IsFuel(const cItem & a_Item) const;
46 private:
47  using cRecipes = std::vector<std::unique_ptr<cBrewingRecipes::cRecipe>>;
48 
49  void ClearRecipes(void);
50 
53  void AddRecipeFromLine(AString a_Line, unsigned int a_LineNum);
54 
56  bool ParseItem(const AString & a_String, cItem & a_Item);
57 
61 };
@ E_ITEM_POTION
Definition: BlockType.h:418
std::string AString
Definition: StringUtils.h:11
std::vector< std::unique_ptr< cBrewingRecipes::cRecipe > > cRecipes
bool ParseItem(const AString &a_String, cItem &a_Item)
Parses an item string, returns true if successful.
void ClearRecipes(void)
const cRecipe * GetRecipeFrom(const cItem &a_Input, const cItem &a_Ingredient) const
Returns a recipe for the specified input, nullptr if no recipe found.
cRecipes m_Recipes
The collection of parsed recipes.
bool IsIngredient(const cItem &a_Ingredient) const
Returns true if the item is a ingredient, false if not.
void ReloadRecipes(void)
void AddRecipeFromLine(AString a_Line, unsigned int a_LineNum)
Parses the recipe contained in the line, adds it to m_pState's recipes.
bool IsBottle(const cItem &a_Item) const
Returns true if the item is a bottle / potion, false if not.
bool IsFuel(const cItem &a_Item) const
Returns true if the item is the fuel, false if not.
Definition: Item.h:37
short m_ItemType
Definition: Item.h:163