HungerManager
Methods
__construct()
php
public function __construct(\pocketmine\entity\Human $entity)addFood()
php
public function addFood(float $amount) : voidaddSaturation()
php
public function addSaturation(float $amount) : voidexhaust()
php
public function exhaust(float $amount, int $cause = \pocketmine\event\player\PlayerExhaustEvent::CAUSE_CUSTOM) : floatIncreases exhaustion level.
getExhaustion()
php
public function getExhaustion() : floatgetFood()
php
public function getFood() : floatgetFoodTickTimer()
php
public function getFoodTickTimer() : intgetMaxFood()
php
public function getMaxFood() : floatgetSaturation()
php
public function getSaturation() : floatisEnabled()
php
public function isEnabled() : boolisHungry()
php
public function isHungry() : boolReturns whether the food level is below the maximum. This doesn't decide if the entity can eat food. Use Human::canEat() for that.
setEnabled()
php
public function setEnabled(bool $enabled) : voidsetExhaustion()
php
public function setExhaustion(float $exhaustion) : voidWARNING: This method does not check if exhausted and does not consume saturation/food.
setFood()
php
public function setFood(float $new) : voidWARNING: This method does not check if full and may throw an exception if out of bounds.
setFoodTickTimer()
php
public function setFoodTickTimer(int $foodTickTimer) : voidsetSaturation()
php
public function setSaturation(float $saturation) : voidWARNING: This method does not check if saturated and may throw an exception if out of bounds.
tick()
php
public function tick(int $tickDiff = 1) : void