mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
2159
This commit is contained in:
parent
0f72601891
commit
2573e4f90d
14 changed files with 65 additions and 57 deletions
|
|
@ -21,10 +21,6 @@ class MobController
|
|||
$oz = ($z > 0 ? 1 : ($z < 0 ? -1 : 0));
|
||||
$this->entity->moveEntityWithOffset($ox, $oy, $oz);
|
||||
$this->faceEntity($this->entity->add($ox, $oy, $oz));
|
||||
$pk = new RotateHeadPacket(); //TODO headYaw auto update
|
||||
$pk->eid = $this->entity->eid;
|
||||
$pk->yaw = $this->entity->yaw;
|
||||
$this->entity->server->api->player->broadcastPacket($this->entity->level->players, $pk);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -46,7 +42,7 @@ class MobController
|
|||
$tan = $z == 0 ? ($x < 0 ? 180 : 0) : (90 - rad2deg(atan($x / $z))); /*arctan(infinity) = pi/2 = (90deg) - 90 = 0*/
|
||||
$thetaOffset = $z <= 0 ? 90 : 270;
|
||||
$calcYaw = $tan + $thetaOffset;
|
||||
$this->entity->yaw = $calcYaw;
|
||||
$this->entity->headYaw = $calcYaw;
|
||||
if($pitch){
|
||||
$diff = sqrt($x * $x + $z * $z);
|
||||
$calcPitch = rad2deg(atan($y / $diff));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue