public void OverwriteFarmAnimal(ref Decorators.FarmAnimal moddedAnimal, string requestedType) { if (!moddedAnimal.HasName()) { return; } var typeLog = GetTypeLog(moddedAnimal.GetUniqueId()); var type = typeLog == null ? requestedType ?? moddedAnimal.GetTypeString() : typeLog.Current; moddedAnimal.UpdateFromData(type); }
public static bool Prefix(ref StardewValley.FarmAnimal __instance, ref Building home) { var moddedAnimal = new Decorators.FarmAnimal(__instance); if (!moddedAnimal.HasName()) { return(true); } moddedAnimal.SetHome(home); Mod.ReadSaveData <FarmAnimals>("farm-animals").OverwriteFarmAnimal(ref moddedAnimal, null); return(false); }