mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-08-30 15:01:19 +00:00
Fixed double chests being openable when the other half has a solid block above it, close #1165
This commit is contained in:
parent
226175f961
commit
138d85307b
@ -136,10 +136,6 @@ class Chest extends Transparent{
|
|||||||
|
|
||||||
public function onActivate(Item $item, Player $player = null) : bool{
|
public function onActivate(Item $item, Player $player = null) : bool{
|
||||||
if($player instanceof Player){
|
if($player instanceof Player){
|
||||||
$top = $this->getSide(Vector3::SIDE_UP);
|
|
||||||
if($top->isTransparent() !== true){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$t = $this->getLevel()->getTile($this);
|
$t = $this->getLevel()->getTile($this);
|
||||||
$chest = null;
|
$chest = null;
|
||||||
@ -157,11 +153,13 @@ class Chest extends Transparent{
|
|||||||
$chest = Tile::createTile("Chest", $this->getLevel(), $nbt);
|
$chest = Tile::createTile("Chest", $this->getLevel(), $nbt);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($chest->namedtag->Lock) and $chest->namedtag->Lock instanceof StringTag){
|
if(
|
||||||
if($chest->namedtag->Lock->getValue() !== $item->getCustomName()){
|
!$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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$player->addWindow($chest->getInventory());
|
$player->addWindow($chest->getInventory());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user