public static void ValidObject(IModHelper helper, string strIndex, out int index) { if (!Context.IsWorldReady) { throw new SaveNotLoadedException(); } if (!int.TryParse(strIndex, out index)) { if (!IntegrateWithJsonAssets.TryParseObjectName(strIndex, out index)) { throw new NotImplementedException("\"" + strIndex + "\" is not a known Object"); } } else if (Paritee.StardewValley.Core.Characters.FarmAnimal.IsProduceAnItem(index) && !Object.ObjectExists(index)) { throw new NotImplementedException("\"" + strIndex + "\" is not a known Object"); } }
private void OnSaveLoaded(object sender, SaveLoadedEventArgs e) { try { IntegrateWithJsonAssets.RefreshFarmAnimalData(Helper); } catch (ApiNotFoundException ex) { Monitor.Log("Cannot refresh farm animal data: " + ex.Message); } catch (SaveNotLoadedException ex) { Monitor.Log("Cannot refresh farm animal data: " + ex.Message); } try { ConvertDirtyFarmAnimals.OnSaveLoaded(e); } catch (KeyNotFoundException ex) { HandleKeyNotFoundException(ex); } }