Setting the yaw and pitch of an entity with a passenger

Discussion in 'Plugin Development' started by CaptainUniverse, Sep 15, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    CaptainUniverse

    title says it all I've got this code right here. so Far it sort of does the effect you get when on PlayerMoveEvent you teleport the player to event.getFrom(). But if i do not remount the player it works. If you are still confused here is the code and if you know a way to do this properly PLEASE TELL ME :)
    Code:java
    1. @EventHandler
    2. public void onMove(PlayerMoveEvent e) {
    3. if (e.getPlayer().isInsideVehicle()) {
    4. if (e.getPlayer().getVehicle().isOnGround()) {
    5. Entity en = e.getPlayer().getVehicle();
    6. Location loc = en.getLocation();
    7. loc.setYaw(e.getPlayer().getLocation().getYaw());
    8. loc.setPitch(e.getPlayer().getLocation().getPitch());
    9. en.eject();
    10. en.teleport(loc);
    11. en.setPassenger(e.getPlayer());
    12. }
    13. }


    Bump

    hey fireblast709 can you help or chasechocolate as well (sorry about the tags im just a bit inpatient =P)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 14, 2016
  2. Offline

    Developerjohn

    CaptainUniverse Lol, I can tell you're impatient due to your postings at 7:38 PM, and 7:46 PM.
     
  3. Offline

    CaptainUniverse

    Developerjohn I know im impatient but it's because most of the time people respond in the same day. by the way do you know how to solve my problem?
     
  4. Offline

    Developerjohn

  5. Offline

    Skionz

  6. Offline

    CaptainUniverse

    No Skionz i am trying to set the yaw and pitch of an entity with a passenger (read the title)
    I am not sure how to do it. I listened for PlayerMoveEvent checked if the player had a vehicle then dismounted the player,teleported the vehicle(mob) and the player to the e.getTo() and then remounted them. it just goes all glitchy is there a better way of doing this anyone and. .. Bump
     
  7. Offline

    CaptainUniverse

  8. Offline

    Panjab

    So where exactly is the problem with changing the entities yaw/pitch..?
     
Thread Status:
Not open for further replies.

Share This Page