From 61f013ae681c5eca72f67d267768f760c0acb5b2 Mon Sep 17 00:00:00 2001 From: mushymato Date: Thu, 1 Jan 2026 01:09:39 -0500 Subject: [PATCH] chore: fix AvoidNetField and obsolete warnings --- .../Framework/Interfaces/IMoreGiantCropsApi.cs | 2 +- .../Framework/Patches/Entities/PetPatch.cs | 10 ++++------ .../Framework/Patches/SpecialObjects/ChestPatch.cs | 8 ++++---- .../Framework/Patches/SpecialObjects/CrabPotPatch.cs | 4 ++-- .../Framework/Patches/SpecialObjects/IndoorPotPatch.cs | 4 ++-- .../Framework/Patches/SpecialObjects/TorchPatch.cs | 2 +- .../Patches/SpecialObjects/WoodChipperPatch.cs | 8 ++++---- .../Patches/StandardObjects/FruitTreePatch.cs | 2 +- .../Patches/StandardObjects/FurniturePatch.cs | 8 ++++---- .../Framework/Patches/StandardObjects/ObjectPatch.cs | 8 ++++---- AlternativeTextures/Framework/UI/CatalogueMenu.cs | 4 ++-- AlternativeTextures/Framework/UI/PaintBucketMenu.cs | 6 +++--- 12 files changed, 32 insertions(+), 34 deletions(-) diff --git a/AlternativeTextures/Framework/Interfaces/IMoreGiantCropsApi.cs b/AlternativeTextures/Framework/Interfaces/IMoreGiantCropsApi.cs index 2018c41a..3f6da9f5 100644 --- a/AlternativeTextures/Framework/Interfaces/IMoreGiantCropsApi.cs +++ b/AlternativeTextures/Framework/Interfaces/IMoreGiantCropsApi.cs @@ -4,6 +4,6 @@ namespace AlternativeTextures.Framework.Interfaces { public interface IMoreGiantCropsApi { - Texture2D? GetTexture(int productIndex); + Texture2D GetTexture(int productIndex); } } diff --git a/AlternativeTextures/Framework/Patches/Entities/PetPatch.cs b/AlternativeTextures/Framework/Patches/Entities/PetPatch.cs index aa03f2b2..09d152c5 100644 --- a/AlternativeTextures/Framework/Patches/Entities/PetPatch.cs +++ b/AlternativeTextures/Framework/Patches/Entities/PetPatch.cs @@ -24,8 +24,7 @@ internal void Apply(Harmony harmony) harmony.Patch(AccessTools.Method(_entity, nameof(Pet.draw), new[] { typeof(SpriteBatch) }), prefix: new HarmonyMethod(GetType(), nameof(DrawPrefix))); harmony.Patch(AccessTools.Method(_entity, nameof(Pet.update), new[] { typeof(GameTime), typeof(GameLocation) }), postfix: new HarmonyMethod(GetType(), nameof(UpdatePostfix))); - harmony.Patch(AccessTools.Constructor(typeof(Cat), new[] { typeof(int), typeof(int), typeof(string), typeof(string) }), postfix: new HarmonyMethod(GetType(), nameof(PetPostfix))); - harmony.Patch(AccessTools.Constructor(typeof(Dog), new[] { typeof(int), typeof(int), typeof(string), typeof(string) }), postfix: new HarmonyMethod(GetType(), nameof(PetPostfix))); + harmony.Patch(AccessTools.Constructor(typeof(Pet), new[] { typeof(int), typeof(int), typeof(string), typeof(string) }), postfix: new HarmonyMethod(GetType(), nameof(PetPostfix))); } private static void ReloadBreedSpritePostfix(Pet __instance) @@ -77,10 +76,9 @@ private static bool DrawPrefix(Pet __instance, int ___shakeTimer, SpriteBatch b) b.Draw(__instance.Sprite.Texture, __instance.getLocalPosition(Game1.viewport) + new Vector2(__instance.Sprite.SpriteWidth * 4 / 2, __instance.GetBoundingBox().Height / 2) + ((___shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero), __instance.Sprite.SourceRect, Color.White, __instance.rotation, new Vector2(__instance.Sprite.SpriteWidth / 2, (float)__instance.Sprite.SpriteHeight * 3f / 4f), Math.Max(0.2f, __instance.Scale) * 4f, (__instance.flip || (__instance.Sprite.CurrentAnimation != null && __instance.Sprite.CurrentAnimation[__instance.Sprite.currentAnimationIndex].flip)) ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, __instance.isSleepingOnFarmerBed.Value ? (((float)__instance.StandingPixel.Y + 112f) / 10000f) : ((float)__instance.StandingPixel.Y / 10000f))); if (__instance.IsEmoting) { - Vector2 emotePosition = __instance.getLocalPosition(Game1.viewport); - emotePosition.X += 32f; - emotePosition.Y -= 96 + ((__instance is Dog) ? 16 : 0); - b.Draw(Game1.emoteSpriteSheet, emotePosition, new Rectangle(__instance.CurrentEmoteIndex * 16 % Game1.emoteSpriteSheet.Width, __instance.CurrentEmoteIndex * 16 / Game1.emoteSpriteSheet.Width * 16, 16, 16), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)__instance.StandingPixel.Y / 10000f + 0.0001f); + Vector2 localPosition = __instance.getLocalPosition(Game1.viewport); + Point point = __instance.GetPetData()?.EmoteOffset ?? Point.Zero; + b.Draw(Game1.emoteSpriteSheet, new Vector2(localPosition.X + 32f + (float)point.X, localPosition.Y - 96f + (float)point.Y), new Rectangle(__instance.CurrentEmoteIndex * 16 % Game1.emoteSpriteSheet.Width, __instance.CurrentEmoteIndex * 16 / Game1.emoteSpriteSheet.Width * 16, 16, 16), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)__instance.StandingPixel.Y / 10000f + 0.0001f); } } diff --git a/AlternativeTextures/Framework/Patches/SpecialObjects/ChestPatch.cs b/AlternativeTextures/Framework/Patches/SpecialObjects/ChestPatch.cs index 38c6e82a..e8dc8beb 100644 --- a/AlternativeTextures/Framework/Patches/SpecialObjects/ChestPatch.cs +++ b/AlternativeTextures/Framework/Patches/SpecialObjects/ChestPatch.cs @@ -96,14 +96,14 @@ private static bool DrawPrefix(Chest __instance, int ___currentLidFrame, int ___ if (__instance.playerChest.Value && (__instance.ParentSheetIndex == 130 || __instance.ParentSheetIndex == 232)) { - spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, new Vector2(draw_x * 64f + (float)((__instance.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0), (draw_y - 1f) * 64f)), new Rectangle(0, textureOffset, 16, 32), __instance.tint.Value * alpha, 0f, Vector2.Zero, 4f, SpriteEffects.None, base_sort_order); - spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, new Vector2(draw_x * 64f + (float)((__instance.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0), (draw_y - 1f) * 64f)), new Rectangle(((___currentLidFrame - __instance.ParentSheetIndex) * textureModel.TextureWidth) + xTileOffset, textureOffset, 16, 32), __instance.tint.Value * alpha * alpha, 0f, Vector2.Zero, 4f, SpriteEffects.None, base_sort_order + 1E-05f); + spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, new Vector2(draw_x * 64f + (float)((__instance.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0), (draw_y - 1f) * 64f)), new Rectangle(0, textureOffset, 16, 32), __instance.Tint * alpha, 0f, Vector2.Zero, 4f, SpriteEffects.None, base_sort_order); + spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, new Vector2(draw_x * 64f + (float)((__instance.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0), (draw_y - 1f) * 64f)), new Rectangle(((___currentLidFrame - __instance.ParentSheetIndex) * textureModel.TextureWidth) + xTileOffset, textureOffset, 16, 32), __instance.Tint * alpha * alpha, 0f, Vector2.Zero, 4f, SpriteEffects.None, base_sort_order + 1E-05f); return false; } if (__instance.playerChest.Value) { - spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, new Vector2(draw_x * 64f + (float)((__instance.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0), (draw_y - 1f) * 64f)), new Rectangle(0, textureOffset, 16, 32), __instance.tint.Value * alpha, 0f, Vector2.Zero, 4f, SpriteEffects.None, base_sort_order); - spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, new Vector2(draw_x * 64f + (float)((__instance.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0), (draw_y - 1f) * 64f)), new Rectangle(((___currentLidFrame - __instance.ParentSheetIndex) * textureModel.TextureWidth) + xTileOffset, textureOffset, 16, 32), __instance.tint.Value * alpha * alpha, 0f, Vector2.Zero, 4f, SpriteEffects.None, base_sort_order + 1E-05f); + spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, new Vector2(draw_x * 64f + (float)((__instance.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0), (draw_y - 1f) * 64f)), new Rectangle(0, textureOffset, 16, 32), __instance.Tint * alpha, 0f, Vector2.Zero, 4f, SpriteEffects.None, base_sort_order); + spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, new Vector2(draw_x * 64f + (float)((__instance.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0), (draw_y - 1f) * 64f)), new Rectangle(((___currentLidFrame - __instance.ParentSheetIndex) * textureModel.TextureWidth) + xTileOffset, textureOffset, 16, 32), __instance.Tint * alpha * alpha, 0f, Vector2.Zero, 4f, SpriteEffects.None, base_sort_order + 1E-05f); return false; } if (__instance.giftbox.Value) diff --git a/AlternativeTextures/Framework/Patches/SpecialObjects/CrabPotPatch.cs b/AlternativeTextures/Framework/Patches/SpecialObjects/CrabPotPatch.cs index 1892c9a5..956ffe39 100644 --- a/AlternativeTextures/Framework/Patches/SpecialObjects/CrabPotPatch.cs +++ b/AlternativeTextures/Framework/Patches/SpecialObjects/CrabPotPatch.cs @@ -100,8 +100,8 @@ private static bool DrawPrefix(CrabPot __instance, float ___yBob, Vector2 ___sha if (__instance.readyForHarvest.Value && __instance.heldObject.Value != null) { float yOffset = 4f * (float)Math.Round(Math.Sin(Game1.currentGameTime.TotalGameTime.TotalMilliseconds / 250.0), 2); - spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, __instance.directionOffset.Value + new Vector2(x * 64 - 8, (float)(y * 64 - 96 - 16) + yOffset)), new Rectangle(141, 465, 20, 24), Color.White * 0.75f, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)((y + 1) * 64) / 10000f + 1E-06f + __instance.tileLocation.X / 10000f); - spriteBatch.Draw(Game1.objectSpriteSheet, Game1.GlobalToLocal(Game1.viewport, __instance.directionOffset.Value + new Vector2(x * 64 + 32, (float)(y * 64 - 64 - 8) + yOffset)), Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, __instance.heldObject.Value.ParentSheetIndex, 16, 16), Color.White * 0.75f, 0f, new Vector2(8f, 8f), 4f, SpriteEffects.None, (float)((y + 1) * 64) / 10000f + 1E-05f + __instance.tileLocation.X / 10000f); + spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, __instance.directionOffset.Value + new Vector2(x * 64 - 8, (float)(y * 64 - 96 - 16) + yOffset)), new Rectangle(141, 465, 20, 24), Color.White * 0.75f, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)((y + 1) * 64) / 10000f + 1E-06f + __instance.TileLocation.X / 10000f); + spriteBatch.Draw(Game1.objectSpriteSheet, Game1.GlobalToLocal(Game1.viewport, __instance.directionOffset.Value + new Vector2(x * 64 + 32, (float)(y * 64 - 64 - 8) + yOffset)), Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, __instance.heldObject.Value.ParentSheetIndex, 16, 16), Color.White * 0.75f, 0f, new Vector2(8f, 8f), 4f, SpriteEffects.None, (float)((y + 1) * 64) / 10000f + 1E-05f + __instance.TileLocation.X / 10000f); } return false; diff --git a/AlternativeTextures/Framework/Patches/SpecialObjects/IndoorPotPatch.cs b/AlternativeTextures/Framework/Patches/SpecialObjects/IndoorPotPatch.cs index b61e8b3b..eb480362 100644 --- a/AlternativeTextures/Framework/Patches/SpecialObjects/IndoorPotPatch.cs +++ b/AlternativeTextures/Framework/Patches/SpecialObjects/IndoorPotPatch.cs @@ -51,7 +51,7 @@ private static bool DrawPrefix(IndoorPot __instance, SpriteBatch spriteBatch, in Rectangle fertilizer_rect = __instance.hoeDirt.Value.GetFertilizerSourceRect(); fertilizer_rect.Width = 13; fertilizer_rect.Height = 13; - spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2(__instance.tileLocation.X * 64f + 4f, __instance.tileLocation.Y * 64f - 12f)), fertilizer_rect, Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (__instance.tileLocation.Y + 0.65f) * 64f / 10000f + (float)x * 1E-05f); + spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2(__instance.TileLocation.X * 64f + 4f, __instance.TileLocation.Y * 64f - 12f)), fertilizer_rect, Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (__instance.TileLocation.Y + 0.65f) * 64f / 10000f + (float)x * 1E-05f); } if (__instance.hoeDirt.Value.crop != null) { @@ -59,7 +59,7 @@ private static bool DrawPrefix(IndoorPot __instance, SpriteBatch spriteBatch, in } if (__instance.heldObject.Value != null) { - __instance.heldObject.Value.draw(spriteBatch, x * 64, y * 64 - 48, (__instance.tileLocation.Y + 0.66f) * 64f / 10000f + (float)x * 1E-05f, 1f); + __instance.heldObject.Value.draw(spriteBatch, x * 64, y * 64 - 48, (__instance.TileLocation.Y + 0.66f) * 64f / 10000f + (float)x * 1E-05f, 1f); } if (__instance.bush.Value != null) { diff --git a/AlternativeTextures/Framework/Patches/SpecialObjects/TorchPatch.cs b/AlternativeTextures/Framework/Patches/SpecialObjects/TorchPatch.cs index c464b375..1b8ddbb9 100644 --- a/AlternativeTextures/Framework/Patches/SpecialObjects/TorchPatch.cs +++ b/AlternativeTextures/Framework/Patches/SpecialObjects/TorchPatch.cs @@ -74,7 +74,7 @@ private static bool DrawPrefix(Torch __instance, Vector2[] ___ashes, SpriteBatch ObjectPatch.DrawPrefix(__instance, spriteBatch, x, y, alpha); float draw_layer = Math.Max(0f, (float)((y + 1) * 64 - 24) / 10000f) + (float)x * 1E-05f; - if (!__instance.isOn.Value) + if (!__instance.IsOn) { return false; } diff --git a/AlternativeTextures/Framework/Patches/SpecialObjects/WoodChipperPatch.cs b/AlternativeTextures/Framework/Patches/SpecialObjects/WoodChipperPatch.cs index 313e1759..ca12774a 100644 --- a/AlternativeTextures/Framework/Patches/SpecialObjects/WoodChipperPatch.cs +++ b/AlternativeTextures/Framework/Patches/SpecialObjects/WoodChipperPatch.cs @@ -67,7 +67,7 @@ private static bool DrawPrefix(Phone __instance, NetRef ___depositedItem draw_position.X += Game1.random.Next(-1, 2) * 2; draw_position.Y += Game1.random.Next(-1, 2) * 2; float draw_scale = Utility.Lerp(1f, 0.75f, completion); - spriteBatch.Draw(Game1.objectSpriteSheet, draw_position, GameLocation.getSourceRectForObject(___depositedItem.Value.ParentSheetIndex), Color.White * alpha, 0f, new Vector2(8f, 8f), 4f * draw_scale, ___depositedItem.Value.flipped.Value ? SpriteEffects.FlipHorizontally : SpriteEffects.None, draw_layer + 0.00175f); + spriteBatch.Draw(Game1.objectSpriteSheet, draw_position, GameLocation.getSourceRectForObject(___depositedItem.Value.ParentSheetIndex), Color.White * alpha, 0f, new Vector2(8f, 8f), 4f * draw_scale, ___depositedItem.Value.Flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, draw_layer + 0.00175f); } if (___depositedItem.Value != null && __instance.MinutesUntilReady > 0) { @@ -80,13 +80,13 @@ private static bool DrawPrefix(Phone __instance, NetRef ___depositedItem return false; } float yOffset = 4f * (float)Math.Round(Math.Sin(Game1.currentGameTime.TotalGameTime.TotalMilliseconds / 250.0), 2); - spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64 - 8, (float)(y * 64 - 96 - 16) + yOffset)), new Rectangle(141, 465, 20, 24), Color.White * 0.75f, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)((y + 1) * 64) / 10000f + 1E-06f + __instance.tileLocation.X / 10000f + ((__instance.ParentSheetIndex == 105) ? 0.0015f : 0f)); + spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64 - 8, (float)(y * 64 - 96 - 16) + yOffset)), new Rectangle(141, 465, 20, 24), Color.White * 0.75f, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)((y + 1) * 64) / 10000f + 1E-06f + __instance.TileLocation.X / 10000f + ((__instance.ParentSheetIndex == 105) ? 0.0015f : 0f)); if (__instance.heldObject.Value != null) { - spriteBatch.Draw(Game1.objectSpriteSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64 + 32, (float)(y * 64 - 64 - 8) + yOffset)), Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, __instance.heldObject.Value.ParentSheetIndex, 16, 16), Color.White * 0.75f, 0f, new Vector2(8f, 8f), 4f, SpriteEffects.None, (float)((y + 1) * 64) / 10000f + 1E-05f + __instance.tileLocation.X / 10000f + ((__instance.ParentSheetIndex == 105) ? 0.0015f : 0f)); + spriteBatch.Draw(Game1.objectSpriteSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64 + 32, (float)(y * 64 - 64 - 8) + yOffset)), Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, __instance.heldObject.Value.ParentSheetIndex, 16, 16), Color.White * 0.75f, 0f, new Vector2(8f, 8f), 4f, SpriteEffects.None, (float)((y + 1) * 64) / 10000f + 1E-05f + __instance.TileLocation.X / 10000f + ((__instance.ParentSheetIndex == 105) ? 0.0015f : 0f)); if (__instance.heldObject.Value is ColoredObject) { - spriteBatch.Draw(Game1.objectSpriteSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64 + 32, (float)(y * 64 - 64 - 8) + yOffset)), Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, __instance.heldObject.Value.ParentSheetIndex + 1, 16, 16), (__instance.heldObject.Value as ColoredObject).color.Value * 0.75f, 0f, new Vector2(8f, 8f), 4f, SpriteEffects.None, (float)((y + 1) * 64) / 10000f + 1E-05f + __instance.tileLocation.X / 10000f + ((__instance.ParentSheetIndex == 105) ? 0.0015f : 1E-05f)); + spriteBatch.Draw(Game1.objectSpriteSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64 + 32, (float)(y * 64 - 64 - 8) + yOffset)), Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, __instance.heldObject.Value.ParentSheetIndex + 1, 16, 16), (__instance.heldObject.Value as ColoredObject).color.Value * 0.75f, 0f, new Vector2(8f, 8f), 4f, SpriteEffects.None, (float)((y + 1) * 64) / 10000f + 1E-05f + __instance.TileLocation.X / 10000f + ((__instance.ParentSheetIndex == 105) ? 0.0015f : 1E-05f)); } } return false; diff --git a/AlternativeTextures/Framework/Patches/StandardObjects/FruitTreePatch.cs b/AlternativeTextures/Framework/Patches/StandardObjects/FruitTreePatch.cs index cbe16ab2..7d078aea 100644 --- a/AlternativeTextures/Framework/Patches/StandardObjects/FruitTreePatch.cs +++ b/AlternativeTextures/Framework/Patches/StandardObjects/FruitTreePatch.cs @@ -65,7 +65,7 @@ private static bool DrawPrefix(FruitTree __instance, float ___shakeRotation, flo Vector2 tileLocation = __instance.Tile; string season = Game1.GetSeasonForLocation(__instance.Location).ToString(); - if (__instance.greenHouseTileTree.Value) + if (__instance.GreenHouseTileTree) { spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2(tileLocation.X * 64f, tileLocation.Y * 64f)), new Rectangle(669, 1957, 16, 16), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 1E-08f); } diff --git a/AlternativeTextures/Framework/Patches/StandardObjects/FurniturePatch.cs b/AlternativeTextures/Framework/Patches/StandardObjects/FurniturePatch.cs index bb0b5cf7..e64b303f 100644 --- a/AlternativeTextures/Framework/Patches/StandardObjects/FurniturePatch.cs +++ b/AlternativeTextures/Framework/Patches/StandardObjects/FurniturePatch.cs @@ -156,12 +156,12 @@ internal static bool DrawPrefix(Furniture __instance, NetInt ___sourceIndexOffse } else { - spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, ___drawPosition.Value + ((__instance.shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero)), sourceRect, Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.Flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (__instance.furniture_type.Value == 12) ? (2E-09f + __instance.tileLocation.Y / 100000f) : ((float)(__instance.boundingBox.Value.Bottom - ((__instance.furniture_type.Value == 6 || __instance.furniture_type.Value == 17 || __instance.furniture_type.Value == 13) ? 48 : 8)) / 10000f)); + spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, ___drawPosition.Value + ((__instance.shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero)), sourceRect, Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.Flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (__instance.furniture_type.Value == 12) ? (2E-09f + __instance.TileLocation.Y / 100000f) : ((float)(__instance.boundingBox.Value.Bottom - ((__instance.furniture_type.Value == 6 || __instance.furniture_type.Value == 17 || __instance.furniture_type.Value == 13) ? 48 : 8)) / 10000f)); } } else { - spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64 + ((__instance.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0), y * 64 - (__instance.sourceRect.Height * 4 - __instance.boundingBox.Height) + ((__instance.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0))), __instance.sourceRect.Value, Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.Flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (__instance.furniture_type.Value == 12) ? (2E-09f + __instance.tileLocation.Y / 100000f) : ((float)(__instance.boundingBox.Value.Bottom - ((__instance.furniture_type.Value == 6 || __instance.furniture_type.Value == 17 || __instance.furniture_type.Value == 13) ? 48 : 8)) / 10000f)); + spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64 + ((__instance.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0), y * 64 - (__instance.sourceRect.Height * 4 - __instance.boundingBox.Height) + ((__instance.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0))), __instance.sourceRect.Value, Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.Flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (__instance.furniture_type.Value == 12) ? (2E-09f + __instance.TileLocation.Y / 100000f) : ((float)(__instance.boundingBox.Value.Bottom - ((__instance.furniture_type.Value == 6 || __instance.furniture_type.Value == 17 || __instance.furniture_type.Value == 13) ? 48 : 8)) / 10000f)); } if (__instance.heldObject.Value != null) { @@ -183,12 +183,12 @@ internal static bool DrawPrefix(Furniture __instance, NetInt ___sourceIndexOffse } } } - if (__instance.isOn.Value && __instance.furniture_type.Value == 14) + if (__instance.IsOn && __instance.furniture_type.Value == 14) { spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2(__instance.boundingBox.Center.X - 12, __instance.boundingBox.Center.Y - 64)), new Rectangle(276 + (int)((Game1.currentGameTime.TotalGameTime.TotalMilliseconds + (double)(x * 3047) + (double)(y * 88)) % 400.0 / 100.0) * 12, 1985, 12, 11), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)(__instance.GetBoundingBoxAt(x, y).Bottom - 2) / 10000f); spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2(__instance.boundingBox.Center.X - 32 - 4, __instance.boundingBox.Center.Y - 64)), new Rectangle(276 + (int)((Game1.currentGameTime.TotalGameTime.TotalMilliseconds + (double)(x * 2047) + (double)(y * 98)) % 400.0 / 100.0) * 12, 1985, 12, 11), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)(__instance.GetBoundingBoxAt(x, y).Bottom - 1) / 10000f); } - else if (__instance.isOn.Value && __instance.furniture_type.Value == 16) + else if (__instance.IsOn && __instance.furniture_type.Value == 16) { spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2(__instance.boundingBox.Center.X - 20, (float)__instance.boundingBox.Center.Y - 105.6f)), new Rectangle(276 + (int)((Game1.currentGameTime.TotalGameTime.TotalMilliseconds + (double)(x * 3047) + (double)(y * 88)) % 400.0 / 100.0) * 12, 1985, 12, 11), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)(__instance.GetBoundingBoxAt(x, y).Bottom - 2) / 10000f); } diff --git a/AlternativeTextures/Framework/Patches/StandardObjects/ObjectPatch.cs b/AlternativeTextures/Framework/Patches/StandardObjects/ObjectPatch.cs index b6372229..619c55d9 100644 --- a/AlternativeTextures/Framework/Patches/StandardObjects/ObjectPatch.cs +++ b/AlternativeTextures/Framework/Patches/StandardObjects/ObjectPatch.cs @@ -149,9 +149,9 @@ internal static bool DrawPrefix(Object __instance, SpriteBatch spriteBatch, int { spriteBatch.Draw(Game1.mouseCursors, position + new Vector2(-32f, -32f), new Rectangle(88, 1779, 32, 32), Color.White * 0.75f, 0f, Vector2.Zero, 4f, SpriteEffects.None, Math.Max(0f, (float)((y + 1) * 64 - 20) / 10000f) + (float)x / 1000000f); } - if (__instance.ParentSheetIndex == 126 && __instance.quality.Value != 0) + if (__instance.ParentSheetIndex == 126 && __instance.Quality != 0) { - spriteBatch.Draw(FarmerRenderer.hatsTexture, position + new Vector2(-3f, -6f) * 4f, new Rectangle((__instance.quality.Value - 1) * 20 % FarmerRenderer.hatsTexture.Width, (__instance.quality.Value - 1) * 20 / FarmerRenderer.hatsTexture.Width * 20 * 4, 20, 20), Color.White * alpha, 0f, Vector2.Zero, 4f, SpriteEffects.None, Math.Max(0f, (float)((y + 1) * 64 - 20) / 10000f) + (float)x * 1E-05f); + spriteBatch.Draw(FarmerRenderer.hatsTexture, position + new Vector2(-3f, -6f) * 4f, new Rectangle((__instance.Quality - 1) * 20 % FarmerRenderer.hatsTexture.Width, (__instance.Quality - 1) * 20 / FarmerRenderer.hatsTexture.Width * 20 * 4, 20, 20), Color.White * alpha, 0f, Vector2.Zero, 4f, SpriteEffects.None, Math.Max(0f, (float)((y + 1) * 64 - 20) / 10000f) + (float)x * 1E-05f); } } else if (!Game1.eventUp || (Game1.CurrentEvent != null && !Game1.CurrentEvent.isTileWalkedOn(x, y))) @@ -166,7 +166,7 @@ internal static bool DrawPrefix(Object __instance, SpriteBatch spriteBatch, int spriteBatch.Draw(textureModel.GetTexture(textureVariation), position2, new Rectangle(artifactOffset, textureOffset, 16, 16), color, 0f, origin, (__instance.scale.Y > 1f) ? __instance.getScale().Y : 4f, __instance.Flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (float)(__instance.isPassable() ? __instance.GetBoundingBoxAt(x, y).Top : __instance.GetBoundingBoxAt(x, y).Bottom) / 10000f); return false; } - if (__instance.fragility.Value != 2) + if (__instance.Fragility != 2) { spriteBatch.Draw(Game1.shadowTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64 + 32, y * 64 + 51 + 4)), Game1.shadowTexture.Bounds, Color.White * alpha, 0f, new Vector2(Game1.shadowTexture.Bounds.Center.X, Game1.shadowTexture.Bounds.Center.Y), 4f, SpriteEffects.None, (float)__instance.GetBoundingBoxAt(x, y).Bottom / 15000f); } @@ -194,7 +194,7 @@ internal static bool DrawPrefix(Object __instance, SpriteBatch spriteBatch, int return false; } - float base_sort = (float)((y + 1) * 64) / 10000f + __instance.tileLocation.X / 50000f; + float base_sort = (float)((y + 1) * 64) / 10000f + __instance.TileLocation.X / 50000f; if (__instance.IsTapper() || __instance.QualifiedItemId.Equals("(BC)MushroomLog")) { base_sort += 0.02f; diff --git a/AlternativeTextures/Framework/UI/CatalogueMenu.cs b/AlternativeTextures/Framework/UI/CatalogueMenu.cs index 93270c15..94fe9e45 100644 --- a/AlternativeTextures/Framework/UI/CatalogueMenu.cs +++ b/AlternativeTextures/Framework/UI/CatalogueMenu.cs @@ -91,7 +91,7 @@ public CatalogueMenu(Farmer who) : base(0, 0, 900, 600, showUpperRightCloseButto var instanceName = $"{AlternativeTextureModel.TextureType.Furniture}_{item.Name}"; int texturesAvailable = AlternativeTextures.textureManager.GetAvailableTextureModels(itemId, instanceName, Game1.player.currentLocation.GetSeason()).Sum(t => t.Variations); - item.stack.Value = texturesAvailable; + item.Stack = texturesAvailable; if (texturesAvailable == 0) { continue; @@ -767,4 +767,4 @@ public override void draw(SpriteBatch b) base.drawMouse(b); } } -} \ No newline at end of file +} diff --git a/AlternativeTextures/Framework/UI/PaintBucketMenu.cs b/AlternativeTextures/Framework/UI/PaintBucketMenu.cs index e8e0f5e7..65c07b09 100644 --- a/AlternativeTextures/Framework/UI/PaintBucketMenu.cs +++ b/AlternativeTextures/Framework/UI/PaintBucketMenu.cs @@ -680,13 +680,13 @@ public override void receiveLeftClick(int x, int y, bool playSound = false) for (int j = 0; j < 12; j++) { var randomColor = new Color(Game1.random.Next(256), Game1.random.Next(256), Game1.random.Next(256)); - AlternativeTextures.multiplayer.broadcastSprites(Game1.currentLocation, new TemporaryAnimatedSprite(6, _textureTarget.tileLocation.Value * 64f, randomColor, 8, flipped: false, 50f) + AlternativeTextures.multiplayer.broadcastSprites(Game1.currentLocation, new TemporaryAnimatedSprite(6, _textureTarget.TileLocation * 64f, randomColor, 8, flipped: false, 50f) { motion = new Vector2((float)Game1.random.Next(-10, 11) / 10f, -Game1.random.Next(1, 3)), acceleration = new Vector2(0f, (float)Game1.random.Next(1, 3) / 100f), accelerationChange = new Vector2(0f, -0.001f), scale = 0.8f, - layerDepth = (_textureTarget.tileLocation.Y + 1f) * 64f / 10000f, + layerDepth = (_textureTarget.TileLocation.Y + 1f) * 64f / 10000f, interval = Game1.random.Next(20, 90) }); } @@ -1216,4 +1216,4 @@ private Rectangle GetCharacterSourceRectangle(AlternativeTextureModel textureMod return sourceRect; } } -} \ No newline at end of file +}