Sitting cats block enderchests from opening (#3906)
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
#include "../UI/ChestWindow.h"
|
||||
#include "../ClientHandle.h"
|
||||
#include "../Mobs/Ocelot.h"
|
||||
#include "../BoundingBox.h"
|
||||
|
||||
|
||||
|
||||
@@ -219,32 +218,13 @@ 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()
|
||||
{
|
||||
cFindSittingCat FindSittingCat;
|
||||
return (
|
||||
(GetPosY() >= cChunkDef::Height - 1) ||
|
||||
!cBlockInfo::IsTransparent(GetWorld()->GetBlock(GetPosX(), GetPosY() + 1, GetPosZ())) ||
|
||||
(GetPosY() < cChunkDef::Height - 1) &&
|
||||
(
|
||||
(GetWorld()->GetBlock(GetPosX(), GetPosY() + 1, GetPosZ()) == E_BLOCK_AIR) &&
|
||||
!GetWorld()->ForEachEntityInBox(cBoundingBox(Vector3d(GetPosX(), GetPosY() + 1, GetPosZ()), 1, 1), FindSittingCat)
|
||||
!cBlockInfo::IsTransparent(GetWorld()->GetBlock(GetPosX(), GetPosY() + 1, GetPosZ())) ||
|
||||
!cOcelot::IsCatSittingOnBlock(GetWorld(), Vector3d(GetPos()))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user