private static bool HandleNightTimeRoutine( ref Decorators.FarmAnimal moddedAnimal, ref Location moddedLocation) { if (Game.GetTimeOfDay() < 1700 || !moddedLocation.IsOutdoors() || moddedAnimal.HasController() || Random.NextDouble() >= 0.002) { return(false); } if (moddedLocation.AnyFarmers()) { moddedLocation.RemoveAnimal(moddedAnimal.GetOriginal()); moddedAnimal.ReturnHome(); return(true); } if (Paritee.StardewValley.Core.Characters.FarmAnimal.UnderMaxPathFindingPerTick()) { Paritee.StardewValley.Core.Characters.FarmAnimal.IncreasePathFindingThisTick(); moddedAnimal.SetFindHomeDoorPathController(moddedLocation.GetOriginal()); } return(false); }