mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Entity: Rename isInsideOfWater() to isUnderwater()
This commit is contained in:
parent
6111ce7df1
commit
adb9390b53
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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){
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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{
|
||||
|
Loading…
x
Reference in New Issue
Block a user