diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index a809f3e11f..19127d619a 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -112,6 +112,11 @@ namespace CalamityMod.CalPlayer // Potions (Quick Buff && Potion Sickness) HandlePotions(player, modPlayer); + // Update all particle sets for items. + // This must be done here instead of in the item logic because these sets are not properly instanced + // in the global classes. Attempting to update them there will cause multiple updates to one set for multiple items. + CalamityGlobalItem.UpdateAllParticleSets(); + // Regularly sync player stats during multiplayer if (player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient) { diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 13a0015304..a7904cc87d 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -87,7 +87,6 @@ namespace CalamityMod.Items public CalamityGlobalItem() { StealthGenBonus = 1f; - EnchantmentEnergyParticles = new ChargingEnergyParticleSet(-1, 2, Color.DarkViolet, Color.White, 0.04f, 24f); } public override GlobalItem Clone(Item item, Item itemClone) @@ -1692,14 +1691,19 @@ namespace CalamityMod.Items #endregion #region Inventory Drawing - internal ChargingEnergyParticleSet EnchantmentEnergyParticles; + internal static ChargingEnergyParticleSet EnchantmentEnergyParticles = new ChargingEnergyParticleSet(-1, 2, Color.DarkViolet, Color.White, 0.04f, 24f); + + internal static void UpdateAllParticleSets() + { + EnchantmentEnergyParticles.Update(); + } public override bool PreDrawInInventory(Item item, SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { void drawItemManually(Color color, float generalScale) { Texture2D itemTexture = Main.itemTexture[item.type]; - Rectangle itemFrame = (Main.itemAnimations[item.type] == null) ? itemTexture.Frame(1, 1, 0, 0) : Main.itemAnimations[item.type].GetFrame(itemTexture); + Rectangle itemFrame = (Main.itemAnimations[item.type] == null) ? itemTexture.Frame() : Main.itemAnimations[item.type].GetFrame(itemTexture); Vector2 itemOrigin = itemFrame.Size() * 0.5f; spriteBatch.Draw(itemTexture, position, itemFrame, color, 0f, itemOrigin, scale * generalScale, SpriteEffects.None, 0f); } @@ -1707,9 +1711,6 @@ namespace CalamityMod.Items if (!EnchantmentManager.ItemUpgradeRelationship.ContainsKey(item.type) || !Main.LocalPlayer.InventoryHas(ModContent.ItemType())) return true; - // Create particle positions as necessary. - EnchantmentEnergyParticles.Update(); - // Draw all particles. float currentPower = 0f; int calamitasNPCIndex = NPC.FindFirstNPC(ModContent.NPCType());