mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
small tweaks to movement during tempt
This commit is contained in:
parent
b81438ee23
commit
968f3b9dd2
2 changed files with 8 additions and 1 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue