diff options
author | Bond-009 <bond.009@outlook.com> | 2017-07-12 12:42:02 +0200 |
---|---|---|
committer | Lukas Pioch <lukas@zgow.de> | 2017-07-12 12:42:02 +0200 |
commit | 6a1984112146a14c96f43e9cdf758f5104d6d2a3 (patch) | |
tree | 373b218beaad1ddfe76e29eb1a6370c6bc0e4624 /src/BlockEntities/ChestEntity.cpp | |
parent | Lua plugin cColor (#3833) (diff) | |
download | cuberite-6a1984112146a14c96f43e9cdf758f5104d6d2a3.tar cuberite-6a1984112146a14c96f43e9cdf758f5104d6d2a3.tar.gz cuberite-6a1984112146a14c96f43e9cdf758f5104d6d2a3.tar.bz2 cuberite-6a1984112146a14c96f43e9cdf758f5104d6d2a3.tar.lz cuberite-6a1984112146a14c96f43e9cdf758f5104d6d2a3.tar.xz cuberite-6a1984112146a14c96f43e9cdf758f5104d6d2a3.tar.zst cuberite-6a1984112146a14c96f43e9cdf758f5104d6d2a3.zip |
Diffstat (limited to '')
-rw-r--r-- | src/BlockEntities/ChestEntity.cpp | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/src/BlockEntities/ChestEntity.cpp b/src/BlockEntities/ChestEntity.cpp index a4576b66d..54f6e0dfa 100644 --- a/src/BlockEntities/ChestEntity.cpp +++ b/src/BlockEntities/ChestEntity.cpp @@ -6,6 +6,8 @@ #include "../Entities/Player.h" #include "../UI/ChestWindow.h" #include "../ClientHandle.h" +#include "../Mobs/Ocelot.h" +#include "../BoundingBox.h" @@ -217,11 +219,36 @@ void cChestEntity::DestroyWindow() +class cFindSittingCat : + public cEntityCallback +{ + virtual bool Item(cEntity * a_Entity) override + { + return ( + (a_Entity->GetEntityType() == cEntity::etMonster) && + (static_cast<cMonster *>(a_Entity)->GetMobType() == eMonsterType::mtOcelot) && + (static_cast<cOcelot *>(a_Entity)->IsSitting()) + ); + } +}; + + + + + bool cChestEntity::IsBlocked() { - // TODO: cats are an obstruction + cFindSittingCat FindSittingCat; return ( (GetPosY() >= cChunkDef::Height - 1) || - !cBlockInfo::IsTransparent(GetWorld()->GetBlock(GetPosX(), GetPosY() + 1, GetPosZ())) + !cBlockInfo::IsTransparent(GetWorld()->GetBlock(GetPosX(), GetPosY() + 1, GetPosZ())) || + ( + (GetWorld()->GetBlock(GetPosX(), GetPosY() + 1, GetPosZ()) == E_BLOCK_AIR) && + !GetWorld()->ForEachEntityInBox(cBoundingBox(Vector3d(GetPosX(), GetPosY() + 1, GetPosZ()), 1, 1), FindSittingCat) + ) ); } + + + + |