Guest User

Untitled

a guest
Jan 20th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | None | 0 0
  1.     public boolean onBlockBreak (Player player, Block block){
  2.         int b = block.getType();
  3.         int dist = 5;
  4.         if(b==52){
  5.             for (BaseEntity e : block.getWorld().getEntityList()){
  6.                 if (e.getEntity() instanceof OEntityXPOrb){
  7.                     double distance = distance(e.getX(), e.getY(), e.getZ(), block.getX(), block.getY(), block.getZ());
  8.                     if (distance <= dist){
  9.                         e.destroy();
  10.                     }
  11.                 }
  12.             }
  13.             player.getWorld().dropItem(block.getLocation(), 52);
  14.         }
  15.         return false;
  16.     }
  17.     public double distance(double x1, double y1, double z1, double x2, double y2, double z2) {
  18.         return Math.sqrt(Math.pow((x1-x2),2)+Math.pow((y1-y2),2)+Math.pow((z1-z2),2));
  19.     }
Add Comment
Please, Sign In to add comment