mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-11 08:19:45 +00:00
Human: simplify setFood()
This commit is contained in:
parent
78dfcc5f2d
commit
c3bbb8905c
@ -206,18 +206,13 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
|||||||
$old = $attr->getValue();
|
$old = $attr->getValue();
|
||||||
$attr->setValue($new);
|
$attr->setValue($new);
|
||||||
|
|
||||||
$reset = false;
|
|
||||||
// ranges: 18-20 (regen), 7-17 (none), 1-6 (no sprint), 0 (health depletion)
|
// ranges: 18-20 (regen), 7-17 (none), 1-6 (no sprint), 0 (health depletion)
|
||||||
foreach([17, 6, 0] as $bound){
|
foreach([17, 6, 0] as $bound){
|
||||||
if(($old > $bound) !== ($new > $bound)){
|
if(($old > $bound) !== ($new > $bound)){
|
||||||
$reset = true;
|
$this->foodTickTimer = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($reset){
|
|
||||||
$this->foodTickTimer = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMaxFood() : float{
|
public function getMaxFood() : float{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user