internal static int FindChestSafe(int x, int y) { if (Main.tile[x, y] != null) { Point16 pos = FindChestTopLeft(x, y, false); return(Chest.FindChest(pos.X, pos.Y)); } return(Chest.FindChestByGuessing(x, y)); }
// bool containsUnsafeChest(int x, int y) { Tile tile = Main.tile[x, y]; if (tile.type == TileID.Containers || tile.type == TileID.Containers2 || tile.type == TileID.FakeContainers || tile.type == TileID.FakeContainers2) { int chestIdx = Chest.FindChestByGuessing(tileX, tileY); if (chestIdx != -1 && Main.chest[chestIdx].item.Any(i => i?.IsAir == false)) { return(true); // No non-empty chests } } return(false); }
private static string DrawMap_FindChestName(LocalizedText[] chestNames, Tile chestTile, int x, int y, int fullTileWidth = 36) { int num = Chest.FindChestByGuessing(x, y); if (num < 0) { return(chestNames[0].Value); } if (Main.chest[num].name != "") { return(string.Concat(chestNames[chestTile.frameX / fullTileWidth], ": ", Main.chest[num].name)); } return(chestNames[chestTile.frameX / fullTileWidth].Value); }