Fixed the half-done hunger implementation, fixed lots of bugs related to hunger

- Fixed starvation doesn't deal any damage at all (Human->getFood() returns a float, not an int, === 0 won't work so great)
- Added exhaustion for sprinting, walking, jumping and sprint-jumping as per MCPE (these use MCPE values, and yes MCPE does walking exhaustion!)
- Fixed attributes don't get reset after player death
- Added food and hunger regeneration in peaceful difficulty
- Added API methods Living->jump() (motion isn't updated yet, so this won't actually do much if plugins try to use it) and Living->getJumpVelocity()

TODO: implement exhaustion for swimming
This commit is contained in:
Dylan K. Taylor
2017-04-03 13:12:33 +01:00
parent 00a226921c
commit 2204942338
6 changed files with 101 additions and 31 deletions

View File

@ -165,6 +165,10 @@ class Attribute{
return $this;
}
public function resetToDefault(){
$this->setValue($this->getDefaultValue());
}
public function getValue(){
return $this->currentValue;
}