mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Human: fix possible bug with food ticking
it updates it but doesn't take note of the updated value, which could cause the code below to be erroneously triggered.
This commit is contained in:
@ -643,6 +643,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
if($difficulty === Level::DIFFICULTY_PEACEFUL and $this->foodTickTimer % 10 === 0){
|
||||
if($food < 20){
|
||||
$this->addFood(1.0);
|
||||
$food = $this->getFood();
|
||||
}
|
||||
if($this->foodTickTimer % 20 === 0 and $health < $this->getMaxHealth()){
|
||||
$this->heal(new EntityRegainHealthEvent($this, 1, EntityRegainHealthEvent::CAUSE_SATURATION));
|
||||
|
Reference in New Issue
Block a user