Skip to content

SwimmingMobTrait 5.46.0 ​

trait · pocketmine\entity\ai\SwimmingMobTrait · source

Mob that lives in water (fish, dolphin, tadpole, nautilus): swimming move control, straight line navigation and wandering targets in water. Out of water it can't wander (fish flop, see the mob). Amphibious mobs (axolotls, turtles, frogs) don't use this: they keep the walking navigation with a SwimmingMoveControl.

Methods ​

canBeMovedByCurrents() ​

php
public function canBeMovedByCurrents() : bool

canBreathe() ​

php
public function canBreathe() : bool

createMoveControl() protected ​

php
protected function createMoveControl() : \pocketmine\entity\ai\control\MoveControl

createNavigation() protected ​

php
protected function createNavigation() : \pocketmine\entity\ai\navigation\PathNavigator

findWanderPos() ​

php
public function findWanderPos(int $horizontal, int $vertical, ?\pocketmine\math\Vector3 $awayFrom = null) : ?\pocketmine\math\Vector3

getSwimSpeed() protected ​

php
abstract protected function getSwimSpeed() : float

Underwater speed in blocks per tick at speed multiplier 1 (Bedrock "underwater_movement").

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.