internal static void OnUpdateNPC(NPC n, int id) { n.whoAmI = id; var bh = n.P_BHandler as NpcBHandler; if (bh != null && !bh.created) bh.Create(); if (bh == null || bh.PreUpdate()) { try { n.RealUpdateNPC(id); } catch (IndexOutOfRangeException ioore) { if (ioore.TargetSite.DeclaringType != typeof(EmoteBubble)) // this somehow, somewhere, sometimes crashes. throw new IndexOutOfRangeException(ioore.Message, ioore); } if (bh != null) bh.OnUpdate(); } }