chicken should look on player correctly now

This commit is contained in:
GameHerobrine 2022-12-25 00:39:19 +03:00
parent 8c12e0de26
commit a37ea6af3f
3 changed files with 3 additions and 3 deletions

View file

@ -45,7 +45,7 @@ class MobController
if($pitch){
$diff = sqrt($x * $x + $z * $z);
$calcPitch = rad2deg(atan($y / $diff));
$this->entity->pitch = $calcPitch;
$this->entity->pitch = $this->entity->type === MOB_CHICKEN ? -$calcPitch : $calcPitch;
}
$this->entity->server->query("UPDATE entities SET pitch = ".$this->entity->pitch.", yaw = ".$this->entity->yaw." WHERE EID = ".$this->entity->eid.";");

View file

@ -17,7 +17,7 @@ class TaskTempt extends TaskBase
public function onUpdate(EntityAI $ai)
{
if($this->target instanceof Entity && $this->target->distanceSquared($ai->entity) > 100 || !$ai->entity->isFood($this->target->player->getHeldItem()->getID())){
if($this->target instanceof Entity && $this->target->isPlayer() && $this->target->distanceSquared($ai->entity) > 100 || !$ai->entity->isFood($this->target->player->getHeldItem()->getID())){
$this->reset();
return;
}