Hello everybody! So, I've been doing some plugin development after a while and one of the things I made is a way to animate armor stands. I thought, why not share it on here. I have no idea if there's already an api out here or something like that, but I thought my class works, so why not share it. How does this work? Everything is packed into 1 class. You create one instance for every armor stand you want to animate and in the constructor you give the path to the animation file and the armor stand to animate. The class will then load it and when you call it's update method it'll set the pose of the armor stand and teleport it to what is specified in the animation file. What are the features? - All the instances don't do anything to each other so you can specify different animations for different armor stands. - You can Play/Pause/Stop an animation - There's a linear interpolate allowing you to not have to specify all the key frames. - Whenever an animation file is parsed, it's cached so it only has to do it once. - It's not that hard to setup, all you have to do is create an instance and call the update method. How does this animation file you're talking about look like? The animation file has a simple layout. This is a simple animation. It's rather easy. YOU DO HAVE TO SPECIFY THE VALUES FOR EVERY KEY FRAME! The yaw value is something that doesn't really like to be updated that much in my testing experience! How would it look like if I would use this class? If you want to make the instance of the class then this is all you have to do: Code (Text): new ArmorStandAnimator(new File(getDataFolder(), "ani2.animc"), armorstand); As you can see it's pretty easy. You just give it a file and the bukkit armorstand class. You should notice that I don't save it to a variable. This is because whenever you create a new instance of the class it automatically adds itself to a list. Then I can later on call a special method that will update all the instances registered. So if I want to create an armor stand and animate it then all I have to do is this: Code (Text): ArmorStand as = Bukkit.getWorld("world").spawn(new Location(Bukkit.getWorld("world"), 0, 4, 0), ArmorStand.class); //spawn the armor stand as.setAI(false); //set some stuff as.setArms(true); as.setCollidable(false); as.setVisible(true); as.setRemoveWhenFarAway(false); as.setInvulnerable(true); new ArmorStandAnimator(new File(getDataFolder(), "ani2.animc"), as); //actually register the armor stand Now there's one thing. The animator class doesn't register a repeating task. It depends on YOU to update it. This is useful because with this you can specify how many updates you have. All the code that you have to perform to update ALL the armor stands is this: Code (Text): ArmorStandAnimator.updateAll(); Are there any current problems? Yes. This was made originally as a concept and it's not a full API thingy. You can very easily make it error if your animation file isn't correct. For example if you remove one of the lines that specify the rotations or body parts then it'll give you a null pointer exception. There are probably also some other things but I don't have any other problems I can think of out of my head. If you found a problem just say it. Another thing is that the yaw that you can specify can bug a lot. It won't give errors, but the animation would be the way it should be. OMG Do you have any GIFS?!?! Yes! This is a gif of an animation. The next gif was a bug, the animation file had the rotations in degrees and bukkit takes it's rotation values in radians so I forgot to convert it. It has been fixed but it looked funny. The gifs I just showed weren't interpolated. This is how it would look if I would've removed keyframes and made it interpolated. (Ignore the sudden jump in the yaw. For some reason the yaw doesn't like to work properly) Questions and Answers These are some questions I think you might have Q: Can I use this in any plugin? Yes you can. But, you can't claim it as your own and you can't remove the license part at the top. Q: What if I want to update an animation file, do I have to reload the server because of that cache? No, there's a method called clearCache() in the class that'll clear the cache. Q: Are there loads of comments added that explain what things do? Yes! There are! Q: Are those comments funny? No they aren't. Sorry. Q: What is the maximum amount of frames per second? The maximum amount of frames per second is 20. Because there are 20 ticks per second. The minimum can be whatever you want because you are the person updating it. This means that you could have a statue that changes position every so often. Q: Whenever I try to teleport the armor stand, it teleports back! Help? This is because you can change it's location in the animation file. The location in the animation file is relative from the starting location on when you initialized the armor stand animator class. You can change the starting location to teleport the armor stand with this method: Code (Text): setStartLocation(Location location) Q: Can I just take a snippet of this code and give it to people for help on how to do things or for my own work? I personally would rather have you use the whole class. But you are allowed to take a part of the code, IF you keep the copyright notice! If you use this code to help somebody by giving this code to them, I'd rather have you link them to this thread instead. There's just a lot of useful information in here and then they know that I made it. Q: What license are you using? I'm using the MIT License. Why this license? This license says that everybody can use it, public and private developers, and you just have to make sure that you keep the copyright notice Generating the animation file So the animation file can easily be made by yourself. But it will take a while. So, if you have an animation program and you know how to make scripts for that program, then you are able to create a script that exports the animation. That is actually what I did. I made a script that allows me to make an armor stand in my animation program and export it. And that's probably the reason why the first 2 gifs looked better than the last one. Because the first 2 gifs were exported with that script and didn't had the interpolation on, because all the frames were already generated by that script. Can I please see the code right now?! Sure! This is the code: http://pastebin.com/5t9YX0V0 I hope this class will be useful and if you've found any errors or anything like that, just tell me here. I would love to hear what you guys think of this.