HungerManager
in package
Table of Contents
- $enabled : bool
- $entity : Human
- $exhaustionAttr : Attribute
- $foodTickTimer : int
- $hungerAttr : Attribute
- $saturationAttr : Attribute
- __construct() : mixed
- addFood() : void
- addSaturation() : void
- exhaust() : float
- Increases exhaustion level.
- getExhaustion() : float
- getFood() : float
- getFoodTickTimer() : int
- getMaxFood() : float
- getSaturation() : float
- isEnabled() : bool
- isHungry() : bool
- Returns whether this Human may consume objects requiring hunger.
- setEnabled() : void
- setExhaustion() : void
- WARNING: This method does not check if exhausted and does not consume saturation/food.
- setFood() : void
- WARNING: This method does not check if full and may throw an exception if out of bounds.
- setFoodTickTimer() : void
- setSaturation() : void
- WARNING: This method does not check if saturated and may throw an exception if out of bounds.
- tick() : void
- fetchAttribute() : Attribute
Properties
$enabled
private
bool
$enabled
= true
$entity
private
Human
$entity
$exhaustionAttr
private
Attribute
$exhaustionAttr
$foodTickTimer
private
int
$foodTickTimer
= 0
$hungerAttr
private
Attribute
$hungerAttr
$saturationAttr
private
Attribute
$saturationAttr
Methods
__construct()
public
__construct(Human $entity) : mixed
Parameters
- $entity : Human
Return values
mixed —addFood()
public
addFood(float $amount) : void
Parameters
- $amount : float
Return values
void —addSaturation()
public
addSaturation(float $amount) : void
Parameters
- $amount : float
Return values
void —exhaust()
Increases exhaustion level.
public
exhaust(float $amount[, int $cause = PlayerExhaustEvent::CAUSE_CUSTOM ]) : float
Parameters
- $amount : float
- $cause : int = PlayerExhaustEvent::CAUSE_CUSTOM
Return values
float —the amount of exhaustion level increased
getExhaustion()
public
getExhaustion() : float
Return values
float —getFood()
public
getFood() : float
Return values
float —getFoodTickTimer()
public
getFoodTickTimer() : int
Return values
int —getMaxFood()
public
getMaxFood() : float
Return values
float —getSaturation()
public
getSaturation() : float
Return values
float —isEnabled()
public
isEnabled() : bool
Return values
bool —isHungry()
Returns whether this Human may consume objects requiring hunger.
public
isHungry() : bool
Return values
bool —setEnabled()
public
setEnabled(bool $enabled) : void
Parameters
- $enabled : bool
Return values
void —setExhaustion()
WARNING: This method does not check if exhausted and does not consume saturation/food.
public
setExhaustion(float $exhaustion) : void
Parameters
- $exhaustion : float
Tags
Return values
void —setFood()
WARNING: This method does not check if full and may throw an exception if out of bounds.
public
setFood(float $new) : void
Parameters
- $new : float
Tags
Return values
void —setFoodTickTimer()
public
setFoodTickTimer(int $foodTickTimer) : void
Parameters
- $foodTickTimer : int
Return values
void —setSaturation()
WARNING: This method does not check if saturated and may throw an exception if out of bounds.
public
setSaturation(float $saturation) : void
Parameters
- $saturation : float
Tags
Return values
void —tick()
public
tick([int $tickDiff = 1 ]) : void
Parameters
- $tickDiff : int = 1
Return values
void —fetchAttribute()
private
static fetchAttribute(Entity $entity, string $attributeId) : Attribute
Parameters
- $entity : Entity
- $attributeId : string