(Ender) Chests are obstructed by opaque blocks.
This commit is contained in:
parent
bebd4de144
commit
91833b7cb8
|
@ -80,7 +80,7 @@ void cChestEntity::UsedBy(cPlayer * a_Player)
|
|||
void cChestEntity::OpenNewWindow(void)
|
||||
{
|
||||
// TODO: cats are an obstruction
|
||||
if ((GetPosY() < cChunkDef::Height - 1) && cBlockInfo::IsSolid(GetWorld()->GetBlock(GetPosX(), GetPosY() + 1, GetPosZ())))
|
||||
if ((GetPosY() < cChunkDef::Height - 1) && !cBlockInfo::IsTransparent(GetWorld()->GetBlock(GetPosX(), GetPosY() + 1, GetPosZ())))
|
||||
{
|
||||
// Obstruction, don't open
|
||||
return;
|
||||
|
@ -99,7 +99,7 @@ void cChestEntity::OpenNewWindow(void)
|
|||
|
||||
virtual bool Item(cChestEntity * a_Chest) override
|
||||
{
|
||||
if ((a_Chest->GetPosY() < cChunkDef::Height - 1) && cBlockInfo::IsSolid(a_Chest->GetWorld()->GetBlock(a_Chest->GetPosX(), a_Chest->GetPosY() + 1, a_Chest->GetPosZ())))
|
||||
if ((a_Chest->GetPosY() < cChunkDef::Height - 1) && !cBlockInfo::IsTransparent(a_Chest->GetWorld()->GetBlock(a_Chest->GetPosX(), a_Chest->GetPosY() + 1, a_Chest->GetPosZ())))
|
||||
{
|
||||
// Obstruction, don't open
|
||||
return false;
|
||||
|
@ -136,7 +136,3 @@ void cChestEntity::OpenNewWindow(void)
|
|||
// There is no chest neighbor, open a single-chest window:
|
||||
OpenWindow(new cChestWindow(this));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -35,6 +35,12 @@ cEnderChestEntity::~cEnderChestEntity()
|
|||
|
||||
void cEnderChestEntity::UsedBy(cPlayer * a_Player)
|
||||
{
|
||||
// TODO: cats are an obstruction
|
||||
if ((GetPosY() < cChunkDef::Height - 1) && !cBlockInfo::IsTransparent(GetWorld()->GetBlock(GetPosX(), GetPosY() + 1, GetPosZ())))
|
||||
{
|
||||
// Obstruction, don't open
|
||||
return;
|
||||
}
|
||||
// If the window is not created, open it anew:
|
||||
cWindow * Window = GetWindow();
|
||||
if (Window == nullptr)
|
||||
|
@ -91,7 +97,3 @@ void cEnderChestEntity::SaveToJson(Json::Value & a_Value, const cItemGrid & a_Gr
|
|||
a_Value.append(Slot);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user