mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-22 20:49:43 +00:00
time flow is better
This commit is contained in:
parent
d2f1574e56
commit
0aa9843458
4 changed files with 11 additions and 8 deletions
|
|
@ -1463,12 +1463,12 @@ class Player{
|
||||||
$this->evid[] = $this->server->event("tile.update", [$this, "eventHandler"]);
|
$this->evid[] = $this->server->event("tile.update", [$this, "eventHandler"]);
|
||||||
$this->lastMeasure = microtime(true);
|
$this->lastMeasure = microtime(true);
|
||||||
$this->server->schedule(50, [$this, "measureLag"], [], true);
|
$this->server->schedule(50, [$this, "measureLag"], [], true);
|
||||||
/*
|
|
||||||
$pk = new SetTimePacket;
|
$pk = new SetTimePacket;
|
||||||
$pk->time = (int) $this->level->getTime();
|
$pk->time = (int) $this->level->getTime();
|
||||||
$pk->started = !$this->level->isTimeStopped();
|
$pk->started = !$this->level->isTimeStopped();
|
||||||
$this->dataPacket($pk);
|
$this->dataPacket($pk);
|
||||||
*/
|
|
||||||
|
|
||||||
console("[INFO] " . FORMAT_AQUA . $this->username . FORMAT_RESET . "[/" . $this->ip . ":" . $this->port . "] logged in with entity id " . $this->eid . " at (" . $this->entity->level->getName() . ", " . round($this->entity->x, 2) . ", " . round($this->entity->y, 2) . ", " . round($this->entity->z, 2) . ")");
|
console("[INFO] " . FORMAT_AQUA . $this->username . FORMAT_RESET . "[/" . $this->ip . ":" . $this->port . "] logged in with entity id " . $this->eid . " at (" . $this->entity->level->getName() . ", " . round($this->entity->x, 2) . ", " . round($this->entity->y, 2) . ", " . round($this->entity->z, 2) . ")");
|
||||||
//spawn!
|
//spawn!
|
||||||
|
|
|
||||||
|
|
@ -387,7 +387,7 @@ class PMFLevel extends PMF{
|
||||||
$this->chunks[$index][$Y] = str_repeat("\x00", 16384);
|
$this->chunks[$index][$Y] = str_repeat("\x00", 16384);
|
||||||
$this->chunkChange[$index][-1] = true;
|
$this->chunkChange[$index][-1] = true;
|
||||||
$this->chunkChange[$index][$Y] = 16384;
|
$this->chunkChange[$index][$Y] = 16384;
|
||||||
$this->locationTable[$index][0] |= 1 << $Y;
|
//$this->locationTable[$index][0] |= 1 << $Y;
|
||||||
$this->chunkInfo[$index][0] = str_repeat("\x00", 256);
|
$this->chunkInfo[$index][0] = str_repeat("\x00", 256);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -377,7 +377,7 @@ class Level{
|
||||||
|
|
||||||
public function onTick(PocketMinecraftServer $server){
|
public function onTick(PocketMinecraftServer $server){
|
||||||
//$ents = $server->api->entity->getAll($this);
|
//$ents = $server->api->entity->getAll($this);
|
||||||
if(!$this->stopTime) ++$this->time;
|
if(!$this->stopTime) $this->time+=2;
|
||||||
foreach($this->entityList as $k => $e){
|
foreach($this->entityList as $k => $e){
|
||||||
if(!($e instanceof Entity)){
|
if(!($e instanceof Entity)){
|
||||||
unset($this->entityList[$k]);
|
unset($this->entityList[$k]);
|
||||||
|
|
@ -629,7 +629,7 @@ class Level{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkTime(){
|
public function checkTime(){
|
||||||
if(!isset($this->level)){
|
/*if(!isset($this->level)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$now = microtime(true);
|
$now = microtime(true);
|
||||||
|
|
@ -642,11 +642,16 @@ class Level{
|
||||||
$this->time = $time;
|
$this->time = $time;
|
||||||
$pk = new SetTimePacket;
|
$pk = new SetTimePacket;
|
||||||
$pk->time = (int) $this->time;
|
$pk->time = (int) $this->time;
|
||||||
|
console($pk->time);
|
||||||
$pk->started = $this->stopTime == false;
|
$pk->started = $this->stopTime == false;
|
||||||
$this->server->api->player->broadcastPacket($this->players, $pk);
|
$this->server->api->player->broadcastPacket($this->players, $pk);
|
||||||
}else{
|
}else{
|
||||||
$this->time -= 20 * 13;
|
$this->time -= 20 * 13;
|
||||||
}
|
}*/
|
||||||
|
$pk = new SetTimePacket;
|
||||||
|
$pk->time = (int) $this->time;
|
||||||
|
$pk->started = $this->stopTime == false;
|
||||||
|
$this->server->api->player->broadcastPacket($this->players, $pk);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isTimeStopped(){
|
public function isTimeStopped(){
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,6 @@ class NormalGenerator implements NewLevelGenerator{
|
||||||
public function generateChunk($chunkX, $chunkZ){
|
public function generateChunk($chunkX, $chunkZ){
|
||||||
$this->random->setSeed(0xdeadbeef ^ ($chunkX << 8) ^ $chunkZ ^ $this->level->getSeed());
|
$this->random->setSeed(0xdeadbeef ^ ($chunkX << 8) ^ $chunkZ ^ $this->level->getSeed());
|
||||||
$hills = array();
|
$hills = array();
|
||||||
$patchesSmall = array();
|
|
||||||
$base = array();
|
$base = array();
|
||||||
for($z = 0; $z < 16; ++$z){
|
for($z = 0; $z < 16; ++$z){
|
||||||
for($x = 0; $x < 16; ++$x){
|
for($x = 0; $x < 16; ++$x){
|
||||||
|
|
@ -137,7 +136,6 @@ class NormalGenerator implements NewLevelGenerator{
|
||||||
$this->level->level->setBiomeIdArrayForChunk($chunkX, $chunkZ, str_repeat(chr(BIOME_PLAINS), 256));
|
$this->level->level->setBiomeIdArrayForChunk($chunkX, $chunkZ, str_repeat(chr(BIOME_PLAINS), 256));
|
||||||
$this->level->setMiniChunk($chunkX, $chunkZ, $chunkY, $chunk);
|
$this->level->setMiniChunk($chunkX, $chunkZ, $chunkY, $chunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function populateChunk($chunkX, $chunkZ){
|
public function populateChunk($chunkX, $chunkZ){
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue