Solved ArmorStand Trail

Discussion in 'Bukkit Help' started by FaTaLxGaming, Oct 11, 2017.

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


    I'm trying to create an ArmorStand trail. I've made one but it is very choppy. Here is my code so far.
                for (int i = player.getBody().getLength(); i >= 1; i--) {
                    int part = i - 1;
                    if (i == 1) {
                    } else {
                        player.getBody().getSegments().get(part).getSegment().teleport(player.getBody().getSegments().get(part - 1).getSegment().getLocation());
    Basically I have the body class which has an arraylist that has the segments. I have a function in the Segment class that returns the armorstand in getSegment(). I have it run those loops every time the player moves. It all works but it is extremely choppy and could be made much better. I'm not sure how to approach this though. I've tried using runnables but that makes it worse.

    I know this is a very bad piece of code because it references so many other classes, but hopefully you guys will understand it. I can't release too much code because I'm working on a mini-game for a server. This one really stumped me and I'm not sure how to get around it.
    Last edited: Oct 11, 2017
  2. Offline


    Try setting it's velocity towards the location you want instead of teleporting, and only teleport it if it is more than a block away from where it should be.
Thread Status:
Not open for further replies.

Share This Page