From 7fdfb8644169a25805afd32f00ced38c1c14cec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Havl=C3=AD=C4=8Dek?= <80639037+havel06@users.noreply.github.com> Date: Wed, 25 Jan 2023 21:46:34 +0100 Subject: Allow certain blocks to be placed on top of upside-down stairs/slabs (#5468) * Placing certain blocks on top of upside down slabs and stairs * remove TODO * fix style errors * IsAnyStairType helper function * Block placement on stairs and slabs --- src/Blocks/BlockLever.h | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src/Blocks/BlockLever.h') diff --git a/src/Blocks/BlockLever.h b/src/Blocks/BlockLever.h index bf6f911a1..60db4ddee 100644 --- a/src/Blocks/BlockLever.h +++ b/src/Blocks/BlockLever.h @@ -2,6 +2,9 @@ #include "BlockHandler.h" #include "../Chunk.h" +#include "Blocks/BlockStairs.h" +#include "ChunkDef.h" +#include "Defines.h" #include "Mixins.h" #include "BlockSlab.h" @@ -117,7 +120,28 @@ private: (((NeighborMeta & 0x08) == 0) && (NeighborFace == BLOCK_FACE_BOTTOM)) ); } - + else if (cBlockStairsHandler::IsAnyStairType(NeighborBlockType)) + { + switch (NeighborFace) + { + case eBlockFace::BLOCK_FACE_YM: + return !(NeighborMeta & E_BLOCK_STAIRS_UPSIDE_DOWN); + case eBlockFace::BLOCK_FACE_YP: + return (NeighborMeta & E_BLOCK_STAIRS_UPSIDE_DOWN); + case eBlockFace::BLOCK_FACE_XP: + return ((NeighborMeta & 0b11) == E_BLOCK_STAIRS_XP); + case eBlockFace::BLOCK_FACE_XM: + return ((NeighborMeta & 0b11) == E_BLOCK_STAIRS_XM); + case eBlockFace::BLOCK_FACE_ZP: + return ((NeighborMeta & 0b11) == E_BLOCK_STAIRS_ZP); + case eBlockFace::BLOCK_FACE_ZM: + return ((NeighborMeta & 0b11) == E_BLOCK_STAIRS_ZM); + default: + { + return false; + } + } + } return false; } -- cgit v1.2.3