-
-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add rewriters for Stardew Valley 1.6
- Loading branch information
1 parent
8865016
commit 8b3c1db
Showing
63 changed files
with
3,233 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
namespace StardewModdingAPI.Framework.ModLoading.Rewriters | ||
{ | ||
/// <summary>Marker class for a rewrite facade used to validate mappings. See comments on <see cref="ReplaceReferencesRewriter"/> for more info.</summary> | ||
internal interface IRewriteFacade { } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BedFurnitureFacade.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using Microsoft.Xna.Framework; | ||
using StardewModdingAPI.Framework.ModLoading.Framework; | ||
using StardewValley; | ||
using StardewValley.Objects; | ||
|
||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member: This is internal code to support rewriters and shouldn't be called directly. | ||
|
||
namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6 | ||
{ | ||
/// <summary>Maps Stardew Valley 1.5.6's <see cref="BedFurniture"/> methods to their newer form to avoid breaking older mods.</summary> | ||
/// <remarks>This is public to support SMAPI rewriting and should never be referenced directly by mods. See remarks on <see cref="ReplaceReferencesRewriter"/> for more info.</remarks> | ||
[SuppressMessage("ReSharper", "UnusedMember.Global", Justification = SuppressReasons.UsedViaRewriting)] | ||
public class BedFurnitureFacade : BedFurniture, IRewriteFacade | ||
{ | ||
/********* | ||
** Public methods | ||
*********/ | ||
public static BedFurniture Constructor(int which, Vector2 tile, int initialRotations) | ||
{ | ||
return new BedFurniture(which.ToString(), tile, initialRotations); | ||
} | ||
|
||
public static BedFurniture Constructor(int which, Vector2 tile) | ||
{ | ||
return new BedFurniture(which.ToString(), tile); | ||
} | ||
|
||
public bool CanModifyBed(GameLocation location, Farmer who) | ||
{ | ||
return this.CanModifyBed(who); | ||
} | ||
|
||
public bool IsBeingSleptIn(GameLocation location) | ||
{ | ||
return this.IsBeingSleptIn(); | ||
} | ||
|
||
|
||
/********* | ||
** Private methods | ||
*********/ | ||
private BedFurnitureFacade() | ||
{ | ||
RewriteHelper.ThrowFakeConstructorCalled(); | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BootsFacade.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using StardewModdingAPI.Framework.ModLoading.Framework; | ||
using StardewValley.Objects; | ||
|
||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member: This is internal code to support rewriters and shouldn't be called directly. | ||
|
||
namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6 | ||
{ | ||
/// <summary>Maps Stardew Valley 1.5.6's <see cref="Boots"/> methods to their newer form to avoid breaking older mods.</summary> | ||
/// <remarks>This is public to support SMAPI rewriting and should never be referenced directly by mods. See remarks on <see cref="ReplaceReferencesRewriter"/> for more info.</remarks> | ||
[SuppressMessage("ReSharper", "UnusedMember.Global", Justification = SuppressReasons.UsedViaRewriting)] | ||
public class BootsFacade : Boots, IRewriteFacade | ||
{ | ||
/********* | ||
** Public methods | ||
*********/ | ||
public static Boots Constructor(int which) | ||
{ | ||
return new Boots(which.ToString()); | ||
} | ||
|
||
|
||
/********* | ||
** Private methods | ||
*********/ | ||
private BootsFacade() | ||
{ | ||
RewriteHelper.ThrowFakeConstructorCalled(); | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BreakableContainer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using StardewModdingAPI.Framework.ModLoading.Framework; | ||
using StardewValley; | ||
using StardewValley.Objects; | ||
|
||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member: This is internal code to support rewriters and shouldn't be called directly. | ||
|
||
namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6 | ||
{ | ||
/// <summary>Maps Stardew Valley 1.5.6's <see cref="BreakableContainer"/> methods to their newer form to avoid breaking older mods.</summary> | ||
/// <remarks>This is public to support SMAPI rewriting and should never be referenced directly by mods. See remarks on <see cref="ReplaceReferencesRewriter"/> for more info.</remarks> | ||
[SuppressMessage("ReSharper", "UnusedMember.Global", Justification = SuppressReasons.UsedViaRewriting)] | ||
[SuppressMessage("ReSharper", "InconsistentNaming", Justification = SuppressReasons.MatchesOriginal)] | ||
public class BreakableContainerFacade : BreakableContainer, IRewriteFacade | ||
{ | ||
/********* | ||
** Public methods | ||
*********/ | ||
public void releaseContents(GameLocation location, Farmer who) | ||
{ | ||
this.releaseContents(who); | ||
} | ||
|
||
|
||
/********* | ||
** Private methods | ||
*********/ | ||
private BreakableContainerFacade() | ||
{ | ||
RewriteHelper.ThrowFakeConstructorCalled(); | ||
} | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BuffFacade.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using StardewModdingAPI.Framework.ModLoading.Framework; | ||
using StardewValley; | ||
using StardewValley.Buffs; | ||
|
||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member: This is internal code to support rewriters and shouldn't be called directly. | ||
|
||
namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6 | ||
{ | ||
/// <summary>Maps Stardew Valley 1.5.6's <see cref="Buff"/> methods to their newer form to avoid breaking older mods.</summary> | ||
/// <remarks>This is public to support SMAPI rewriting and should never be referenced directly by mods. See remarks on <see cref="ReplaceReferencesRewriter"/> for more info.</remarks> | ||
[SuppressMessage("ReSharper", "InconsistentNaming", Justification = SuppressReasons.MatchesOriginal)] | ||
[SuppressMessage("ReSharper", "ParameterHidesMember", Justification = SuppressReasons.MatchesOriginal)] | ||
[SuppressMessage("ReSharper", "UnusedMember.Global", Justification = SuppressReasons.UsedViaRewriting)] | ||
[SuppressMessage("ReSharper", "UnusedParameter.Local", Justification = SuppressReasons.MatchesOriginal)] | ||
public class BuffFacade : Buff, IRewriteFacade | ||
{ | ||
/********* | ||
** Public methods | ||
*********/ | ||
public static Buff Constructor(string description, int millisecondsDuration, string source, int index) | ||
{ | ||
return new Buff(index.ToString(), source, description: description, duration: millisecondsDuration, iconSheetIndex: index); | ||
} | ||
|
||
public static Buff Constructor(int which) | ||
{ | ||
return new Buff(which.ToString()); | ||
} | ||
|
||
public static Buff Constructor(int farming, int fishing, int mining, int digging, int luck, int foraging, int crafting, int maxStamina, int magneticRadius, int speed, int defense, int attack, int minutesDuration, string source, string displaySource) | ||
{ | ||
return new Buff( | ||
null, | ||
source, | ||
displaySource, | ||
duration: minutesDuration / Game1.realMilliSecondsPerGameMinute, | ||
effects: new BuffEffects { FarmingLevel = { farming }, FishingLevel = { fishing }, MiningLevel = { mining }, LuckLevel = { luck }, ForagingLevel = { foraging }, MaxStamina = { maxStamina }, MagneticRadius = { magneticRadius }, Speed = { speed }, Defense = { defense }, Attack = { attack } } | ||
); | ||
} | ||
|
||
public void addBuff() | ||
{ | ||
Game1.player.buffs.Apply(this); | ||
} | ||
|
||
public void removeBuff() | ||
{ | ||
Game1.player.buffs.Remove(this.id); | ||
} | ||
|
||
|
||
/********* | ||
** Private methods | ||
*********/ | ||
private BuffFacade() | ||
: base(null) | ||
{ | ||
RewriteHelper.ThrowFakeConstructorCalled(); | ||
} | ||
} | ||
} |
91 changes: 91 additions & 0 deletions
91
src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BuildableGameLocationFacade.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using Microsoft.Xna.Framework; | ||
using StardewModdingAPI.Framework.ModLoading.Framework; | ||
using StardewValley; | ||
using StardewValley.Buildings; | ||
|
||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member: This is internal code to support rewriters and shouldn't be called directly. | ||
|
||
namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6 | ||
{ | ||
/// <summary>Maps Stardew Valley 1.5.6's <c>BuildableGameLocation</c> methods to their newer form on <see cref="GameLocation"/> to avoid breaking older mods.</summary> | ||
/// <remarks>This is public to support SMAPI rewriting and should never be referenced directly by mods. See remarks on <see cref="ReplaceReferencesRewriter"/> for more info.</remarks> | ||
[SuppressMessage("ReSharper", "InconsistentNaming", Justification = SuppressReasons.MatchesOriginal)] | ||
[SuppressMessage("ReSharper", "ParameterHidesMember", Justification = SuppressReasons.MatchesOriginal)] | ||
[SuppressMessage("ReSharper", "UnusedMember.Global", Justification = SuppressReasons.UsedViaRewriting)] | ||
public class BuildableGameLocationFacade : GameLocation, IRewriteFacade | ||
{ | ||
/********* | ||
** Public methods | ||
*********/ | ||
public new bool buildStructure(Building b, Vector2 tileLocation, Farmer who, bool skipSafetyChecks = false) | ||
{ | ||
return base.buildStructure(b, tileLocation, who, skipSafetyChecks); | ||
} | ||
|
||
public new bool destroyStructure(Vector2 tile) | ||
{ | ||
return base.destroyStructure(tile); | ||
} | ||
|
||
public new bool destroyStructure(Building b) | ||
{ | ||
return base.destroyStructure(b); | ||
} | ||
|
||
public new Building getBuildingAt(Vector2 tile) | ||
{ | ||
return base.getBuildingAt(tile); | ||
} | ||
|
||
public new Building getBuildingByName(string name) | ||
{ | ||
return base.getBuildingByName(name); | ||
} | ||
|
||
public Building? getBuildingUnderConstruction() | ||
{ | ||
foreach (Building b in this.buildings) | ||
{ | ||
if (b.daysOfConstructionLeft > 0 || b.daysUntilUpgrade > 0) | ||
return b; | ||
} | ||
|
||
return null; | ||
} | ||
|
||
public int getNumberBuildingsConstructed(string name) | ||
{ | ||
return base.getNumberBuildingsConstructed(name); | ||
} | ||
|
||
public bool isBuildable(Vector2 tileLocation) | ||
{ | ||
return base.isBuildable(tileLocation); | ||
} | ||
|
||
public new bool isPath(Vector2 tileLocation) | ||
{ | ||
return base.isPath(tileLocation); | ||
} | ||
|
||
public new bool isBuildingConstructed(string name) | ||
{ | ||
return base.isBuildingConstructed(name); | ||
} | ||
|
||
public new bool isThereABuildingUnderConstruction() | ||
{ | ||
return base.isThereABuildingUnderConstruction(); | ||
} | ||
|
||
|
||
/********* | ||
** Private methods | ||
*********/ | ||
private BuildableGameLocationFacade() | ||
{ | ||
RewriteHelper.ThrowFakeConstructorCalled(); | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BuildingFacade.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using Netcode; | ||
using StardewModdingAPI.Framework.ModLoading.Framework; | ||
using StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6.Internal; | ||
using StardewValley.Buildings; | ||
using StardewValley.Objects; | ||
|
||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member: This is internal code to support rewriters and shouldn't be called directly. | ||
|
||
namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6 | ||
{ | ||
/// <summary>Maps Stardew Valley 1.5.6's <see cref="Building"/> methods to their newer form to avoid breaking older mods.</summary> | ||
/// <remarks>This is public to support SMAPI rewriting and should never be referenced directly by mods. See remarks on <see cref="ReplaceReferencesRewriter"/> for more info.</remarks> | ||
[SuppressMessage("ReSharper", "InconsistentNaming", Justification = SuppressReasons.MatchesOriginal)] | ||
[SuppressMessage("ReSharper", "UnusedMember.Global", Justification = SuppressReasons.UsedViaRewriting)] | ||
public class BuildingFacade : Building, IRewriteFacade | ||
{ | ||
/********* | ||
** Accessors | ||
*********/ | ||
public NetRef<Chest> input => NetRefWrapperCache<Chest>.GetCachedWrapperFor(this.GetBuildingChest("Input")); // Mill | ||
public NetRef<Chest> output => NetRefWrapperCache<Chest>.GetCachedWrapperFor(this.GetBuildingChest("Output")); // Mill | ||
|
||
|
||
/********* | ||
** Private methods | ||
*********/ | ||
private BuildingFacade() | ||
{ | ||
RewriteHelper.ThrowFakeConstructorCalled(); | ||
} | ||
} | ||
} |
Oops, something went wrong.