summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
authorhle0 <91701075+hle0@users.noreply.github.com>2024-11-08 00:05:47 +0100
committerGitHub <noreply@github.com>2024-11-08 00:05:47 +0100
commit33b9c5dc6dae42fb6fc33283ded888a8001e5394 (patch)
tree136bb3e02c25e49feb00a06857e4145a54b6c339 /src/World.cpp
parentRemove simple template-id from constructors for Vector3 template. (#5586) (diff)
downloadcuberite-33b9c5dc6dae42fb6fc33283ded888a8001e5394.tar
cuberite-33b9c5dc6dae42fb6fc33283ded888a8001e5394.tar.gz
cuberite-33b9c5dc6dae42fb6fc33283ded888a8001e5394.tar.bz2
cuberite-33b9c5dc6dae42fb6fc33283ded888a8001e5394.tar.lz
cuberite-33b9c5dc6dae42fb6fc33283ded888a8001e5394.tar.xz
cuberite-33b9c5dc6dae42fb6fc33283ded888a8001e5394.tar.zst
cuberite-33b9c5dc6dae42fb6fc33283ded888a8001e5394.zip
Diffstat (limited to 'src/World.cpp')
-rw-r--r--src/World.cpp34
1 files changed, 22 insertions, 12 deletions
diff --git a/src/World.cpp b/src/World.cpp
index 2f92020bf..781d44c3a 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -1539,8 +1539,7 @@ bool cWorld::GetLargeTreeAdjustment(Vector3i & a_BlockPos, NIBBLETYPE a_Meta)
{
NIBBLETYPE meta;
BLOCKTYPE type;
- GetBlockTypeMeta(a_BlockPos.addedXZ(x, z), type, meta);
- IsLarge = IsLarge && (type == E_BLOCK_SAPLING) && ((meta & 0x07) == a_Meta);
+ IsLarge = IsLarge && GetBlockTypeMeta(a_BlockPos.addedXZ(x, z), type, meta) && (type == E_BLOCK_SAPLING) && ((meta & 0x07) == a_Meta);
}
}
@@ -1557,8 +1556,7 @@ bool cWorld::GetLargeTreeAdjustment(Vector3i & a_BlockPos, NIBBLETYPE a_Meta)
{
NIBBLETYPE meta;
BLOCKTYPE type;
- GetBlockTypeMeta(a_BlockPos.addedXZ(x, z), type, meta);
- IsLarge = IsLarge && (type == E_BLOCK_SAPLING) && ((meta & 0x07) == a_Meta);
+ IsLarge = IsLarge && GetBlockTypeMeta(a_BlockPos.addedXZ(x, z), type, meta) && (type == E_BLOCK_SAPLING) && ((meta & 0x07) == a_Meta);
}
}
@@ -1576,8 +1574,7 @@ bool cWorld::GetLargeTreeAdjustment(Vector3i & a_BlockPos, NIBBLETYPE a_Meta)
{
NIBBLETYPE meta;
BLOCKTYPE type;
- GetBlockTypeMeta(a_BlockPos.addedXZ(x, z), type, meta);
- IsLarge = IsLarge && (type == E_BLOCK_SAPLING) && ((meta & 0x07) == a_Meta);
+ IsLarge = IsLarge && GetBlockTypeMeta(a_BlockPos.addedXZ(x, z), type, meta) && (type == E_BLOCK_SAPLING) && ((meta & 0x07) == a_Meta);
}
}
@@ -1596,8 +1593,7 @@ bool cWorld::GetLargeTreeAdjustment(Vector3i & a_BlockPos, NIBBLETYPE a_Meta)
{
NIBBLETYPE meta;
BLOCKTYPE type;
- GetBlockTypeMeta(a_BlockPos.addedXZ(x, z), type, meta);
- IsLarge = IsLarge && (type == E_BLOCK_SAPLING) && ((meta & 0x07) == a_Meta);
+ IsLarge = IsLarge && GetBlockTypeMeta(a_BlockPos.addedXZ(x, z), type, meta) && (type == E_BLOCK_SAPLING) && ((meta & 0x07) == a_Meta);
}
}
@@ -2044,7 +2040,10 @@ void cWorld::PlaceBlock(const Vector3i a_Position, const BLOCKTYPE a_BlockType,
{
BLOCKTYPE BlockType;
NIBBLETYPE BlockMeta;
- GetBlockTypeMeta(a_Position, BlockType, BlockMeta);
+ if (!GetBlockTypeMeta(a_Position, BlockType, BlockMeta))
+ {
+ return;
+ }
SetBlock(a_Position, a_BlockType, a_BlockMeta);
@@ -2070,7 +2069,10 @@ bool cWorld::DigBlock(Vector3i a_BlockPos, const cEntity * a_Digger)
{
BLOCKTYPE BlockType;
NIBBLETYPE BlockMeta;
- GetBlockTypeMeta(a_BlockPos, BlockType, BlockMeta);
+ if (!GetBlockTypeMeta(a_BlockPos, BlockType, BlockMeta))
+ {
+ return false;
+ }
if (!m_ChunkMap.DigBlock(a_BlockPos))
{
@@ -2617,7 +2619,11 @@ bool cWorld::IsTrapdoorOpen(int a_BlockX, int a_BlockY, int a_BlockZ)
{
BLOCKTYPE Block;
NIBBLETYPE Meta;
- GetBlockTypeMeta({ a_BlockX, a_BlockY, a_BlockZ }, Block, Meta);
+ if (!GetBlockTypeMeta({ a_BlockX, a_BlockY, a_BlockZ }, Block, Meta))
+ {
+ return false;
+ }
+
if ((Block != E_BLOCK_TRAPDOOR) && (Block != E_BLOCK_IRON_TRAPDOOR))
{
return false;
@@ -2634,7 +2640,11 @@ bool cWorld::SetTrapdoorOpen(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_Op
{
BLOCKTYPE Block;
NIBBLETYPE Meta;
- GetBlockTypeMeta({ a_BlockX, a_BlockY, a_BlockZ }, Block, Meta);
+ if (!GetBlockTypeMeta({ a_BlockX, a_BlockY, a_BlockZ }, Block, Meta))
+ {
+ return false;
+ }
+
if ((Block != E_BLOCK_TRAPDOOR) && (Block != E_BLOCK_IRON_TRAPDOOR))
{
return false;