However, the spawning iron golem still must not collide with any existing entities. Adjacent blocks are irrelevant, so golems can spawn partially inside adjacent solid blocks. This means the iron golem can spawn inside 1-deep water or inside blocks like slabs, fences, and carpets (if other checks pass).
The target block and 2 blocks above must not be a full block, nor be redstone-powered, nor be rails, and the two blocks above must not be water. The target location is then checked whether the block underneath has a solid top surface (which is not the same as 'solid-blocking'). A random y column is picked and then the topmost block in that column is selected that is air, water, or lava, and has a ' solid-blocking' block underneath, or block at y=+6 if none such is available in that column. When a villager tries to summon a golem, up to 10 attempts are made to spawn a golem within a 16×13×16 box centered on the villager (villager block position +7/−8 blocks along x/z axes and +6/−6 blocks along y axis).
In Java Edition, villagers can summon iron golems, either when they are gossiping or panicking.