1
0
Fork 0
cuberite-2a/src/BlockInfo.h

72 lines
2.1 KiB
C
Raw Normal View History

#pragma once
2014-03-01 19:34:19 +00:00
class cBlockInfo
{
public:
2014-03-01 19:34:19 +00:00
cBlockInfo();
/** (Re-)Initializes the internal BlockInfo structures. */
static void Initialize(void);
/** Returns the associated BlockInfo structure. */
2014-03-01 19:34:19 +00:00
static cBlockInfo & GetById(unsigned int a_ID);
2014-03-01 19:34:19 +00:00
/** How much light do the blocks emit on their own? */
NIBBLETYPE m_LightValue;
2014-03-01 19:34:19 +00:00
/** How much light do the blocks consume? */
NIBBLETYPE m_SpreadLightFalloff;
2014-03-01 19:34:19 +00:00
/** Is a block completely transparent? (light doesn't get decreased(?)) */
bool m_Transparent;
2014-03-01 19:34:19 +00:00
/** Is a block destroyed after a single hit? */
bool m_OneHitDig;
2014-03-01 19:34:19 +00:00
/** Can a piston break this block? */
bool m_PistonBreakable;
2014-03-01 19:34:19 +00:00
/** Can this block hold snow atop? */
bool m_IsSnowable;
2014-03-01 19:34:19 +00:00
/** Does this block require a tool to drop? */
bool m_RequiresSpecialTool;
2014-03-01 19:34:19 +00:00
/** Is this block solid (player cannot walk through)? */
bool m_IsSolid;
2014-03-01 19:34:19 +00:00
/** Does this block fully occupy it's voxel - is it a 'full' block? */
bool m_FullyOccupiesVoxel;
inline static NIBBLETYPE GetLightValue (unsigned int a_ID) { return GetById(a_ID).m_LightValue; }
inline static NIBBLETYPE GetSpreadLightFalloff(unsigned int a_ID) { return GetById(a_ID).m_SpreadLightFalloff; }
inline static bool IsTransparent (unsigned int a_ID) { return GetById(a_ID).m_Transparent; }
inline static bool IsOneHitDig (unsigned int a_ID) { return GetById(a_ID).m_OneHitDig; }
2014-03-01 19:34:19 +00:00
inline static bool IsPistonBreakable (unsigned int a_ID) { return GetById(a_ID).m_PistonBreakable; }
inline static bool IsSnowable (unsigned int a_ID) { return GetById(a_ID).m_IsSnowable; }
inline static bool RequiresSpecialTool (unsigned int a_ID) { return GetById(a_ID).m_RequiresSpecialTool; }
inline static bool IsSolid (unsigned int a_ID) { return GetById(a_ID).m_IsSolid; }
inline static bool FullyOccupiesVoxel (unsigned int a_ID) { return GetById(a_ID).m_FullyOccupiesVoxel; }
protected:
// TODO xdot: Change to std::vector to support dynamic block IDs
2014-03-01 19:34:19 +00:00
static cBlockInfo ms_Info[256];
};