mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-06 20:07:09 +00:00
Update exhaustion values for 1.18.30 (#5034)
This commit is contained in:
parent
1e59679ec2
commit
89cc449808
@ -156,9 +156,9 @@ class Human extends Living implements ProjectileSource, InventoryHolder{
|
|||||||
public function jump() : void{
|
public function jump() : void{
|
||||||
parent::jump();
|
parent::jump();
|
||||||
if($this->isSprinting()){
|
if($this->isSprinting()){
|
||||||
$this->hungerManager->exhaust(0.8, PlayerExhaustEvent::CAUSE_SPRINT_JUMPING);
|
$this->hungerManager->exhaust(0.2, PlayerExhaustEvent::CAUSE_SPRINT_JUMPING);
|
||||||
}else{
|
}else{
|
||||||
$this->hungerManager->exhaust(0.2, PlayerExhaustEvent::CAUSE_JUMPING);
|
$this->hungerManager->exhaust(0.05, PlayerExhaustEvent::CAUSE_JUMPING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ class HungerManager{
|
|||||||
if($food >= 18){
|
if($food >= 18){
|
||||||
if($health < $this->entity->getMaxHealth()){
|
if($health < $this->entity->getMaxHealth()){
|
||||||
$this->entity->heal(new EntityRegainHealthEvent($this->entity, 1, EntityRegainHealthEvent::CAUSE_SATURATION));
|
$this->entity->heal(new EntityRegainHealthEvent($this->entity, 1, EntityRegainHealthEvent::CAUSE_SATURATION));
|
||||||
$this->exhaust(3.0, PlayerExhaustEvent::CAUSE_HEALTH_REGEN);
|
$this->exhaust(6.0, PlayerExhaustEvent::CAUSE_HEALTH_REGEN);
|
||||||
}
|
}
|
||||||
}elseif($food <= 0){
|
}elseif($food <= 0){
|
||||||
if(($difficulty === World::DIFFICULTY_EASY && $health > 10) || ($difficulty === World::DIFFICULTY_NORMAL && $health > 1) || $difficulty === World::DIFFICULTY_HARD){
|
if(($difficulty === World::DIFFICULTY_EASY && $health > 10) || ($difficulty === World::DIFFICULTY_NORMAL && $health > 1) || $difficulty === World::DIFFICULTY_HARD){
|
||||||
|
@ -36,7 +36,7 @@ class HungerEffect extends Effect{
|
|||||||
|
|
||||||
public function applyEffect(Living $entity, EffectInstance $instance, float $potency = 1.0, ?Entity $source = null) : void{
|
public function applyEffect(Living $entity, EffectInstance $instance, float $potency = 1.0, ?Entity $source = null) : void{
|
||||||
if($entity instanceof Human){
|
if($entity instanceof Human){
|
||||||
$entity->getHungerManager()->exhaust(0.025 * $instance->getEffectLevel(), PlayerExhaustEvent::CAUSE_POTION);
|
$entity->getHungerManager()->exhaust(0.1 * $instance->getEffectLevel(), PlayerExhaustEvent::CAUSE_POTION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1253,11 +1253,11 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
|||||||
|
|
||||||
$horizontalDistanceTravelled = sqrt((($from->x - $to->x) ** 2) + (($from->z - $to->z) ** 2));
|
$horizontalDistanceTravelled = sqrt((($from->x - $to->x) ** 2) + (($from->z - $to->z) ** 2));
|
||||||
if($horizontalDistanceTravelled > 0){
|
if($horizontalDistanceTravelled > 0){
|
||||||
//TODO: check swimming (adds 0.015 exhaustion in MCPE)
|
//TODO: check for swimming
|
||||||
if($this->isSprinting()){
|
if($this->isSprinting()){
|
||||||
$this->hungerManager->exhaust(0.1 * $horizontalDistanceTravelled, PlayerExhaustEvent::CAUSE_SPRINTING);
|
$this->hungerManager->exhaust(0.01 * $horizontalDistanceTravelled, PlayerExhaustEvent::CAUSE_SPRINTING);
|
||||||
}else{
|
}else{
|
||||||
$this->hungerManager->exhaust(0.01 * $horizontalDistanceTravelled, PlayerExhaustEvent::CAUSE_WALKING);
|
$this->hungerManager->exhaust(0.0, PlayerExhaustEvent::CAUSE_WALKING);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->nextChunkOrderRun > 20){
|
if($this->nextChunkOrderRun > 20){
|
||||||
@ -1652,7 +1652,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
|||||||
}
|
}
|
||||||
$this->inventory->setItemInHand($item);
|
$this->inventory->setItemInHand($item);
|
||||||
}
|
}
|
||||||
$this->hungerManager->exhaust(0.025, PlayerExhaustEvent::CAUSE_MINING);
|
$this->hungerManager->exhaust(0.005, PlayerExhaustEvent::CAUSE_MINING);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
@ -1762,7 +1762,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
|||||||
$this->inventory->setItemInHand($heldItem);
|
$this->inventory->setItemInHand($heldItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->hungerManager->exhaust(0.3, PlayerExhaustEvent::CAUSE_ATTACK);
|
$this->hungerManager->exhaust(0.1, PlayerExhaustEvent::CAUSE_ATTACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -2305,7 +2305,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
|||||||
protected function applyPostDamageEffects(EntityDamageEvent $source) : void{
|
protected function applyPostDamageEffects(EntityDamageEvent $source) : void{
|
||||||
parent::applyPostDamageEffects($source);
|
parent::applyPostDamageEffects($source);
|
||||||
|
|
||||||
$this->hungerManager->exhaust(0.3, PlayerExhaustEvent::CAUSE_DAMAGE);
|
$this->hungerManager->exhaust(0.1, PlayerExhaustEvent::CAUSE_DAMAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function attack(EntityDamageEvent $source) : void{
|
public function attack(EntityDamageEvent $source) : void{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user