mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-22 12:39:43 +00:00
some fixes to prevent deprecated warning spam on php 8.2
This commit is contained in:
parent
1272932257
commit
2f6e2ffcab
10 changed files with 12 additions and 7 deletions
|
|
@ -961,7 +961,7 @@ class Player{
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->lastChunk = [$x, $z];
|
$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->orderChunks();
|
||||||
}
|
}
|
||||||
$this->server->schedule(MAX_CHUNK_RATE, [$this, "getNextChunk"], $world);
|
$this->server->schedule(MAX_CHUNK_RATE, [$this, "getNextChunk"], $world);
|
||||||
|
|
@ -1940,7 +1940,6 @@ class Player{
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->entityMovementQueueLength += $len;
|
$this->entityMovementQueueLength += $len;
|
||||||
$this->entityMovementPacketsPerSecond += $packets;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
class TaskFollowParent extends TaskBase
|
class TaskFollowParent extends TaskBase
|
||||||
{
|
{
|
||||||
|
public $speedMultiplier;
|
||||||
public function __construct($speed){
|
public function __construct($speed){
|
||||||
$this->speedMultiplier = $speed;
|
$this->speedMultiplier = $speed;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
class TaskMate extends TaskBase
|
class TaskMate extends TaskBase
|
||||||
{
|
{
|
||||||
|
public $speedMultiplier;
|
||||||
public function __construct($speed){
|
public function __construct($speed){
|
||||||
$this->speedMultiplier = $speed;
|
$this->speedMultiplier = $speed;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ class TaskRangedAttack extends \TaskBase
|
||||||
public $server;
|
public $server;
|
||||||
public $attackCounter = 0;
|
public $attackCounter = 0;
|
||||||
public $seenTicks = 0;
|
public $seenTicks = 0;
|
||||||
|
public $rangeSquared = 0;
|
||||||
public function __construct($speed, $range){
|
public function __construct($speed, $range){
|
||||||
$this->speedMultiplier = $speed;
|
$this->speedMultiplier = $speed;
|
||||||
$this->rangeSquared = $range*$range;
|
$this->rangeSquared = $range*$range;
|
||||||
|
|
@ -14,7 +15,6 @@ class TaskRangedAttack extends \TaskBase
|
||||||
public function onStart(EntityAI $ai)
|
public function onStart(EntityAI $ai)
|
||||||
{
|
{
|
||||||
$this->selfCounter = 1;
|
$this->selfCounter = 1;
|
||||||
$this->ticksNoSeen = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onEnd(EntityAI $ai)
|
public function onEnd(EntityAI $ai)
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
class TaskTempt extends TaskBase
|
class TaskTempt extends TaskBase
|
||||||
{
|
{
|
||||||
|
public $speedMultiplier;
|
||||||
|
public $targetDistance;
|
||||||
public function __construct($speed){
|
public function __construct($speed){
|
||||||
$this->speedMultiplier = $speed;
|
$this->speedMultiplier = $speed;
|
||||||
$this->targetDistance = 10*10;
|
$this->targetDistance = 10*10;
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ class Zombie extends Monster{
|
||||||
}
|
}
|
||||||
|
|
||||||
for($y = (int)$this->y; $y < 129; $y++){
|
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)){
|
if(StaticBlock::getIsSolid($block)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ class Arrow extends Entity{
|
||||||
public $criticial = false;
|
public $criticial = false;
|
||||||
public $groundTicks = 0;
|
public $groundTicks = 0;
|
||||||
public $shotByPlayer = false;
|
public $shotByPlayer = false;
|
||||||
|
public $shotByEntity = false;
|
||||||
|
|
||||||
function __construct(Level $level, $eid, $class, $type = 0, $data = []){
|
function __construct(Level $level, $eid, $class, $type = 0, $data = []){
|
||||||
parent::__construct($level, $eid, $class, $type, $data);
|
parent::__construct($level, $eid, $class, $type, $data);
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,7 @@ class ItemEntity extends Entity{
|
||||||
$friction = 0.98;
|
$friction = 0.98;
|
||||||
if($this->onGround){
|
if($this->onGround){
|
||||||
$friction = 0.588;
|
$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);
|
if($v3 > 0) $friction = StaticBlock::getSlipperiness($v3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ class XorShift128Random{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setSeed($seed){
|
public function setSeed($seed){
|
||||||
|
$seed = (int)$seed;
|
||||||
$this->x = 123456789 ^ $seed;
|
$this->x = 123456789 ^ $seed;
|
||||||
$this->y = 362436069 ^ ($seed << 17) | (($seed >> 15) & 0x7fffffff) & 0xffffffff;
|
$this->y = 362436069 ^ ($seed << 17) | (($seed >> 15) & 0x7fffffff) & 0xffffffff;
|
||||||
$this->z = 521288629 ^ ($seed << 31) | (($seed >> 1 ) & 0x7fffffff) & 0xffffffff;
|
$this->z = 521288629 ^ ($seed << 31) | (($seed >> 1 ) & 0x7fffffff) & 0xffffffff;
|
||||||
|
|
|
||||||
|
|
@ -71,8 +71,8 @@ class MobSpawner{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$x = mt_rand($player->entity->x - 32, $player->entity->x + 32);
|
$x = mt_rand(floor($player->entity->x - 32), ceil($player->entity->x + 32));
|
||||||
$z = mt_rand($player->entity->z - 32, $player->entity->z + 32);
|
$z = mt_rand(floor($player->entity->z - 32), ceil($player->entity->z + 32));
|
||||||
$diffX = $x-$player->entity->x;
|
$diffX = $x-$player->entity->x;
|
||||||
$diffZ = $z-$player->entity->z;
|
$diffZ = $z-$player->entity->z;
|
||||||
$dist = $diffX*$diffX + $diffZ*$diffZ;
|
$dist = $diffX*$diffX + $diffZ*$diffZ;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue