mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-17 11:18:52 +00:00
Added a normal Temporal Generator
This commit is contained in:
parent
8bf10c523e
commit
a830555d90
@ -100,7 +100,11 @@ class LevelAPI{
|
|||||||
$generator = $this->server->api->getProperty("generator");
|
$generator = $this->server->api->getProperty("generator");
|
||||||
$generator = new $generator($options);
|
$generator = new $generator($options);
|
||||||
}else{
|
}else{
|
||||||
$generator = new SuperflatGenerator($options);
|
if(strtoupper($this->server->api->getProperty("level-type")) == "FLAT"){
|
||||||
|
$generator = new SuperflatGenerator($options);
|
||||||
|
}else{
|
||||||
|
$generator = new TemporalGenerator($options);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$gen = new WorldGenerator($generator, $name, $seed === false ? Utils::readInt(Utils::getRandomBytes(4, false)):(int) $seed);
|
$gen = new WorldGenerator($generator, $name, $seed === false ? Utils::readInt(Utils::getRandomBytes(4, false)):(int) $seed);
|
||||||
$gen->generate();
|
$gen->generate();
|
||||||
|
@ -426,11 +426,15 @@ class PlayerAPI{
|
|||||||
"lastIP" => "",
|
"lastIP" => "",
|
||||||
"lastID" => 0,
|
"lastID" => 0,
|
||||||
);
|
);
|
||||||
$data = new Config(DATA_PATH."players/".$iname.".yml", CONFIG_YAML, $default);
|
|
||||||
if(!file_exists(DATA_PATH."players/".$iname.".yml")){
|
if(!file_exists(DATA_PATH."players/".$iname.".yml")){
|
||||||
console("[NOTICE] Player data not found for \"".$iname."\", creating new profile");
|
console("[NOTICE] Player data not found for \"".$iname."\", creating new profile");
|
||||||
|
$data = new Config(DATA_PATH."players/".$iname.".yml", CONFIG_YAML, $default);
|
||||||
$data->save();
|
$data->save();
|
||||||
|
}else{
|
||||||
|
$data = new Config(DATA_PATH."players/".$iname.".yml", CONFIG_YAML, $default);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(($this->server->gamemode & 0x01) === 0x01){
|
if(($this->server->gamemode & 0x01) === 0x01){
|
||||||
$data->set("health", 20);
|
$data->set("health", 20);
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ class ServerAPI{
|
|||||||
"generator-settings" => "",
|
"generator-settings" => "",
|
||||||
"level-name" => "world",
|
"level-name" => "world",
|
||||||
"level-seed" => "",
|
"level-seed" => "",
|
||||||
"level-type" => "FLAT",
|
"level-type" => "DEFAULT",
|
||||||
"enable-query" => true,
|
"enable-query" => true,
|
||||||
"enable-rcon" => false,
|
"enable-rcon" => false,
|
||||||
"rcon.password" => substr(base64_encode(Utils::getRandomBytes(20, false)), 3, 10),
|
"rcon.password" => substr(base64_encode(Utils::getRandomBytes(20, false)), 3, 10),
|
||||||
|
@ -28,6 +28,9 @@ the Free Software Foundation, either version 3 of the License, or
|
|||||||
class CoalItem extends Item{
|
class CoalItem extends Item{
|
||||||
public function __construct($meta = 0, $count = 1){
|
public function __construct($meta = 0, $count = 1){
|
||||||
parent::__construct(COAL, $meta & 0x01, $count, "Coal");
|
parent::__construct(COAL, $meta & 0x01, $count, "Coal");
|
||||||
|
if($this->metadata === 1){
|
||||||
|
$this->name = "Charcoal";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -383,6 +383,10 @@ class Level{
|
|||||||
return (int) $this->level->getData("seed");
|
return (int) $this->level->getData("seed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setSeed($seed){
|
||||||
|
$this->level->setData("seed", (int) $seed);
|
||||||
|
}
|
||||||
|
|
||||||
public function scheduleBlockUpdate(Position $pos, $delay, $type = BLOCK_UPDATE_SCHEDULED){
|
public function scheduleBlockUpdate(Position $pos, $delay, $type = BLOCK_UPDATE_SCHEDULED){
|
||||||
return $this->server->api->block->scheduleBlockUpdate($pos, $delay, $type);
|
return $this->server->api->block->scheduleBlockUpdate($pos, $delay, $type);
|
||||||
}
|
}
|
||||||
|
101
src/world/generator/TemporalGenerator.php
Normal file
101
src/world/generator/TemporalGenerator.php
Normal file
File diff suppressed because one or more lines are too long
@ -65,7 +65,7 @@ class WorldGenerator{
|
|||||||
console("[NOTICE] Populating level");
|
console("[NOTICE] Populating level");
|
||||||
$this->generator->populateLevel();
|
$this->generator->populateLevel();
|
||||||
$this->level->setSpawn($this->generator->getSpawn());
|
$this->level->setSpawn($this->generator->getSpawn());
|
||||||
$this->level->save(true);
|
$this->level->save(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function close(){
|
public function close(){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user