Implement difficulty per-world (#878)

* Moved Server::getDifficultyFromString() to Level
* Added ability to set difficulty in worlds section of pocketmine.yml for generation
This commit is contained in:
Dylan K. Taylor
2017-09-26 11:16:51 +01:00
committed by GitHub
parent e64076ec81
commit 38fad4b963
9 changed files with 132 additions and 50 deletions

View File

@ -391,14 +391,14 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
if($this->isAlive()){
$food = $this->getFood();
$health = $this->getHealth();
$difficulty = $this->server->getDifficulty();
$difficulty = $this->level->getDifficulty();
$this->foodTickTimer += $tickDiff;
if($this->foodTickTimer >= 80){
$this->foodTickTimer = 0;
}
if($difficulty === 0 and $this->foodTickTimer % 10 === 0){ //Peaceful
if($difficulty === Level::DIFFICULTY_PEACEFUL and $this->foodTickTimer % 10 === 0){
if($food < 20){
$this->addFood(1.0);
}