mobs will follow player if the player has food(no pathfinder), autojump tweaks

This commit is contained in:
GameHerobrine 2023-01-22 23:23:31 +03:00
parent 1aef739065
commit 616c933d3d
2 changed files with 8 additions and 6 deletions

View file

@ -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;
}

View file

@ -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);
}