mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 16:51:42 +00:00
WorldCreationOptions are now mandatory during creation of worlds
This commit is contained in:
parent
203cc7fcef
commit
7b21fc8e9d
@ -244,7 +244,7 @@ class WorldManager{
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function generateWorld(string $name, ?WorldCreationOptions $options = null, bool $backgroundGeneration = true) : bool{
|
||||
public function generateWorld(string $name, WorldCreationOptions $options, bool $backgroundGeneration = true) : bool{
|
||||
if(trim($name) === "" or $this->isWorldGenerated($name)){
|
||||
return false;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ interface WritableWorldProvider extends WorldProvider{
|
||||
/**
|
||||
* Generate the needed files in the path given
|
||||
*/
|
||||
public static function generate(string $path, string $name, ?WorldCreationOptions $options = null) : void;
|
||||
public static function generate(string $path, string $name, WorldCreationOptions $options) : void;
|
||||
|
||||
/**
|
||||
* Saves a chunk (usually to disk).
|
||||
|
@ -53,8 +53,7 @@ class BedrockWorldData extends BaseNbtWorldData{
|
||||
public const GENERATOR_INFINITE = 1;
|
||||
public const GENERATOR_FLAT = 2;
|
||||
|
||||
public static function generate(string $path, string $name, ?WorldCreationOptions $options = null) : void{
|
||||
$options ??= WorldCreationOptions::create();
|
||||
public static function generate(string $path, string $name, WorldCreationOptions $options) : void{
|
||||
switch($options->getGeneratorClass()){
|
||||
case Flat::class:
|
||||
$generatorType = self::GENERATOR_FLAT;
|
||||
|
@ -43,10 +43,9 @@ use const ZLIB_ENCODING_GZIP;
|
||||
|
||||
class JavaWorldData extends BaseNbtWorldData{
|
||||
|
||||
public static function generate(string $path, string $name, ?WorldCreationOptions $options = null, int $version = 19133) : void{
|
||||
public static function generate(string $path, string $name, WorldCreationOptions $options, int $version = 19133) : void{
|
||||
//TODO, add extra details
|
||||
|
||||
$options ??= WorldCreationOptions::create();
|
||||
$worldData = CompoundTag::create()
|
||||
->setByte("hardcore", 0)
|
||||
->setByte("Difficulty", $options->getDifficulty())
|
||||
|
@ -143,7 +143,7 @@ class LevelDB extends BaseWorldProvider implements WritableWorldProvider{
|
||||
return file_exists($path . "/level.dat") and is_dir($path . "/db/");
|
||||
}
|
||||
|
||||
public static function generate(string $path, string $name, ?WorldCreationOptions $options = null) : void{
|
||||
public static function generate(string $path, string $name, WorldCreationOptions $options) : void{
|
||||
self::checkForLevelDBExtension();
|
||||
|
||||
if(!file_exists($path . "/db")){
|
||||
|
@ -74,7 +74,7 @@ abstract class RegionWorldProvider extends BaseWorldProvider{
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function generate(string $path, string $name, ?WorldCreationOptions $options = null) : void{
|
||||
public static function generate(string $path, string $name, WorldCreationOptions $options) : void{
|
||||
if(!file_exists($path)){
|
||||
mkdir($path, 0777, true);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user