Entity: Rename isInsideOfWater() to isUnderwater()

This commit is contained in:
Dylan K. Taylor
2018-05-19 18:10:43 +01:00
parent 6111ce7df1
commit adb9390b53
5 changed files with 6 additions and 6 deletions

View File

@ -2505,7 +2505,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$ev->setCancelled(); $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); $ev->setDamage($ev->getFinalDamage() / 2, EntityDamageEvent::MODIFIER_CRITICAL);
} }

View File

@ -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)); $block = $this->level->getBlockAt(Math::floorFloat($this->x), Math::floorFloat($y = ($this->y + $this->getEyeHeight())), Math::floorFloat($this->z));
if($block instanceof Water){ if($block instanceof Water){

View File

@ -686,7 +686,7 @@ abstract class Living extends Entity implements Damageable{
* @return bool * @return bool
*/ */
public function canBreathe() : bool{ public function canBreathe() : bool{
return $this->hasEffect(Effect::WATER_BREATHING) or !$this->isInsideOfWater(); return $this->hasEffect(Effect::WATER_BREATHING) or !$this->isUnderwater();
} }
/** /**

View File

@ -93,7 +93,7 @@ class Squid extends WaterAnimal{
$this->swimDirection->y = -0.5; $this->swimDirection->y = -0.5;
} }
$inWater = $this->isInsideOfWater(); $inWater = $this->isUnderwater();
if(!$inWater){ if(!$inWater){
$this->swimDirection = null; $this->swimDirection = null;
}elseif($this->swimDirection !== null){ }elseif($this->swimDirection !== null){
@ -116,7 +116,7 @@ class Squid extends WaterAnimal{
} }
protected function applyGravity() : void{ protected function applyGravity() : void{
if(!$this->isInsideOfWater()){ if(!$this->isUnderwater()){
parent::applyGravity(); parent::applyGravity();
} }
} }

View File

@ -32,7 +32,7 @@ abstract class WaterAnimal extends Creature implements Ageable{
} }
public function canBreathe() : bool{ public function canBreathe() : bool{
return $this->isInsideOfWater(); return $this->isUnderwater();
} }
public function onAirExpired() : void{ public function onAirExpired() : void{