Human: Use Item->getEnchantmentLevel() for Respiration check

This commit is contained in:
Dylan K. Taylor 2018-01-11 18:32:46 +00:00
parent a6c1e02847
commit 98eba11da5

View File

@ -611,8 +611,8 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
protected function doAirSupplyTick(int $tickDiff){
//TODO: allow this to apply to other mobs
if(($ench = $this->inventory->getHelmet()->getEnchantment(Enchantment::RESPIRATION)) === null or
lcg_value() <= (1 / ($ench->getLevel() + 1))){
if(($respirationLevel = $this->inventory->getHelmet()->getEnchantmentLevel(Enchantment::RESPIRATION)) <= 0 or
lcg_value() <= (1 / ($respirationLevel + 1))){
parent::doAirSupplyTick($tickDiff);
}
}