TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ FindChestByGuessing()

static int Terraria.Chest.FindChestByGuessing ( int X,
int Y )
inlinestatic

Tries to find the T:Terraria.Chest associated with the tile at (X , Y ) (tile coordinates).

Parameters
XThe x-coordinate to check, in tile coordinates.
YThe y-coordinate to check, in tile coordinates.
Returns
The index in F:Terraria.Main.chest of the chest associated with the tile at (X , Y ), or -1 if one doesn't exist.

If you have the top-left corner of the chest tile, use M:Terraria.Chest.FindChest(System.Int32,System.Int32).

Definition at line 780 of file Chest.cs.

781 {
782 for (int i = 0; i < 8000; i++)
783 {
784 if (Main.chest[i] != null && Main.chest[i].x >= X && Main.chest[i].x < X + 2 && Main.chest[i].y >= Y && Main.chest[i].y < Y + 2)
785 {
786 return i;
787 }
788 }
789 return -1;
790 }

References Terraria.Main.chest.

Referenced by Terraria.Main.DrawMap_FindChestName().

+ Here is the caller graph for this function: