fixed time not being sent correctly on creative mode the first time

This commit is contained in:
Shoghi Cervantes 2014-03-05 01:25:53 +01:00
parent 274f8a6113
commit 9c38ead76d
3 changed files with 7 additions and 6 deletions

View File

@ -324,6 +324,7 @@ abstract class Entity extends Position{
$this->chunksLoaded = array();
$pk = new SetTimePacket;
$pk->time = $this->level->getTime();
$pk->started = $this->level->stopTime == false;
$this->dataPacket($pk);
}
$this->spawnToAll();

View File

@ -356,8 +356,8 @@ class Player extends PlayerEntity{
$newOrder = array();
$lastChunk = $this->chunksLoaded;
$centerX = intval(($this->x - 0.5) / 16);
$centerZ = intval(($this->z - 0.5) / 16);
$centerX = $this->x >> 4;
$centerZ = $this->z >> 4;
$startX = $centerX - $this->viewDistance;
$startZ = $centerZ - $this->viewDistance;
$finalX = $centerX + $this->viewDistance;
@ -1460,9 +1460,6 @@ class Player extends PlayerEntity{
$this->spawnToAll();
$this->sendChat($this->server->motd."\n");
if($this->iusername === "steve" or $this->iusername === "stevie"){
$this->sendChat("You're using the default username. Please change it on the Minecraft PE settings.\n");
}
$this->sendInventory();
$this->sendSettings();
$this->sendArmor();
@ -1471,11 +1468,13 @@ class Player extends PlayerEntity{
$pk = new SetTimePacket;
$pk->time = $this->level->getTime();
$pk->started = $this->level->stopTime == false;
$this->dataPacket($pk);
$pos = new Position($this->x, $this->y, $this->z, $this->level);
$pos = $this->level->getSafeSpawn($pos);
$this->teleport($pos);
$this->sendBuffer();
$this->server->handle("player.spawn", $this);
break;
case 2://Chunk loaded?

View File

@ -29,7 +29,8 @@ class Level{
public $chunkTiles = array();
public $nextSave, $level;
private $time, $startCheck, $startTime, $server, $name, $usedChunks, $changedBlocks, $changedCount, $stopTime, $generator;
public $stopTime;
private $time, $startCheck, $startTime, $server, $name, $usedChunks, $changedBlocks, $changedCount, $generator;
public function __construct(PMFLevel $level, $name){
$this->server = ServerAPI::request();