Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.chickenstyle.luckyblocks.utilsfolder;
- import org.bukkit.Location;
- import org.bukkit.Material;
- import org.bukkit.entity.ArmorStand;
- import org.bukkit.entity.EntityType;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.scheduler.BukkitRunnable;
- import org.bukkit.util.EulerAngle;
- import org.bukkit.util.Vector;
- public class TestAnimation extends BukkitRunnable {
- ArmorStand stand;
- Location loc;
- int ticks = 0;
- int newTicks = 0;
- boolean runOnce = false;
- @SuppressWarnings("deprecation")
- public TestAnimation(Location loc) {
- stand = (ArmorStand) loc.getWorld().spawnEntity(loc, EntityType.ARMOR_STAND);
- stand.setArms(true);
- stand.setVisible(true);
- stand.setGravity(false);
- stand.setRightArmPose(new EulerAngle(1.493 * Math.PI, -(Math.PI/4), 0));
- stand.setItemInHand(new ItemStack(Material.STONE_PICKAXE));
- this.loc = loc;
- }
- @Override
- public void run() {
- if (ticks < 100) {
- ticks++;
- double t = ((double) ticks%40) * Math.PI / 20;
- Vector v = new Vector(Math.cos(t), 0, Math.sin(t));
- v.multiply(.1);
- stand.setVelocity(v);
- float yaw = stand.getLocation().getYaw();
- yaw += 9;
- Location location = new Location(stand.getWorld(), stand.getLocation().getX(), stand.getLocation().getY(), stand.getLocation().getZ(), yaw, stand.getLocation().getPitch());
- stand.teleport(location.add(v));
- } else {
- stand.remove();
- cancel();
- return;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment