Changes

Jump to navigation Jump to search
Line 44: Line 44:  
<li>Unhandled errors in a patch can be hard to troubleshoot, which often leads to players asking for help on the SMAPI page instead of your mod. '''Please''' handle errors, log them, and default to the original code. For example:
 
<li>Unhandled errors in a patch can be hard to troubleshoot, which often leads to players asking for help on the SMAPI page instead of your mod. '''Please''' handle errors, log them, and default to the original code. For example:
 
<syntaxhighlight lang="C#">
 
<syntaxhighlight lang="C#">
public class ObjectPatches
+
internal class ObjectPatches
 
{
 
{
 
     private static IMonitor Monitor;
 
     private static IMonitor Monitor;
    
     // call this method from your Entry class
 
     // call this method from your Entry class
     public static void Initialize(IMonitor monitor)
+
     internal static void Initialize(IMonitor monitor)
 
     {
 
     {
 
         Monitor = monitor;
 
         Monitor = monitor;
 
     }
 
     }
   −
     public static bool CanBePlacedHere_Prefix(StardewValley.Object __instance, GameLocation location, Vector2 tile, ref bool __result)
+
     // patches need to be static!
 +
    internal static bool CanBePlacedHere_Prefix(StardewValley.Object __instance, GameLocation location, Vector2 tile, ref bool __result)
 
     {
 
     {
 
         try
 
         try
528

edits

Navigation menu