예제 #1
0
        public Item[] items;         //Hold all the items this window has inside it.
        public Windows(WindowType type, Point3 pos, World world, Player p)
        {
            try
            {
                id        = FreeId();
                this.type = (byte)type;
                this.p    = p;
                crafting  = new Crafting(p, 9);
                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!"); }
        }
예제 #2
0
        public Inventory(Player pl)
        {
            p = pl;

            items = new Item[45];
            crafting = new Crafting(pl, 4);
            for (int i = 0; i < items.Length; i++)
                items[i] = Item.Nothing;

            current_index = 36;
        }
예제 #3
0
        public Inventory(Player pl)
        {
            p = pl;

            items    = new Item[45];
            crafting = new Crafting(pl, 4);
            for (int i = 0; i < items.Length; i++)
            {
                items[i] = Item.Nothing;
            }

            current_index = 36;
        }
예제 #4
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;
                crafting = new Crafting(p, 9);
                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!"); }
        }