From ab62fc398818d717b54110b13e1b3af48e07b686 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Thu, 7 Nov 2024 20:03:21 +0000 Subject: Clean up CanBeAt Functions (#5587) * Use cChunkDef::IsValidHeight for CanBeAt functions, and related helpers. * Add mixins for SolidSurfaceUnderneat and DirtLikeUnderneath * Minor fixes after change review. --- src/Blocks/BlockCarpet.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/Blocks/BlockCarpet.h') diff --git a/src/Blocks/BlockCarpet.h b/src/Blocks/BlockCarpet.h index 841e94b11..2477ee344 100644 --- a/src/Blocks/BlockCarpet.h +++ b/src/Blocks/BlockCarpet.h @@ -27,7 +27,8 @@ private: virtual bool CanBeAt(const cChunk & a_Chunk, const Vector3i a_Position, const NIBBLETYPE a_Meta) const override { - return (a_Position.y > 0) && (a_Chunk.GetBlock(a_Position.addedY(-1)) != E_BLOCK_AIR); + const auto PosBelow = a_Position.addedY(-1); + return cChunkDef::IsValidHeight(PosBelow) && (a_Chunk.GetBlock(PosBelow) != E_BLOCK_AIR); } -- cgit v1.2.3