diff --git a/Harmony/HarmonyPatcher.cs b/Harmony/HarmonyPatcher.cs index 05aa3a4..91a07ea 100644 --- a/Harmony/HarmonyPatcher.cs +++ b/Harmony/HarmonyPatcher.cs @@ -9,6 +9,7 @@ using StardewModdingAPI; using StardewValley; using StardewValley.Buildings; +using StardewValley.Locations; using StardewValley.Menus; using StardewValley.Network; @@ -29,6 +30,7 @@ internal static void Initialize(IMonitor monitor, IModHelper modHelper, string i harmonyInstance.Patch(original: AccessTools.Method(typeof(Multiplayer), nameof(StardewValley.Multiplayer.broadcastLocationDelta)), prefix: new HarmonyMethod(typeof(HarmonyPatcher), nameof(BroadcastLocationDelta_Prefix))); harmonyInstance.Patch(original: AccessTools.Method(typeof(Multiplayer), nameof(StardewValley.Multiplayer.processIncomingMessage)), postfix: new HarmonyMethod(typeof(HarmonyPatcher), nameof(ProcessIncomingMessage_Postfix))); harmonyInstance.Patch(original: AccessTools.Method(typeof(Building), nameof(Building.updateInteriorWarps)), prefix: new HarmonyMethod(typeof(HarmonyPatcher), nameof(UpdateInteriorWarps_Prefix))); + harmonyInstance.Patch(original: AccessTools.Method(typeof(Cabin), nameof(Cabin.getPorchStandingSpot)), prefix: new HarmonyMethod(typeof(HarmonyPatcher), nameof(GetPorchStandingSpot_Prefix))); harmonyInstance.Patch(original: AccessTools.Method(typeof(ChatBox), nameof(ChatBox.receiveChatMessage)), postfix: new HarmonyMethod(typeof(HarmonyPatcher), nameof(ReceiveChatMessage_Postfix))); } @@ -163,6 +165,18 @@ public static bool UpdateInteriorWarps_Prefix(Building __instance, GameLocation } } + private static bool GetPorchStandingSpot_Prefix(Cabin __instance, ref Point __result) + { + try { + __result = new Point(__instance.warps.First().TargetX, __instance.warps.First().TargetY); + return false; + } + catch (Exception e) { + _monitor.Log($"Failed in {nameof(GetPorchStandingSpot_Prefix)}:\n{e}", LogLevel.Error); + return true; + } + } + internal static void ReceiveChatMessage_Postfix(long sourceFarmer, string message) { try diff --git a/manifest.json b/manifest.json index 99c9747..50d6194 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "Name": "CabinStacker", "Author": "reyqn", - "Version": "1.1.0", + "Version": "1.1.1", "Description": "This will allow you to stack cabins in multiplayer, each player using the farmhouse as its own cabin. You can now play with an unlimited number of friends, without wasting space for your crops and other buildings.", "UniqueID": "reyqn.CabinStacker", "EntryDll": "CabinStacker.dll",