Extended Entity Speed

Discussion in 'Plugin Development' started by Someone_Like_You, Jun 9, 2014.

Thread Status:
Not open for further replies.
  1. Hey, Im trying to set the enitity speed (when a player riding it) using floats, my problem is that I would like to add exactly 20% to the entity speed (20% of his current speed), any ideas how would I do such thing? I cant just do speed = entityspeed * 0.2 + entityspeed because it will boost a lot more than those 20%,,,
     
  2. Offline

    RingOfStorms

    I'm not sure I get why you can't do currentSpeed*.2F + currentSpeed = newSpeed. That would be exactly 20% more. What do you mean by a lot more than those 20%?
     
  3. Offline

    mine-care

    This has been around for awhile once you can set walking or flying speed only on player, the walkthru I found, was check if it is a living entity, cast it to livingmentity, apply speed potion...
     
  4. Offline

    bigteddy98

    just do entityspeed * 1,2 that should work fine?
     
    Someone_Like_You likes this.
  5. mine-care its extended entity, I can simply set its attribute,

    bigteddy98 it is, its adding 20% more to the entity speed, I made little speedo-meter thing that tells me how fast Im going, when the speed is 0.2 the thingy shows im going in around 200 bpm (blocks per minute), when im adding that 20%, im going in like 300 bpm...
     
  6. bump, anyone? adding 20% of the current number boosting the entity with more then 20%,
     
  7. Offline

    Garris0n

    I don't believe it's linear.

    Have you tried, say, adding less than 20%?...
     
    Someone_Like_You likes this.
  8. Garris0n yea, I added, it did boost it about ~20% (you have to play with the number bit), but I will need to add diffrent numbers too (and combined ones too, so like 20% of the current speed + 50% of the current speed), so I cant simply just add that 20%... any ideas? :(
     
  9. Offline

    Garris0n

    Try to figure out how it scales, I guess.
     
  10. Garris0n the problem is that I might add a lot of percentages to that speed and I will need it to be exact what I added,(so if Il add 20% and then add 5%, Il need it to be exact 25% more than the normal speed), I might add 25% after that 10% then 9% maybe 86% after...
     
  11. Offline

    RingOfStorms

    Edit: I realized that you aren't actually looking at player movement, this post may not be as useful as I thought for you. But ill keep it here since it is still good info on the player speed.

    Ok because I realized i might need to know this info for some future stuff I thought I would dig into some client code and figure out what is going on.

    I haven't fully figured out the scale or every factor that effects speed as the method is still very obfuscated and hard to read. Maybe someone else can have a bit of a better go at it until I find time to dive deeper into it. I have however, narrowed it down to two methods which are the updateTask() function in the EntityAIControlledByPlayer class as well as the moveEntityWIthHeading in the EntityLivingBase. You'll see the updateTask does a lot with speed and has then at the very end it calls the moveWithHeading which does even more with things like block slipierness,

    One thing to note is that the method getAIMoveSpeed() returns the speed that is sent by the server via the packet player abilities. So anytime you see the getAIMoveSpeed called that is the value that you've set in your plugin.

    updateTask()

    moveEntityWithHeading()
     
    Someone_Like_You likes this.
  12. RingOfStorms thank you, its not for my question, but you did wrote a lot and show examples :)
     
Thread Status:
Not open for further replies.

Share This Page