summaryrefslogtreecommitdiffstats
path: root/src/Items
diff options
context:
space:
mode:
authorbeeduck <b33duck@gmail.com>2016-07-18 22:10:00 +0200
committerMattes D <github@xoft.cz>2016-07-18 22:10:00 +0200
commitdb65e11d57fb52395a3ba2e9372bdaf29aca691c (patch)
tree25bcc8449ab859676dcc2dea7b318051c22e51f1 /src/Items
parentUpdate README.md (#3266) (diff)
downloadcuberite-db65e11d57fb52395a3ba2e9372bdaf29aca691c.tar
cuberite-db65e11d57fb52395a3ba2e9372bdaf29aca691c.tar.gz
cuberite-db65e11d57fb52395a3ba2e9372bdaf29aca691c.tar.bz2
cuberite-db65e11d57fb52395a3ba2e9372bdaf29aca691c.tar.lz
cuberite-db65e11d57fb52395a3ba2e9372bdaf29aca691c.tar.xz
cuberite-db65e11d57fb52395a3ba2e9372bdaf29aca691c.tar.zst
cuberite-db65e11d57fb52395a3ba2e9372bdaf29aca691c.zip
Diffstat (limited to '')
-rw-r--r--src/Items/ItemBoat.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/Items/ItemBoat.h b/src/Items/ItemBoat.h
index 208904130..de16c70dc 100644
--- a/src/Items/ItemBoat.h
+++ b/src/Items/ItemBoat.h
@@ -77,7 +77,22 @@ public:
double y = Callbacks.m_Pos.y;
double z = Callbacks.m_Pos.z;
- cBoat * Boat = new cBoat(x + 0.5, y + 1, z + 0.5);
+ // Verify that block type for spawn point is water
+ BLOCKTYPE SpawnBlock = a_World->GetBlock(x, y, z);
+ if (!IsBlockWater(SpawnBlock))
+ {
+ return false;
+ }
+
+ // Block above must be air to spawn a boat (prevents spawning a boat underwater)
+ BLOCKTYPE BlockAbove = a_World->GetBlock(x, y + 1, z);
+ if (BlockAbove != E_BLOCK_AIR)
+ {
+ return false;
+ }
+
+ // Spawn block at water level
+ cBoat * Boat = new cBoat(x + 0.5, y + 0.5, z + 0.5);
Boat->Initialize(*a_World);
return true;