static bool Prefix(HatManager __instance) { try { if (!modded) { System.Console.WriteLine("Adding hats"); modded = true; var id = 0; foreach (var hatData in _hatDatas) { var hat = CreateHat(hatData, id++); __instance.AllHats.Add(hat); if (hatData.highUp) { TallIds.Add((uint)(__instance.AllHats.Count - 1)); } IdToData.Add((uint)__instance.AllHats.Count - 1, hatData); } } return(true); } catch (Exception e) { System.Console.WriteLine("During Prefix, an exception occured"); System.Console.WriteLine("------------------------------------------------"); System.Console.WriteLine(e); System.Console.WriteLine("------------------------------------------------"); throw; } }