Using event.setZ but keep exact same position relative to current block

Discussion in 'Plugin Development' started by amunro, Jan 10, 2013.

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


    So I have an unusual problem. I want to stop the player falling no matter what their velocity is. I already tried setting their velocity, but I cannot get it to work from certain heights.

    Anyway, I am trying to set the Z value of the player but it causes the player position on the current block to reset (the player gets moved in x/y slightly) to the edge of the block. This makes the effect look very glitchy.

    Here is the relevant code:

    Location top = event.getTo().clone();
    private double ceil(double num) {
        return Math.ceil(num) + 0.1D;
    Like I said, this solution solves my falling problem but causes another one. It resets the x,y to where the edge of the block is, making the player teleport.

    Is there any way to access a location relative to the current block?

    Haha nevermind, I was using setZ when I should have been using setY.

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


    you are setting the Z instead of the Y? (for starters)
    [edit] nvm you found that yourself
    amunro likes this.
Thread Status:
Not open for further replies.

Share This Page