-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModEntry.cs
More file actions
46 lines (42 loc) · 1.28 KB
/
Copy pathModEntry.cs
File metadata and controls
46 lines (42 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;
using Microsoft.Xna.Framework;
using StardewModdingAPI;
using StardewModdingAPI.Events;
using StardewModdingAPI.Utilities;
using StardewValley;
using HarmonyLib;
using Microsoft.Xna.Framework.Input;
namespace Shift2Speed
{
/// <summary>The mod entry point.</summary>
internal sealed class ModEntry : Mod
{
/*********
** Public methods
*********/
/// <summary>The mod entry point, called after the mod is first loaded.</summary>
/// <paramname="helper">Provides simplified APIs for writing mods.</param>
public override void Entry(IModHelper helper)
{
var harmony = new Harmony(this.ModManifest.UniqueID);
harmony.PatchAll();
}
[HarmonyPatch(typeof(Farmer), nameof(Farmer.getMovementSpeed))]
public static class SpeedPatch
{
public static void Postfix(Farmer __instance, ref float __result)
{
KeyboardState state = Keyboard.GetState();
bool sprinting = state.IsKeyDown(Keys.LeftShift);
if (sprinting)
{
__result = 8;
}
else
{
__result = 5;
}
}
}
}
}