mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-04 00:55:14 +00:00
PhpStorm automated formatting (#11)
* PhpStorm reformatting * Tuned PhpStorm reformatting * Improved ItemIds and BlockIds formatting * Tuned more PhpStorm reformatting * Improved string concatenation
This commit is contained in:
@ -19,7 +19,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace pocketmine\level;
|
||||
|
||||
@ -77,8 +77,8 @@ interface ChunkManager{
|
||||
public function getChunk(int $chunkX, int $chunkZ);
|
||||
|
||||
/**
|
||||
* @param int $chunkX
|
||||
* @param int $chunkZ
|
||||
* @param int $chunkX
|
||||
* @param int $chunkZ
|
||||
* @param FullChunk $chunk
|
||||
*/
|
||||
public function setChunk(int $chunkX, int $chunkZ, FullChunk $chunk = null);
|
||||
|
@ -19,7 +19,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
declare(strict_types = 1);
|
||||
|
||||
/**
|
||||
* All Level related classes are here, like Generators, Populators, Noise, ...
|
||||
@ -267,7 +267,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
}
|
||||
|
||||
public static function blockHash(int $x, int $y, int $z){
|
||||
return PHP_INT_SIZE === 8 ? (($x & 0xFFFFFFF) << 35) | (($y & 0x7f) << 28) | ($z & 0xFFFFFFF) : $x . ":" . $y .":". $z;
|
||||
return PHP_INT_SIZE === 8 ? (($x & 0xFFFFFFF) << 35) | (($y & 0x7f) << 28) | ($z & 0xFFFFFFF) : $x . ":" . $y . ":" . $z;
|
||||
}
|
||||
|
||||
public static function chunkBlockHash(int $x, int $y, int $z) : int{
|
||||
@ -378,14 +378,14 @@ class Level implements ChunkManager, Metadatable{
|
||||
public function registerGenerator(){
|
||||
$size = $this->server->getScheduler()->getAsyncTaskPoolSize();
|
||||
for($i = 0; $i < $size; ++$i){
|
||||
$this->server->getScheduler()->scheduleAsyncTaskToWorker(new GeneratorRegisterTask($this, $this->generatorInstance), $i);
|
||||
$this->server->getScheduler()->scheduleAsyncTaskToWorker(new GeneratorRegisterTask($this, $this->generatorInstance), $i);
|
||||
}
|
||||
}
|
||||
|
||||
public function unregisterGenerator(){
|
||||
$size = $this->server->getScheduler()->getAsyncTaskPoolSize();
|
||||
for($i = 0; $i < $size; ++$i){
|
||||
$this->server->getScheduler()->scheduleAsyncTaskToWorker(new GeneratorUnregisterTask($this, $this->generatorInstance), $i);
|
||||
$this->server->getScheduler()->scheduleAsyncTaskToWorker(new GeneratorUnregisterTask($this, $this->generatorInstance), $i);
|
||||
}
|
||||
}
|
||||
|
||||
@ -447,7 +447,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
}else{
|
||||
$this->server->batchPackets($players, $pk, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -707,7 +707,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
|
||||
foreach($this->moveToSend as $index => $entry){
|
||||
Level::getXZ($index, $chunkX, $chunkZ);
|
||||
foreach($entry as $e) {
|
||||
foreach($entry as $e){
|
||||
$pk = new MoveEntityPacket();
|
||||
$pk->eid = $e[0];
|
||||
$pk->x = $e[1];
|
||||
@ -901,7 +901,6 @@ class Level implements ChunkManager, Metadatable{
|
||||
Level::getXZ($index, $chunkX, $chunkZ);
|
||||
|
||||
|
||||
|
||||
if(!isset($this->chunks[$index]) or ($chunk = $this->getChunk($chunkX, $chunkZ, false)) === null){
|
||||
unset($this->chunkTickList[$index]);
|
||||
continue;
|
||||
|
@ -19,7 +19,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace pocketmine\level;
|
||||
|
||||
@ -107,8 +107,8 @@ class SimpleChunkManager implements ChunkManager{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $chunkX
|
||||
* @param int $chunkZ
|
||||
* @param int $chunkX
|
||||
* @param int $chunkZ
|
||||
* @param FullChunk $chunk
|
||||
*/
|
||||
public function setChunk(int $chunkX, int $chunkZ, FullChunk $chunk = null){
|
||||
@ -128,7 +128,7 @@ class SimpleChunkManager implements ChunkManager{
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getSeed() {
|
||||
public function getSeed(){
|
||||
return $this->seed;
|
||||
}
|
||||
}
|
@ -173,9 +173,9 @@ interface FullChunk{
|
||||
public function getHeightMap($x, $z);
|
||||
|
||||
/**
|
||||
* @param int $x 0-15
|
||||
* @param int $z 0-15
|
||||
* @param $value 0-255
|
||||
* @param int $x 0-15
|
||||
* @param int $z 0-15
|
||||
* @param $value 0-255
|
||||
*/
|
||||
public function setHeightMap($x, $z, $value);
|
||||
|
||||
|
@ -40,8 +40,8 @@ abstract class BaseChunk extends BaseFullChunk implements Chunk{
|
||||
* @param ChunkSection[] $sections
|
||||
* @param int[] $biomeColors
|
||||
* @param int[] $heightMap
|
||||
* @param CompoundTag[] $entities
|
||||
* @param CompoundTag[] $tiles
|
||||
* @param CompoundTag[] $entities
|
||||
* @param CompoundTag[] $tiles
|
||||
*
|
||||
* @throws ChunkException
|
||||
*/
|
||||
|
@ -82,8 +82,8 @@ abstract class BaseFullChunk implements FullChunk{
|
||||
* @param string $blockLight
|
||||
* @param int[] $biomeColors
|
||||
* @param int[] $heightMap
|
||||
* @param CompoundTag[] $entities
|
||||
* @param CompoundTag[] $tiles
|
||||
* @param CompoundTag[] $entities
|
||||
* @param CompoundTag[] $tiles
|
||||
*/
|
||||
protected function __construct($provider, $x, $z, $blocks, $data, $skyLight, $blockLight, array $biomeColors = [], array $heightMap = [], array $entities = [], array $tiles = [], array $extraData = []){
|
||||
$this->provider = $provider;
|
||||
|
@ -131,7 +131,7 @@ class RegionLoader{
|
||||
protected function saveChunk($x, $z, $chunkData){
|
||||
$length = strlen($chunkData) + 1;
|
||||
if($length + 4 > self::MAX_SECTOR_LENGTH){
|
||||
throw new ChunkException("Chunk is too big! ".($length + 4)." > ".self::MAX_SECTOR_LENGTH);
|
||||
throw new ChunkException("Chunk is too big! " . ($length + 4) . " > " . self::MAX_SECTOR_LENGTH);
|
||||
}
|
||||
$sectors = (int) ceil(($length + 4) / 4096);
|
||||
$index = self::getChunkOffset($x, $z);
|
||||
|
@ -159,7 +159,7 @@ class Flat extends Generator{
|
||||
}
|
||||
|
||||
public function generateChunk($chunkX, $chunkZ){
|
||||
if($this->chunk === null) {
|
||||
if($this->chunk === null){
|
||||
if(isset($this->options["preset"]) and $this->options["preset"] != ""){
|
||||
$this->parsePreset($this->options["preset"], $chunkX, $chunkZ);
|
||||
}else{
|
||||
|
@ -88,7 +88,7 @@ abstract class Generator{
|
||||
if($samplingRate === 0){
|
||||
throw new \InvalidArgumentException("samplingRate cannot be 0");
|
||||
}
|
||||
if ($xSize % $samplingRate !== 0) {
|
||||
if($xSize % $samplingRate !== 0){
|
||||
throw new \InvalidArgumentCountException("xSize % samplingRate must return 0");
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ abstract class Noise{
|
||||
);
|
||||
}
|
||||
|
||||
public static function trilinearLerp($x, $y, $z, $q000, $q001, $q010, $q011, $q100, $q101, $q110, $q111, $x1, $x2, $y1, $y2, $z1, $z2) {
|
||||
public static function trilinearLerp($x, $y, $z, $q000, $q001, $q010, $q011, $q100, $q101, $q110, $q111, $x1, $x2, $y1, $y2, $z1, $z2){
|
||||
$dx1 = (($x2 - $x) / ($x2 - $x1));
|
||||
$dx2 = (($x - $x1) / ($x2 - $x1));
|
||||
$dy1 = (($y2 - $y) / ($y2 - $y1));
|
||||
|
@ -101,10 +101,10 @@ class Normal extends Generator{
|
||||
$hash *= $hash + 223;
|
||||
$xNoise = $hash >> 20 & 3;
|
||||
$zNoise = $hash >> 22 & 3;
|
||||
if ($xNoise == 3) {
|
||||
if($xNoise == 3){
|
||||
$xNoise = 1;
|
||||
}
|
||||
if($zNoise == 3) {
|
||||
if($zNoise == 3){
|
||||
$zNoise = 1;
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
namespace pocketmine\level\generator\normal\biome;
|
||||
|
||||
|
||||
|
||||
class DesertBiome extends SandyBiome{
|
||||
|
||||
public function __construct(){
|
||||
|
@ -37,8 +37,8 @@ class FloatingTextParticle extends Particle{
|
||||
|
||||
/**
|
||||
* @param Vector3 $pos
|
||||
* @param int $text
|
||||
* @param string $title
|
||||
* @param int $text
|
||||
* @param string $title
|
||||
*/
|
||||
public function __construct(Vector3 $pos, $text, $title = ""){
|
||||
parent::__construct($pos->x, $pos->y, $pos->z);
|
||||
|
Reference in New Issue
Block a user