mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 19:02:59 +00:00
Block::readStateFromWorld() now returns the block object that should be used for the target position
this enables changing the block type completely if the situation calls for it.
This commit is contained in:
@ -68,13 +68,15 @@ class Bed extends Transparent{
|
||||
$w->writeBool($this->head);
|
||||
}
|
||||
|
||||
public function readStateFromWorld() : void{
|
||||
public function readStateFromWorld() : Block{
|
||||
parent::readStateFromWorld();
|
||||
//read extra state information from the tile - this is an ugly hack
|
||||
$tile = $this->position->getWorld()->getTile($this->position);
|
||||
if($tile instanceof TileBed){
|
||||
$this->color = $tile->getColor();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function writeStateToWorld() : void{
|
||||
|
Reference in New Issue
Block a user