mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
Bed::setOccupied() no longer sets itself into the world
setting itself into the world is very annoying when trying to simply set up a blockstate.
This commit is contained in:
@ -106,12 +106,6 @@ class Bed extends Transparent{
|
||||
|
||||
public function setOccupied(bool $occupied = true) : void{
|
||||
$this->occupied = $occupied;
|
||||
$this->pos->getWorld()->setBlock($this->pos, $this, false);
|
||||
|
||||
if(($other = $this->getOtherHalf()) !== null){
|
||||
$other->occupied = $occupied;
|
||||
$this->pos->getWorld()->setBlock($other->pos, $other, false);
|
||||
}
|
||||
}
|
||||
|
||||
private function getOtherHalfSide() : int{
|
||||
@ -165,6 +159,13 @@ class Bed extends Transparent{
|
||||
|
||||
}
|
||||
|
||||
public function onNearbyBlockChange() : void{
|
||||
if(($other = $this->getOtherHalf()) !== null and $other->occupied !== $this->occupied){
|
||||
$this->occupied = $other->occupied;
|
||||
$this->pos->getWorld()->setBlock($this->pos, $this);
|
||||
}
|
||||
}
|
||||
|
||||
public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
|
||||
if($item instanceof ItemBed){ //TODO: the item should do this
|
||||
$this->color = $item->getColor();
|
||||
|
Reference in New Issue
Block a user