Skip to content

HungerManager ​

class · pocketmine\entity\HungerManager · source

Methods ​

__construct() ​

php
public function __construct(\pocketmine\entity\Human $entity)

addFood() ​

php
public function addFood(float $amount) : void

addSaturation() ​

php
public function addSaturation(float $amount) : void

exhaust() ​

php
public function exhaust(float $amount, int $cause = \pocketmine\event\player\PlayerExhaustEvent::CAUSE_CUSTOM) : float

Increases exhaustion level.

getExhaustion() ​

php
public function getExhaustion() : float

getFood() ​

php
public function getFood() : float

getFoodTickTimer() ​

php
public function getFoodTickTimer() : int

getMaxFood() ​

php
public function getMaxFood() : float

getSaturation() ​

php
public function getSaturation() : float

isEnabled() ​

php
public function isEnabled() : bool

isHungry() ​

php
public function isHungry() : bool

Returns 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) : void

setExhaustion() ​

php
public function setExhaustion(float $exhaustion) : void

WARNING: This method does not check if exhausted and does not consume saturation/food.

setFood() ​

php
public function setFood(float $new) : void

WARNING: This method does not check if full and may throw an exception if out of bounds.

setFoodTickTimer() ​

php
public function setFoodTickTimer(int $foodTickTimer) : void

setSaturation() ​

php
public function setSaturation(float $saturation) : void

WARNING: 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

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.