Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. Entity item = e.getPlayer().getWorld().dropItemNaturally(e.getPlayer().getLocation().add(0.0D, 1.3D, 0.0D), ceggItem.getItem());
  2.  
  3. if (e.getPlayer().getItemInHand().getAmount() == 1) {
  4. e.getPlayer().setItemInHand(null);
  5. } else {
  6. e.getPlayer().getItemInHand().setAmount(e.getPlayer().getItemInHand().getAmount() - 1);
  7. }
  8.  
  9. double pitch = (e.getPlayer().getLocation().getPitch() + 90.0F) * 3.141592653589793D / 180.0D;
  10. double yaw = (e.getPlayer().getLocation().getYaw() + 90.0F) * 3.141592653589793D / 180.0D;
  11.  
  12. double x = Math.sin(pitch) * Math.cos(yaw);
  13. double y = Math.sin(pitch) * Math.sin(yaw);
  14. double z = Math.cos(pitch);
  15.  
  16. Vector vector = new Vector(x, z, y);
  17.  
  18. item.setVelocity(vector);
  19.  
  20. new BukkitRunnable() {
  21. @Override
  22. public void run() {
  23. item.remove();
  24. e.getPlayer().getWorld().createExplosion(item.getLocation(), 3);
  25. }
  26. }.runTaskLater(RageFactions.p, 20L * RageFactions.p.getConfig().getInt("throwable-creepereggs.explode-after"));
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement