Moving armor stands in a circle?

Discussion in 'Spigot Plugin Development' started by Escad, Jul 16, 2018.

  1. I have a few questions about this:
    1. Is there a more efficient way to move armor stands than teleporting them? I've heard that this could get laggy quickly, especially considering I intend to use multiple armor stands.
    2. I have no clue how to begin mathing out the locations for them to move with the midpoint and the radius.

    Advice is greatly appreciated.
     
  2. I believe it may be better to simply set the armorstand's velocity. I don't know the math, but it should be possible to set velocity, wait a tick, and then readjust the velocity. However, while this would remove some of the "jerky" behavior found in teleporting, you may actually find it more efficient to make a custom NMS bat or silverfish which only moves in a circle, and have your armor stand ride it. This would avoid per-tick clocks, and allow for more complex shapes, as well as easily controlling the armor stand independently from its circling behavior.
    If you, in fact, mean to simply have the armorstand stationary and have it rotate around its own center, the easily approach would probably a custom NMS armor stand and override (at least if I remember correctly) method B_(), which is in charge of correcting the various limbs of the armor stand every tick.
     
  3. Optic_Fusion1

    Resource Staff

    the method heavily depends on which version OP is using
     
  4. ah, I apologize, I just assumed they were using 1.12.
     
  5. So you want to do something like this?

    For better performance you could
    - create a array with X number of offsets that you will use
    - spawn them with packets so they are only client side
    - every X tick(s):
    for all armor stands:
    add x z from array to center location
    send armor stand teleport packet with the location to players that see armor stand
    subtract x z from location
    if you want higher/lower radius just multiply x z with radius
     
  6. Didn't think to note that - the version is 1.8 (yes, I know, it's a requested plugin).
     
  7. Ah! I see. it appears to be entityArmorStand.t_() in 1.8.8.
    (Also you should suggest the server maker update to a newer version)
     
    • Like Like x 1