diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 225191f60..57663213e 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -2505,7 +2505,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $ev->setCancelled(); } - if(!$this->isSprinting() and !$this->isFlying() and $this->fallDistance > 0 and !$this->hasEffect(Effect::BLINDNESS) and !$this->isInsideOfWater()){ + if(!$this->isSprinting() and !$this->isFlying() and $this->fallDistance > 0 and !$this->hasEffect(Effect::BLINDNESS) and !$this->isUnderwater()){ $ev->setDamage($ev->getFinalDamage() / 2, EntityDamageEvent::MODIFIER_CRITICAL); } diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index fbfa531e3..620fd76db 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -1464,7 +1464,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{ } - public function isInsideOfWater() : bool{ + public function isUnderwater() : bool{ $block = $this->level->getBlockAt(Math::floorFloat($this->x), Math::floorFloat($y = ($this->y + $this->getEyeHeight())), Math::floorFloat($this->z)); if($block instanceof Water){ diff --git a/src/pocketmine/entity/Living.php b/src/pocketmine/entity/Living.php index be4c56237..49cba5fc2 100644 --- a/src/pocketmine/entity/Living.php +++ b/src/pocketmine/entity/Living.php @@ -686,7 +686,7 @@ abstract class Living extends Entity implements Damageable{ * @return bool */ public function canBreathe() : bool{ - return $this->hasEffect(Effect::WATER_BREATHING) or !$this->isInsideOfWater(); + return $this->hasEffect(Effect::WATER_BREATHING) or !$this->isUnderwater(); } /** diff --git a/src/pocketmine/entity/Squid.php b/src/pocketmine/entity/Squid.php index a792364d4..a09f08bca 100644 --- a/src/pocketmine/entity/Squid.php +++ b/src/pocketmine/entity/Squid.php @@ -93,7 +93,7 @@ class Squid extends WaterAnimal{ $this->swimDirection->y = -0.5; } - $inWater = $this->isInsideOfWater(); + $inWater = $this->isUnderwater(); if(!$inWater){ $this->swimDirection = null; }elseif($this->swimDirection !== null){ @@ -116,7 +116,7 @@ class Squid extends WaterAnimal{ } protected function applyGravity() : void{ - if(!$this->isInsideOfWater()){ + if(!$this->isUnderwater()){ parent::applyGravity(); } } diff --git a/src/pocketmine/entity/WaterAnimal.php b/src/pocketmine/entity/WaterAnimal.php index 1396efe6c..4bcc7d3b9 100644 --- a/src/pocketmine/entity/WaterAnimal.php +++ b/src/pocketmine/entity/WaterAnimal.php @@ -32,7 +32,7 @@ abstract class WaterAnimal extends Creature implements Ageable{ } public function canBreathe() : bool{ - return $this->isInsideOfWater(); + return $this->isUnderwater(); } public function onAirExpired() : void{