Advertisement
manderson93

Block Radius Excerpt

Jun 17th, 2016
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.68 KB | None | 0 0
  1. int radius = BlocksRadius.get(key);
  2. Location location = event.getEntity().getLocation();
  3. World world = location.getWorld();
  4. HashSet<Block> blocklist = new HashSet<Block>();
  5. for (int x = -(radius); x <= radius; x ++) {
  6.     for (int y = -(radius); y <= radius; y ++) {
  7.         for (int z = -(radius); z <= radius; z ++) {
  8.             Block b = location.getWorld().getBlockAt(x + location.getBlockX(), y + location.getBlockY(), z + location.getBlockZ());
  9.             blocklist.add(b);
  10.         }
  11.     }
  12. }
  13. for(Block b: blocklist) {
  14.     Integer[] pairs = BlockPairs.get(key);
  15.     if(b.getTypeId() == pairs[0]) {
  16.         world.getBlockAt(b.getLocation()).setTypeId(pairs[1]);
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement