mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-23 04:59:46 +00:00
sendBuffer will add packet to recoveryQueue which should help to prevent the loss of some packets
This commit is contained in:
parent
0b7fd74175
commit
24269bc359
2 changed files with 10 additions and 15 deletions
|
|
@ -420,6 +420,8 @@ class Player{
|
||||||
public function sendBuffer(){
|
public function sendBuffer(){
|
||||||
if($this->bufferLen > 0 and $this->buffer instanceof RakNetPacket){
|
if($this->bufferLen > 0 and $this->buffer instanceof RakNetPacket){
|
||||||
$this->buffer->seqNumber = $this->counter[0]++;
|
$this->buffer->seqNumber = $this->counter[0]++;
|
||||||
|
$this->recoveryQueue[$this->buffer->seqNumber] = $this->buffer;
|
||||||
|
$this->buffer->sendtime = microtime(true);
|
||||||
$this->send($this->buffer);
|
$this->send($this->buffer);
|
||||||
}
|
}
|
||||||
$this->bufferLen = 0;
|
$this->bufferLen = 0;
|
||||||
|
|
@ -963,15 +965,6 @@ class Player{
|
||||||
}
|
}
|
||||||
|
|
||||||
if($m !== ""){
|
if($m !== ""){
|
||||||
|
|
||||||
/*$pk = new LevelEventPacket();
|
|
||||||
$pk->evid = LevelEventPacket::EVENT_OPEN_DOOR_SOUND;
|
|
||||||
$pk->x = $this->entity->x;
|
|
||||||
$pk->y = $this->entity->y;
|
|
||||||
$pk->z = $this->entity->z;
|
|
||||||
$pk->data = 0;
|
|
||||||
$this->dataPacket($pk);*/
|
|
||||||
|
|
||||||
$pk = new MessagePacket;
|
$pk = new MessagePacket;
|
||||||
$pk->source = ($author instanceof Player) ? $author->username : $author;
|
$pk->source = ($author instanceof Player) ? $author->username : $author;
|
||||||
$pk->message = TextFormat::clean($m); //Colors not implemented :(
|
$pk->message = TextFormat::clean($m); //Colors not implemented :(
|
||||||
|
|
@ -2800,6 +2793,7 @@ class Player{
|
||||||
switch($packet->pid()){
|
switch($packet->pid()){
|
||||||
case RakNetInfo::NACK:
|
case RakNetInfo::NACK:
|
||||||
foreach($packet->packets as $count){
|
foreach($packet->packets as $count){
|
||||||
|
|
||||||
if(isset($this->recoveryQueue[$count])){
|
if(isset($this->recoveryQueue[$count])){
|
||||||
$this->resendQueue[$count] =& $this->recoveryQueue[$count];
|
$this->resendQueue[$count] =& $this->recoveryQueue[$count];
|
||||||
$this->lag[] = $time - $this->recoveryQueue[$count]->sendtime;
|
$this->lag[] = $time - $this->recoveryQueue[$count]->sendtime;
|
||||||
|
|
|
||||||
|
|
@ -353,13 +353,14 @@ class PMFLevel extends PMF{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBlockID($x, $y, $z){
|
public function getBlockID($x, $y, $z){
|
||||||
|
if($y > 127 || $y < 0){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if($x < 0 || $x > 255 || $z < 0 || $z > 255){
|
if($x < 0 || $x > 255 || $z < 0 || $z > 255){
|
||||||
return INVISIBLE_BEDROCK;
|
return INVISIBLE_BEDROCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($y > 127 || $y < 0){
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
$X = $x >> 4;
|
$X = $x >> 4;
|
||||||
$Z = $z >> 4;
|
$Z = $z >> 4;
|
||||||
$Y = $y >> 4;
|
$Y = $y >> 4;
|
||||||
|
|
@ -460,12 +461,12 @@ class PMFLevel extends PMF{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBlock($x, $y, $z){
|
public function getBlock($x, $y, $z){
|
||||||
if($x < 0 || $x > 255 || $z < 0 || $z > 255){
|
|
||||||
return [INVISIBLE_BEDROCK, 0];
|
|
||||||
}
|
|
||||||
if($y < 0 || $y > 127){
|
if($y < 0 || $y > 127){
|
||||||
return [AIR, 0];
|
return [AIR, 0];
|
||||||
}
|
}
|
||||||
|
if($x < 0 || $x > 255 || $z < 0 || $z > 255){
|
||||||
|
return [INVISIBLE_BEDROCK, 0];
|
||||||
|
}
|
||||||
|
|
||||||
$X = $x >> 4;
|
$X = $x >> 4;
|
||||||
$Z = $z >> 4;
|
$Z = $z >> 4;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue