public static int CreateChest(int X, int Y, int id = -1)
{
int index1 = id;
if (index1 == -1)
{
index1 = Chest.FindEmptyChest(X, Y, 21, 0, 1);
if (index1 == -1)
return -1;
if (Main.netMode == 1)
return index1;
}
Main.chest[index1] = new Chest(false);
Main.chest[index1].x = X;
Main.chest[index1].y = Y;
for (int index2 = 0; index2 < 40; ++index2)
Main.chest[index1].item[index2] = new Item();
return index1;
}