void Display_MenuChanged(object sender, StardewModdingAPI.Events.MenuChangedEventArgs e) { if (e.NewMenu is CarpenterMenu menu) { Helper.Events.Input.ButtonReleased += CarpenterMenu_ButtonReleased; Composting.AddBlueprint(menu); } else if (e.OldMenu is CarpenterMenu oldmenu) { Helper.Events.Input.ButtonReleased -= CarpenterMenu_ButtonReleased; Game1.getFarm().buildings.Set(new List <Building>(Game1.getFarm().buildings).Select((Building building) => building is ShippingBin bin && Composting.IsComposter(bin) ? CompostingBin.FromShippingBin(bin) : building).ToList()); } if (e.NewMenu is ComposterMenu compMenu) { } else if (e.OldMenu is ComposterMenu oldCompMenu) { oldCompMenu.SaveCompostItems(); } }
public static void SetCompostingBins() { Game1.getFarm().buildings.Set(new List <Building>(Game1.getFarm().buildings).Select((Building building) => building is ShippingBin bin && Composting.IsComposter(bin) ? CompostingBin.FromShippingBin(bin) : building).ToList()); }
public static void OnNewDay() { //if (Game1.getFarm().buildings.ToList().Exists((Building obj) => Composting.IsComposter(obj))) // ModEntry.GetMonitor().Log("Found Composter", StardewModdingAPI.LogLevel.Alert); Game1.getFarm().buildings.Set(new List <Building>(Game1.getFarm().buildings).Select((Building building) => building is ShippingBin bin && Composting.IsComposter(bin) ? CompostingBin.FromShippingBin(bin) : building).ToList()); //if (Game1.getFarm().buildings.ToList().Exists((Building obj) => obj is CompostingBin)) // ModEntry.GetMonitor().Log("transformed composter", StardewModdingAPI.LogLevel.Alert); }