diff options
author | Tycho <work.tycho+git@gmail.com> | 2014-03-22 15:48:16 +0100 |
---|---|---|
committer | Tycho <work.tycho+git@gmail.com> | 2014-03-22 15:48:16 +0100 |
commit | 2266c2150daad68c19d320683f6bf5abd7f2ebb2 (patch) | |
tree | 111fe0c36643afd27317b8d9a4c7912b6899ec4a /src/Blocks/BlockCake.h | |
parent | Patched tolua to understand size_t (diff) | |
parent | Implemented faster upscaling using templates. (diff) | |
download | cuberite-2266c2150daad68c19d320683f6bf5abd7f2ebb2.tar cuberite-2266c2150daad68c19d320683f6bf5abd7f2ebb2.tar.gz cuberite-2266c2150daad68c19d320683f6bf5abd7f2ebb2.tar.bz2 cuberite-2266c2150daad68c19d320683f6bf5abd7f2ebb2.tar.lz cuberite-2266c2150daad68c19d320683f6bf5abd7f2ebb2.tar.xz cuberite-2266c2150daad68c19d320683f6bf5abd7f2ebb2.tar.zst cuberite-2266c2150daad68c19d320683f6bf5abd7f2ebb2.zip |
Diffstat (limited to 'src/Blocks/BlockCake.h')
-rw-r--r-- | src/Blocks/BlockCake.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/Blocks/BlockCake.h b/src/Blocks/BlockCake.h new file mode 100644 index 000000000..36e133388 --- /dev/null +++ b/src/Blocks/BlockCake.h @@ -0,0 +1,55 @@ +#pragma once + +#include "BlockHandler.h" + + + + + +class cBlockCakeHandler : + public cBlockHandler +{ +public: + cBlockCakeHandler(BLOCKTYPE a_BlockType) + : cBlockHandler(a_BlockType) + { + } + + virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override + { + NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); + + if (!a_Player->Feed(2, 0.1)) + { + return; + } + + if (Meta >= 5) + { + a_ChunkInterface.FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0); + } + else + { + a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta + 1); + } + } + + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + { + // Give nothing + } + + virtual bool IsUseable(void) override + { + return true; + } + + virtual const char * GetStepSound(void) override + { + return "step.cloth"; + } +} ; + + + + |