php8.2 fixes

This commit is contained in:
GameHerobrine 2023-07-03 07:10:04 +03:00
parent d7d346a237
commit 6d89c50e43
13 changed files with 33 additions and 26 deletions

View file

@ -18,7 +18,7 @@ class Level{
* @var Entity[]
*/
public $entityList;
public $tiles, $blockUpdates, $nextSave, $players = [], $level;
public $tiles, $blockUpdates, $nextSave, $players = [], $level, $mobSpawner;
private $time, $startCheck, $startTime, $server, $name, $usedChunks, $changedBlocks, $changedCount, $stopTime;
private $generator;
@ -397,7 +397,7 @@ class Level{
foreach($eids as $cid => $_){
$p = $this->server->clients[$cid] ?? false;
if($p instanceof Player){
$dist = abs($xz[0] - ($p->entity->x >> 4)) + abs($xz[1] - ($p->entity->z >> 4));
$dist = abs($xz[0] - (((int)$p->entity->x) >> 4)) + abs($xz[1] - (((int)$p->entity->z) >> 4));
if($dist > 8){
//ConsoleAPI::debug("{$p->player} freeing chunk: {$xz[0]} {$xz[1]}");
$this->freeChunk($xz[0], $xz[1], $p);

View file

@ -10,28 +10,28 @@ class ExperimentalGenerator implements NewLevelGenerator{
/**
* @var Populator[]
*/
private $populators = array();
public $populators = array();
/**
* @var Populator[]
*/
private $genPopulators = array();
private $level;
private $random;
private $waterHeight = 63;
private $noiseHills;
private $noisePatches;
private $noisePatchesSmall;
private $noiseBase;
public $genPopulators = array();
public $level;
public $random;
public $waterHeight = 63;
public $noiseHills;
public $noisePatches;
public $noisePatchesSmall;
public $noiseBase;
public $selector;
private static $GAUSSIAN_KERNEL = null;
private static $SMOOTH_SIZE = 2;
public static $GAUSSIAN_KERNEL = null;
public static $SMOOTH_SIZE = 2;
public function __construct(array $options = array()){
ExperimentalGenerator::generateKernel();
}
private static function generateKernel(){
public static function generateKernel(){
ExperimentalGenerator::$GAUSSIAN_KERNEL = [];
$bellSize = 1 / ExperimentalGenerator::$SMOOTH_SIZE;
@ -88,10 +88,10 @@ class ExperimentalGenerator implements NewLevelGenerator{
}
public function pickBiome($x, $z){
$hash = $x * 2345803 ^ $z * 9236449 ^ $this->level->level->getSeed();
$hash = (int) ($x * 2345803 ^ $z * 9236449 ^ $this->level->level->getSeed());
$hash *= $hash + 223;
$xNoise = $hash >> 20 & 3;
$zNoise = $hash >> 22 & 3;
$xNoise = ((int)$hash) >> 20 & 3;
$zNoise = ((int)$hash) >> 22 & 3;
if($xNoise == 3){
$xNoise = 1;
}

View file

@ -2,7 +2,7 @@
class WorldGenerator{
private $seed, $level, $path, $random, $generator, $width;
private $seed, $level, $path, $random, $generator, $width, $height;
public function __construct(LevelGenerator $generator, $name, $seed = false, $width = 16, $height = 8){
$this->seed = $seed !== false ? (int) $seed : Utils::readInt(Utils::getRandomBytes(4, false));