From a428a3056e05ebfc1ad579ef6d47e1fa52da2ceb Mon Sep 17 00:00:00 2001 From: Flowaria Date: Wed, 18 Sep 2024 19:23:42 +0900 Subject: [PATCH] PrimitiveRenderer as ModSystem --- CalamityMod.cs | 2 -- Graphics/Primitives/PrimitiveRenderer.cs | 6 ++++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CalamityMod.cs b/CalamityMod.cs index a5b522c8bb..b9a5c30903 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -110,8 +110,6 @@ namespace CalamityMod if (!Main.dedServ) { - PrimitiveRenderer.Initialize(); - // This must be done separately from immediate loading, as loading is now multithreaded. // However, render targets and certain other graphical objects can only be created on the main thread. Main.QueueMainThreadAction(() => Main.OnPreDraw += PrepareRenderTargets); diff --git a/Graphics/Primitives/PrimitiveRenderer.cs b/Graphics/Primitives/PrimitiveRenderer.cs index 928c64bfd4..66fa36a79d 100644 --- a/Graphics/Primitives/PrimitiveRenderer.cs +++ b/Graphics/Primitives/PrimitiveRenderer.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Graphics.Shaders; +using Terraria.ModLoader; namespace CalamityMod.Graphics.Primitives { @@ -19,7 +20,8 @@ namespace CalamityMod.Graphics.Primitives /// If you wish to use pixelation, you MUST make the NPC/Projectile inherit and use instead of predraw..
/// You can also optionally specify a render layer with . It is by default. /// - public static class PrimitiveRenderer + [Autoload(Side = ModSide.Client)] + public sealed class PrimitiveRenderer : ModSystem { #region Static Members private static DynamicVertexBuffer VertexBuffer; @@ -46,7 +48,7 @@ namespace CalamityMod.Graphics.Primitives private static short IndicesIndex; - internal static void Initialize() + public override void OnModLoad() { Main.QueueMainThreadAction(() => {