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

View file

@ -1,27 +1,26 @@
<?php <?php
class CarpetBlock extends FlowableBlock{ class CarpetBlock extends FlowableBlock{
protected static $names = [0 => "White Carpet",
1 => "Orange Carpet",
2 => "Magenta Carpet",
3 => "Light Blue Carpet",
4 => "Yellow Carpet",
5 => "Lime Carpet",
6 => "Pink Carpet",
7 => "Gray Carpet",
8 => "Light Gray Carpet",
9 => "Cyan Carpet",
10 => "Purple Carpet",
11 => "Blue Carpet",
12 => "Brown Carpet",
13 => "Green Carpet",
14 => "Red Carpet",
15 => "Black Carpet",];
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(CARPET, $meta, "Carpet"); parent::__construct(CARPET, $meta, self::$names[$meta]);
$names = array(
0 => "White Carpet",
1 => "Orange Carpet",
2 => "Magenta Carpet",
3 => "Light Blue Carpet",
4 => "Yellow Carpet",
5 => "Lime Carpet",
6 => "Pink Carpet",
7 => "Gray Carpet",
8 => "Light Gray Carpet",
9 => "Cyan Carpet",
10 => "Purple Carpet",
11 => "Blue Carpet",
12 => "Brown Carpet",
13 => "Green Carpet",
14 => "Red Carpet",
15 => "Black Carpet",
);
$this->name = $names[$this->meta & 0x15];
$this->hardness = 0; $this->hardness = 0;
$this->isFullBlock = false; $this->isFullBlock = false;
$this->isSolid = true; $this->isSolid = true;

View file

@ -13,7 +13,7 @@ class CyanFlowerBlock extends FlowableBlock{
8 => "Oxeye Daisy", 8 => "Oxeye Daisy",
]; ];
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(CYAN_FLOWER, $meta, self::$names[$meta & 0x08]); parent::__construct(CYAN_FLOWER, $meta, nullsafe(self::$names[$meta], "Poppy"));
$this->hardness = 0; $this->hardness = 0;
} }

View file

@ -1,18 +1,19 @@
<?php <?php
class StoneBlock extends SolidBlock{ class StoneBlock extends SolidBlock{
protected static $names = [
0 => "Stone",
1 => "Granite",
2 => "Polished Granite",
3 => "Diorite",
4 => "Polished Diorite",
5 => "Andesite",
6 => "Polished Andesite",
];
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(STONE, $meta, "Stone"); parent::__construct(STONE, $meta, nullsafe(self::$names[$meta], "Stone"));
$names = array(
0 => "Stone",
1 => "Granite",
2 => "Polished Granite",
3 => "Diorite",
4 => "Polished Diorite",
5 => "Andesite",
6 => "Polished Andesite",
);
$this->name = $names[$this->meta & 0x06];
$this->hardness = 30; $this->hardness = 30;
} }

View file

@ -1,27 +1,28 @@
<?php <?php
class WoolBlock extends SolidBlock{ class WoolBlock extends SolidBlock{
protected static $names = array(
0 => "White Wool",
1 => "Orange Wool",
2 => "Magenta Wool",
3 => "Light Blue Wool",
4 => "Yellow Wool",
5 => "Lime Wool",
6 => "Pink Wool",
7 => "Gray Wool",
8 => "Light Gray Wool",
9 => "Cyan Wool",
10 => "Purple Wool",
11 => "Blue Wool",
12 => "Brown Wool",
13 => "Green Wool",
14 => "Red Wool",
15 => "Black Wool",
);
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(WOOL, $meta, "Wool"); parent::__construct(WOOL, $meta, nullsafe(self::$names[$meta], "Wool"));
$names = array(
0 => "White Wool",
1 => "Orange Wool",
2 => "Magenta Wool",
3 => "Light Blue Wool",
4 => "Yellow Wool",
5 => "Lime Wool",
6 => "Pink Wool",
7 => "Gray Wool",
8 => "Light Gray Wool",
9 => "Cyan Wool",
10 => "Purple Wool",
11 => "Blue Wool",
12 => "Brown Wool",
13 => "Green Wool",
14 => "Red Wool",
15 => "Black Wool",
);
$this->name = $names[$this->meta & 0x15];
$this->hardness = 4; $this->hardness = 4;
} }

View file

@ -1,6 +1,14 @@
<?php <?php
class Level{ class Level{
/**
* A generator type.
* 0 - Old
* 1 - Infinite
* @var integer
*/
public $generatorType = 0;
/** /**
* @var Config * @var Config
*/ */
@ -99,7 +107,7 @@ class Level{
return $cache; return $cache;
} }
}*/ }*/
$gen = true;//!($X > 15 || $X < 0 || $Z > 15 || $Z < 0); //TODO inf Worlds $gen = $this->generatorType === 1 || !($X > 15 || $X < 0 || $Z > 15 || $Z < 0);
$orderedIds = ""; $orderedIds = "";
$orderedData = ""; $orderedData = "";
$orderedSkyLight = str_repeat("\x00", 16*16*64); $orderedSkyLight = str_repeat("\x00", 16*16*64);
@ -107,7 +115,7 @@ class Level{
$orderedBiomeIds = str_repeat("\x01", 16*16); //all plains, according to PocketMine 1.4 source $orderedBiomeIds = str_repeat("\x01", 16*16); //all plains, according to PocketMine 1.4 source
$orderedBiomeColors = str_repeat("\x00\x85\xb2\x4a", 256); // also PM 1.4 $orderedBiomeColors = str_repeat("\x00\x85\xb2\x4a", 256); // also PM 1.4
$tileEntities = ""; $tileEntities = "";
$this->level->generateChunk($X, $Z, $this->generator); if($gen)$this->level->generateChunk($X, $Z, $this->generator);
if(!$this->level->isChunkLoaded($X, $Z)){ if(!$this->level->isChunkLoaded($X, $Z)){
$this->level->loadChunk($X, $Z); $this->level->loadChunk($X, $Z);
} }