From 616c933d3dc429cfca1029efe18e164167813c8d Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Sun, 22 Jan 2023 23:23:31 +0300 Subject: [PATCH] mobs will follow player if the player has food(no pathfinder), autojump tweaks --- src/entity/ai/MobController.php | 10 +++++----- src/entity/ai/tasks/TaskTempt.php | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/entity/ai/MobController.php b/src/entity/ai/MobController.php index 6b673809..55495dd7 100644 --- a/src/entity/ai/MobController.php +++ b/src/entity/ai/MobController.php @@ -21,14 +21,14 @@ class MobController $xf = $this->entity->x + ($this->entity->getSpeedModifer() * $ox * $this->entity->getSpeed()); $zf = $this->entity->z + ($this->entity->getSpeedModifer() * $oz * $this->entity->getSpeed()); $bs = [ //TODO simplify(somehow) - $this->entity->level->getBlockWithoutVector(ceil($xf), $this->entity->y, ceil($zf)), - $this->entity->level->getBlockWithoutVector(ceil($xf), $this->entity->y, $zf), - $this->entity->level->getBlockWithoutVector($xf, $this->entity->y, ceil($zf)), - $this->entity->level->getBlockWithoutVector($xf, $this->entity->y, $zf) + $this->entity->level->getBlockWithoutVector(ceil($xf), floor($this->entity->y), ceil($zf)), + $this->entity->level->getBlockWithoutVector(ceil($xf), floor($this->entity->y), $zf - ($oz < 0 ? 1 : 0)), + $this->entity->level->getBlockWithoutVector($xf - ($ox < 0 ? 1 : 0), floor($this->entity->y), $zf - ($oz < 0 ? 1 : 0)), + $this->entity->level->getBlockWithoutVector($xf - ($ox < 0 ? 1 : 0), floor($this->entity->y), ceil($zf)), ]; foreach($bs as $b){ if($b->isSolid){ - if(!$this->entity->level->getBlock($b->getSide(1))->isSolid){ + if(!$b->getSide(1)->isSolid){ $oy = 1; break; } diff --git a/src/entity/ai/tasks/TaskTempt.php b/src/entity/ai/tasks/TaskTempt.php index d98f11fc..2f989359 100644 --- a/src/entity/ai/tasks/TaskTempt.php +++ b/src/entity/ai/tasks/TaskTempt.php @@ -21,7 +21,9 @@ class TaskTempt extends TaskBase $this->reset(); return; } - //TODO following + + $ai->mobController->moveTo($this->target->x, floor($ai->entity->y), $this->target->z); + $ai->mobController->lookOn($this->target); }