PocketMine-MP 5.14.2 git-50e2c469a547a16a23b2dc691e70a51d34e29395
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 111 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 132 of file HungerManager.php.

◆ getExhaustion()

pocketmine\entity\HungerManager::getExhaustion ( )

Definition at line 115 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 169 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 97 of file HungerManager.php.

◆ isEnabled()

pocketmine\entity\HungerManager::isEnabled ( )

Definition at line 221 of file HungerManager.php.

◆ isHungry()

pocketmine\entity\HungerManager::isHungry ( )

Returns whether this Human may consume objects requiring hunger.

Definition at line 93 of file HungerManager.php.

◆ setEnabled()

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

Definition at line 225 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 123 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 173 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 107 of file HungerManager.php.

◆ tick()

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

Definition at line 180 of file HungerManager.php.


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