small tweaks to movement during tempt

This commit is contained in:
GameHerobrine 2024-03-20 04:17:45 +03:00
parent b81438ee23
commit 968f3b9dd2
2 changed files with 8 additions and 1 deletions

View file

@ -30,6 +30,7 @@ class MobController
public $deltaLookYaw, $deltaLookPitch;
public $isLooking = false;
public $headYawIsYaw = false;
public function __construct($e){
$this->entity = $e;
@ -55,6 +56,7 @@ class MobController
$this->speedMultiplier = $speed;
$this->updateMove = true;
}
public function setMovingOffset($x, $y, $z, $speed){
$this->moveToX = $this->entity->x + ($x);
$this->moveToY = $this->entity->y + ($y);
@ -166,6 +168,9 @@ class MobController
$this->entity->headYaw = self::limitAngle($this->entity->headYaw, $this->entity->renderYawOffset, 10);
}
if($this->headYawIsYaw) $this->entity->yaw = $this->entity->headYaw;
$this->headYawIsYaw = false;
/* Some stuff for pathfinder - nc doesnt have it now
* float var11 = MathHelper.wrapAngleTo180_float(this.entity.rotationYawHead - this.entity.renderYawOffset);

View file

@ -31,8 +31,10 @@ class TaskTempt extends TaskBase
$zdiff = ($target->z - $ai->entity->z);
$dist = $xdiff*$xdiff + $ydiff*$ydiff + $zdiff*$zdiff;
$ai->mobController->setLookPosition($target->x, $target->y + $target->getEyeHeight(), $target->z, 30, $ai->entity->getVerticalFaceSpeed());
if($dist >= 6.25){ //TODO update yaw even if dist is less
if($dist >= 6.25){
$ai->mobController->setMovingTarget($target->x, $target->y, $target->z, $this->speedMultiplier);
}else{
$ai->mobController->headYawIsYaw = true;
}