Level: Make sleepTicks private, don't write directly

This commit is contained in:
Dylan K. Taylor 2017-12-30 18:41:13 +00:00
parent e5c58f9b04
commit bcb080e2b9
2 changed files with 7 additions and 3 deletions

View File

@ -1183,7 +1183,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$this->setSpawn($pos);
$this->level->sleepTicks = 60;
$this->level->setSleepTicks(60);
return true;
}
@ -1200,7 +1200,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$this->setDataProperty(self::DATA_PLAYER_BED_POSITION, self::DATA_TYPE_POS, [0, 0, 0]);
$this->setPlayerFlag(self::DATA_PLAYER_FLAG_SLEEP, false);
$this->level->sleepTicks = 0;
$this->level->setSleepTicks(0);
$pk = new AnimatePacket();
$pk->entityRuntimeId = $this->id;

View File

@ -223,7 +223,7 @@ class Level implements ChunkManager, Metadatable{
private $blockStates;
/** @var int */
public $sleepTicks = 0;
private $sleepTicks = 0;
/** @var int */
private $chunkTickRadius;
@ -838,6 +838,10 @@ class Level implements ChunkManager, Metadatable{
}
}
public function setSleepTicks(int $ticks) : void{
$this->sleepTicks = $ticks;
}
public function sendBlockExtraData(int $x, int $y, int $z, int $id, int $data, array $targets = null){
$pk = new LevelEventPacket;
$pk->evid = LevelEventPacket::EVENT_SET_DATA;