Merge branch 'next-minor'

This commit is contained in:
Dylan K. Taylor 2019-06-22 16:05:17 +01:00
commit 0273bd4f53
2 changed files with 11 additions and 2 deletions

View File

@ -145,7 +145,7 @@ class Bed extends Transparent{
return true; return true;
} }
$time = $this->getWorld()->getTime() % World::TIME_FULL; $time = $this->getWorld()->getTimeOfDay();
$isNight = ($time >= World::TIME_NIGHT and $time < World::TIME_SUNRISE); $isNight = ($time >= World::TIME_NIGHT and $time < World::TIME_SUNRISE);

View File

@ -887,7 +887,7 @@ class World implements ChunkManager, Metadatable{
} }
if($resetTime){ if($resetTime){
$time = $this->getTime() % World::TIME_FULL; $time = $this->getTimeOfDay();
if($time >= World::TIME_NIGHT and $time < World::TIME_SUNRISE){ if($time >= World::TIME_NIGHT and $time < World::TIME_SUNRISE){
$this->setTime($this->getTime() + World::TIME_FULL - $time); $this->setTime($this->getTime() + World::TIME_FULL - $time);
@ -2682,6 +2682,15 @@ class World implements ChunkManager, Metadatable{
return $this->time; return $this->time;
} }
/**
* Returns the current time of day
*
* @return int
*/
public function getTimeOfDay() : int{
return $this->time % self::TIME_FULL;
}
/** /**
* Returns the World display name. * Returns the World display name.
* WARNING: This is NOT guaranteed to be unique. Multiple worlds at runtime may share the same display name. * WARNING: This is NOT guaranteed to be unique. Multiple worlds at runtime may share the same display name.