Slow speed the closer to ground level(Math)

Discussion in 'Plugin Development' started by Lightspeed, Apr 14, 2016.

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

    Lightspeed

    Update method for entities(The method called every tick or so to update an entity)?
    >
    I have a class extending EntityHorse and would like to know what the update method is.
    1.8 - 1.9 Just give me ideas and I'll try to find the correct awnser.

    I need this to change a custom Entities gravity(Can I override a gravity method or do I have to override move?)

    >Awnser>
    For 1.9 it's n and I simply set motionY to -x.
    Note: Thanks for the optimization mythbusterma! :D
    <<

    New Question

    So instead of putting these threads to waste Ima change my question!

    I would like to go from 0.9 to 0.4 when I go from block 14 above land to right on the surface.

    I know a bit confusing I'll upload an image of what I mean in a bit.

    [​IMG]

    Somthing like this?

    Any nice way I can see the curve(Like shown above) of my system?

    I have so far
    Code:
    int i = world.getHighestBlockYAt(new BlockPosition(this.locX, this.locY, this.locZ)).getY();
    double floatDec = ((this.locY - i) / 100 + 0.4);
    System.out.println(floatDec);
    if (this.locY - i <= 14)
    {
        this.motY = -floatDec;
        return;
    }
    this.motY = -0.9;
    I can do math, but figuring out the solution . . . nope!

    NOTE> Img is hosted on my site so don't expect it to stay up long>

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Apr 14, 2016
Thread Status:
Not open for further replies.

Share This Page