public static List<List<BlockPos>> splitContinuousRows(List<BlockPos> rowList, int dir) {
        List<List<BlockPos>> rows = new LinkedList<>();

        LinkedList<BlockPos> row = new LinkedList<>();
        for (BlockPos next : rowList) {
            // Begin a new row
            if (row.isEmpty()) {
                row.addLast(next);
                continue;
            }
            // If next pos continues the sequence, add it to the row
            if (row.getLast().relative(Direction.values()[dir]).equals(next)) {
                row.addLast(next);

            } else { // Otherwise, there was a gap. End current row and begin a new one
                rows.add(row);
                row = new LinkedList<>();
                row.addLast(next);
            }
        }

        // Add the last row
        if (!row.isEmpty()) {
            rows.add(row);
        }

        return rows;
    }
Splits a list of positions all in one row extending towards dir into lists of contiguous
rows without any gaps.

@param rowList List of BlockPos all in one row along the axis towards dir
@param dir Direction of the row (i.e. last position is towards this dir from the first)
@return List of row lists, with head being the first position, and tail being some
        amount of offsets of head towards dir
core/src/main/java/mrtjp/projectred/lib/VecLib.java