Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean onBlockBreak (Player player, Block block){
- int b = block.getType();
- int dist = 5;
- if(b==52){
- for (BaseEntity e : block.getWorld().getEntityList()){
- if (e.getEntity() instanceof OEntityXPOrb){
- double distance = distance(e.getX(), e.getY(), e.getZ(), block.getX(), block.getY(), block.getZ());
- if (distance <= dist){
- e.destroy();
- }
- }
- }
- player.getWorld().dropItem(block.getLocation(), 52);
- }
- return false;
- }
- public double distance(double x1, double y1, double z1, double x2, double y2, double z2) {
- return Math.sqrt(Math.pow((x1-x2),2)+Math.pow((y1-y2),2)+Math.pow((z1-z2),2));
- }
Add Comment
Please, Sign In to add comment