How do you teleport to exact X, Y, Z, Pitch and Yaw

Discussion in 'Plugin Development' started by MrGiGimz, Apr 26, 2014.

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

    MrGiGimz

    Hello. So with the Location loc = new Location (Bukkit.getWorld("world"); how do I teleport the player to exact x y z pitch and yaw. ive googled and cannot find the way to do this how i would like it down. what is the code for one to make this dream of teleporting to exact x y z pitch and yaw a reality? any help would be amazing
     
  2. Offline

    caseif

    Code:java
    1. Location loc = new Location(Bukkit.getWorld("world"), x, y, z, pitch, yaw);
     
  3. Offline

    rfsantos1996

    jd.bukkit.org/rb/doxygen/da/dac/classorg_1_1bukkit_1_1Location.html

    See its cronstructor
     
  4. Offline

    MrGiGimz

    ShadyPotato it told me i had to remove the numbers where you have pitch and yaw any suggestions?
     
  5. Offline

    tommyhoogstra

    You could do after what ShadyPotato said
    loc.setYaw
    loc.setPitch
     
  6. Offline

    Slikey

    THe pitch and yaw have to be floats. I think you wanted to pass ints.
     
  7. Offline

    Deleted user

    You can set yaw and pitch later.
    Code:java
    1. Location location = new Location(<world>, <x>, <y>, <z>);
    2. location.setYaw(<yaw>);
    3. location.setPitch(<pitch>);
     
  8. Offline

    Codex Arcanum

    Not true.
     
  9. Offline

    deathline75

    For pitch and yaw, just add a F after the values or add a cast like:
    Code:java
    1. Location loc = new Location(Bukkit.getWorld("world"), x, y, z, (float) pitch, (float) yaw);
    2.  
    3. Location loc = new Location(Bukkit.getWorld("world"), x, y, z, 0F , 0F);
    4.  
     
  10. Offline

    BillyBobJoe168

    Yaw comes before pitch I think?
     
  11. Offline

    Deleted user

Thread Status:
Not open for further replies.

Share This Page