From 8a7bbdc80e93b9f3d47d07b69d49f73ed6a79d54 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Wed, 18 Sep 2024 00:27:13 +0900 Subject: [PATCH] Moved AuricCarpet Replacement to ExtraTextureRefs --- CalPlayer/CalamityPlayerMiscEffects.cs | 5 +++-- CalamityMod.cs | 10 ---------- ExtraTextures/ExtraTextureRefs.cs | 14 +++++++++++++- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 5bb0b081e5..b17575ad8e 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -13,6 +13,7 @@ using CalamityMod.CustomRecipes; using CalamityMod.DataStructures; using CalamityMod.Dusts; using CalamityMod.Events; +using CalamityMod.ExtraTextures; using CalamityMod.Items; using CalamityMod.Items.Accessories; using CalamityMod.Items.Ammo; @@ -787,8 +788,8 @@ namespace CalamityMod.CalPlayer // Update Carpet textures if (Main.netMode != NetmodeID.Server && Player.whoAmI == Main.myPlayer) { - Asset carpetAuric = ModContent.Request("CalamityMod/ExtraTextures/AuricCarpet"); - Asset carpetOriginal = CalamityMod.carpetOriginal; + Asset carpetAuric = ExtraTextureRefs.FlyingCarpetAuric; + Asset carpetOriginal = ExtraTextureRefs.FlyingCarpetVanilla; TextureAssets.FlyingCarpet = (auricSet ? carpetAuric : carpetOriginal); } diff --git a/CalamityMod.cs b/CalamityMod.cs index 590d8779bd..72b70bacf1 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -84,8 +84,6 @@ namespace CalamityMod public static int ghostKillCount = 0; public static int sharkKillCount = 0; - public static Asset carpetOriginal; - // Holds the Texture Arrays for all the lava textures. // These are used for the lava styles. They are seperate from Textureasset.Instance._liquidTexture as they will conflict with ModWaterStyle // Can hold up to 255 lava styles (more than enough) (excluding the normal lava texture which is liquidTexture 1) @@ -125,8 +123,6 @@ namespace CalamityMod #region Load public override void Load() { - carpetOriginal = TextureAssets.FlyingCarpet; - // Initialize the CalamityLists as this is coupled in tons of other type CalamityLists.Load(); @@ -204,12 +200,6 @@ namespace CalamityMod Main.OnPreDraw -= PrepareRenderTargets; }); - if (!Main.dedServ) - { - TextureAssets.FlyingCarpet = carpetOriginal; - } - - carpetOriginal = null; _Instance = null; base.Unload(); } diff --git a/ExtraTextures/ExtraTextureRefs.cs b/ExtraTextures/ExtraTextureRefs.cs index 29ffcdbfbe..9928fb7067 100644 --- a/ExtraTextures/ExtraTextureRefs.cs +++ b/ExtraTextures/ExtraTextureRefs.cs @@ -5,6 +5,8 @@ using System.Text; using System.Threading.Tasks; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; +using Terraria; +using Terraria.GameContent; using Terraria.ModLoader; namespace CalamityMod.ExtraTextures @@ -24,6 +26,10 @@ namespace CalamityMod.ExtraTextures public static Asset WallOfFleshEyeGlowmask; public static Asset WallOfFleshDemonSickleTexture; + // Flying Carpet Replacements + public static Asset FlyingCarpetVanilla; + public static Asset FlyingCarpetAuric; + public override void OnModLoad() { DestroyerGlowmasks[0] = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerHeadGlow", AssetRequestMode.AsyncLoad); @@ -37,11 +43,17 @@ namespace CalamityMod.ExtraTextures WallOfFleshEyeGlowmask = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/WallOfFleshEyeTelegraphGlow", AssetRequestMode.AsyncLoad); WallOfFleshDemonSickleTexture = ModContent.Request("CalamityMod/Projectiles/Melee/ForbiddenOathbladeProjectile", AssetRequestMode.AsyncLoad); + + FlyingCarpetVanilla = TextureAssets.FlyingCarpet; + FlyingCarpetAuric = ModContent.Request("CalamityMod/ExtraTextures/AuricCarpet", AssetRequestMode.AsyncLoad); } public override void Unload() { - + if (!Main.dedServ) + { + TextureAssets.FlyingCarpet = FlyingCarpetVanilla; + } } } }