Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.25 KB | None | 0 0
  1.     public boolean isBlockInLine(World world, int xOffset, int yOffset, int zOffset, int x, int y, int z) {
  2.  
  3.         if (xOffset != 0) {
  4.  
  5.             for (int j = (y - yDown - yOffset); j <= (y + yUp - yOffset); j++) {
  6.  
  7.                 for (int k = (z - zAxisHalfed - zOffset); k <= (z + zAxisHalfed - zOffset); k++) {
  8.  
  9.                     if (xOffset > 0) {
  10.  
  11.                         if(isProtectedBlock(world.getBlockId(x + xAxisHalfed + xOffset, j, k))) {
  12.  
  13.                             return true;
  14.                         }
  15.                     }
  16.                     else {
  17.  
  18.                         if(isProtectedBlock(world.getBlockId(x - xAxisHalfed + xOffset, j, k))) {
  19.  
  20.                             return true;
  21.                         }
  22.                     }
  23.                 }
  24.             }
  25.         }
  26.  
  27.         if (zOffset != 0) {
  28.  
  29.             for (int j = (y - yDown - yOffset); j <= (y + yUp - yOffset); j++) {
  30.  
  31.                 for (int i = (x - xAxisHalfed - xOffset); i <= (x + xAxisHalfed - xOffset); i++) {
  32.  
  33.                     if (zOffset > 0) {
  34.  
  35.                         if(isProtectedBlock(world.getBlockId(i, j, z + zAxisHalfed + zOffset))) {
  36.  
  37.                             return true;
  38.                         }
  39.                     }
  40.                     else {
  41.  
  42.                         if(isProtectedBlock(world.getBlockId(i, j, z - zAxisHalfed + zOffset))) {
  43.  
  44.                             return true;
  45.                         }
  46.                     }
  47.                 }
  48.             }
  49.         }
  50.  
  51.         if (yOffset != 0) {
  52.  
  53.             for (int i = (x - xAxisHalfed - xOffset); i <= (x + xAxisHalfed - xOffset); i++) {
  54.  
  55.                 for (int k = (z - zAxisHalfed - zOffset); k <= (z + zAxisHalfed - zOffset); z++) {
  56.  
  57.                     if (yOffset > 0) {
  58.  
  59.                         if(isProtectedBlock(world.getBlockId(i, y + yUp + yOffset, k))) {
  60.  
  61.                             return true;
  62.                         }
  63.                     }
  64.                     else {
  65.  
  66.                         if(isProtectedBlock(world.getBlockId(i, y - yDown + yOffset, k))) {
  67.  
  68.                             return true;
  69.                         }
  70.                     }
  71.                 }
  72.             }
  73.         }
  74.  
  75.         return false;
  76.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement