mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
AddPlayerPacket is sent directly now
This commit is contained in:
parent
2a47f92d9a
commit
c3b09096b4
5 changed files with 13 additions and 9 deletions
|
|
@ -1194,8 +1194,9 @@ class Player{
|
|||
foreach($this->resendQueue as $count => $data){
|
||||
unset($this->resendQueue[$count]);
|
||||
$this->packetStats[1]++;
|
||||
$this->lag[] = microtime(true) - $data->sendtime;
|
||||
$data->sendtime = microtime(true);
|
||||
$this->lag[] = $time - $data->sendtime;
|
||||
$data->sendtime = $time;
|
||||
|
||||
$cnt = $this->send($data);
|
||||
if(isset($this->chunkCount[$count])){
|
||||
unset($this->chunkCount[$count]);
|
||||
|
|
@ -2649,13 +2650,14 @@ class Player{
|
|||
|
||||
public function handlePacket(RakNetPacket $packet){
|
||||
if($this->connected === true){
|
||||
$this->timeout = microtime(true) + 20;
|
||||
$time = microtime(true);
|
||||
$this->timeout = $time + 20;
|
||||
switch($packet->pid()){
|
||||
case RakNetInfo::NACK:
|
||||
foreach($packet->packets as $count){
|
||||
if(isset($this->recoveryQueue[$count])){
|
||||
$this->resendQueue[$count] =& $this->recoveryQueue[$count];
|
||||
$this->lag[] = microtime(true) - $this->recoveryQueue[$count]->sendtime;
|
||||
$this->lag[] = $time - $this->recoveryQueue[$count]->sendtime;
|
||||
unset($this->recoveryQueue[$count]);
|
||||
}
|
||||
++$this->packetStats[1];
|
||||
|
|
@ -2665,7 +2667,7 @@ class Player{
|
|||
case RakNetInfo::ACK:
|
||||
foreach($packet->packets as $count){
|
||||
if(isset($this->recoveryQueue[$count])){
|
||||
$this->lag[] = microtime(true) - $this->recoveryQueue[$count]->sendtime;
|
||||
$this->lag[] = $time - $this->recoveryQueue[$count]->sendtime;
|
||||
unset($this->recoveryQueue[$count]);
|
||||
unset($this->resendQueue[$count]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -447,6 +447,7 @@ class PocketMinecraftServer{
|
|||
if(!is_callable($callback)){
|
||||
return false;
|
||||
}
|
||||
|
||||
$chcnt = $this->scheduleCnt++;
|
||||
$this->schedule[$chcnt] = [$callback, $data, $eventName];
|
||||
$this->query("INSERT INTO actions (ID, interval, last, repeat) VALUES(" . $chcnt . ", " . ($ticks / 20) . ", " . microtime(true) . ", " . (((bool) $repeat) === true ? 1 : 0) . ");");
|
||||
|
|
@ -604,7 +605,8 @@ class PocketMinecraftServer{
|
|||
foreach($this->api->level->levels as $l){
|
||||
$l->onTick($this, $time);
|
||||
}
|
||||
return $this->tickerFunction($time);
|
||||
$r = $this->tickerFunction($time);
|
||||
return $r;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1081,7 +1081,7 @@ class Entity extends Position
|
|||
$pk->itemID = 0;
|
||||
$pk->itemAuxValue = 0;
|
||||
$pk->metadata = $this->getMetadata();
|
||||
$player->dataPacket($pk);
|
||||
$player->directDataPacket($pk, 2, true);
|
||||
|
||||
$pk = new SetEntityMotionPacket();
|
||||
$pk->eid = $this->eid;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ class AxisAlignedBB{
|
|||
public $maxX;
|
||||
public $maxY;
|
||||
public $maxZ;
|
||||
|
||||
|
||||
public function __construct($minX, $minY, $minZ, $maxX, $maxY, $maxZ){
|
||||
$this->minX = $minX;
|
||||
$this->minY = $minY;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
class Vector3{
|
||||
public $x, $y, $z;
|
||||
|
||||
|
||||
public function __construct($x = 0, $y = 0, $z = 0){
|
||||
$this->x = $x;
|
||||
$this->y = $y;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue