summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockPortal.h
diff options
context:
space:
mode:
authorAlexander Harkness <me@bearbin.net>2024-11-07 00:31:57 +0100
committerAlexander Harkness <me@bearbin.net>2024-11-07 00:39:01 +0100
commit457ec3db25543dfd730425c0aeef874f1c3fea3e (patch)
treeb99e444ec72e67b2bbbfc9d2fcf6052024583549 /src/Blocks/BlockPortal.h
parentAdded code to export definitions for a lua-language-server (#5475) (diff)
downloadcuberite-canbeat-cleanup.tar
cuberite-canbeat-cleanup.tar.gz
cuberite-canbeat-cleanup.tar.bz2
cuberite-canbeat-cleanup.tar.lz
cuberite-canbeat-cleanup.tar.xz
cuberite-canbeat-cleanup.tar.zst
cuberite-canbeat-cleanup.zip
Diffstat (limited to 'src/Blocks/BlockPortal.h')
-rw-r--r--src/Blocks/BlockPortal.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Blocks/BlockPortal.h b/src/Blocks/BlockPortal.h
index 05daa9337..f4b5a50bd 100644
--- a/src/Blocks/BlockPortal.h
+++ b/src/Blocks/BlockPortal.h
@@ -51,9 +51,9 @@ private:
virtual bool CanBeAt(const cChunk & a_Chunk, const Vector3i a_Position, const NIBBLETYPE a_Meta) const override
{
- if ((a_Position.y <= 0) || (a_Position.y >= cChunkDef::Height - 1))
+ if (!cChunkDef::IsValidHeight(a_Position.addedY(-1)) || !cChunkDef::IsValidHeight(a_Position.addedY(1)))
{
- return false; // In case someone places a portal with meta 1 or 2 at boundaries, and server tries to get invalid coords at Y - 1 or Y + 1.
+ return false; // Must be 1 away from the boundary, there will always be another portal or an obsidian between the portal block and the boundary.
}
switch (a_Meta)