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);

View file

@ -1,27 +1,26 @@
<?php
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){
parent::__construct(CARPET, $meta, "Carpet");
$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];
parent::__construct(CARPET, $meta, self::$names[$meta]);
$this->hardness = 0;
$this->isFullBlock = false;
$this->isSolid = true;

View file

@ -13,7 +13,7 @@ class CyanFlowerBlock extends FlowableBlock{
8 => "Oxeye Daisy",
];
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;
}

View file

@ -1,18 +1,19 @@
<?php
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){
parent::__construct(STONE, $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];
parent::__construct(STONE, $meta, nullsafe(self::$names[$meta], "Stone"));
$this->hardness = 30;
}

View file

@ -1,27 +1,28 @@
<?php
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){
parent::__construct(WOOL, $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];
parent::__construct(WOOL, $meta, nullsafe(self::$names[$meta], "Wool"));
$this->hardness = 4;
}

View file

@ -1,6 +1,14 @@
<?php
class Level{
/**
* A generator type.
* 0 - Old
* 1 - Infinite
* @var integer
*/
public $generatorType = 0;
/**
* @var Config
*/
@ -99,7 +107,7 @@ class Level{
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 = "";
$orderedData = "";
$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
$orderedBiomeColors = str_repeat("\x00\x85\xb2\x4a", 256); // also PM 1.4
$tileEntities = "";
$this->level->generateChunk($X, $Z, $this->generator);
if($gen)$this->level->generateChunk($X, $Z, $this->generator);
if(!$this->level->isChunkLoaded($X, $Z)){
$this->level->loadChunk($X, $Z);
}