summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockVines.h
diff options
context:
space:
mode:
authorAlexander Harkness <me@bearbin.net>2024-11-07 21:03:21 +0100
committerGitHub <noreply@github.com>2024-11-07 21:03:21 +0100
commitab62fc398818d717b54110b13e1b3af48e07b686 (patch)
treed76804f9c594695ac3b90a00687b5398158df1f5 /src/Blocks/BlockVines.h
parentAdded code to export definitions for a lua-language-server (#5475) (diff)
downloadcuberite-ab62fc398818d717b54110b13e1b3af48e07b686.tar
cuberite-ab62fc398818d717b54110b13e1b3af48e07b686.tar.gz
cuberite-ab62fc398818d717b54110b13e1b3af48e07b686.tar.bz2
cuberite-ab62fc398818d717b54110b13e1b3af48e07b686.tar.lz
cuberite-ab62fc398818d717b54110b13e1b3af48e07b686.tar.xz
cuberite-ab62fc398818d717b54110b13e1b3af48e07b686.tar.zst
cuberite-ab62fc398818d717b54110b13e1b3af48e07b686.zip
Diffstat (limited to 'src/Blocks/BlockVines.h')
-rw-r--r--src/Blocks/BlockVines.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Blocks/BlockVines.h b/src/Blocks/BlockVines.h
index a23ba1489..edbd30f36 100644
--- a/src/Blocks/BlockVines.h
+++ b/src/Blocks/BlockVines.h
@@ -119,15 +119,16 @@ private:
}
// Check if vine above us, add its meta to MaxMeta:
- if ((a_Position.y < cChunkDef::Height - 1) && (a_Chunk.GetBlock(a_Position.addedY(1)) == E_BLOCK_VINES))
+ const auto AbovePos = a_Position.addedY(1);
+ if (cChunkDef::IsValidHeight(AbovePos) && (a_Chunk.GetBlock(AbovePos) == E_BLOCK_VINES))
{
- MaxMeta |= a_Chunk.GetMeta(a_Position.addedY(1));
+ MaxMeta |= a_Chunk.GetMeta(AbovePos);
}
NIBBLETYPE Common = a_CurrentMeta & MaxMeta; // Neighbors that we have and are legal.
if (Common != a_CurrentMeta)
{
- bool HasTop = (a_Position.y < (cChunkDef::Height - 1)) && IsBlockAttachable(a_Chunk.GetBlock(a_Position.addedY(1)));
+ bool HasTop = cChunkDef::IsValidHeight(AbovePos) && IsBlockAttachable(a_Chunk.GetBlock(AbovePos));
if ((Common == 0) && !HasTop) // Meta equals 0 also means top. Make a last-ditch attempt to save the vine.
{
return VINE_LOST_SUPPORT;