mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-22 04:29:43 +00:00
mobs should swim now
This commit is contained in:
parent
c2e069ef08
commit
6f54da56ba
3 changed files with 39 additions and 5 deletions
34
src/entity/ai/tasks/TaskSwimming.php
Normal file
34
src/entity/ai/tasks/TaskSwimming.php
Normal 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue