diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index aa2b8ef64d..5724c27253 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -869,20 +869,20 @@ namespace CalamityMod.ILEditing #region GeneralDrawLayer Systems Drawing private static void GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer drawLayer) { - Main.spriteBatch.TryEnd(); + Main.spriteBatch.End(); GeneralParticleHandler.DrawParticleCollectionsAtSpecificLayer(drawLayer); - Main.spriteBatch.TryEnd(); - Main.spriteBatch.TryBegin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); MetaballManager.DrawMetaballs(drawLayer); - Main.spriteBatch.TryEnd(); + Main.spriteBatch.End(); PrimitivePixelationSystem.DrawTargetScaled(drawLayer); PixelationManager.DrawPixelatedTargets(drawLayer); - Main.spriteBatch.TryEnd(); + Main.spriteBatch.End(); RendererManager.DrawRendererAtLayer(drawLayer); } @@ -891,7 +891,7 @@ namespace CalamityMod.ILEditing { GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer.BeforeAllTiles); // TODO: [SAFEACTION] this is a bandaid solution, but almost assuredly the method call here does not always correct state - Main.spriteBatch.TryBegin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); orig(self); } @@ -932,7 +932,7 @@ namespace CalamityMod.ILEditing orig(self); GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer.AfterEverything); // TODO: [SAFEACTION] this is a bandaid solution, but almost assuredly the method call here does not always correct state - Main.spriteBatch.TryBegin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); } #endregion diff --git a/Skies/SCalSky.cs b/Skies/SCalSky.cs index 0f3fc458aa..88f9424701 100644 --- a/Skies/SCalSky.cs +++ b/Skies/SCalSky.cs @@ -250,7 +250,7 @@ namespace CalamityMod.Skies Rectangle dest = new Rectangle(posOffset.X - tex.Width, posOffset.Y - tex.Height, (int)(tex.Width * repeatX), (int)(tex.Height * repeatY)); //We need the texture to loop, so we use a linearwrap sampler state. We draw it one extra texture size in all directions around the screen to provide buffer for the posOffset. - spriteBatch.TryEnd(); + spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearWrap, DepthStencilState.None, RasterizerState.CullCounterClockwise); spriteBatch.Draw( diff --git a/Systems/Graphic/PixelationSystem/PixelationManager.cs b/Systems/Graphic/PixelationSystem/PixelationManager.cs index cd3e82352d..02bd8e5c4f 100644 --- a/Systems/Graphic/PixelationSystem/PixelationManager.cs +++ b/Systems/Graphic/PixelationSystem/PixelationManager.cs @@ -167,7 +167,7 @@ namespace CalamityMod.Systems.Graphic.PixelationSystem } orig(); - Main.spriteBatch.TryEnd(); + Main.spriteBatch.End(); } private static void DrawCollectionsToTarget(Dictionary targetCollection, Matrix pixelationMatrix, List drawerCollection) @@ -197,8 +197,8 @@ namespace CalamityMod.Systems.Graphic.PixelationSystem var targetCollection = ReturnAssociatedTargetCollection(drawLayer); foreach (var keyValuePair in targetCollection) { - Main.spriteBatch.TryEnd(); - Main.spriteBatch.TryBegin(default, keyValuePair.Key, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.End(); + Main.spriteBatch.Begin(default, keyValuePair.Key, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); float targetScale = 1f / PixelationResolution; Main.spriteBatch.Draw(keyValuePair.Value, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, targetScale, SpriteEffects.None, 0f); diff --git a/Systems/TileMerging/TileBlendTexture_Baking.cs b/Systems/TileMerging/TileBlendTexture_Baking.cs index 9bb30a1293..c1144805d3 100644 --- a/Systems/TileMerging/TileBlendTexture_Baking.cs +++ b/Systems/TileMerging/TileBlendTexture_Baking.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Systems { BakeBlendTexture_Inner(texture); // TODO: [SAFEACTION] Bandaid fix - Main.spriteBatch.TryEnd(); + Main.spriteBatch.End(); }); } @@ -61,7 +61,7 @@ namespace CalamityMod.Systems } }); // TODO: [SAFEACTION] bandaid fix - Main.spriteBatch.TryEnd(); + Main.spriteBatch.End(); graphicsDevice.SetRenderTarget(null); } } diff --git a/Utilities/DrawingUtils.SpriteBatch.cs b/Utilities/DrawingUtils.SpriteBatch.cs index 5ca311e370..94bf21edb7 100644 --- a/Utilities/DrawingUtils.SpriteBatch.cs +++ b/Utilities/DrawingUtils.SpriteBatch.cs @@ -52,7 +52,7 @@ namespace CalamityMod return; spriteBatch.GetParameters(out var parameters); - spriteBatch.TryEnd(); + spriteBatch.End(); spriteBatch.Begin(sortMode, settings.blendState, settings.samplerState, settings.depthStencilState, settings.rasterizerState ?? Main.Rasterizer, effect, transformMatrix); batchCallback?.Invoke();