Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Member Functions | Private Member Functions | Private Attributes | List of all members
cRecipeMapper Class Reference

The RecipeMapper handles the translation of crafting recipes into protocol specific recipe Ids. More...

#include <RecipeMapper.h>

Public Member Functions

 cRecipeMapper (void)
 
std::optional< UInt32GetCuberiteRecipeId (UInt32 a_ProtocolRecipeId, UInt32 a_ProtocolVersion)
 Translates the protocol specific RecipeId to the cuberite RecipeId. More...
 
std::optional< UInt32GetProtocolRecipeId (UInt32 a_RecipeId, UInt32 a_ProtocolVersion)
 Translates the cuberite RecipeId to the protocol specific RecipeId. More...
 
 ~cRecipeMapper ()
 

Private Member Functions

void AddRecipeLine (const AString &a_ProtocolVersion, int a_LineNum, const AString &a_RecipeLine, const std::map< AString, UInt32 > &a_RecipeNameMap)
 Handles a single line of the protocol specific mapping file. More...
 
void loadRecipes (const AString &a_ProtocolVersion)
 Load Recipes from the protocol specific mapping file. More...
 

Private Attributes

std::map< AString, std::map< UInt32, UInt32 > > m_ProtocolVersionMap
 A mapping for each protocol from the protocol specific RecipeId and the cuberite RecipeId. More...
 

Detailed Description

The RecipeMapper handles the translation of crafting recipes into protocol specific recipe Ids.

The crafting recipes are identified by the RecipeId. The actual configuration is stored in the protocol specific configuration directory, e.g. Server/Protocol/1.12.2/base.recipes.txt

Definition at line 13 of file RecipeMapper.h.

Constructor & Destructor Documentation

◆ cRecipeMapper()

cRecipeMapper::cRecipeMapper ( void  )

Definition at line 5 of file RecipeMapper.cpp.

◆ ~cRecipeMapper()

cRecipeMapper::~cRecipeMapper ( )

Definition at line 63 of file RecipeMapper.cpp.

Member Function Documentation

◆ AddRecipeLine()

void cRecipeMapper::AddRecipeLine ( const AString a_ProtocolVersion,
int  a_LineNum,
const AString a_RecipeLine,
const std::map< AString, UInt32 > &  a_RecipeNameMap 
)
private

Handles a single line of the protocol specific mapping file.

Definition at line 71 of file RecipeMapper.cpp.

◆ GetCuberiteRecipeId()

std::optional< UInt32 > cRecipeMapper::GetCuberiteRecipeId ( UInt32  a_ProtocolRecipeId,
UInt32  a_ProtocolVersion 
)

Translates the protocol specific RecipeId to the cuberite RecipeId.

Definition at line 115 of file RecipeMapper.cpp.

◆ GetProtocolRecipeId()

std::optional< UInt32 > cRecipeMapper::GetProtocolRecipeId ( UInt32  a_RecipeId,
UInt32  a_ProtocolVersion 
)

Translates the cuberite RecipeId to the protocol specific RecipeId.

Definition at line 94 of file RecipeMapper.cpp.

◆ loadRecipes()

void cRecipeMapper::loadRecipes ( const AString a_ProtocolVersion)
private

Load Recipes from the protocol specific mapping file.

Definition at line 23 of file RecipeMapper.cpp.

Member Data Documentation

◆ m_ProtocolVersionMap

std::map<AString, std::map<UInt32, UInt32> > cRecipeMapper::m_ProtocolVersionMap
private

A mapping for each protocol from the protocol specific RecipeId and the cuberite RecipeId.

Definition at line 27 of file RecipeMapper.h.


The documentation for this class was generated from the following files: