Terraria.Chest.AfterPlacement_Hook C# (CSharp) Method

AfterPlacement_Hook() public static method

public static AfterPlacement_Hook ( int x, int y, int type = 21, int style, int direction = 1 ) : int
x int
y int
type int
style int
direction int
return int
        public static int AfterPlacement_Hook(int x, int y, int type = 21, int style = 0, int direction = 1)
        {
            Point16 baseCoords = new Point16(x, y);
            TileObjectData.OriginToTopLeft(type, style, ref baseCoords);
            int emptyChest = FindEmptyChest(baseCoords.X, baseCoords.Y, 21, 0, 1);
            if (emptyChest == -1)
                return -1;
            if (Main.netMode != 1)
            {
                Chest chest = new Chest(false);
                chest.x = baseCoords.X;
                chest.y = baseCoords.Y;
                for (int index = 0; index < 40; ++index)
                    chest.item[index] = new Item();
                Main.chest[emptyChest] = chest;
            }
            else if (type == 21)
                NetMessage.SendData(34, -1, -1, "", 0, (float)x, (float)y, (float)style, 0, 0, 0);
            else
                NetMessage.SendData(34, -1, -1, "", 2, (float)x, (float)y, (float)style, 0, 0, 0);
            return emptyChest;
        }