Advertisement
JackOUT

Untitled

Mar 1st, 2022 (edited)
1,267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.19 KB | None | 0 0
  1.         final Consumer<ArmorStand> consumer = armorStand -> {
  2.             armorStand.setVisible(true);
  3.             armorStand.setSmall(true);
  4.             armorStand.setArms(true);
  5.             CompProperty.GRAVITY.apply(armorStand, false);
  6.             armorStand.setMarker(false);
  7.             armorStand.setItemInHand(itemStack);
  8.         };
  9.  
  10.         final Player player = event.getPlayer();
  11.         final ArmorStand stand = player.getWorld().spawn(player.getLocation(), ArmorStand.class, consumer);
  12.         final Location standLocation = stand.getLocation();
  13.         final Location destination = player.getLocation().clone().add(0, 0.24, 0).add(player.getLocation().getDirection());
  14.         final Vector vector = destination.subtract(player.getLocation()).toVector().add(new Vector(0, 0.4, 0));
  15.  
  16.         new BukkitRunnable() {
  17.  
  18.             @Override
  19.             public void run() {
  20.                 final EulerAngle rotation = stand.getRightArmPose().add(20, 0, 0);
  21.  
  22.                 stand.setRightArmPose(rotation);       
  23.                 vector.add(new Vector(0, -0.08, 0));
  24.                 stand.teleport(standLocation.add(vector.normalize()));
  25.  
  26.                 final Location armTipLocation = ArmourStandUtil.getSmallArmTip(stand);
  27.                 Common.runTimer(20, () -> CompParticle.VILLAGER_HAPPY.spawn(armTipLocation));
  28.             }
  29.         }.runTaskTimer(SimplePlugin.getInstance(), 0, 10);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement