PHP: $p;$ent;$yaw = atan2($ent->z - $p->z; $ent->x - $p->x) + 90;$p->setRotation($yaw, $p->pitch);$y = ($yaw + 90) * M_PI / 180;$pitch = $p->pitch * M_PI / 180 * -1;$x = cos($y) * cos($pitch);$y = sin($pitch);$z = sin($y) * cos($pitch);$p->setMotion(new Vector($x, $y, $z)); ent is the target entiy instance. p is the entity who follows ent.
Meanwhile, neither your title nor the OP specified the subject to follow a player... How do you expect me to know that you're not talking about rotating a Jack-O' Lantern to look at the player? And how does "see his inventory" have anything to do with this thread?