summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/ModHelpers
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-07-06 22:26:09 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-07-06 22:26:09 -0400
commitd51ffe58f7b7450cd4c4a7ee3d8b4da1cf55e7e4 (patch)
treeec19cdd7567125e47cfd49c7c044fc09f09f6b2f /src/SMAPI/Framework/ModHelpers
parent8e9237bdd7ec179975c9be5e28c811b42007e707 (diff)
parentbcb9e25d8666d2c1384515063ffbf987c36b8b0e (diff)
downloadSMAPI-d51ffe58f7b7450cd4c4a7ee3d8b4da1cf55e7e4.tar.gz
SMAPI-d51ffe58f7b7450cd4c4a7ee3d8b4da1cf55e7e4.tar.bz2
SMAPI-d51ffe58f7b7450cd4c4a7ee3d8b4da1cf55e7e4.zip
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI/Framework/ModHelpers')
-rw-r--r--src/SMAPI/Framework/ModHelpers/CommandHelper.cs4
-rw-r--r--src/SMAPI/Framework/ModHelpers/ContentHelper.cs2
-rw-r--r--src/SMAPI/Framework/ModHelpers/ModHelper.cs16
3 files changed, 18 insertions, 4 deletions
diff --git a/src/SMAPI/Framework/ModHelpers/CommandHelper.cs b/src/SMAPI/Framework/ModHelpers/CommandHelper.cs
index ddbd618a..21435f62 100644
--- a/src/SMAPI/Framework/ModHelpers/CommandHelper.cs
+++ b/src/SMAPI/Framework/ModHelpers/CommandHelper.cs
@@ -1,5 +1,7 @@
using System;
+#if SMAPI_DEPRECATED
using StardewModdingAPI.Framework.Deprecations;
+#endif
namespace StardewModdingAPI.Framework.ModHelpers
{
@@ -32,6 +34,7 @@ namespace StardewModdingAPI.Framework.ModHelpers
return this;
}
+#if SMAPI_DEPRECATED
/// <inheritdoc />
[Obsolete("Use mod-provided APIs to integrate with mods instead. This method will be removed in SMAPI 4.0.0.")]
public bool Trigger(string name, string[] arguments)
@@ -45,5 +48,6 @@ namespace StardewModdingAPI.Framework.ModHelpers
return this.CommandManager.Trigger(name, arguments);
}
+#endif
}
}
diff --git a/src/SMAPI/Framework/ModHelpers/ContentHelper.cs b/src/SMAPI/Framework/ModHelpers/ContentHelper.cs
index 427adac2..9992cb52 100644
--- a/src/SMAPI/Framework/ModHelpers/ContentHelper.cs
+++ b/src/SMAPI/Framework/ModHelpers/ContentHelper.cs
@@ -1,3 +1,4 @@
+#if SMAPI_DEPRECATED
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -249,3 +250,4 @@ namespace StardewModdingAPI.Framework.ModHelpers
}
}
}
+#endif
diff --git a/src/SMAPI/Framework/ModHelpers/ModHelper.cs b/src/SMAPI/Framework/ModHelpers/ModHelper.cs
index 48973691..caa66bad 100644
--- a/src/SMAPI/Framework/ModHelpers/ModHelper.cs
+++ b/src/SMAPI/Framework/ModHelpers/ModHelper.cs
@@ -1,7 +1,9 @@
using System;
using System.IO;
using StardewModdingAPI.Events;
+#if SMAPI_DEPRECATED
using StardewModdingAPI.Framework.Deprecations;
+#endif
using StardewModdingAPI.Framework.Input;
namespace StardewModdingAPI.Framework.ModHelpers
@@ -9,12 +11,14 @@ namespace StardewModdingAPI.Framework.ModHelpers
/// <summary>Provides simplified APIs for writing mods.</summary>
internal class ModHelper : BaseHelper, IModHelper, IDisposable
{
+#if SMAPI_DEPRECATED
/*********
** Fields
*********/
/// <summary>The backing field for <see cref="Content"/>.</summary>
[Obsolete("This only exists to support legacy code and will be removed in SMAPI 4.0.0.")]
private readonly ContentHelper ContentImpl;
+#endif
/*********
@@ -26,6 +30,7 @@ namespace StardewModdingAPI.Framework.ModHelpers
/// <inheritdoc />
public IModEvents Events { get; }
+#if SMAPI_DEPRECATED
/// <inheritdoc />
[Obsolete($"Use {nameof(IGameContentHelper)} or {nameof(IModContentHelper)} instead.")]
public IContentHelper Content
@@ -42,6 +47,7 @@ namespace StardewModdingAPI.Framework.ModHelpers
return this.ContentImpl;
}
}
+#endif
/// <inheritdoc />
public IGameContentHelper GameContent { get; }
@@ -96,9 +102,9 @@ namespace StardewModdingAPI.Framework.ModHelpers
/// <exception cref="InvalidOperationException">The <paramref name="modDirectory"/> path does not exist on disk.</exception>
public ModHelper(
IModMetadata mod, string modDirectory, Func<SInputState> currentInputState, IModEvents events,
-#pragma warning disable CS0612 // deprecated code
+#if SMAPI_DEPRECATED
ContentHelper contentHelper,
-#pragma warning restore CS0612
+#endif
IGameContentHelper gameContentHelper, IModContentHelper modContentHelper, IContentPackHelper contentPackHelper, ICommandHelper commandHelper, IDataHelper dataHelper, IModRegistry modRegistry, IReflectionHelper reflectionHelper, IMultiplayerHelper multiplayer, ITranslationHelper translationHelper
)
: base(mod)
@@ -111,9 +117,9 @@ namespace StardewModdingAPI.Framework.ModHelpers
// initialize
this.DirectoryPath = modDirectory;
-#pragma warning disable CS0612 // deprecated code
+#if SMAPI_DEPRECATED
this.ContentImpl = contentHelper ?? throw new ArgumentNullException(nameof(contentHelper));
-#pragma warning restore CS0612
+#endif
this.GameContent = gameContentHelper ?? throw new ArgumentNullException(nameof(gameContentHelper));
this.ModContent = modContentHelper ?? throw new ArgumentNullException(nameof(modContentHelper));
this.ContentPacks = contentPackHelper ?? throw new ArgumentNullException(nameof(contentPackHelper));
@@ -127,12 +133,14 @@ namespace StardewModdingAPI.Framework.ModHelpers
this.Events = events;
}
+#if SMAPI_DEPRECATED
/// <summary>Get the underlying instance for <see cref="IContentHelper"/>.</summary>
[Obsolete("This only exists to support legacy code and will be removed in SMAPI 4.0.0.")]
public ContentHelper GetLegacyContentHelper()
{
return this.ContentImpl;
}
+#endif
/****
** Mod config file