mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 03:59:43 +00:00
php8.2 fixes
This commit is contained in:
parent
d7d346a237
commit
6d89c50e43
13 changed files with 33 additions and 26 deletions
|
|
@ -3,7 +3,7 @@
|
|||
class ConsoleAPI{
|
||||
|
||||
private $loop, $server, $event, $help, $cmds, $alias;
|
||||
|
||||
public $last;
|
||||
function __construct(){
|
||||
$this->help = [];
|
||||
$this->cmds = [];
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ class EntityAPI{
|
|||
public $entities;
|
||||
private $server;
|
||||
private $eCnt = 1;
|
||||
|
||||
public $serverSpawnAnimals, $serverSpawnMobs;
|
||||
function __construct(){
|
||||
$this->entities = [];
|
||||
$this->server = ServerAPI::request();
|
||||
|
|
|
|||
|
|
@ -57,6 +57,11 @@ class ServerAPI{
|
|||
*/
|
||||
public $plugin;
|
||||
|
||||
/**
|
||||
* @var QueryHandler
|
||||
*/
|
||||
public $query;
|
||||
|
||||
private $asyncCalls = [];
|
||||
private $server;
|
||||
private $config;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ class PocketMinecraftServer{
|
|||
*/
|
||||
public $api;
|
||||
private $serverip, $evCnt, $handCnt, $events, $eventsID, $handlers, $serverType, $lastTick, $memoryStats, $async = [], $asyncID = 0;
|
||||
|
||||
public $levelData, $doTick, $difficulty, $tiles, $entities, $schedule, $scheduleCnt, $whitelist, $spawn, $asyncThread, $stop;
|
||||
function __construct($name, $gamemode = SURVIVAL, $seed = false, $port = 19132, $serverip = "0.0.0.0"){
|
||||
$this->port = (int) $port;
|
||||
$this->doTick = true;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class Entity extends Position
|
|||
const CLASS_TYPE = - 1;
|
||||
|
||||
public $counter = 0;
|
||||
|
||||
public $invincible, $status, $health, $fire, $crouched, $position, $meta, $stack;
|
||||
public static $updateOnTick, $allowedAI;
|
||||
public $isCollidable;
|
||||
public $canBeAttacked;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ class MinecraftInterface{
|
|||
public $bandwidth;
|
||||
private $socket;
|
||||
private $packets;
|
||||
|
||||
public $start, $stop;
|
||||
function __construct($server, $port = 25565, $serverip = "0.0.0.0"){
|
||||
$this->socket = new UDPSocket($server, $port, true, $serverip);
|
||||
if($this->socket->connected === false){
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
class UDPSocket{
|
||||
|
||||
public $connected, $sock, $server;
|
||||
|
||||
public $port;
|
||||
function __construct($server, $port, $listen = false, $serverip = "0.0.0.0"){
|
||||
$this->server = $server;
|
||||
$this->port = $port;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
class RakNetCodec{
|
||||
|
||||
public $packet;
|
||||
|
||||
public $buffer;
|
||||
public function __construct(RakNetPacket $packet){
|
||||
$this->packet = $packet;
|
||||
$this->buffer = &$this->packet->buffer;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ define("PMF_CURRENT_LEVEL_VERSION", 0x01);
|
|||
class PMFLevel extends PMF{
|
||||
|
||||
public $isLoaded = true;
|
||||
public $level;
|
||||
public $levelData = [];
|
||||
private $locationTable = [];
|
||||
private $log = 4;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
class Random{
|
||||
|
||||
public $x, $y, $z, $w;
|
||||
public $i, $j, $state;
|
||||
public $haveNextNextGaussian = false;
|
||||
public $nextNextGaussian = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue