protected boolean isRailValid(World world, int x, int y, int z, int meta) {
        boolean valid = true;
        if (!world.isSideSolid(x, y - 1, z, ForgeDirection.UP))
            valid = false;
        if (meta == 2 && !world.isSideSolid(x + 1, y, z, ForgeDirection.UP))
            valid = false;
        else if (meta == 3 && !world.isSideSolid(x - 1, y, z, ForgeDirection.UP))
            valid = false;
        else if (meta == 4 && !world.isSideSolid(x, y, z - 1, ForgeDirection.UP))
            valid = false;
        else if (meta == 5 && !world.isSideSolid(x, y, z + 1, ForgeDirection.UP))
            valid = false;
        return valid;
    }