diff options
Diffstat (limited to 'src/Entities/HangingEntity.h')
-rw-r--r-- | src/Entities/HangingEntity.h | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/Entities/HangingEntity.h b/src/Entities/HangingEntity.h index 9d783006c..5d0aa17b3 100644 --- a/src/Entities/HangingEntity.h +++ b/src/Entities/HangingEntity.h @@ -46,6 +46,9 @@ public: protected: + Byte m_Facing; + + virtual void SpawnOn(cClientHandle & a_ClientHandle) override; virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override { @@ -53,6 +56,7 @@ protected: UNUSED(a_Chunk); } + /** Converts protocol hanging item facing to eBlockFace values */ inline static eBlockFace ProtocolFaceToBlockFace(Byte a_ProtocolFace) { @@ -77,6 +81,7 @@ protected: return Dir; } + /** Converts eBlockFace values to protocol hanging item faces */ inline static Byte BlockFaceToProtocolFace(eBlockFace a_BlockFace) { @@ -89,7 +94,9 @@ protected: case BLOCK_FACE_ZM: Dir = 2; break; case BLOCK_FACE_XM: Dir = 1; break; case BLOCK_FACE_XP: Dir = 3; break; - default: + case BLOCK_FACE_YP: + case BLOCK_FACE_YM: + case BLOCK_FACE_NONE: { // Uncomment when entities are initialised with their real data, instead of dummy values: // LOGINFO("Invalid facing (%d) in a cHangingEntity, adjusting to BLOCK_FACE_XP.", a_BlockFace); @@ -97,13 +104,17 @@ protected: Dir = cHangingEntity::BlockFaceToProtocolFace(BLOCK_FACE_XP); } + #if !defined(__clang__) + default: + { + ASSERT(!"Unknown BLOCK_FACE"); + return 0; + } + #endif } return Dir; } - - Byte m_Facing; - }; // tolua_export |