From 9c38ead76dde0c7de26802975f5d788d76b02d4d Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Wed, 5 Mar 2014 01:25:53 +0100 Subject: [PATCH] fixed time not being sent correctly on creative mode the first time --- src/Entity.php | 1 + src/Player.php | 9 ++++----- src/world/Level.php | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Entity.php b/src/Entity.php index c36ff1168..44073d524 100644 --- a/src/Entity.php +++ b/src/Entity.php @@ -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(); diff --git a/src/Player.php b/src/Player.php index 973e0ce07..f6348c1e2 100644 --- a/src/Player.php +++ b/src/Player.php @@ -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? diff --git a/src/world/Level.php b/src/world/Level.php index 27b3dd91a..df34724c1 100644 --- a/src/world/Level.php +++ b/src/world/Level.php @@ -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();