What blocks are iron golem spawn proof?
Your code worked just fine for me, so I think that make it throws that error because you have some topology error in your shape. I've just adapted your code adding a check and repair part in order to avoid error (st_is_valid and st_make_valid).
Here you can download the data and code I've used.
library(sf)
library(mapview)
# Load data
my.sf <- st_read("shape/shape.gpkg", quiet = TRUE)
# Check for errors
st_is_valid(my.sf, reason = TRUE)
# Repare if needed
my.sf <- st_make_valid(my.sf)
# Subset the data to create two independent shps
i = 2
one = my.sf[i, ]
left = my.sf[-i,]
# Create buffer
buff = st_buffer(one, 1000) # distance
# CHeck which polygons overlaps with my buffer
out.overlap = st_overlaps(buff, left)
# Subset the polygons that overlaps with the buffer
nbrs.buff <- left[st_overlaps(buff,left)[[1]],]
u <- st_union(st_geometry(nbrs.buff), st_geometry(one), by_feature = FALSE)
int.buff.one = st_difference(buff, u)
# RESULTS
mapview(my.sf)+mapview(int.buff.one, alpha=0.5, color="red",lwd=3)
Suppose that any function $g:\mathbb{R}\to\mathbb{R}$, that is $n-1$ differentiable and has (at least) $n$ distinct zeroes satisfies that $g^{(n-1)}(x)=0$ for some $x$. Now our function $f$ is $n$ times differentiable and has $n+1$ distinct zeros, we need to show that $f^{(n)}(x)=0$ for some $x$.
Consider $g(x)=f'(x)$, which is $n-1$ times differentiable. If we accept that $g$ has $n$ distinct zeroes then we will have that $g^{(n-1)}(x)=0$ for some $x$ but since $g^{(n-1)}(x)=f^{(n)}(x)$, we will be done.
To prove that $g(x)=f'(x)$ has $n$ distinct zeroes, it is simple: Since $f$ is $n$ times differentiable, in particular is differentiable, and since it has $n+1$ distinct zeroes, $x_0<x_1<\ldots<x_{n_1}<x_n$, between any two consecutive zeroes, $x_i<x_{i+1}$ apply Rolle's Theorem to conclude that $f'$ will have (at least) one zero, that is $g$ will have (at least) $n$ distinct zeroes.
The induction hypothesis is that if f is (n-1) times differentiable and f has n distinct zeros then $f^(n-1)(x)=0 for some x.
Now we show for when f is n times differentiable and f has n+1 distinct zeros. By Rolle's Theorem applied n times (between the n+1 distinct zeros of f) we have that f' has n zeros and is n-1 times differentiable. Applying the induction hypothesis completes the induction.