mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
Block: Use parent::place() instead of setBlock() directly
This commit is contained in:
@ -152,11 +152,11 @@ class Bed extends Transparent{
|
||||
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, Player $player = null) : bool{
|
||||
$down = $this->getSide(Facing::DOWN);
|
||||
if(!$down->isTransparent()){
|
||||
$meta = $player instanceof Player ? Bearing::rotate($player->getDirection(), 2) : 0; //rotate 180 degrees
|
||||
$next = $this->getSide(self::getOtherHalfSide($meta));
|
||||
$this->meta = $player instanceof Player ? Bearing::rotate($player->getDirection(), 2) : 0; //rotate 180 degrees
|
||||
$next = $this->getSide(self::getOtherHalfSide($this->meta));
|
||||
if($next->canBeReplaced() and !$next->getSide(Facing::DOWN)->isTransparent()){
|
||||
$this->getLevel()->setBlock($blockReplace, BlockFactory::get($this->id, $meta), true, true);
|
||||
$this->getLevel()->setBlock($next, BlockFactory::get($this->id, $meta | self::BITFLAG_HEAD), true, true);
|
||||
parent::place($item, $blockReplace, $blockClicked, $face, $clickVector, $player);
|
||||
$this->getLevel()->setBlock($next, BlockFactory::get($this->id, $this->meta | self::BITFLAG_HEAD), true, true);
|
||||
|
||||
Tile::createTile(Tile::BED, $this->getLevel(), TileBed::createNBT($this, $face, $item, $player));
|
||||
Tile::createTile(Tile::BED, $this->getLevel(), TileBed::createNBT($next, $face, $item, $player));
|
||||
|
Reference in New Issue
Block a user