mobs should swim now

This commit is contained in:
GameHerobrine 2023-01-17 20:29:19 +03:00
parent c2e069ef08
commit 6f54da56ba
3 changed files with 39 additions and 5 deletions

View file

@ -0,0 +1,34 @@
<?php
class TaskSwimming extends TaskBase
{
public function onStart(EntityAI $ai)
{
$this->selfCounter = 1;
}
public function onEnd(EntityAI $ai)
{
}
public function onUpdate(EntityAI $ai)
{
if(!$ai->entity->inWater){
$this->reset();
}
if(Utils::randomFloat() < 0.8){ #1.5.2 method
$ai->entity->speedY = 0.42;
}
}
public function canBeExecuted(EntityAI $ai)
{
return $ai->entity->inWater;
}
}