public static Block findRailsVertical(Block from, BlockFace mode) {
int sy = from.getY();
int x = from.getX();
int z = from.getZ();
World world = from.getWorld();
if (mode == BlockFace.DOWN) {
for (int y = sy - 1; y > 0; --y) {
if (ISTCRAIL.get(world, x, y, z)) {
return world.getBlockAt(x, y, z);
}
}
} else if (mode == BlockFace.UP) {
int height = world.getMaxHeight();
for (int y = sy + 1; y < height; y++) {
if (ISTCRAIL.get(world, x, y, z)) {
return world.getBlockAt(x, y, z);
}
}
}
return null;
}