diff --git a/src/Player.php b/src/Player.php index b6b1cb81e..f164e86f2 100644 --- a/src/Player.php +++ b/src/Player.php @@ -440,13 +440,6 @@ class Player{ "eid" => $data->eid, )); break; - case "time.change": - if($data["level"] === $this->level){ - $this->dataPacket(MC_SET_TIME, array( - "time" => $data["time"], - )); - } - break; case "entity.animate": if($data["eid"] === $this->eid or $data["entity"]->level !== $this->level){ break; @@ -912,7 +905,6 @@ class Player{ $this->entity->z = $this->data->get("position")["z"]; $this->entity->setName($this->username); $this->entity->data["clientID"] = $this->clientID; - $this->evid[] = $this->server->event("time.change", array($this, "eventHandler")); $this->evid[] = $this->server->event("server.chat", array($this, "eventHandler")); $this->evid[] = $this->server->event("entity.remove", array($this, "eventHandler")); $this->evid[] = $this->server->event("entity.move", array($this, "eventHandler")); diff --git a/src/network/CustomPacketHandler.php b/src/network/CustomPacketHandler.php index 6af4ecfff..ccbcc860a 100644 --- a/src/network/CustomPacketHandler.php +++ b/src/network/CustomPacketHandler.php @@ -449,6 +449,21 @@ class CustomPacketHandler{ } } break; + case MC_LEVEL_EVENT: + if($this->c === false){ + $this->data["unknown1"] = Utils::readShort($this->get(2)); + $this->data["unknown2"] = Utils::readShort($this->get(2)); + $this->data["unknown3"] = Utils::readShort($this->get(2)); + $this->data["unknown4"] = Utils::readShort($this->get(2)); + $this->data["unknown5"] = Utils::readInt($this->get(4)); + }else{ + $this->raw .= Utils::writeShort($this->data["unknown1"]); + $this->raw .= Utils::writeShort($this->data["unknown2"]); + $this->raw .= Utils::writeShort($this->data["unknown3"]); + $this->raw .= Utils::writeShort($this->data["unknown4"]); + $this->raw .= Utils::writeInt($this->data["unknown5"]); + } + break; case MC_ENTITY_EVENT: if($this->c === false){ $this->data["eid"] = Utils::readInt($this->get(4)); diff --git a/src/world/Level.php b/src/world/Level.php index 62ea1a4c9..908bfd2c2 100644 --- a/src/world/Level.php +++ b/src/world/Level.php @@ -63,14 +63,17 @@ class Level{ } public function checkThings(){ + $players = $this->server->api->player->getAll($this); $now = microtime(true); $time = $this->startTime + ($now - $this->startCheck) * 20; if($this->server->api->dhandle("time.change", array("level" => $this, "time" => $time)) !== false){ $this->time = $time; + $this->server->api->player->broadcastPacket($players, MC_SET_TIME, array( + "time" => $this->time, + )); } if(count($this->changedCount) > 0){ - $players = $this->server->api->player->getAll($this); arsort($this->changedCount); $resendChunks = array(); foreach($this->changedCount as $index => $count){