diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-12-07 01:18:58 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-12-07 01:18:58 +0100 |
commit | 347e80bdd88f894394373745859f405dc82c1819 (patch) | |
tree | 82bf1b2163cbf7c59bf3c0181583982f34912aca /src/Blocks/BlockEnderchest.h | |
parent | Renamed animation function (diff) | |
download | cuberite-347e80bdd88f894394373745859f405dc82c1819.tar cuberite-347e80bdd88f894394373745859f405dc82c1819.tar.gz cuberite-347e80bdd88f894394373745859f405dc82c1819.tar.bz2 cuberite-347e80bdd88f894394373745859f405dc82c1819.tar.lz cuberite-347e80bdd88f894394373745859f405dc82c1819.tar.xz cuberite-347e80bdd88f894394373745859f405dc82c1819.tar.zst cuberite-347e80bdd88f894394373745859f405dc82c1819.zip |
Diffstat (limited to 'src/Blocks/BlockEnderchest.h')
-rw-r--r-- | src/Blocks/BlockEnderchest.h | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/src/Blocks/BlockEnderchest.h b/src/Blocks/BlockEnderchest.h index 0ce813f1c..50d8e38e0 100644 --- a/src/Blocks/BlockEnderchest.h +++ b/src/Blocks/BlockEnderchest.h @@ -1,18 +1,18 @@ #pragma once -#include "BlockHandler.h" +#include "BlockEntity.h" class cBlockEnderchestHandler : - public cBlockHandler + public cBlockEntityHandler { public: cBlockEnderchestHandler(BLOCKTYPE a_BlockType) - : cBlockHandler(a_BlockType) + : cBlockEntityHandler(a_BlockType) { } @@ -21,6 +21,49 @@ public: //todo: Drop Ender Chest if using silk touch pickaxe a_Pickups.push_back(cItem(E_BLOCK_OBSIDIAN, 8, 0)); } + + virtual bool GetPlacementBlockTypeMeta( + cWorld * a_World, cPlayer * a_Player, + int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, + int a_CursorX, int a_CursorY, int a_CursorZ, + BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta + ) override + { + a_BlockType = m_BlockType; + a_BlockMeta = RotationToMetaData(a_Player->GetRotation()); + return true; + } + + virtual const char * GetStepSound(void) override + { + return "step.stone"; + } + + static NIBBLETYPE RotationToMetaData(double a_Rotation) + { + a_Rotation += 90 + 45; // So its not aligned with axis + + if (a_Rotation > 360.f) + { + a_Rotation -= 360.f; + } + if ((a_Rotation >= 0.f) && (a_Rotation < 90.f)) + { + return 0x4; + } + else if ((a_Rotation >= 180) && (a_Rotation < 270)) + { + return 0x5; + } + else if ((a_Rotation >= 90) && (a_Rotation < 180)) + { + return 0x2; + } + else + { + return 0x3; + } + } } ; |