41    public static function getNetworkTypeId() : 
string{ 
return EntityIds::SQUID; }
 
   43    public ?
Vector3 $swimDirection = 
null;
 
   44    public float $swimSpeed = 0.1;
 
   46    private int $switchDirectionTicker = 0;
 
   50    public function initEntity(
CompoundTag $nbt) : 
void{
 
   51        $this->setMaxHealth(10);
 
   52        parent::initEntity($nbt);
 
   55    public function getName() : 
string{
 
   60        parent::attack($source);
 
   66            $this->swimSpeed = mt_rand(150, 350) / 2000;
 
   67            $e = $source->getDamager();
 
   69                $this->swimDirection = $this->location->subtractVector($e->location)->normalize();
 
   76    private function generateRandomDirection() : 
Vector3{
 
   77        return new Vector3(mt_rand(-1000, 1000) / 1000, mt_rand(-500, 500) / 1000, mt_rand(-1000, 1000) / 1000);
 
   80    protected function entityBaseTick(
int $tickDiff = 1) : 
bool{
 
   85        if(++$this->switchDirectionTicker === 100){
 
   86            $this->switchDirectionTicker = 0;
 
   87            if(mt_rand(0, 100) < 50){
 
   88                $this->swimDirection = 
null;
 
   92        $hasUpdate = parent::entityBaseTick($tickDiff);
 
   96            if($this->location->y > 62 && $this->swimDirection !== 
null){
 
   97                $this->swimDirection = $this->swimDirection->withComponents(
null, -0.5, 
null);
 
  100            $inWater = $this->isUnderwater();
 
  101            $this->setHasGravity(!$inWater);
 
  103                $this->swimDirection = 
null;
 
  104            }elseif($this->swimDirection !== 
null){
 
  105                if($this->motion->lengthSquared() <= $this->swimDirection->lengthSquared()){
 
  106                    $this->motion = $this->swimDirection->multiply($this->swimSpeed);
 
  109                $this->swimDirection = $this->generateRandomDirection();
 
  110                $this->swimSpeed = mt_rand(50, 100) / 2000;
 
  113            $f = sqrt(($this->motion->x ** 2) + ($this->motion->z ** 2));
 
  115                -atan2($this->motion->x, $this->motion->z) * 180 / M_PI,
 
  116                -atan2($f, $this->motion->y) * 180 / M_PI