some fixes to prevent deprecated warning spam on php 8.2

This commit is contained in:
GameHerobrine 2026-01-05 10:39:06 +03:00
parent 1272932257
commit 2f6e2ffcab
10 changed files with 12 additions and 7 deletions

View file

@ -961,7 +961,7 @@ class Player{
}
$this->lastChunk = [$x, $z];
if($this->lastOrderX != ($this->entity->x >> 4) || $this->lastOrderZ != ($this->entity->z >> 4)){
if($this->lastOrderX != ((int)$this->entity->x >> 4) || $this->lastOrderZ != ((int)$this->entity->z >> 4)){
$this->orderChunks();
}
$this->server->schedule(MAX_CHUNK_RATE, [$this, "getNextChunk"], $world);
@ -1940,7 +1940,6 @@ class Player{
}
$this->entityMovementQueueLength += $len;
$this->entityMovementPacketsPerSecond += $packets;
}
/**

View file

@ -2,6 +2,7 @@
class TaskFollowParent extends TaskBase
{
public $speedMultiplier;
public function __construct($speed){
$this->speedMultiplier = $speed;
}

View file

@ -2,6 +2,7 @@
class TaskMate extends TaskBase
{
public $speedMultiplier;
public function __construct($speed){
$this->speedMultiplier = $speed;
}

View file

@ -5,6 +5,7 @@ class TaskRangedAttack extends \TaskBase
public $server;
public $attackCounter = 0;
public $seenTicks = 0;
public $rangeSquared = 0;
public function __construct($speed, $range){
$this->speedMultiplier = $speed;
$this->rangeSquared = $range*$range;
@ -14,7 +15,6 @@ class TaskRangedAttack extends \TaskBase
public function onStart(EntityAI $ai)
{
$this->selfCounter = 1;
$this->ticksNoSeen = 0;
}
public function onEnd(EntityAI $ai)

View file

@ -2,6 +2,8 @@
class TaskTempt extends TaskBase
{
public $speedMultiplier;
public $targetDistance;
public function __construct($speed){
$this->speedMultiplier = $speed;
$this->targetDistance = 10*10;

View file

@ -32,7 +32,7 @@ class Zombie extends Monster{
}
for($y = (int)$this->y; $y < 129; $y++){
$block = $this->level->level->getBlockID($this->x, $y, $this->z);
$block = $this->level->level->getBlockID(floor($this->x), $y, floor($this->z));
if(StaticBlock::getIsSolid($block)){
return false;
}

View file

@ -13,6 +13,7 @@ class Arrow extends Entity{
public $criticial = false;
public $groundTicks = 0;
public $shotByPlayer = false;
public $shotByEntity = false;
function __construct(Level $level, $eid, $class, $type = 0, $data = []){
parent::__construct($level, $eid, $class, $type, $data);

View file

@ -200,7 +200,7 @@ class ItemEntity extends Entity{
$friction = 0.98;
if($this->onGround){
$friction = 0.588;
$v3 = $this->level->level->getBlockID($this->x, floor($this->boundingBox->minY) - 1, $this->z);
$v3 = $this->level->level->getBlockID(floor($this->x), floor($this->boundingBox->minY) - 1, floor($this->z));
if($v3 > 0) $friction = StaticBlock::getSlipperiness($v3);
}

View file

@ -28,6 +28,7 @@ class XorShift128Random{
}
public function setSeed($seed){
$seed = (int)$seed;
$this->x = 123456789 ^ $seed;
$this->y = 362436069 ^ ($seed << 17) | (($seed >> 15) & 0x7fffffff) & 0xffffffff;
$this->z = 521288629 ^ ($seed << 31) | (($seed >> 1 ) & 0x7fffffff) & 0xffffffff;

View file

@ -71,8 +71,8 @@ class MobSpawner{
continue;
}
$x = mt_rand($player->entity->x - 32, $player->entity->x + 32);
$z = mt_rand($player->entity->z - 32, $player->entity->z + 32);
$x = mt_rand(floor($player->entity->x - 32), ceil($player->entity->x + 32));
$z = mt_rand(floor($player->entity->z - 32), ceil($player->entity->z + 32));
$diffX = $x-$player->entity->x;
$diffZ = $z-$player->entity->z;
$dist = $diffX*$diffX + $diffZ*$diffZ;