If you have a mob, you want it to be unique. An easy way to make your mob unique is to add some custom
AI for it. This can either be completely custom, which can be quite difficult, or adaptations of already existing
AI. You will now see two examples of custom
AI code, which can be used in quite a few situations. This should give you an insight in how to make your own
AI as well as two useful
AIs you could use.
The following piece of AI in Listing A.17 will make a mob fly when it is hurt, which is, in this case, set to two hearts.
package com.wuppy.samsmod.ai;import net.minecraft.entity.EntityCreature;import net.minecraft.entity.ai.EntityAIBase;import ...