Fix players levitating in beds and teleportation of sleeping players

This commit is contained in:
dktapps 2016-08-22 19:45:25 +01:00 committed by Dylan K. Taylor
parent a6f8379c40
commit 97f6b80969

View File

@ -980,7 +980,6 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
} }
$this->sleeping = clone $pos; $this->sleeping = clone $pos;
$this->teleport(new Position($pos->x + 0.5, $pos->y - 0.5, $pos->z + 0.5, $this->level));
$this->setDataProperty(self::DATA_PLAYER_BED_POSITION, self::DATA_TYPE_POS, [$pos->x, $pos->y, $pos->z]); $this->setDataProperty(self::DATA_PLAYER_BED_POSITION, self::DATA_TYPE_POS, [$pos->x, $pos->y, $pos->z]);
$this->setDataFlag(self::DATA_PLAYER_FLAGS, self::DATA_PLAYER_FLAG_SLEEP, true); $this->setDataFlag(self::DATA_PLAYER_FLAGS, self::DATA_PLAYER_FLAG_SLEEP, true);
@ -1491,8 +1490,9 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
$this->timings->startTiming(); $this->timings->startTiming();
if($this->spawned){ if($this->spawned){
$this->processMovement($tickDiff); if(!$this->isSleeping()){
$this->processMovement($tickDiff);
}
$this->entityBaseTick($tickDiff); $this->entityBaseTick($tickDiff);
if(!$this->isSpectator() and $this->speed !== null){ if(!$this->isSpectator() and $this->speed !== null){
@ -3361,6 +3361,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
$this->resetFallDistance(); $this->resetFallDistance();
$this->nextChunkOrderRun = 0; $this->nextChunkOrderRun = 0;
$this->newPosition = null; $this->newPosition = null;
$this->stopSleep();
return true; return true;
} }
return false; return false;