From e28d59a860e2ea21cb5922f24f1c15fe712e717b Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 18 Dec 2025 21:50:47 +0900 Subject: [PATCH] Skip Loop if no item is present --- Utilities/TextureUtils/DeferredTextureLoadingManager.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Utilities/TextureUtils/DeferredTextureLoadingManager.cs b/Utilities/TextureUtils/DeferredTextureLoadingManager.cs index 71dd7e68d0..7902863691 100644 --- a/Utilities/TextureUtils/DeferredTextureLoadingManager.cs +++ b/Utilities/TextureUtils/DeferredTextureLoadingManager.cs @@ -8,12 +8,14 @@ namespace CalamityMod { private static readonly List Textures = []; private static readonly List TexturesToRemove = []; + private static bool HasItem = false; public static void Enqueue(IDeferredLoadTexture texture) { Main.QueueMainThreadAction(() => { Textures.Add(texture); + HasItem = true; }); } @@ -29,6 +31,9 @@ namespace CalamityMod private static void DoUpdate() { + if (!HasItem) + return; + int limitPerTick = 2; foreach (var texture in Textures) { @@ -39,7 +44,7 @@ namespace CalamityMod limitPerTick--; } - if (limitPerTick < 0) + if (limitPerTick <= 0) { break; } @@ -51,6 +56,7 @@ namespace CalamityMod } TexturesToRemove.Clear(); + HasItem = Textures.Count != 0; } } }