Automate creation and deletion of Tiles for appropriate blocks

closes #880
This commit is contained in:
Dylan K. Taylor
2019-02-13 12:27:13 +00:00
parent 260c5dcf00
commit 01e7ebeb5c
13 changed files with 100 additions and 97 deletions

View File

@ -31,7 +31,6 @@ use pocketmine\math\Facing;
use pocketmine\math\Vector3;
use pocketmine\Player;
use pocketmine\tile\Skull as TileSkull;
use pocketmine\tile\TileFactory;
use function floor;
class Skull extends Flowable{
@ -70,13 +69,18 @@ class Skull extends Flowable{
}
}
protected function getTileClass() : ?string{
return TileSkull::class;
}
public function writeStateToWorld() : void{
parent::writeStateToWorld();
/** @var TileSkull $tile */
$tile = TileFactory::create(TileSkull::class, $this->getLevel(), $this->asVector3());
$tile->setRotation($this->rotation);
$tile->setType($this->type);
$this->level->addTile($tile);
//extra block properties storage hack
$tile = $this->level->getTile($this);
if($tile instanceof TileSkull){
$tile->setRotation($this->rotation);
$tile->setType($this->type);
}
}
public function getHardness() : float{