mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-22 04:29:43 +00:00
real head yaw fixed
This commit is contained in:
parent
9d6322f587
commit
88cec22404
4 changed files with 41 additions and 10 deletions
|
|
@ -480,7 +480,7 @@ class PlayerAPI{
|
|||
}
|
||||
$this->server->query("DELETE FROM players WHERE name = '" . $player->username . "';");
|
||||
$this->server->api->entity->remove($player->eid);
|
||||
unset($player->level->players[$this->CID]);
|
||||
unset($player->level->players[$player->CID]);
|
||||
if($player->entity instanceof Entity){
|
||||
unset($player->entity->player);
|
||||
//unset($player->entity);
|
||||
|
|
|
|||
|
|
@ -135,6 +135,8 @@ abstract class Living extends Entity implements Pathfindable{
|
|||
|
||||
//Yaw rotation in 1.5 is handled in a bit different place but hopefully this will work too
|
||||
$this->ai->mobController->updateHeadYaw();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function moveEntityWithHeading($strafe, $forward){
|
||||
|
|
@ -153,15 +155,17 @@ abstract class Living extends Entity implements Pathfindable{
|
|||
$var8 = 0.16277136 / ($friction*$friction*$friction);
|
||||
|
||||
if($this->onGround){
|
||||
//all mobs have ai enabled in nc for now
|
||||
$var5 = $this->getAIMoveSpeed();
|
||||
//TODO if AIEnabled
|
||||
{
|
||||
//{
|
||||
//TODO $var5 = getAIMoveSpeed
|
||||
}
|
||||
//}
|
||||
//else
|
||||
{
|
||||
$var5 = $this->landMovementFactor;
|
||||
}
|
||||
$var5 *= $var8;
|
||||
//{
|
||||
// $var5 = $this->landMovementFactor;
|
||||
//}
|
||||
//$var5 *= $var8;
|
||||
}else{
|
||||
$var5 = $this->jumpMovementFactor;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ class MobController
|
|||
public $moveToX, $moveToY, $moveToZ;
|
||||
public $speed;
|
||||
public $updateMove = false;
|
||||
public $isLooking = false;
|
||||
|
||||
|
||||
public function __construct($e){
|
||||
$this->entity = $e;
|
||||
|
|
@ -123,12 +125,34 @@ class MobController
|
|||
}
|
||||
$this->entity->renderYawOffset = self::limitAngle2($this->entity->headYaw, $this->entity->renderYawOffset, $v5);
|
||||
}
|
||||
$this->entity->headYaw = $this->entity->renderYawOffset;
|
||||
}
|
||||
|
||||
public function rotateTick(){ //TODO handle more rotation
|
||||
|
||||
$this->entity->pitch = 0;
|
||||
if($this->isLooking){
|
||||
$this->isLooking = false;
|
||||
//TODO
|
||||
}else{
|
||||
$this->entity->headYaw = self::limitAngle($this->entity->headYaw, $this->entity->renderYawOffset, 10);
|
||||
}
|
||||
|
||||
/* Some stuff for pathfinder - nc doesnt have it now
|
||||
* float var11 = MathHelper.wrapAngleTo180_float(this.entity.rotationYawHead - this.entity.renderYawOffset);
|
||||
|
||||
if (!this.entity.getNavigator().noPath())
|
||||
{
|
||||
if (var11 < -75.0F)
|
||||
{
|
||||
this.entity.rotationYawHead = this.entity.renderYawOffset - 75.0F;
|
||||
}
|
||||
|
||||
if (var11 > 75.0F)
|
||||
{
|
||||
this.entity.rotationYawHead = this.entity.renderYawOffset + 75.0F;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
//$this->entity->lastHeadYaw = $this->entity->headYaw;
|
||||
//$w180 = Utils::wrapAngleTo180($this->finalHeadYaw - $this->entity->headYaw);
|
||||
|
|
|
|||
|
|
@ -69,8 +69,11 @@ class Utils{
|
|||
|
||||
public static function wrapAngleTo180($angle)
|
||||
{
|
||||
$angle = fmod($angle+180, 360);
|
||||
return $angle < 0 ? $angle + 360 : $angle - 180;
|
||||
$angle = fmod($angle, 360);
|
||||
|
||||
if($angle >= 180) $angle -= 360;
|
||||
if($angle < -180) $angle += 360;
|
||||
return $angle;
|
||||
}
|
||||
public static function getSign($v){
|
||||
return $v <=> 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue