Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean isBlockInLine(World world, int xOffset, int yOffset, int zOffset, int x, int y, int z) {
- if (xOffset != 0) {
- for (int j = (y - yDown - yOffset); j <= (y + yUp - yOffset); j++) {
- for (int k = (z - zAxisHalfed - zOffset); k <= (z + zAxisHalfed - zOffset); k++) {
- if (xOffset > 0) {
- if(isProtectedBlock(world.getBlockId(x + xAxisHalfed + xOffset, j, k))) {
- return true;
- }
- }
- else {
- if(isProtectedBlock(world.getBlockId(x - xAxisHalfed + xOffset, j, k))) {
- return true;
- }
- }
- }
- }
- }
- if (zOffset != 0) {
- for (int j = (y - yDown - yOffset); j <= (y + yUp - yOffset); j++) {
- for (int i = (x - xAxisHalfed - xOffset); i <= (x + xAxisHalfed - xOffset); i++) {
- if (zOffset > 0) {
- if(isProtectedBlock(world.getBlockId(i, j, z + zAxisHalfed + zOffset))) {
- return true;
- }
- }
- else {
- if(isProtectedBlock(world.getBlockId(i, j, z - zAxisHalfed + zOffset))) {
- return true;
- }
- }
- }
- }
- }
- if (yOffset != 0) {
- for (int i = (x - xAxisHalfed - xOffset); i <= (x + xAxisHalfed - xOffset); i++) {
- for (int k = (z - zAxisHalfed - zOffset); k <= (z + zAxisHalfed - zOffset); z++) {
- if (yOffset > 0) {
- if(isProtectedBlock(world.getBlockId(i, y + yUp + yOffset, k))) {
- return true;
- }
- }
- else {
- if(isProtectedBlock(world.getBlockId(i, y - yDown + yOffset, k))) {
- return true;
- }
- }
- }
- }
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement