mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-20 07:39:42 +00:00
Merge branch 'next-major' into modern-world-support
This commit is contained in:
@@ -1273,7 +1273,7 @@ class World implements ChunkManager{
|
||||
* get an angle in radians, or by 360 to get an angle in degrees.
|
||||
*/
|
||||
public function computeSunAnglePercentage() : float{
|
||||
$timeProgress = ($this->time % 24000) / 24000;
|
||||
$timeProgress = ($this->time % self::TIME_FULL) / self::TIME_FULL;
|
||||
|
||||
//0.0 needs to be high noon, not dusk
|
||||
$sunProgress = $timeProgress + ($timeProgress < 0.25 ? 0.75 : -0.25);
|
||||
|
@@ -28,13 +28,12 @@ namespace pocketmine\world\format\io;
|
||||
*/
|
||||
class ReadOnlyWorldProviderManagerEntry extends WorldProviderManagerEntry{
|
||||
|
||||
/** @phpstan-var FromPath */
|
||||
private \Closure $fromPath;
|
||||
|
||||
/** @phpstan-param FromPath $fromPath */
|
||||
public function __construct(\Closure $isValid, \Closure $fromPath){
|
||||
public function __construct(
|
||||
\Closure $isValid,
|
||||
private \Closure $fromPath
|
||||
){
|
||||
parent::__construct($isValid);
|
||||
$this->fromPath = $fromPath;
|
||||
}
|
||||
|
||||
public function fromPath(string $path) : WorldProvider{ return ($this->fromPath)($path); }
|
||||
|
@@ -31,13 +31,10 @@ use pocketmine\world\format\io\exception\UnsupportedWorldFormatException;
|
||||
*/
|
||||
abstract class WorldProviderManagerEntry{
|
||||
|
||||
/** @phpstan-var IsValid */
|
||||
protected \Closure $isValid;
|
||||
|
||||
/** @phpstan-param IsValid $isValid */
|
||||
protected function __construct(\Closure $isValid){
|
||||
$this->isValid = $isValid;
|
||||
}
|
||||
protected function __construct(
|
||||
protected \Closure $isValid
|
||||
){}
|
||||
|
||||
/**
|
||||
* Tells if the path is a valid world.
|
||||
|
@@ -30,19 +30,17 @@ use pocketmine\world\WorldCreationOptions;
|
||||
* @phpstan-type Generate \Closure(string $path, string $name, WorldCreationOptions $options) : void
|
||||
*/
|
||||
final class WritableWorldProviderManagerEntry extends WorldProviderManagerEntry{
|
||||
/** @phpstan-var FromPath */
|
||||
private \Closure $fromPath;
|
||||
/** @phpstan-var Generate */
|
||||
private \Closure $generate;
|
||||
|
||||
/**
|
||||
* @phpstan-param FromPath $fromPath
|
||||
* @phpstan-param Generate $generate
|
||||
*/
|
||||
public function __construct(\Closure $isValid, \Closure $fromPath, \Closure $generate){
|
||||
public function __construct(
|
||||
\Closure $isValid,
|
||||
private \Closure $fromPath,
|
||||
private \Closure $generate
|
||||
){
|
||||
parent::__construct($isValid);
|
||||
$this->fromPath = $fromPath;
|
||||
$this->generate = $generate;
|
||||
}
|
||||
|
||||
public function fromPath(string $path) : WritableWorldProvider{
|
||||
|
@@ -26,13 +26,10 @@ namespace pocketmine\world\generator;
|
||||
use function exp;
|
||||
|
||||
final class Gaussian{
|
||||
public int $smoothSize;
|
||||
/** @var float[][] */
|
||||
public array $kernel = [];
|
||||
|
||||
public function __construct(int $smoothSize){
|
||||
$this->smoothSize = $smoothSize;
|
||||
|
||||
public function __construct(public int $smoothSize){
|
||||
$bellSize = 1 / $this->smoothSize;
|
||||
$bellHeight = 2 * $this->smoothSize;
|
||||
|
||||
|
@@ -41,10 +41,6 @@ use function igbinary_unserialize;
|
||||
class PopulationTask extends AsyncTask{
|
||||
private const TLS_KEY_ON_COMPLETION = "onCompletion";
|
||||
|
||||
private int $worldId;
|
||||
private int $chunkX;
|
||||
private int $chunkZ;
|
||||
|
||||
private ?string $chunk;
|
||||
|
||||
private string $adjacentChunks;
|
||||
@@ -54,10 +50,14 @@ class PopulationTask extends AsyncTask{
|
||||
* @phpstan-param array<int, Chunk|null> $adjacentChunks
|
||||
* @phpstan-param OnCompletion $onCompletion
|
||||
*/
|
||||
public function __construct(int $worldId, int $chunkX, int $chunkZ, ?Chunk $chunk, array $adjacentChunks, \Closure $onCompletion){
|
||||
$this->worldId = $worldId;
|
||||
$this->chunkX = $chunkX;
|
||||
$this->chunkZ = $chunkZ;
|
||||
public function __construct(
|
||||
private int $worldId,
|
||||
private int $chunkX,
|
||||
private int $chunkZ,
|
||||
?Chunk $chunk,
|
||||
array $adjacentChunks,
|
||||
\Closure $onCompletion
|
||||
){
|
||||
$this->chunk = $chunk !== null ? FastChunkSerializer::serializeTerrain($chunk) : null;
|
||||
|
||||
$this->adjacentChunks = igbinary_serialize(array_map(
|
||||
|
@@ -40,12 +40,9 @@ class LightPopulationTask extends AsyncTask{
|
||||
/** @var string */
|
||||
public $chunk;
|
||||
|
||||
/** @var string */
|
||||
private $resultHeightMap;
|
||||
/** @var string */
|
||||
private $resultSkyLightArrays;
|
||||
/** @var string */
|
||||
private $resultBlockLightArrays;
|
||||
private string $resultHeightMap;
|
||||
private string $resultSkyLightArrays;
|
||||
private string $resultBlockLightArrays;
|
||||
|
||||
/**
|
||||
* @phpstan-param \Closure(array<int, LightArray> $blockLight, array<int, LightArray> $skyLight, array<int, int> $heightMap) : void $onCompletion
|
||||
|
Reference in New Issue
Block a user