Development Assistance Yaw of a minecart alway is 0

Discussion in 'Plugin Help/Development/Requests' started by rossistboss, May 13, 2015.

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

    rossistboss

    I am writing a plugin that needs to know the direction a Minecart is facing and use it to modify some blocks around the cart. The problem is, cart.getLocation() always returns a Location with a getYaw() value of 0. I have tried this while being a cart facing 0, 90, 180, and 270. It always returns 0. I have verified that the vehicle is not null. Is there a reason for this? If this is some sort of limitation of the Bukkit API, is there an alternate way to do this?

    The code I am using to get the yaw of the cart:
    Code:
    Code:
    double yaw = player.getVehicle().getLocation().getYaw();
    
     
  2. Offline

    FerusGrim

    Have you attempted to?:

    Code:
    player.getVehicle().getLocation().setYaw(yaw);
    Just for the prosperity of checking whether or not the Entity properly handles Yaw values?
     
  3. Offline

    rossistboss

    According to this nothing will happen if I try to set the yaw of a minecart because the physics that run every tick set the yaw of the cart to what its direction should be based on which direction the tracks it is on are facing.

    <merged by eyamaz>

    Ok, I think that I might have an explanation for my issues. I ran a few experiments with what the yaw of the cart is when it is on tracks facing various directions. When a cart is on rails that are straight, facing any direction as long as they are not corner tracks, the yaw will always be zero. It is zero for tracks facing both positive z/negative z and positive x/negative x. Which is weird, logically, shouldn't one of them be 180? The game probably has a reason for this, but it is unknown to me.

    Now here is the weird part. When the cart is on a corner track, the yaw is the expected value. It is either -45, -125, 45, or 135, depending on which of the 4 corner track directions the cart is on.

    I have no idea how the game gets by without using 180 for one direction of straight tracks.

    Try writing a test plugin that logs the yaw of the vehicle the player is in when a command is run. Test it while you are in a cart on all the different orientations that rails can have. What results do you get?

    Minecraft server version: 1.8.3
    Bukkit server version: git-Bukkit-0a645a2
    Bukkit API version: 1.8.3-R0.1-SNAPSHOT
     
    Last edited: May 14, 2015
  4. Offline

    timtower Administrator Administrator Moderator

    Moved to Bukkit alternatives
     
  5. Offline

    rossistboss

    Bump because I still need help with this
     
  6. Offline

    rossistboss

  7. Offline

    rossistboss

    Still open
     
  8. Offline

    rossistboss

  9. Offline

    rossistboss

  10. Offline

    sciolizer

    Works for me. :(

    [​IMG]
    What actions in game are you doing to test your code? As you can see, I tested by having a minecart go around in circles endlessly.
     
Thread Status:
Not open for further replies.

Share This Page