private static void HandleHatchling( ref Decorators.AnimalHouse moddedAnimalHouse, string name, Farmer moddedPlayer) { if (moddedAnimalHouse.IsFull()) { return; } var withEggReadyToHatch = moddedAnimalHouse.GetIncubatorWithEggReadyToHatch(); if (withEggReadyToHatch == null) { return; } string type; type = new Incubator(withEggReadyToHatch) .GetRandomType(FarmAnimals.GroupTypesByCategory() .ToDictionary (kvp => kvp.Key, kvp => moddedPlayer.SanitizeBlueChickens(kvp.Value))); var building = moddedAnimalHouse.GetBuilding(); var farmAnimal = new Decorators.FarmAnimal(moddedPlayer.CreateFarmAnimal(type, name, building)); farmAnimal.AddToBuilding(building); moddedAnimalHouse.ResetIncubator(withEggReadyToHatch); farmAnimal.SetCurrentProduce(-1); }
public static void Postfix(ref StardewValley.AnimalHouse __instance) { var animalHouse = new Decorators.AnimalHouse(__instance); if (animalHouse.IsFull() || animalHouse.GetIncubatorWithEggReadyToHatch() == null) { return; } animalHouse.SetIncubatorHatchEvent(); }