Pitch and Yaw not working

Discussion in 'Plugin Development' started by PumpMelon, Dec 2, 2016.

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

    PumpMelon

    Hey Bukkit Community,
    I've tried for a long time, usually it works without a hitch but for some reason the pitch and yaw are not taking effect.
    http://hastebin.com/rowadosige.java

    I just spawn facing completely downwards or looking at the sky, or just in a random spot.

    Thanks,
    Melon
     
  2. Offline

    SirGregg

    @PumpMelon Are you sure that the pitch and yaw variables are set in dataC? Also, when you create a new Location(world, x, y, z, yaw, pitch), you don't need to use setYaw() and setPitch on the location name. If you cannot get the yaw/pitch to set in the new Location(), set the yaw and pitch of the PLAYER after teleportation has occured.
     
  3. Offline

    Tecno_Wizard

    @PumpMelon, 8-space tabs... ballsy move there.

    A location is strictly a location. It doesn't store any information about pitch or yaw, so you'll have to set that after the teleport, just as @SirGregg said.

    Secondly, there are some things you can do to improve on your code. Feel free to ignore them.
    1. Lists, lists, lists. Everyone at Bukkit is so obsessed with lists, but did you know that a HashSet is more appropriate here? It won't allow duplicates in the collection. Lists are better when you need elements in order.
    2. Why on earth are you using a while loop? All you need is a conditional.
    3. That list has absolutely no reason to be static. It's incredibly bad practice.
     
  4. Offline

    SirGregg

    @Tecno_Wizard There is a built in Location that takes yaw and pitch arguments, but it doesn't seem to be working for them.
    @PumpMelon Mind posting what ever data is inside the dataC file for further troubleshooting?
     
  5. Offline

    PumpMelon

    @SirGregg
    Well this is odd, the yaw and pitch work fine now. But whenever I move I get the "Exiting teleportation" message. Even though I remove them from timer right after they move.

    @Tecno_Wizard
    Your suggestions have been noted, changed to a HashSet.
     
  6. Offline

    SirGregg

    @PumpMelon You didn't change the runnable code?
     
  7. Offline

    Tecno_Wizard

    @PumpMelon, this is where debug mode becomes useful. Have you ever used the Java debugger?
     
Thread Status:
Not open for further replies.

Share This Page