private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            IHandlerAPI api = this.Helper.ModRegistry.GetApi <IHandlerAPI>("Platonymous.CustomFarming");

            //Change all outputs to Crab Pot
            api.setOutputHandler("Platonymous.NewMachines.NewMachines.json.0", (obj, o, m, r) =>
            {
                Monitor.Log("Serving Cran Pot");
                return(new CrabPot(Vector2.Zero, 1));
            });

            //Prevent the machine from accepting regular milk
            api.setInputHandler("Platonymous.NewMachines.NewMachines.json.0", (obj, o, m) =>
            {
                return(o.ParentSheetIndex != 184);
            });

            //Post log when clicked
            api.setClickHandler("Platonymous.NewMachines.NewMachines.json.0", (obj) => Monitor.Log("Clicked " + obj.Name, LogLevel.Info));
        }
Example #2
0
        private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            IHandlerAPI api = this.Helper.ModRegistry.GetApi <IHandlerAPI>("Platonymous.CustomFarming");

            api.setOutputHandler(config.MachineID, (obj, o, m, r) =>
            {
                ++Game1.stats.GeodesCracked;
                var item = Utility.getTreasureFromGeode(obj.getOne());
                if (item.Type.Contains("Mineral"))
                {
                    Game1.player.foundMineral(item.ParentSheetIndex);
                }
                else if (item.Type.Contains("Arch") && !Game1.player.hasOrWillReceiveMail("artifactFound"))
                {
                    item = new StardewValley.Object(390, 5, false, -1, 0);
                }

                return(item);
            });
        }