diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 737ef4d8..d6110561 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -524,7 +524,7 @@ namespace TShockAPI if (tilex < 0 || tilex >= Main.maxTilesX || tiley < 0 || tiley >= Main.maxTilesY) return false; - if (Main.tile[tilex, tiley].type != 0x15) //Chest + if (Main.tile[tilex, tiley].type != 0x15 && (!Tools.MaxChests() && Main.tile[tilex, tiley].type != 0)) //Chest { Log.Debug(string.Format("TileKill(TileXY:{0}_{1}, Type:{2})", tilex, tiley, Main.tile[tilex, tiley].type)); diff --git a/TShockAPI/Tools.cs b/TShockAPI/Tools.cs index f959ee45..bdf6cfdf 100755 --- a/TShockAPI/Tools.cs +++ b/TShockAPI/Tools.cs @@ -519,5 +519,19 @@ namespace TShockAPI } return true; } + + /// + /// Checks if world has hit the max number of chests + /// + /// True if the entire chest array is used + public static bool MaxChests() + { + for (int i = 0; i < Main.chest.Length; i++) + { + if (Main.chest[i] == null) + return false; + } + return true; + } } } \ No newline at end of file