Exemple #1
0
        byte type; //This holds type information, used in deciding which kind of window we need to send.

        #endregion Fields

        #region Constructors

        public Windows(WindowType type, Point3 pos, World world, Player p)
        {
            try
            {
                id = FreeId();
                this.type = (byte)type;
                this.p = p;

                switch (Type)
                {
                    case WindowType.Chest:
                        name = "Chest"; //We change this to "Large Chest" Later if it needs it :3
                        container = world.GetBlockContainer(pos);
                        items = container.Items;
                        container.AddPlayer(p);
                        break;
                    case WindowType.Dispenser:
                        name = "Workbench";
                        //container = world.GetBlockContainer(pos); // We don't have a container for this yet.
                        items = new Item[9];
                        break;
                    case WindowType.Furnace:
                        name = "Furnace";
                        //container = world.GetBlockContainer(pos); // We don't have a container for this yet.
                        items = new Item[3];
                        break;
                    case WindowType.Workbench:
                        name = "Dispenser";
                        items = new Item[10];
                        break;
                    case WindowType.EnchantmentTable:
                        name = "Enchant";
                        items = new Item[1];
                        break;
                    case WindowType.BrewingStand:
                        name = "Brewing Stand";
                        //container = world.GetBlockContainer(pos); // We don't have a container for this yet.
                        items = new Item[4];
                        break;
                }

                if (Type == WindowType.Workbench || Type == WindowType.EnchantmentTable)
                {
                    for (int i = 0; i < InventorySize; i++)
                        items[i] = Item.Nothing;
                }
            }
            catch { Logger.Log("Error making window!"); }
        }
 public void Dispose()
 {
     if (container != null)
     {
         container.RemovePlayer(p);
         container = null;
     }
     items = null;
     name = null;
     p = null;
 }