-
-
Save Draco18s/a1a5d65fe39b8fe85cab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static boolean isBlockUnsupported(World world, int x, int y, int z) { | |
Block s; | |
int dir = 0; | |
int ox = 0; | |
int oz = 0; | |
int m; | |
boolean a, b; | |
do { | |
switch(dir) { | |
case 0: | |
ox++; | |
break; | |
case 1: | |
oz++; | |
break; | |
case 2: | |
ox--; | |
break; | |
case 3: | |
oz--; | |
break; | |
} | |
s = world.getBlock(x+ox, y, z+oz); | |
m = world.getBlockMetadata(x+ox, y, z+oz); | |
a = supportBlocks.indexOf(s) >= 0; | |
if(HardLibAPI.stoneManager.isUnstableBlock(s,m) && m != 0) { | |
a = false; | |
} | |
//a = a && !(HardLibAPI.stoneManager.isUnstableBlock(s) && m == 0); | |
s = world.getBlock(x+ox, y-1, z+oz); | |
m = world.getBlockMetadata(x+ox, y-1, z+oz); | |
b = supportBlocks.indexOf(s) >= 0; | |
if(HardLibAPI.stoneManager.isUnstableBlock(s,m) && m != 0) { | |
b = false; | |
} | |
b = b || (world.isBlockNormalCubeDefault(x+ox, y-1, z+oz, true) && world.doesBlockHaveSolidTopSurface(world, x+ox, y-1, z+oz)); | |
if(!a || (ox > maxDist || ox < -maxDist || oz > maxDist || oz < -maxDist)) { | |
ox = 0; | |
oz = 0; | |
dir++; | |
} | |
else if(a && b) { | |
break; | |
} | |
} while(dir >= 0 && dir < 4); | |
if(dir == 4) { | |
return true; | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment