fixed some names

This commit is contained in:
GameHerobrine 2023-02-27 01:04:17 +03:00
parent 63ef7c628c
commit 8248088c29
6 changed files with 74 additions and 66 deletions

View file

@ -7,7 +7,6 @@ class Player{
/** @var Entity */
public $entity = false;
private $generator = 0; //TODO modify in config?
private $reload = true;
public $auth = false;
public $CID;
@ -405,15 +404,15 @@ class Player{
$X = $this->entity->x >> 4;
$Z = $this->entity->z >> 4;
$this->chunksOrder = [];
if($this->generator != 0) $chunkToUnload = $this->chunksLoaded;
$startX = $this->generator === 1 ? $X - 4 : 0;
$stopX = $this->generator === 1 ? $X + 4 : 15;
$startZ = $this->generator === 1 ? $Z - 4 : 0;
$stopZ = $this->generator === 1 ? $Z + 4 : 15;
if($this->level->generatorType != 0) $chunkToUnload = $this->chunksLoaded;
$startX = $this->level->generatorType === 1 ? $X - 4 : 0;
$stopX = $this->level->generatorType === 1 ? $X + 4 : 15;
$startZ = $this->level->generatorType === 1 ? $Z - 4 : 0;
$stopZ = $this->level->generatorType === 1 ? $Z + 4 : 15;
for($x = $startX; $x <= $stopX; ++$x){
for($z = $startZ; $z <= $stopZ; ++$z){
$d = $x . ":" . $z;
if($this->generator != 0) unset($chunkToUnload[$d]);
if($this->level->generatorType != 0) unset($chunkToUnload[$d]);
//if($x < 0 || $x > 15 || $z < 0 || $z > 15) continue; //TODO infinite worlds
if(!isset($this->chunksLoaded[$d])){
$this->chunksOrder[$d] = abs($x - $X) + abs($z - $Z);
@ -421,7 +420,7 @@ class Player{
}
}
asort($this->chunksOrder);
if($this->generator != 0){
if($this->level->generatorType != 0){
foreach($chunkToUnload as $chunk => $useless){
$chunkI = explode(":", $chunk);
$cX = $chunkI[0];
@ -478,10 +477,10 @@ class Player{
public function entityTick(){
//ConsoleAPI::debug("{$this->username}, cl: ".count($this->chunksLoaded).", oc: ".count($this->chunksOrder));
if(count($this->chunksOrder) <= 0 && $this->generator != 0){
if(count($this->chunksOrder) <= 0 && $this->level->generatorType != 0){
$this->orderChunks();
}
//if($this->reload && $this->generator != 0){
//if($this->reload && $this->level->generatorType != 0){
$this->getNextChunk($this->level);
// $this->reload = false;
//}
@ -978,7 +977,7 @@ class Player{
$pk->spawnX = $spwnPos->x;
$pk->spawnY = $spwnPos->y;
$pk->spawnZ = $spwnPos->z;
$pk->generator = $this->generator;
$pk->generator = $this->level->generatorType;
$pk->gamemode = $this->gamemode & 0x01;
$pk->eid = 0;
$this->dataPacket($pk);
@ -1445,7 +1444,7 @@ class Player{
$pk->x = (int) $this->entity->x;
$pk->y = (int) $this->entity->y;
$pk->z = (int) $this->entity->z;
$pk->generator = $this->generator; //1 - inf, 0 - old, 2 - flat
$pk->generator = $this->level->generatorType; //1 - inf, 0 - old, 2 - flat
$pk->gamemode = $this->gamemode & 0x01;
$pk->eid = 0;
$this->dataPacket($pk);