diff --git a/CropHarvestBubbles/CodePatches.cs b/CropHarvestBubbles/CodePatches.cs deleted file mode 100644 index 5b2bec52..00000000 --- a/CropHarvestBubbles/CodePatches.cs +++ /dev/null @@ -1,33 +0,0 @@ -using HarmonyLib; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using StardewValley; -using System; -using Rectangle = Microsoft.Xna.Framework.Rectangle; - -namespace CropHarvestBubbles -{ - public partial class ModEntry - { - [HarmonyPatch(typeof(Crop), nameof(Crop.draw))] - public class Crop_draw_Patch - { - public static void Postfix(Crop __instance, SpriteBatch b, Vector2 tileLocation, Color toTint, float rotation) - { - if (!Config.ModEnabled || (Config.RequireKeyPress && !Config.PressKeys.IsDown()) || __instance.forageCrop.Value || __instance.dead.Value || __instance.currentPhase.Value < __instance.phaseDays.Count - 1 || (__instance.fullyGrown.Value && __instance.dayOfCurrentPhase.Value > 0) || !Game1.objectInformation.TryGetValue(__instance.indexOfHarvest.Value, out var value) || (Config.IgnoreFlowers && value.Contains("/Basic -80/"))) - return; - - float base_sort = (float)((tileLocation.Y + 1) * 64) / 10000f + tileLocation.X / 50000f; - float yOffset = 4f * (float)Math.Round(Math.Sin(Game1.currentGameTime.TotalGameTime.TotalMilliseconds / 250.0), 2); - float movePercent = (100 - Config.SizePercent) / 100f; - b.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2(tileLocation.X * 64 - 8 + movePercent * 40, tileLocation.Y * 64 - 96 - 16 + yOffset + movePercent * 96)), new Rectangle?(new Rectangle(141, 465, 20, 24)), Color.White * (Config.OpacityPercent / 100f), 0f, Vector2.Zero, 4f * (Config.SizePercent / 100f), SpriteEffects.None, base_sort + 1E-06f); - - b.Draw(Game1.objectSpriteSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2(tileLocation.X * 64 + 32, tileLocation.Y * 64 - 64 - 8 + yOffset + movePercent * 56)), new Rectangle?(Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, __instance.indexOfHarvest.Value, 16, 16)), Color.White * (Config.OpacityPercent / 100f), 0f, new Vector2(8f, 8f), 4f * (Config.SizePercent / 100f), SpriteEffects.None, base_sort + 1E-05f); - if (__instance.programColored.Value) - { - b.Draw(Game1.objectSpriteSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(tileLocation.X * 64 + 32), (float)(tileLocation.Y * 64 - 64 - 8) + yOffset)), new Rectangle?(Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, __instance.indexOfHarvest.Value + 1, 16, 16)), __instance.tintColor.Value * (Config.OpacityPercent / 100f), 0f, new Vector2(8f, 8f), 4f * (Config.SizePercent / 100f), SpriteEffects.None, base_sort + 1.1E-05f); - } - } - } - } -} \ No newline at end of file diff --git a/CropHarvestBubbles/CropHarvestBubbles.csproj b/CropHarvestBubbles/CropHarvestBubbles.csproj index 1871d01c..a277a5ea 100644 --- a/CropHarvestBubbles/CropHarvestBubbles.csproj +++ b/CropHarvestBubbles/CropHarvestBubbles.csproj @@ -1,7 +1,7 @@  1.0.0 - net5.0 + net6.0 true AnyCPU;x64 diff --git a/CropHarvestBubbles/Methods.cs b/CropHarvestBubbles/Methods.cs deleted file mode 100644 index f93196db..00000000 --- a/CropHarvestBubbles/Methods.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace CropHarvestBubbles -{ - public partial class ModEntry - { - } -} \ No newline at end of file diff --git a/CropHarvestBubbles/ModEntry.cs b/CropHarvestBubbles/ModEntry.cs index 30a03cec..9a860710 100644 --- a/CropHarvestBubbles/ModEntry.cs +++ b/CropHarvestBubbles/ModEntry.cs @@ -1,17 +1,20 @@ using HarmonyLib; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using StardewValley; +using System; +using Rectangle = Microsoft.Xna.Framework.Rectangle; using StardewModdingAPI; namespace CropHarvestBubbles { /// The mod entry point. - public partial class ModEntry : Mod + public class ModEntry : Mod { - - public static IMonitor SMonitor; - public static IModHelper SHelper; - public static ModConfig Config; - - public static ModEntry context; + internal static IMonitor SMonitor; + internal static IModHelper SHelper; + internal static ModConfig Config; + internal static Harmony harmony; /// The mod entry point, called after the mod is first loaded. /// Provides simplified APIs for writing mods. @@ -19,22 +22,23 @@ public override void Entry(IModHelper helper) { Config = Helper.ReadConfig(); - context = this; - SMonitor = Monitor; SHelper = helper; - + harmony = new Harmony(ModManifest.UniqueID); Helper.Events.GameLoop.GameLaunched += GameLoop_GameLaunched; - var harmony = new Harmony(ModManifest.UniqueID); - harmony.PatchAll(); + harmony.Patch( + original: AccessTools.Method(typeof(Crop), nameof(Crop.draw)), + postfix: new HarmonyMethod(typeof(ModEntry), nameof(Postfix_draw)) + ); + harmony.Patch( + original: AccessTools.Method(typeof(Crop), nameof(Crop.drawWithOffset)), + postfix: new HarmonyMethod(typeof(ModEntry), nameof(Postfix_drawWithOffset)) + ); } - - private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { - // get Generic Mod Config Menu's API (if it's installed) var configMenu = Helper.ModRegistry.GetApi("spacechase0.GenericModConfigMenu"); if (configMenu is null) @@ -91,7 +95,43 @@ private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameL min: 1, max: 100 ); + } + public static void Postfix_draw(Crop __instance, SpriteBatch b, Vector2 tileLocation) + { + drawLogic(__instance, b, tileLocation); + } + public static void Postfix_drawWithOffset(Crop __instance, SpriteBatch b, Vector2 tileLocation, Vector2 offset) + { + drawLogic(__instance, b, tileLocation, (int)offset.X); + } + public static void drawLogic(Crop __instance, SpriteBatch b, Vector2 tileLocation, int offset = 0) + { + var item = ItemRegistry.GetDataOrErrorItem(__instance.indexOfHarvest.Value); + if (!Config.ModEnabled || (Config.RequireKeyPress && !Config.PressKeys.IsDown()) || __instance.forageCrop.Value || __instance.dead.Value || __instance.currentPhase.Value < __instance.phaseDays.Count - 1 || (__instance.fullyGrown.Value && __instance.dayOfCurrentPhase.Value > 0) || !Game1.objectData.ContainsKey(__instance.indexOfHarvest.Value) || (Config.IgnoreFlowers && item.Category == StardewValley.Object.flowersCategory)) + return; + + float base_sort = (float)((tileLocation.Y + 1) * 64) / 10000f + tileLocation.X / 50000f; + float yOffset = 4f * (float)Math.Round(Math.Sin(Game1.currentGameTime.TotalGameTime.TotalMilliseconds / 250.0), 2); + float movePercent = (100 - Config.SizePercent) / 100f; + + b.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2(tileLocation.X * 64 - 8 + movePercent * 40, tileLocation.Y * 64 - 96 - 16 - offset + yOffset + movePercent * 96)), new Rectangle?(new Rectangle(141, 465, 20, 24)), Color.White * (Config.OpacityPercent / 100f), 0f, Vector2.Zero, 4f * (Config.SizePercent / 100f), SpriteEffects.None, base_sort + 1E-06f); + + b.Draw( + item.GetTexture(), + Game1.GlobalToLocal(Game1.viewport, new Vector2(tileLocation.X * 64 + 32, tileLocation.Y * 64 - 64 - offset - 8 + yOffset + movePercent * 56)), + item.GetSourceRect(), + Color.White * (Config.OpacityPercent / 100f), 0f, new Vector2(8f, 8f), 4f * (Config.SizePercent / 100f), SpriteEffects.None, base_sort + 1E-05f + ); + if (__instance.programColored.Value) + { + b.Draw( + item.GetTexture(), + Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(tileLocation.X * 64 + 32), (float)(tileLocation.Y * 64 - 64 - 8 - offset) + yOffset)), + item.GetSourceRect(), + __instance.tintColor.Value * (Config.OpacityPercent / 100f), 0f, new Vector2(8f, 8f), 4f * (Config.SizePercent / 100f), SpriteEffects.None, base_sort + 1.1E-05f + ); + } } } } \ No newline at end of file diff --git a/CropHarvestBubbles/manifest.json b/CropHarvestBubbles/manifest.json index dd9ae204..00d4b5a0 100644 --- a/CropHarvestBubbles/manifest.json +++ b/CropHarvestBubbles/manifest.json @@ -1,22 +1,10 @@ { "Name": "Crop Harvest Bubbles", "Author": "aedenthorn", - "Version": "0.3.0", - "Description": "Crop Harvest Bubbles.", + "Version": "0.3.1-unofficial.1-logophile", + "Description": "Adds hovering bubble indicators when crops are ready to harvest.", "UniqueID": "aedenthorn.CropHarvestBubbles", "EntryDll": "CropHarvestBubbles.dll", - "MinimumApiVersion": "3.15.0", - "ModUpdater": { - "Repository": "StardewValleyMods", - "User": "aedenthorn", - "Directory": "_releases", - "ModFolder": "CropHarvestBubbles" - }, - "Dependencies": [ - { - "UniqueID": "Platonymous.ModUpdater", - "IsRequired": false - } - ], - "UpdateKeys": [ "Nexus:17761" ] + "MinimumApiVersion": "4.0.0-alpha", + "UpdateKeys": [ "" ] } \ No newline at end of file diff --git a/CropVariation/CropVariation.csproj b/CropVariation/CropVariation.csproj index ac0b2130..a998ac43 100644 --- a/CropVariation/CropVariation.csproj +++ b/CropVariation/CropVariation.csproj @@ -1,7 +1,7 @@  1.0.0 - net5.0 + net6.0 true AnyCPU;x64 diff --git a/CropVariation/Methods.cs b/CropVariation/Methods.cs index e263317f..ba18a563 100644 --- a/CropVariation/Methods.cs +++ b/CropVariation/Methods.cs @@ -38,7 +38,7 @@ private static void GetRandomColorVars(HoeDirt hoeDirt) } private static int ChangeQuality(Crop crop, HoeDirt hoeDirt, int quality) { - if (!Config.EnableMod || crop.indexOfHarvest.Value == 771 || crop.indexOfHarvest.Value == 889) + if (!Config.EnableMod || crop.indexOfHarvest.Value == "771" || crop.indexOfHarvest.Value == "889") return quality; float factor = 0; if(Config.ColorVariationQualityFactor > 0) diff --git a/CropVariation/manifest.json b/CropVariation/manifest.json index 95e70f50..75e4b3fb 100644 --- a/CropVariation/manifest.json +++ b/CropVariation/manifest.json @@ -1,22 +1,10 @@ { "Name": "Crop Variation", "Author": "aedenthorn", - "Version": "0.2.5", - "Description": "Crop Variation.", + "Version": "0.2.5.1-unofficial.1-Logophile", + "Description": "Adds visual variation to crops", "UniqueID": "aedenthorn.CropVariation", "EntryDll": "CropVariation.dll", - "MinimumApiVersion": "3.13.0", - "ModUpdater": { - "Repository": "StardewValleyMods", - "User": "aedenthorn", - "Directory": "_releases", - "ModFolder": "CropVariation" - }, - "UpdateKeys": [ "Nexus:11467" ], - "Dependencies": [ - { - "UniqueID": "Platonymous.ModUpdater", - "IsRequired": false - } - ] + "MinimumApiVersion": "4.0.0-alpha", + "UpdateKeys": [""] } \ No newline at end of file diff --git a/FishSpotBait/FishSpotBait.csproj b/FishSpotBait/FishSpotBait.csproj index c60e2e37..9ae8ead8 100644 --- a/FishSpotBait/FishSpotBait.csproj +++ b/FishSpotBait/FishSpotBait.csproj @@ -1,7 +1,7 @@  1.0.0 - net5.0 + net6.0 true AnyCPU;x64 diff --git a/FishSpotBait/manifest.json b/FishSpotBait/manifest.json index 09d9396a..48c847d6 100644 --- a/FishSpotBait/manifest.json +++ b/FishSpotBait/manifest.json @@ -1,22 +1,9 @@ { "Name": "Fish Spot Bait", "Author": "aedenthorn", - "Version": "0.1.1", - "Description": "Fish Spot Bait.", + "Version": "0.1.2-unofficial.1-logophile", + "Description": "Drop bait in the water to lure fish to that spot.", "UniqueID": "aedenthorn.FishSpotBait", "EntryDll": "FishSpotBait.dll", - "MinimumApiVersion": "3.15.0", - "ModUpdater": { - "Repository": "StardewValleyMods", - "User": "aedenthorn", - "Directory": "_releases", - "ModFolder": "FishSpotBait" - }, - "Dependencies": [ - { - "UniqueID": "Platonymous.ModUpdater", - "IsRequired": false - } - ], - "UpdateKeys": [ "Nexus:17581" ] + "MinimumApiVersion": "4.0.0-alpha" } \ No newline at end of file diff --git a/GiftRejection/GiftRejection.csproj b/GiftRejection/GiftRejection.csproj index f34d6ce8..25171773 100644 --- a/GiftRejection/GiftRejection.csproj +++ b/GiftRejection/GiftRejection.csproj @@ -1,7 +1,7 @@  1.0.0 - net5.0 + net6.0 true AnyCPU;x64 diff --git a/GiftRejection/manifest.json b/GiftRejection/manifest.json index e664bc10..d7722ff7 100644 --- a/GiftRejection/manifest.json +++ b/GiftRejection/manifest.json @@ -1,22 +1,9 @@ { "Name": "Gift Rejection", "Author": "aedenthorn", - "Version": "0.1.0", - "Description": "Gift Rejection.", + "Version": "0.1.1-unofficial.1-logophile", + "Description": "Causes NPCs to throw gifts they don't like.", "UniqueID": "aedenthorn.GiftRejection", "EntryDll": "GiftRejection.dll", - "MinimumApiVersion": "3.15.0", - "ModUpdater": { - "Repository": "StardewValleyMods", - "User": "aedenthorn", - "Directory": "_releases", - "ModFolder": "GiftRejection" - }, - "Dependencies": [ - { - "UniqueID": "Platonymous.ModUpdater", - "IsRequired": false - } - ], - "UpdateKeys": [ "Nexus:" ] + "MinimumApiVersion": "4.0.0-alpha", } \ No newline at end of file