mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
more entity optimizations
This commit is contained in:
parent
2b0ad36e14
commit
2d9b37aa9c
12 changed files with 44 additions and 62 deletions
|
|
@ -16,7 +16,7 @@ class TaskLookAround extends TaskBase
|
|||
|
||||
public function canBeExecuted(EntityAI $ai)
|
||||
{
|
||||
return !$ai->entity->inPanic && !$ai->entity->isMoving() && Utils::randomFloat() < 0.02 && !$ai->isStarted("TaskLookAtPlayer") && !$ai->isStarted("TaskTempt") && !$ai->entity->hasPath(); /*Vanilla value*/
|
||||
return !$ai->entity->inPanic && !$ai->entity->isMoving() && lcg_value() < 0.02 && !$ai->isStarted("TaskLookAtPlayer") && !$ai->isStarted("TaskTempt") && !$ai->entity->hasPath(); /*Vanilla value*/
|
||||
}
|
||||
|
||||
public function onUpdate(EntityAI $ai)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ class TaskLookAtPlayer extends TaskBase{
|
|||
public $target = false;
|
||||
private $state, $yaw, $pitch;
|
||||
public function canBeExecuted(EntityAI $ai){
|
||||
return !$ai->entity->inPanic && Utils::randomFloat() < 0.02 && !$ai->entity->isMovingHorizontally() && !$ai->isStarted("TaskLookAround") && !$ai->isStarted("TaskTempt") && !$ai->entity->hasPath();
|
||||
return !$ai->entity->inPanic && lcg_value() < 0.02 && !$ai->entity->isMovingHorizontally() && !$ai->isStarted("TaskLookAround") && !$ai->isStarted("TaskTempt") && !$ai->entity->hasPath();
|
||||
}
|
||||
|
||||
protected function findTarget($e, $r){
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class TaskSwimming extends TaskBase
|
|||
return;
|
||||
}
|
||||
|
||||
if(Utils::randomFloat() < 0.8){ #1.5.2 method
|
||||
if(lcg_value() < 0.8){ #1.5.2 method
|
||||
$ai->mobController->setJumping(true);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue