From ef8dd147326d67e99f1bc4edfb9260a84bdc13ad Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 27 Nov 2025 18:26:55 +0900 Subject: [PATCH] ScarletSeaGrassWall - Removed System.Random Usage --- Walls/ScarletSeaGrassWall.cs | 7 ++++--- Walls/UnsafeWalls/UnsafeScarletSeaGrassWall.cs | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Walls/ScarletSeaGrassWall.cs b/Walls/ScarletSeaGrassWall.cs index c8550a7e30..6be76e2d5b 100644 --- a/Walls/ScarletSeaGrassWall.cs +++ b/Walls/ScarletSeaGrassWall.cs @@ -5,6 +5,7 @@ using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Utilities; namespace CalamityMod.Walls { @@ -32,10 +33,10 @@ namespace CalamityMod.Walls if (i > Main.screenPosition.X / 16 && i < Main.screenPosition.X / 16 + Main.screenWidth / 16 && j > Main.screenPosition.Y / 16 && j < Main.screenPosition.Y / 16 + Main.screenHeight / 16) { Texture2D tex = leafTexture.Value; - var rand = new Random(i + (j * 100000)); + var rand = new FastRandom(i + (j * 100000)); - float offset = i * j % 6.28f + (float)rand.NextDouble() / 8f; - float sin = (float)Math.Sin(Main.GameUpdateCount / 45f + offset); + float offset = i * j % 6.28f + rand.NextFloat() / 8f; + float sin = MathF.Sin(Main.GameUpdateCount / 45f + offset); spriteBatch.Draw(tex, (new Vector2(i + 0.5f, j + 0.5f) + TileAdj) * 16 + new Vector2(1, 0.5f) * sin * 2.2f - Main.screenPosition, new Rectangle(rand.Next(4) * 26, 0, 24, 24), Lighting.GetColor(i, j), offset + sin * 0.09f, new Vector2(12, 12), 1 + sin / 14f, 0, 0); diff --git a/Walls/UnsafeWalls/UnsafeScarletSeaGrassWall.cs b/Walls/UnsafeWalls/UnsafeScarletSeaGrassWall.cs index d7175d3781..d780f36a7e 100644 --- a/Walls/UnsafeWalls/UnsafeScarletSeaGrassWall.cs +++ b/Walls/UnsafeWalls/UnsafeScarletSeaGrassWall.cs @@ -5,6 +5,7 @@ using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Utilities; namespace CalamityMod.Walls.UnsafeWalls { @@ -34,10 +35,10 @@ namespace CalamityMod.Walls.UnsafeWalls if (i > Main.screenPosition.X / 16 && i < Main.screenPosition.X / 16 + Main.screenWidth / 16 && j > Main.screenPosition.Y / 16 && j < Main.screenPosition.Y / 16 + Main.screenHeight / 16) { Texture2D tex = leafTexture.Value; - var rand = new Random(i + (j * 100000)); + var rand = new FastRandom(i + (j * 100000)); - float offset = i * j % 6.28f + (float)rand.NextDouble() / 8f; - float sin = (float)Math.Sin(Main.GameUpdateCount / 45f + offset); + float offset = i * j % 6.28f + rand.NextFloat() / 8f; + float sin = MathF.Sin(Main.GameUpdateCount / 45f + offset); spriteBatch.Draw(tex, (new Vector2(i + 0.5f, j + 0.5f) + TileAdj) * 16 + new Vector2(1, 0.5f) * sin * 2.2f - Main.screenPosition, new Rectangle(rand.Next(4) * 26, 0, 24, 24), Lighting.GetColor(i, j), offset + sin * 0.09f, new Vector2(12, 12), 1 + sin / 14f, 0, 0);