Health Points: 100
Attack Strengh: 7 - 21; To players: Easy: 4-11, Normal: 7-21, Hard: 10-31
Common drops: Iron Ingot (3-5); Poppy(0-2)
Network ID: 99
Savegame ID: VillagerGolem
Iron golems are 2.9 blocks high and 1.4 blocks wide.
Iron golems are immune to drowning and fall damage.
Iron golems can be leashed.
The Pathfinder of Iron golems avoids water.
Iron Golems can´t despawn naturally, even if the PersistenceRequired NBT-tag is set to 0.
Iron Golems have all the NBT-tags of entities and mobs. Additionally they have the following NBT-tags:
<Byte> PlayerCreated:1 or 0 (true/false) - true if this golem was created by a player. If true, the golem will never attack the player.
There are two main ways to spawn iron golems:
1. Building iron golems (Here should be a link to a golem building mechanics page at some point in time)
2. Spawning in Villages (Here should be a link to a page about Iron Golem Spawning Mechanics at some point in time)
Here´s a picture of the NBT structure of a stereotypical player-created iron golem in the overworld.
Interpretation of the Code of the Class EntityIronGolem: Edit
The class EntityIronGolem inherits from the classes EntityGolem, EntityCreature, EntityLiving, EntityLivingBase and Entity. It implements the interfaces IAnimals and ICommandSender.
The class EntityIronGolem uses the following EntityAI classes:
AttackOnCollide: speedTowardsTarget = 1; longMemory = true; classTarget = null
MoveTowardsTarget: speed = 0.9; maxTargetDistance = 32
MoveThroughVillage: movementSpeed = 0.6; isNocturnal = true
MoveTowardsRestriction: movementSpeed = 1
Wander: speed = 0.6
WatchClosest: watchedClass=player; maxDistanceForPlayer=6
HurtByTarget: entityCallsForHelp = false; field_179447_c = null
NearestAttackableTargetNonCreeper: targetClass = EntityLiving; targetChance = 10; shouldCheckSight = false; nearbyOnly = true; Predicate IMob
(Ideally all of these AIClasses should get their own page at some point in time)
The following behaviours are implemented in the iron golem class itself:
An iron golem will check every 70-120 ticks, whether a village is in a radius of 32 blocks. If there is a village in a 32 block radius, he will set the center of the closest village to be his home. If there is no village in a 32 block radius while an iron golem checks for villages, he will set his home to be nothing.
Iron Golems will target mobs, which implement the interface IMob. (This requires further study.)
Player-created Iron Golems cannot attack players.
The attack of an iron golem has a cooldown of 10 ticks.
If an iron golem successfully attacks an entity, it will increase its y-motion by 0,4000000059604645.
If the method handleHealthUpdate(byte par1) is used with the parameter 11, the iron golem will hold a rose for 400 ticks. (This requires further study)
If an iron golem dies, while being attacked by a player and while the iron golem has a home village, the popularity of the player in the village will decrease by 5.
EntityAI-Classes excluse to iron golems Edit
The following EntityAI classes are used by iron golems only, and therefore do not need their own page.
If it´s day, an iron golem has every 3 ticks a 1 in 8000 chance to look for villagers in 6x2x6 box around the iron golem. If there is a villager, he will hold a rose for 400 ticks, while looking at the villager he found.
If the iron golem I has a home village V, and village V has at least one agressor A, that is a suitable target for I, I will target A. If there is no suitable village aggressor, I will target the first player in the playerlist of V, that has -15 or less village popularity in V and is a suitable target for I. (What counts as an agressor, and what is a suitable target is implemented in the classes Village and EntityAITarget. They might get their own page at some point.)
This AI class is implemented as a static class in the EntityIronGolem class file. This AI class inherits from EntityAINearestAttackableTarget, and has only the difference, that the method boolean apply(EntityLivingBase e), returns always false, if e is a Creeper.