Merge commit 'a2543ff80d2906bccda1a4e2fdbd9d8e7d147fb3'

This commit is contained in:
Dylan K. Taylor
2020-04-18 17:33:05 +01:00
76 changed files with 286 additions and 238 deletions

View File

@ -73,7 +73,7 @@ class Bed extends Transparent{
public function readStateFromWorld() : void{
parent::readStateFromWorld();
//read extra state information from the tile - this is an ugly hack
$tile = $this->pos->getWorld()->getTile($this->pos);
$tile = $this->pos->getWorldNonNull()->getTile($this->pos);
if($tile instanceof TileBed){
$this->color = $tile->getColor();
}
@ -82,7 +82,7 @@ class Bed extends Transparent{
public function writeStateToWorld() : void{
parent::writeStateToWorld();
//extra block properties storage hack
$tile = $this->pos->getWorld()->getTile($this->pos);
$tile = $this->pos->getWorldNonNull()->getTile($this->pos);
if($tile instanceof TileBed){
$tile->setColor($this->color);
}
@ -105,11 +105,11 @@ class Bed extends Transparent{
public function setOccupied(bool $occupied = true) : void{
$this->occupied = $occupied;
$this->pos->getWorld()->setBlock($this->pos, $this, false);
$this->pos->getWorldNonNull()->setBlock($this->pos, $this, false);
if(($other = $this->getOtherHalf()) !== null){
$other->occupied = $occupied;
$this->pos->getWorld()->setBlock($other->pos, $other, false);
$this->pos->getWorldNonNull()->setBlock($other->pos, $other, false);
}
}
@ -139,7 +139,7 @@ class Bed extends Transparent{
return true;
}
$time = $this->pos->getWorld()->getTimeOfDay();
$time = $this->pos->getWorldNonNull()->getTimeOfDay();
$isNight = ($time >= World::TIME_NIGHT and $time < World::TIME_SUNRISE);