diff --git a/src/pocketmine/block/Chest.php b/src/pocketmine/block/Chest.php index 31640b3ee..eca854726 100644 --- a/src/pocketmine/block/Chest.php +++ b/src/pocketmine/block/Chest.php @@ -136,10 +136,6 @@ class Chest extends Transparent{ public function onActivate(Item $item, Player $player = null) : bool{ if($player instanceof Player){ - $top = $this->getSide(Vector3::SIDE_UP); - if($top->isTransparent() !== true){ - return true; - } $t = $this->getLevel()->getTile($this); $chest = null; @@ -157,10 +153,12 @@ class Chest extends Transparent{ $chest = Tile::createTile("Chest", $this->getLevel(), $nbt); } - if(isset($chest->namedtag->Lock) and $chest->namedtag->Lock instanceof StringTag){ - if($chest->namedtag->Lock->getValue() !== $item->getCustomName()){ - return true; - } + if( + !$this->getSide(Vector3::SIDE_UP)->isTransparent() or + ($chest->isPaired() and !$chest->getPair()->getBlock()->getSide(Vector3::SIDE_UP)->isTransparent()) or + (isset($chest->namedtag->Lock) and $chest->namedtag->Lock instanceof StringTag and $chest->namedtag->Lock->getValue() !== $item->getCustomName()) + ){ + return true; } $player->addWindow($chest->getInventory());