public int getGroundHeight(int x, int z) {
        if (x >= CHUNK_SIZE || z >= CHUNK_SIZE || x < 0 || z < 0) {
            throw new IllegalArgumentException("Cannot get a ground height out of chunk bounds!");
        }
        for (int y = CHUNK_SIZE - 1; y >= 0; y--) {
            if (!blocks.getBlock(x, y, z).isTransparent()) {
                return y;
            }
        }
        return -1;
    }