From 42335aa6cc5864c958d30facf2104bf825ea30ff Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Mon, 24 Aug 2020 19:37:33 -0400 Subject: [PATCH] Loop optimization to minimize reflection impact --- TileEntities/TEPowerCellFactory.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TileEntities/TEPowerCellFactory.cs b/TileEntities/TEPowerCellFactory.cs index 578ded006b..fc84f37ee3 100644 --- a/TileEntities/TEPowerCellFactory.cs +++ b/TileEntities/TEPowerCellFactory.cs @@ -1,6 +1,5 @@ using CalamityMod.CalPlayer; using CalamityMod.Tiles; -using System; using System.IO; using System.Reflection; using Terraria; @@ -74,6 +73,8 @@ namespace CalamityMod.TileEntities for (int i = 0; i < Main.maxPlayers; i++) { Player p = Main.player[i]; + if (!p.active) + continue; // Use reflection to stop TML from spitting an error here. // Try-catching will not stop this error, TML will print it to console anyway. The error is harmless.