Position: rename getWorldNonNull() to getWorld(), remove original getWorld()

This commit is contained in:
Dylan K. Taylor
2020-06-29 21:19:46 +01:00
parent fc22fd80d8
commit 670ad9eb9d
81 changed files with 259 additions and 275 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->getWorldNonNull()->getTile($this->pos);
$tile = $this->pos->getWorld()->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->getWorldNonNull()->getTile($this->pos);
$tile = $this->pos->getWorld()->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->getWorldNonNull()->setBlock($this->pos, $this, false);
$this->pos->getWorld()->setBlock($this->pos, $this, false);
if(($other = $this->getOtherHalf()) !== null){
$other->occupied = $occupied;
$this->pos->getWorldNonNull()->setBlock($other->pos, $other, false);
$this->pos->getWorld()->setBlock($other->pos, $other, false);
}
}
@ -139,7 +139,7 @@ class Bed extends Transparent{
return true;
}
$time = $this->pos->getWorldNonNull()->getTimeOfDay();
$time = $this->pos->getWorld()->getTimeOfDay();
$isNight = ($time >= World::TIME_NIGHT and $time < World::TIME_SUNRISE);