summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Events
diff options
context:
space:
mode:
Diffstat (limited to 'src/StardewModdingAPI/Events')
-rw-r--r--src/StardewModdingAPI/Events/ChangeType.cs15
-rw-r--r--src/StardewModdingAPI/Events/ContentEvents.cs29
-rw-r--r--src/StardewModdingAPI/Events/ControlEvents.cs112
-rw-r--r--src/StardewModdingAPI/Events/EventArgsClickableMenuChanged.cs31
-rw-r--r--src/StardewModdingAPI/Events/EventArgsClickableMenuClosed.cs26
-rw-r--r--src/StardewModdingAPI/Events/EventArgsCommand.cs28
-rw-r--r--src/StardewModdingAPI/Events/EventArgsControllerButtonPressed.cs32
-rw-r--r--src/StardewModdingAPI/Events/EventArgsControllerButtonReleased.cs32
-rw-r--r--src/StardewModdingAPI/Events/EventArgsControllerTriggerPressed.cs37
-rw-r--r--src/StardewModdingAPI/Events/EventArgsControllerTriggerReleased.cs37
-rw-r--r--src/StardewModdingAPI/Events/EventArgsCurrentLocationChanged.cs31
-rw-r--r--src/StardewModdingAPI/Events/EventArgsFarmerChanged.cs33
-rw-r--r--src/StardewModdingAPI/Events/EventArgsGameLocationsChanged.cs27
-rw-r--r--src/StardewModdingAPI/Events/EventArgsInput.cs126
-rw-r--r--src/StardewModdingAPI/Events/EventArgsIntChanged.cs29
-rw-r--r--src/StardewModdingAPI/Events/EventArgsInventoryChanged.cs41
-rw-r--r--src/StardewModdingAPI/Events/EventArgsKeyPressed.cs26
-rw-r--r--src/StardewModdingAPI/Events/EventArgsKeyboardStateChanged.cs31
-rw-r--r--src/StardewModdingAPI/Events/EventArgsLevelUp.cs52
-rw-r--r--src/StardewModdingAPI/Events/EventArgsLoadedGameChanged.cs27
-rw-r--r--src/StardewModdingAPI/Events/EventArgsLocationObjectsChanged.cs28
-rw-r--r--src/StardewModdingAPI/Events/EventArgsMineLevelChanged.cs30
-rw-r--r--src/StardewModdingAPI/Events/EventArgsMouseStateChanged.cs42
-rw-r--r--src/StardewModdingAPI/Events/EventArgsNewDay.cs37
-rw-r--r--src/StardewModdingAPI/Events/EventArgsStringChanged.cs31
-rw-r--r--src/StardewModdingAPI/Events/EventArgsValueChanged.cs31
-rw-r--r--src/StardewModdingAPI/Events/GameEvents.cs216
-rw-r--r--src/StardewModdingAPI/Events/GraphicsEvents.cs116
-rw-r--r--src/StardewModdingAPI/Events/InputEvents.cs45
-rw-r--r--src/StardewModdingAPI/Events/ItemStackChange.cs20
-rw-r--r--src/StardewModdingAPI/Events/LocationEvents.cs54
-rw-r--r--src/StardewModdingAPI/Events/MenuEvents.cs40
-rw-r--r--src/StardewModdingAPI/Events/MineEvents.cs28
-rw-r--r--src/StardewModdingAPI/Events/PlayerEvents.cs115
-rw-r--r--src/StardewModdingAPI/Events/SaveEvents.cs56
-rw-r--r--src/StardewModdingAPI/Events/TimeEvents.cs163
36 files changed, 1854 insertions, 0 deletions
diff --git a/src/StardewModdingAPI/Events/ChangeType.cs b/src/StardewModdingAPI/Events/ChangeType.cs
new file mode 100644
index 00000000..4b207f08
--- /dev/null
+++ b/src/StardewModdingAPI/Events/ChangeType.cs
@@ -0,0 +1,15 @@
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Indicates how an inventory item changed.</summary>
+ public enum ChangeType
+ {
+ /// <summary>The entire stack was removed.</summary>
+ Removed,
+
+ /// <summary>The entire stack was added.</summary>
+ Added,
+
+ /// <summary>The stack size changed.</summary>
+ StackChange
+ }
+} \ No newline at end of file
diff --git a/src/StardewModdingAPI/Events/ContentEvents.cs b/src/StardewModdingAPI/Events/ContentEvents.cs
new file mode 100644
index 00000000..4b4e2ad0
--- /dev/null
+++ b/src/StardewModdingAPI/Events/ContentEvents.cs
@@ -0,0 +1,29 @@
+using System;
+using StardewModdingAPI.Framework;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Events raised when the game loads content.</summary>
+ public static class ContentEvents
+ {
+
+ /*********
+ ** Events
+ *********/
+ /// <summary>Raised after the content language changes.</summary>
+ public static event EventHandler<EventArgsValueChanged<string>> AfterLocaleChanged;
+
+
+ /*********
+ ** Internal methods
+ *********/
+ /// <summary>Raise an <see cref="AfterLocaleChanged"/> event.</summary>
+ /// <param name="monitor">Encapsulates monitoring and logging.</param>
+ /// <param name="oldLocale">The previous locale.</param>
+ /// <param name="newLocale">The current locale.</param>
+ internal static void InvokeAfterLocaleChanged(IMonitor monitor, string oldLocale, string newLocale)
+ {
+ monitor.SafelyRaiseGenericEvent($"{nameof(ContentEvents)}.{nameof(ContentEvents.AfterLocaleChanged)}", ContentEvents.AfterLocaleChanged?.GetInvocationList(), null, new EventArgsValueChanged<string>(oldLocale, newLocale));
+ }
+ }
+}
diff --git a/src/StardewModdingAPI/Events/ControlEvents.cs b/src/StardewModdingAPI/Events/ControlEvents.cs
new file mode 100644
index 00000000..80d0f547
--- /dev/null
+++ b/src/StardewModdingAPI/Events/ControlEvents.cs
@@ -0,0 +1,112 @@
+using System;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Input;
+using StardewModdingAPI.Framework;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Events raised when the player uses a controller, keyboard, or mouse.</summary>
+ public static class ControlEvents
+ {
+ /*********
+ ** Events
+ *********/
+ /// <summary>Raised when the <see cref="KeyboardState"/> changes. That happens when the player presses or releases a key.</summary>
+ public static event EventHandler<EventArgsKeyboardStateChanged> KeyboardChanged;
+
+ /// <summary>Raised when the player presses a keyboard key.</summary>
+ public static event EventHandler<EventArgsKeyPressed> KeyPressed;
+
+ /// <summary>Raised when the player releases a keyboard key.</summary>
+ public static event EventHandler<EventArgsKeyPressed> KeyReleased;
+
+ /// <summary>Raised when the <see cref="MouseState"/> changes. That happens when the player moves the mouse, scrolls the mouse wheel, or presses/releases a button.</summary>
+ public static event EventHandler<EventArgsMouseStateChanged> MouseChanged;
+
+ /// <summary>The player pressed a controller button. This event isn't raised for trigger buttons.</summary>
+ public static event EventHandler<EventArgsControllerButtonPressed> ControllerButtonPressed;
+
+ /// <summary>The player released a controller button. This event isn't raised for trigger buttons.</summary>
+ public static event EventHandler<EventArgsControllerButtonReleased> ControllerButtonReleased;
+
+ /// <summary>The player pressed a controller trigger button.</summary>
+ public static event EventHandler<EventArgsControllerTriggerPressed> ControllerTriggerPressed;
+
+ /// <summary>The player released a controller trigger button.</summary>
+ public static event EventHandler<EventArgsControllerTriggerReleased> ControllerTriggerReleased;
+
+
+ /*********
+ ** Internal methods
+ *********/
+ /// <summary>Raise a <see cref="KeyboardChanged"/> event.</summary>
+ /// <param name="monitor">Encapsulates monitoring and logging.</param>
+ /// <param name="priorState">The previous keyboard state.</param>
+ /// <param name="newState">The current keyboard state.</param>
+ internal static void InvokeKeyboardChanged(IMonitor monitor, KeyboardState priorState, KeyboardState newState)
+ {
+ monitor.SafelyRaiseGenericEvent($"{nameof(ControlEvents)}.{nameof(ControlEvents.KeyboardChanged)}", ControlEvents.KeyboardChanged?.GetInvocationList(), null, new EventArgsKeyboardStateChanged(priorState, newState));
+ }
+
+ /// <summary>Raise a <see cref="MouseChanged"/> event.</summary>
+ /// <param name="monitor">Encapsulates monitoring and logging.</param>
+ /// <param name="priorState">The previous mouse state.</param>
+ /// <param name="newState">The current mouse state.</param>
+ /// <param name="priorPosition">The previous mouse position on the screen adjusted for the zoom level.</param>
+ /// <param name="newPosition">The current mouse position on the screen adjusted for the zoom level.</param>
+ internal static void InvokeMouseChanged(IMonitor monitor, MouseState priorState, MouseState newState, Point priorPosition, Point newPosition)
+ {
+ monitor.SafelyRaiseGenericEvent($"{nameof(ControlEvents)}.{nameof(ControlEvents.MouseChanged)}", ControlEvents.MouseChanged?.GetInvocationList(), null, new EventArgsMouseStateChanged(priorState, newState, priorPosition, newPosition));
+ }
+
+ /// <summary>Raise a <see cref="KeyPressed"/> event.</summary>
+ /// <param name="monitor">Encapsulates monitoring and logging.</param>
+ /// <param name="key">The keyboard button that was pressed.</param>
+ internal static void InvokeKeyPressed(IMonitor monitor, Keys key)
+ {
+ monitor.SafelyRaiseGenericEvent($"{nameof(ControlEvents)}.{nameof(ControlEvents.KeyPressed)}", ControlEvents.KeyPressed?.GetInvocationList(), null, new EventArgsKeyPressed(key));
+ }
+
+ /// <summary>Raise a <see cref="KeyReleased"/> event.</summary>
+ /// <param name="monitor">Encapsulates monitoring and logging.</param>
+ /// <param name="key">The keyboard button that was released.</param>
+ internal static void InvokeKeyReleased(IMonitor monitor, Keys key)
+ {
+ monitor.SafelyRaiseGenericEvent($"{nameof(ControlEvents)}.{nameof(ControlEvents.KeyReleased)}", ControlEvents.KeyReleased?.GetInvocationList(), null, new EventArgsKeyPressed(key));
+ }
+
+ /// <summary>Raise a <see cref="ControllerButtonPressed"/> event.</summary>
+ /// <param name="monitor">Encapsulates monitoring and logging.</param>
+ /// <param name="button">The controller button that was pressed.</param>
+ internal static void InvokeButtonPressed(IMonitor monitor, Buttons button)
+ {
+ monitor.SafelyRaiseGenericEvent($"{nameof(ControlEvents)}.{nameof(ControlEvents.ControllerButtonPressed)}", ControlEvents.ControllerButtonPressed?.GetInvocationList(), null, new EventArgsControllerButtonPressed(PlayerIndex.One, button));
+ }
+
+ /// <summary>Raise a <see cref="ControllerButtonReleased"/> event.</summary>
+ /// <param name="monitor">Encapsulates monitoring and logging.</param>
+ /// <param name="button">The controller button that was released.</param>
+ internal static void InvokeButtonReleased(IMonitor monitor, Buttons button)
+ {
+ monitor.SafelyRaiseGenericEvent($"{nameof(ControlEvents)}.{nameof(ControlEvents.ControllerButtonReleased)}", ControlEvents.ControllerButtonReleased?.GetInvocationList(), null, new EventArgsControllerButtonReleased(PlayerIndex.One, button));
+ }
+
+ /// <summary>Raise a <see cref="ControllerTriggerPressed"/> event.</summary>
+ /// <param name="monitor">Encapsulates monitoring and logging.</param>
+ /// <param name="button">The trigger button that was pressed.</param>
+ /// <param name="value">The current trigger value.</param>
+ internal static void InvokeTriggerPressed(IMonitor monitor, Buttons button, float value)
+ {
+ monitor.SafelyRaiseGenericEvent($"{nameof(ControlEvents)}.{nameof(ControlEvents.ControllerTriggerPressed)}", ControlEvents.ControllerTriggerPressed?.GetInvocationList(), null, new EventArgsControllerTriggerPressed(PlayerIndex.One, button, value));
+ }
+
+ /// <summary>Raise a <see cref="ControllerTriggerReleased"/> event.</summary>
+ /// <param name="monitor">Encapsulates monitoring and logging.</param>
+ /// <param name="button">The trigger button that was pressed.</param>
+ /// <param name="value">The current trigger value.</param>
+ internal static void InvokeTriggerReleased(IMonitor monitor, Buttons button, float value)
+ {
+ monitor.SafelyRaiseGenericEvent($"{nameof(ControlEvents)}.{nameof(ControlEvents.ControllerTriggerReleased)}", ControlEvents.ControllerTriggerReleased?.GetInvocationList(), null, new EventArgsControllerTriggerReleased(PlayerIndex.One, button, value));
+ }
+ }
+}
diff --git a/src/StardewModdingAPI/Events/EventArgsClickableMenuChanged.cs b/src/StardewModdingAPI/Events/EventArgsClickableMenuChanged.cs
new file mode 100644
index 00000000..2a2aa163
--- /dev/null
+++ b/src/StardewModdingAPI/Events/EventArgsClickableMenuChanged.cs
@@ -0,0 +1,31 @@
+using System;
+using StardewValley.Menus;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for a <see cref="MenuEvents.MenuChanged"/> event.</summary>
+ public class EventArgsClickableMenuChanged : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The previous menu.</summary>
+ public IClickableMenu NewMenu { get; }
+
+ /// <summary>The current menu.</summary>
+ public IClickableMenu PriorMenu { get; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="priorMenu">The previous menu.</param>
+ /// <param name="newMenu">The current menu.</param>
+ public EventArgsClickableMenuChanged(IClickableMenu priorMenu, IClickableMenu newMenu)
+ {
+ this.NewMenu = newMenu;
+ this.PriorMenu = priorMenu;
+ }
+ }
+}
diff --git a/src/StardewModdingAPI/Events/EventArgsClickableMenuClosed.cs b/src/StardewModdingAPI/Events/EventArgsClickableMenuClosed.cs
new file mode 100644
index 00000000..5e6585f0
--- /dev/null
+++ b/src/StardewModdingAPI/Events/EventArgsClickableMenuClosed.cs
@@ -0,0 +1,26 @@
+using System;
+using StardewValley.Menus;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for a <see cref="MenuEvents.MenuClosed"/> event.</summary>
+ public class EventArgsClickableMenuClosed : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The menu that was closed.</summary>
+ public IClickableMenu PriorMenu { get; }
+
+
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="priorMenu">The menu that was closed.</param>
+ public EventArgsClickableMenuClosed(IClickableMenu priorMenu)
+ {
+ this.PriorMenu = priorMenu;
+ }
+ }
+}
diff --git a/src/StardewModdingAPI/Events/EventArgsCommand.cs b/src/StardewModdingAPI/Events/EventArgsCommand.cs
new file mode 100644
index 00000000..35370139
--- /dev/null
+++ b/src/StardewModdingAPI/Events/EventArgsCommand.cs
@@ -0,0 +1,28 @@
+#if SMAPI_1_x
+using System;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for a <see cref="StardewModdingAPI.Command.CommandFired"/> event.</summary>
+ [Obsolete("Use " + nameof(IModHelper) + "." + nameof(IModHelper.ConsoleCommands))]
+ public class EventArgsCommand : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The triggered command.</summary>
+ public Command Command { get; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="command">The triggered command.</param>
+ public EventArgsCommand(Command command)
+ {
+ this.Command = command;
+ }
+ }
+}
+#endif \ No newline at end of file
diff --git a/src/StardewModdingAPI/Events/EventArgsControllerButtonPressed.cs b/src/StardewModdingAPI/Events/EventArgsControllerButtonPressed.cs
new file mode 100644
index 00000000..3243b80b
--- /dev/null
+++ b/src/StardewModdingAPI/Events/EventArgsControllerButtonPressed.cs
@@ -0,0 +1,32 @@
+using System;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Input;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for a <see cref="ControlEvents.ControllerButtonPressed"/> event.</summary>
+ public class EventArgsControllerButtonPressed : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The player who pressed the button.</summary>
+ public PlayerIndex PlayerIndex { get; }
+
+ /// <summary>The controller button that was pressed.</summary>
+ public Buttons ButtonPressed { get; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="playerIndex">The player who pressed the button.</param>
+ /// <param name="button">The controller button that was pressed.</param>
+ public EventArgsControllerButtonPressed(PlayerIndex playerIndex, Buttons button)
+ {
+ this.PlayerIndex = playerIndex;
+ this.ButtonPressed = button;
+ }
+ }
+}
diff --git a/src/StardewModdingAPI/Events/EventArgsControllerButtonReleased.cs b/src/StardewModdingAPI/Events/EventArgsControllerButtonReleased.cs
new file mode 100644
index 00000000..e05a080b
--- /dev/null
+++ b/src/StardewModdingAPI/Events/EventArgsControllerButtonReleased.cs
@@ -0,0 +1,32 @@
+using System;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Input;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for a <see cref="ControlEvents.ControllerButtonReleased"/> event.</summary>
+ public class EventArgsControllerButtonReleased : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The player who pressed the button.</summary>
+ public PlayerIndex PlayerIndex { get; }
+
+ /// <summary>The controller button that was pressed.</summary>
+ public Buttons ButtonReleased { get; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="playerIndex">The player who pressed the button.</param>
+ /// <param name="button">The controller button that was released.</param>
+ public EventArgsControllerButtonReleased(PlayerIndex playerIndex, Buttons button)
+ {
+ this.PlayerIndex = playerIndex;
+ this.ButtonReleased = button;
+ }
+ }
+}
diff --git a/src/StardewModdingAPI/Events/EventArgsControllerTriggerPressed.cs b/src/StardewModdingAPI/Events/EventArgsControllerTriggerPressed.cs
new file mode 100644
index 00000000..a2087733
--- /dev/null
+++ b/src/StardewModdingAPI/Events/EventArgsControllerTriggerPressed.cs
@@ -0,0 +1,37 @@
+using System;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Input;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for a <see cref="ControlEvents.ControllerTriggerPressed"/> event.</summary>
+ public class EventArgsControllerTriggerPressed : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The player who pressed the button.</summary>
+ public PlayerIndex PlayerIndex { get; }
+
+ /// <summary>The controller button that was pressed.</summary>
+ public Buttons ButtonPressed { get; }
+
+ /// <summary>The current trigger value.</summary>
+ public float Value { get; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="playerIndex">The player who pressed the trigger button.</param>
+ /// <param name="button">The trigger button that was pressed.</param>
+ /// <param name="value">The current trigger value.</param>
+ public EventArgsControllerTriggerPressed(PlayerIndex playerIndex, Buttons button, float value)
+ {
+ this.PlayerIndex = playerIndex;
+ this.ButtonPressed = button;
+ this.Value = value;
+ }
+ }
+}
diff --git a/src/StardewModdingAPI/Events/EventArgsControllerTriggerReleased.cs b/src/StardewModdingAPI/Events/EventArgsControllerTriggerReleased.cs
new file mode 100644
index 00000000..d2eecbec
--- /dev/null
+++ b/src/StardewModdingAPI/Events/EventArgsControllerTriggerReleased.cs
@@ -0,0 +1,37 @@
+using System;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Input;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for a <see cref="ControlEvents.ControllerTriggerReleased"/> event.</summary>
+ public class EventArgsControllerTriggerReleased : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The player who pressed the button.</summary>
+ public PlayerIndex PlayerIndex { get; }
+
+ /// <summary>The controller button that was released.</summary>
+ public Buttons ButtonReleased { get; }
+
+ /// <summary>The current trigger value.</summary>
+ public float Value { get; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="playerIndex">The player who pressed the trigger button.</param>
+ /// <param name="button">The trigger button that was released.</param>
+ /// <param name="value">The current trigger value.</param>
+ public EventArgsControllerTriggerReleased(PlayerIndex playerIndex, Buttons button, float value)
+ {
+ this.PlayerIndex = playerIndex;
+ this.ButtonReleased = button;
+ this.Value = value;
+ }
+ }
+}
diff --git a/src/StardewModdingAPI/Events/EventArgsCurrentLocationChanged.cs b/src/StardewModdingAPI/Events/EventArgsCurrentLocationChanged.cs
new file mode 100644
index 00000000..25d3ebf3
--- /dev/null
+++ b/src/StardewModdingAPI/Events/EventArgsCurrentLocationChanged.cs
@@ -0,0 +1,31 @@
+using System;
+using StardewValley;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for a <see cref="LocationEvents.CurrentLocationChanged"/> event.</summary>
+ public class EventArgsCurrentLocationChanged : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The player's current location.</summary>
+ public GameLocation NewLocation { get; }
+
+ /// <summary>The player's previous location.</summary>
+ public GameLocation PriorLocation { get; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="priorLocation">The player's previous location.</param>
+ /// <param name="newLocation">The player's current location.</param>
+ public EventArgsCurrentLocationChanged(GameLocation priorLocation, GameLocation newLocation)
+ {
+ this.NewLocation = newLocation;
+ this.PriorLocation = priorLocation;
+ }
+ }
+}
diff --git a/src/StardewModdingAPI/Events/EventArgsFarmerChanged.cs b/src/StardewModdingAPI/Events/EventArgsFarmerChanged.cs
new file mode 100644
index 00000000..4c359939
--- /dev/null
+++ b/src/StardewModdingAPI/Events/EventArgsFarmerChanged.cs
@@ -0,0 +1,33 @@
+#if SMAPI_1_x
+using System;
+using SFarmer = StardewValley.Farmer;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for a <see cref="PlayerEvents.FarmerChanged"/> event.</summary>
+ public class EventArgsFarmerChanged : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The previous player character.</summary>
+ public SFarmer NewFarmer { get; }
+
+ /// <summary>The new player character.</summary>
+ public SFarmer PriorFarmer { get; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="priorFarmer">The previous player character.</param>
+ /// <param name="newFarmer">The new player character.</param>
+ public EventArgsFarmerChanged(SFarmer priorFarmer, SFarmer newFarmer)
+ {
+ this.PriorFarmer = priorFarmer;
+ this.NewFarmer = newFarmer;
+ }
+ }
+}
+#endif \ No newline at end of file
diff --git a/src/StardewModdingAPI/Events/EventArgsGameLocationsChanged.cs b/src/StardewModdingAPI/Events/EventArgsGameLocationsChanged.cs
new file mode 100644
index 00000000..fb8c821e
--- /dev/null
+++ b/src/StardewModdingAPI/Events/EventArgsGameLocationsChanged.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using StardewValley;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for a <see cref="LocationEvents.LocationsChanged"/> event.</summary>
+ public class EventArgsGameLocationsChanged : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The current list of game locations.</summary>
+ public List<GameLocation> NewLocations { get; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="newLocations">The current list of game locations.</param>
+ public EventArgsGameLocationsChanged(List<GameLocation> newLocations)
+ {
+ this.NewLocations = newLocations;
+ }
+ }
+}
diff --git a/src/StardewModdingAPI/Events/EventArgsInput.cs b/src/StardewModdingAPI/Events/EventArgsInput.cs
new file mode 100644
index 00000000..31368555
--- /dev/null
+++ b/src/StardewModdingAPI/Events/EventArgsInput.cs
@@ -0,0 +1,126 @@
+#if !SMAPI_1_x
+using System;
+using System.Linq;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Input;
+using StardewModdingAPI.Utilities;
+using StardewValley;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments when a button is pressed or released.</summary>
+ public class EventArgsInput : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The button on the controller, keyboard, or mouse.</summary>
+ public SButton Button { get; }
+
+ /// <summary>The current cursor position.</summary>
+ public ICursorPosition Cursor { get; set; }
+
+ /// <summary>Whether the input is considered a 'click' by the game for enabling action.</summary>
+ public bool IsClick { get; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="button">The button on the controller, keyboard, or mouse.</param>
+ /// <param name="cursor">The cursor position.</param>
+ /// <param name="isClick">Whether the input is considered a 'click' by the game for enabling action.</param>
+ public EventArgsInput(SButton button, ICursorPosition cursor, bool isClick)
+ {
+ this.Button = button;
+ this.Cursor = cursor;
+ this.IsClick = isClick;
+ }
+
+ /// <summary>Prevent the game from handling the vurrent button press. This doesn't prevent other mods from receiving the event.</summary>
+ public void SuppressButton()
+ {
+ this.SuppressButton(this.Button);
+ }
+
+ /// <summary>Prevent the game from handling a button press. This doesn't prevent other mods from receiving the event.</summary>
+ /// <param name="button">The button to suppress.</param>
+ public void SuppressButton(SButton button)
+ {
+ // keyboard
+ if (this.Button.TryGetKeyboard(out Keys key))
+ Game1.oldKBState = new KeyboardState(Game1.oldKBState.GetPressedKeys().Except(new[] { key }).ToArray());
+
+ // controller
+ else if (this.Button.TryGetController(out Buttons controllerButton))