From 457ec3db25543dfd730425c0aeef874f1c3fea3e Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Wed, 6 Nov 2024 23:31:57 +0000 Subject: Use cChunkDef::IsValidHeight for CanBeAt functions, and related helpers. --- src/Blocks/BlockPressurePlate.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/Blocks/BlockPressurePlate.h') diff --git a/src/Blocks/BlockPressurePlate.h b/src/Blocks/BlockPressurePlate.h index 6d852bfc0..d69234cee 100644 --- a/src/Blocks/BlockPressurePlate.h +++ b/src/Blocks/BlockPressurePlate.h @@ -22,14 +22,15 @@ private: virtual bool CanBeAt(const cChunk & a_Chunk, const Vector3i a_Position, const NIBBLETYPE a_Meta) const override { - if (a_Position.y <= 0) + const auto PosBelow = a_Position.addedY(-1); + if (!cChunkDef::IsValidHeight(PosBelow)) { return false; } BLOCKTYPE Block; NIBBLETYPE BlockMeta; - a_Chunk.GetBlockTypeMeta(a_Position.addedY(-1), Block, BlockMeta); + a_Chunk.GetBlockTypeMeta(PosBelow, Block, BlockMeta); // upside down slabs if (cBlockSlabHandler::IsAnySlabType(Block)) -- cgit v1.2.3