Cuberite
A lightweight, fast and extensible game server for Minecraft
Functions
Defines.cpp File Reference
#include "Globals.h"
#include "Defines.h"
#include "BlockType.h"
Include dependency graph for Defines.cpp:

Go to the source code of this file.

Functions

Vector3i AddFaceDirection (const Vector3i a_Position, const eBlockFace a_BlockFace, const bool a_InvertDirection)
 Returns the coords of a block that is neighboring the specified position through its specified face. More...
 
void AddFaceDirection (int &a_BlockX, int &a_BlockY, int &a_BlockZ, eBlockFace a_BlockFace, bool a_bInverse)
 Modifies the specified coords so that they point to the block adjacent to the one specified through its specified face. More...
 
AString BlockFaceToString (eBlockFace a_BlockFace)
 Returns the textual representation of the BlockFace constant. More...
 
const char * ClickActionToString (int a_ClickAction)
 Returns a textual representation of the click action. More...
 
AString DamageTypeToString (eDamageType a_DamageType)
 Translates damage type constant to a string representation (built-in). More...
 
AString DimensionToString (eDimension a_Dimension)
 Translates a dimension enum to dimension string. More...
 
bool IsValidBlock (int a_BlockType)
 Returns true if the specified block type is valid (known). More...
 
bool IsValidItem (int a_ItemType)
 Returns true if the specified item type is valid (known). More...
 
eBlockFace MirrorBlockFaceY (eBlockFace a_BlockFace)
 Returns a blockface mirrored around the Y axis (doesn't change up / down). More...
 
eBlockFace ReverseBlockFace (eBlockFace a_BlockFace)
 Returns a blockface opposite to the one specified. More...
 
eBlockFace RotateBlockFaceCCW (eBlockFace a_BlockFace)
 Returns a blockface rotated around the Y axis counter-clockwise. More...
 
eBlockFace RotateBlockFaceCW (eBlockFace a_BlockFace)
 Returns a blockface rotated around the Y axis clockwise. More...
 
eDamageType StringToDamageType (const AString &a_DamageTypeString)
 Translates a damage type string to damage type. More...
 
eDimension StringToDimension (const AString &a_DimensionString)
 Translates a dimension string to dimension enum. More...
 

Function Documentation

◆ AddFaceDirection() [1/2]

Vector3i AddFaceDirection ( Vector3i  a_Pos,
eBlockFace  a_BlockFace,
bool  a_InvertDirection = false 
)

Returns the coords of a block that is neighboring the specified position through its specified face.

If a_InvertDirection is true, the opposite direction is used instead.

Definition at line 392 of file Defines.cpp.

◆ AddFaceDirection() [2/2]

void AddFaceDirection ( int &  a_BlockX,
int &  a_BlockY,
int &  a_BlockZ,
eBlockFace  a_BlockFace,
bool  a_bInverse = false 
)

Modifies the specified coords so that they point to the block adjacent to the one specified through its specified face.

If a_Inverse is true, the opposite direction is used instead.

Definition at line 378 of file Defines.cpp.

◆ BlockFaceToString()

AString BlockFaceToString ( eBlockFace  a_BlockFace)

Returns the textual representation of the BlockFace constant.

Definition at line 141 of file Defines.cpp.

◆ ClickActionToString()

const char* ClickActionToString ( int  a_ClickAction)

Returns a textual representation of the click action.

Definition at line 10 of file Defines.cpp.

◆ DamageTypeToString()

AString DamageTypeToString ( eDamageType  a_DamageType)

Translates damage type constant to a string representation (built-in).

Definition at line 267 of file Defines.cpp.

◆ DimensionToString()

AString DimensionToString ( eDimension  a_Dimension)

Translates a dimension enum to dimension string.

Takes an eDimension enum value and returns "Overworld" on failure.

Definition at line 236 of file Defines.cpp.

◆ IsValidBlock()

bool IsValidBlock ( int  a_BlockType)

Returns true if the specified block type is valid (known).

Definition at line 160 of file Defines.cpp.

◆ IsValidItem()

bool IsValidItem ( int  a_ItemType)

Returns true if the specified item type is valid (known).

Definition at line 172 of file Defines.cpp.

◆ MirrorBlockFaceY()

eBlockFace MirrorBlockFaceY ( eBlockFace  a_BlockFace)

Returns a blockface mirrored around the Y axis (doesn't change up / down).

Definition at line 54 of file Defines.cpp.

◆ ReverseBlockFace()

eBlockFace ReverseBlockFace ( eBlockFace  a_BlockFace)

Returns a blockface opposite to the one specified.

Definition at line 121 of file Defines.cpp.

◆ RotateBlockFaceCCW()

eBlockFace RotateBlockFaceCCW ( eBlockFace  a_BlockFace)

Returns a blockface rotated around the Y axis counter-clockwise.

Definition at line 77 of file Defines.cpp.

◆ RotateBlockFaceCW()

eBlockFace RotateBlockFaceCW ( eBlockFace  a_BlockFace)

Returns a blockface rotated around the Y axis clockwise.

Definition at line 99 of file Defines.cpp.

◆ StringToDamageType()

eDamageType StringToDamageType ( const AString a_DamageString)

Translates a damage type string to damage type.

Takes either a number or a damage type alias (built-in). Returns -1 on failure

Definition at line 300 of file Defines.cpp.

◆ StringToDimension()

eDimension StringToDimension ( const AString a_DimensionString)

Translates a dimension string to dimension enum.

Takes either a number or a dimension alias (built-in). Returns dimOverworld on failure

Definition at line 194 of file Defines.cpp.