entity movement updates are unreliable, tweaked some AABB methods

This commit is contained in:
GameHerobrine 2024-02-28 06:08:11 +03:00
parent 2854949f27
commit 0a26fbd442
2 changed files with 9 additions and 23 deletions

View file

@ -1263,18 +1263,18 @@ class Player{
$this->sendEntityMovementUpdateQueue();
}
if($motionSent){
$motion->messageIndex = $this->counter[3]++;
$motion->reliability = 2;
$motion->messageIndex = 0; //force 0 cuz reliability 0
$motion->reliability = 0;
$this->entityMovementQueue->data[] = $motion;
}
if($moveSent){
$move->messageIndex = $this->counter[3]++;
$move->reliability = 2;
$move->messageIndex = 0;
$move->reliability = 0;
$this->entityMovementQueue->data[] = $move;
}
if($headSent){
$headyaw->messageIndex = $this->counter[3]++;
$headyaw->reliability = 2;
$headyaw->messageIndex = 0;
$headyaw->reliability = 0;
$this->entityMovementQueue->data[] = $headyaw;
}

View file

@ -66,14 +66,7 @@ class AxisAlignedBB{
}
public function expand($x, $y, $z){
$this->minX -= $x;
$this->minY -= $y;
$this->minZ -= $z;
$this->maxX += $x;
$this->maxY += $y;
$this->maxZ += $z;
return $this;
return new AxisAlignedBB($this->minX - $x, $this->minY - $y, $this->minZ - $z, $this->maxX + $x, $this->maxY + $y, $this->maxZ + $z);
}
public function offset($x, $y, $z){
@ -92,14 +85,7 @@ class AxisAlignedBB{
}
public function contract($x, $y, $z){
$this->minX += $x;
$this->minY += $y;
$this->minZ += $z;
$this->maxX -= $x;
$this->maxY -= $y;
$this->maxZ -= $z;
return $this;
return new AxisAlignedBB($this->minX + $x, $this->minY + $y, $this->minZ + $z, $this->maxX - $x, $this->maxY - $y, $this->maxZ - $z);
}
public function setBB(AxisAlignedBB $bb){
@ -313,7 +299,7 @@ class AxisAlignedBB{
}
public function __toString(){
return "min: {$this->minX}, {$this->minY}, {$this->minZ}, max: {$this->maxX}, {$this->maxY}, {$this->maxZ}";
return "AABB min: {$this->minX}, {$this->minY}, {$this->minZ}, max: {$this->maxX}, {$this->maxY}, {$this->maxZ}";
}
}