Modify custom entity speed after its been spawned?

Discussion in 'Spigot Plugin Development' started by Simo389, Jun 6, 2015.

  1. So I've spawned in a custom entity (a slime), and I need to modify its speed.

    Currently I use the standard approach within the g() method of:
    Code (Text):
    float speed = 0.35F;
    But I need to modify this often, what's the best way to achieve this? Can I create a method within the custom entity class that exposes this? Or can I create a listener of some sort when the entity moves/does something which I can then modify its speed within?
  2. Does speed have to be final (don't have anything to look at on mobile)?
    Otherwise you can create a speed variable for each slime object and modify as you see fit. Call the .k(speed) within the g() method before any movement occurs.