Iron golems are large, strong robot-like monsters, which resemble the villagers. Their purpose is to defend the villagers from any hostile mob, this includes the player if the player attacks any of the villagers.
Killing an iron golem won’t give you any experience, despite it being one of the hardest mobs to defeat, this is because iron golems can be crafted. Iron golems will drop 3-5 iron ingots and 0-2 roses though, but due to their high health, strong attack and the rarity of villages, farming iron golems isn’t very effective without boosting and automating their spawn rate.
Occurence and behavior
Iron golems can spawn naturally in villages, though there have to be at least 16 villagers and 21 houses (doors). Iron golems can also be created, like snow golems, by placing 4 blocks of iron in a T-shape and finishing with a pumpkin on top of that. The pumpkin has to be placed last or it won’t work. Jack-o-lanters work as well, though their appearance will be the same. Pistons cannot be used to create iron golems, as pumpkins cannot be pushed by them.
Once a golem has spawned, it will slowly wobble around the village or the area it was created in, untill a hostile mob or player threatens them or the villagers. Once they have a target they will quickly move towards it and attack it by swinging their arms into the air, throwing their opponent into the air, which can cause extra fall damage. Cacti, lava, fire and poison will harm them and they will make no effort to avoid them. They don’t take fall damage and are unable to drown, though they do avoid water.
An iron golem will only attack hostile mobs if they’re within its range (5 blocks), except during raids, in which the golem will attack any hostile mob. There doesn’t have to be line of sight to trigger it to attack you or a mob.
Iron golems will never attack creepers, wolves, ghasts, slimes or magma cubes. These mobs can become hostile towards them however, when they’re caught in its large attack radius.
Iron golems that have been created by the player will not attack the player, though a server restart could cause the golem to become hostile towards the player if it’s provoked.
Iron golems can hold roses, which is a reference to the robots in the animated movie: ‘Laputa: Castle in the Sky’. These roses can be given to the villagers and villager children will often stop running around when passing a golem with a rose and cautiously take the flower from it.