diff options
Diffstat (limited to '')
-rw-r--r-- | src/Blocks/BlockButton.h | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/src/Blocks/BlockButton.h b/src/Blocks/BlockButton.h index d703d73bd..1a141eff3 100644 --- a/src/Blocks/BlockButton.h +++ b/src/Blocks/BlockButton.h @@ -1,10 +1,15 @@ #pragma once #include "BlockHandler.h" +#include "BlockSlab.h" +#include "BlockStairs.h" #include "../BlockInfo.h" #include "../Chunk.h" +#include "Defines.h" +#include "Entities/Player.h" #include "Mixins.h" #include "ChunkInterface.h" +#include "World.h" @@ -132,7 +137,37 @@ private: return false; } BLOCKTYPE SupportBlockType; - a_Chunk.UnboundedRelGetBlockType(SupportRelPos, SupportBlockType); + NIBBLETYPE SupportBlockMeta; + a_Chunk.UnboundedRelGetBlock(SupportRelPos, SupportBlockType, SupportBlockMeta); + eBlockFace Face = BlockMetaDataToBlockFace(a_Meta); + + // upside down slabs + if (cBlockSlabHandler::IsAnySlabType(SupportBlockType)) + { + return (Face == BLOCK_FACE_YP) && (SupportBlockMeta & E_META_WOODEN_SLAB_UPSIDE_DOWN); + } + + // stairs (top and sides) + if (cBlockStairsHandler::IsAnyStairType(SupportBlockType)) + { + switch (Face) + { + case eBlockFace::BLOCK_FACE_YP: + return (SupportBlockMeta & E_BLOCK_STAIRS_UPSIDE_DOWN); + case eBlockFace::BLOCK_FACE_XP: + return ((SupportBlockMeta & 0b11) == E_BLOCK_STAIRS_XP); + case eBlockFace::BLOCK_FACE_XM: + return ((SupportBlockMeta & 0b11) == E_BLOCK_STAIRS_XM); + case eBlockFace::BLOCK_FACE_ZP: + return ((SupportBlockMeta & 0b11) == E_BLOCK_STAIRS_ZP); + case eBlockFace::BLOCK_FACE_ZM: + return ((SupportBlockMeta & 0b11) == E_BLOCK_STAIRS_ZM); + default: + { + return false; + } + } + } return cBlockInfo::FullyOccupiesVoxel(SupportBlockType); } |