private static void HandleFindProduce(ref Decorators.FarmAnimal moddedAnimal, ref Location moddedLocation)
        {
            var moddedPlayer = new Farmer(Game.GetPlayer());

            if (!IsValidLocation(moddedLocation) || !CanFindProduce(moddedAnimal, moddedPlayer) ||
                Random.NextDouble() >= 0.0002 || !HasNoImpediments(moddedAnimal, moddedLocation))
            {
                return;
            }
            if (moddedPlayer.IsCurrentLocation(moddedLocation.GetOriginal()))
            {
                BellsAndWhistles.PlaySound("dirtyHit", 450);
                BellsAndWhistles.PlaySound("dirtyHit", 900);
                BellsAndWhistles.PlaySound("dirtyHit", 1350);
            }

            if (Game.IsCurrentLocation(moddedLocation.GetOriginal()))
            {
                moddedAnimal.AnimateFindingProduce();
            }
            else
            {
                moddedAnimal.FindProduce(moddedPlayer.GetOriginal());
            }
        }
        public static bool Prefix(
            ref StardewValley.Menus.PurchaseAnimalsMenu __instance,
            ref int x,
            ref int y,
            ref bool playSound)
        {
            var moddedMenu = new Decorators.PurchaseAnimalsMenu(__instance);

            if (!IsActionable(moddedMenu) || IsClosingMenu(moddedMenu, x, y))
            {
                return(true);
            }
            var moddedPlayer = new Farmer(Game.GetPlayer());

            return(moddedMenu.IsOnFarm()
        ? HandleOnFarm(ref moddedMenu, x, y, moddedPlayer)
        : HandleStockSelection(ref moddedMenu, x, y, moddedPlayer));
        }