Better chip fall off detection

main
Astoria 2 years ago
parent 937b721555
commit de582168e6

@ -73,7 +73,40 @@ public abstract class AbstractWireTileSided extends AbstractWireTile{
@Override
public void onNeighborBlockChange(World world, int i, int j, int k, int l) {
this.dropTileIfCantStay(world, i, j, k);
if (this.dropTileIfCantStay(world, i, j, k)) {
int i1 = world.getBlockMetadata(i, j, k);
boolean flag = true;
switch(i1){
case 0:
if(world.isBlockNormalCube(i, j + 1, k))
flag = false;
break;
case 1:
if(world.isBlockNormalCube(i - 1, j, k))
flag = false;
break;
case 2:
if(world.isBlockNormalCube(i + 1, j, k))
flag = false;
break;
case 3:
if(world.isBlockNormalCube(i, j, k - 1))
flag = false;
break;
case 4:
if(world.isBlockNormalCube(i, j, k + 1))
flag = false;
break;
case 5:
if(this.canPlaceOnTop(world, i, j - 1, k))
flag = false;
break;
}
if (flag) {
this.dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k));
world.setBlockWithNotify(i, j, k, 0);
}
}
}
private boolean dropTileIfCantStay(World world, int i, int j, int k) {

Loading…
Cancel
Save