summaryrefslogtreecommitdiffstats
path: root/src/BlockEntities
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-06-22 15:47:05 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-06-22 15:47:05 +0200
commitb2bf4661222f9dd8c234716ac2b81ccf6a09217c (patch)
treee4eaa44fb47f187f643e79834a44fb9b72325618 /src/BlockEntities
parentMerge branch 'master' of https://github.com/mc-server/MCServer (diff)
downloadcuberite-b2bf4661222f9dd8c234716ac2b81ccf6a09217c.tar
cuberite-b2bf4661222f9dd8c234716ac2b81ccf6a09217c.tar.gz
cuberite-b2bf4661222f9dd8c234716ac2b81ccf6a09217c.tar.bz2
cuberite-b2bf4661222f9dd8c234716ac2b81ccf6a09217c.tar.lz
cuberite-b2bf4661222f9dd8c234716ac2b81ccf6a09217c.tar.xz
cuberite-b2bf4661222f9dd8c234716ac2b81ccf6a09217c.tar.zst
cuberite-b2bf4661222f9dd8c234716ac2b81ccf6a09217c.zip
Diffstat (limited to '')
-rw-r--r--src/BlockEntities/ChestEntity.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/BlockEntities/ChestEntity.cpp b/src/BlockEntities/ChestEntity.cpp
index dfbe6ae87..cb9cc89bf 100644
--- a/src/BlockEntities/ChestEntity.cpp
+++ b/src/BlockEntities/ChestEntity.cpp
@@ -122,6 +122,13 @@ void cChestEntity::UsedBy(cPlayer * a_Player)
void cChestEntity::OpenNewWindow(void)
{
+ // TODO: cats are an obstruction
+ if ((GetPosY() + 1 < cChunkDef::Height) && cBlockInfo::IsSolid(GetWorld()->GetBlock(GetPosX(), GetPosY() + 1, GetPosZ())))
+ {
+ // Obstruction, don't open
+ return;
+ }
+
// Callback for opening together with neighbor chest:
class cOpenDouble :
public cChestCallback
@@ -135,6 +142,12 @@ void cChestEntity::OpenNewWindow(void)
virtual bool Item(cChestEntity * a_Chest) override
{
+ if ((a_Chest->GetPosY() + 1 < cChunkDef::Height) && cBlockInfo::IsSolid(a_Chest->GetWorld()->GetBlock(a_Chest->GetPosX(), a_Chest->GetPosY() + 1, a_Chest->GetPosZ())))
+ {
+ // Obstruction, don't open
+ return false;
+ }
+
// The primary chest should eb the one with lesser X or Z coord:
cChestEntity * Primary = a_Chest;
cChestEntity * Secondary = m_ThisChest;