PocketMine-MP 5.23.3 git-976fc63567edab7a6fb6aeae739f43cf9fe57de4
Loading...
Searching...
No Matches
pocketmine\entity\HungerManager Class Reference
+ Collaboration diagram for pocketmine\entity\HungerManager:

Public Member Functions

 __construct (private Human $entity)
 
 addFood (float $amount)
 
 addSaturation (float $amount)
 
 exhaust (float $amount, int $cause=PlayerExhaustEvent::CAUSE_CUSTOM)
 
 getExhaustion ()
 
 getFood ()
 
 getFoodTickTimer ()
 
 getMaxFood ()
 
 getSaturation ()
 
 isEnabled ()
 
 isHungry ()
 
 setEnabled (bool $enabled)
 
 setExhaustion (float $exhaustion)
 
 setFood (float $new)
 
 setFoodTickTimer (int $foodTickTimer)
 
 setSaturation (float $saturation)
 
 tick (int $tickDiff=1)
 

Detailed Description

Definition at line 33 of file HungerManager.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\entity\HungerManager::__construct ( private Human $entity)

Definition at line 43 of file HungerManager.php.

Member Function Documentation

◆ addFood()

pocketmine\entity\HungerManager::addFood ( float $amount)

Definition at line 84 of file HungerManager.php.

◆ addSaturation()

pocketmine\entity\HungerManager::addSaturation ( float $amount)

Definition at line 112 of file HungerManager.php.

◆ exhaust()

pocketmine\entity\HungerManager::exhaust ( float $amount,
int $cause = PlayerExhaustEvent::CAUSE_CUSTOM )

Increases exhaustion level.

Returns
float the amount of exhaustion level increased

Definition at line 133 of file HungerManager.php.

◆ getExhaustion()

pocketmine\entity\HungerManager::getExhaustion ( )

Definition at line 116 of file HungerManager.php.

◆ getFood()

pocketmine\entity\HungerManager::getFood ( )

Definition at line 57 of file HungerManager.php.

◆ getFoodTickTimer()

pocketmine\entity\HungerManager::getFoodTickTimer ( )

Definition at line 170 of file HungerManager.php.

◆ getMaxFood()

pocketmine\entity\HungerManager::getMaxFood ( )

Definition at line 80 of file HungerManager.php.

◆ getSaturation()

pocketmine\entity\HungerManager::getSaturation ( )

Definition at line 98 of file HungerManager.php.

◆ isEnabled()

pocketmine\entity\HungerManager::isEnabled ( )

Definition at line 222 of file HungerManager.php.

◆ isHungry()

pocketmine\entity\HungerManager::isHungry ( )

Returns whether the food level is below the maximum. This doesn't decide if the entity can eat food. Use Human::canEat() for that.

Definition at line 94 of file HungerManager.php.

◆ setEnabled()

pocketmine\entity\HungerManager::setEnabled ( bool $enabled)

Definition at line 226 of file HungerManager.php.

◆ setExhaustion()

pocketmine\entity\HungerManager::setExhaustion ( float $exhaustion)

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

See also
HungerManager::exhaust()

Definition at line 124 of file HungerManager.php.

◆ setFood()

pocketmine\entity\HungerManager::setFood ( float $new)

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

See also
HungerManager::addFood()
Exceptions

InvalidArgumentException

Definition at line 67 of file HungerManager.php.

◆ setFoodTickTimer()

pocketmine\entity\HungerManager::setFoodTickTimer ( int $foodTickTimer)

Definition at line 174 of file HungerManager.php.

◆ setSaturation()

pocketmine\entity\HungerManager::setSaturation ( float $saturation)

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

See also
HungerManager::addSaturation()
Exceptions

InvalidArgumentException

Definition at line 108 of file HungerManager.php.

◆ tick()

pocketmine\entity\HungerManager::tick ( int $tickDiff = 1)

Definition at line 181 of file HungerManager.php.


The documentation for this class was generated from the following file: