public static void NPCAI(NPC npc)
{
if (PreAI(npc))
{
int type = npc.type;
bool useAiType = npc.modNPC != null && npc.modNPC.aiType > 0;
if (useAiType)
{
npc.type = npc.modNPC.aiType;
}
npc.VanillaAI();
if (useAiType)
{
npc.type = type;
}
AI(npc);
}
PostAI(npc);
}