コード例 #1
0
ファイル: CoreCommands.cs プロジェクト: GoldishKirby/MiNET
        public void Kit(Player player, int kitId)
        {
            var inventory = player.Inventory;

            switch (kitId)
            {
                case 0:
                    // Kit leather tier
                    inventory.Boots = new ItemLeatherBoots();
                    inventory.Leggings = new ItemLeatherLeggings();
                    inventory.Chest = new ItemLeatherChestplate();
                    inventory.Helmet = new ItemLeatherHelmet();
                    break;
                case 1:
                    // Kit gold tier
                    inventory.Boots = new ItemGoldBoots();
                    inventory.Leggings = new ItemGoldLeggings();
                    inventory.Chest = new ItemGoldChestplate();
                    inventory.Helmet = new ItemGoldHelmet();
                    break;
                case 2:
                    // Kit chain tier
                    inventory.Boots = new ItemChainmailBoots();
                    inventory.Leggings = new ItemChainmailLeggings();
                    inventory.Chest = new ItemChainmailChestplate();
                    inventory.Helmet = new ItemChainmailHelmet();
                    break;
                case 3:
                    // Kit iron tier
                    inventory.Boots = new ItemIronBoots();
                    inventory.Leggings = new ItemIronLeggings();
                    inventory.Chest = new ItemIronChestplate();
                    inventory.Helmet = new ItemIronHelmet();
                    break;
                case 4:
                    // Kit diamond tier
                    inventory.Boots = new ItemDiamondBoots();
                    inventory.Leggings = new ItemDiamondLeggings();
                    inventory.Chest = new ItemDiamondChestplate();
                    inventory.Helmet = new ItemDiamondHelmet();
                    break;
            }

            // 0 = protection
            // 1 = Fire protection
            // 2 = Feather falling
            // 3 = Blast protection
            // 4 = Projectile protection
            // 5 = Thorns

            EnchantArmor(player.Inventory, 0, 2);

            var command = new ItemCommand(41, 0, delegate(ItemCommand itemCommand, Level level, Player arg3, BlockCoordinates arg4) { Log.Info("Clicked on command"); });

            // Hotbar
            byte c = 0;
            //inventory.Slots[c++] = new ItemStack(command, 1); // Custom command block

            //2016 - 02 - 26 02:59:08,740[6] INFO MiNET.Client.MiNetClient - Item Type = Item, Id = 358, Metadata = 0, Count = 1,
            // ExtraData = TAG_Compound("tag"): 1 entries {
            //	TAG_String("map_uuid"): "-4294967268"
            //}

            //inventory.Slots[c++] = new ItemItemFrame() { Count = 64 };
            //inventory.Slots[c++] = new ItemBlock(new WoodenPlanks(), 0) { Count = 64 };
            inventory.Slots[c++] = new ItemCompass(); // Wooden Sword
            inventory.Slots[c++] = new ItemWoodenSword(); // Wooden Sword
            inventory.Slots[c++] = new ItemStoneSword(); // Stone Sword
            inventory.Slots[c++] = new ItemGoldSword(); // Golden Sword
            inventory.Slots[c++] = new ItemIronSword(); // Iron Sword
            inventory.Slots[c++] = new ItemDiamondSword(); // Diamond Sword
            inventory.Slots[c++] = new ItemBow(); // Bow
            inventory.Slots[c++] = new ItemArrow {Count = 64}; // Arrows
            inventory.Slots[c++] = new ItemEgg {Count = 64}; // Eggs
            inventory.Slots[c++] = new ItemSnowball {Count = 64}; // Snowballs
            inventory.Slots[c++] = new ItemIronSword
            {
                ExtraData = new NbtCompound {new NbtList("ench") {new NbtCompound {new NbtShort("id", 9), new NbtShort("lvl", 1)}}}
            };

            inventory.Slots[c++] = new ItemIronSword
            {
                ExtraData = new NbtCompound {{new NbtCompound("display") {new NbtString("Name", "test")}}}
            };

            //inventory.Slots[c++] = new ItemEmptyMap { Count = 64 }; // Wooden Sword
            inventory.Slots[c++] = new ItemStoneAxe();
            inventory.Slots[c++] = new ItemStoneAxe();
            inventory.Slots[c++] = new ItemWoodenPickaxe();
            inventory.Slots[c++] = new ItemBread {Count = 5};
            //inventory.Slots[c++] = new ItemBlock(new Block(35), 0) {Count = 64};
            //inventory.Slots[c++] = new ItemBucket(8);

            //inventory.Slots[c++] = ItemFactory.GetItem(39, 0) { Count = 1};
            //inventory.Slots[c++] = ItemFactory.GetItem(40, 0), 4);
            //inventory.Slots[c++] = ItemFactory.GetItem(281, 0), 4);

            //for (byte i = 0; i < inventory.ItemHotbar.Length; i++)
            //{
            //	inventory.ItemHotbar[i] = i;
            //}

            player.SendPlayerInventory();
            SendEquipmentForPlayer(player);
            SendArmorForPlayer(player);

            player.Level.BroadcastMessage(string.Format("Player {0} changed kit.", player.Username), type: MessageType.Raw);
        }
コード例 #2
0
ファイル: CoreCommands.cs プロジェクト: hireymage/MiNET
        public void Kit(Player player, int kitId)
        {
            var inventory = player.Inventory;

            switch (kitId)
            {
                case 0:
                    // Kit leather tier
                    break;
                case 1:
                    // Kit gold tier
                    break;
                case 2:
                    // Kit chain tier
                    break;
                case 3:
                    // Kit iron tier
                    inventory.Boots = new ItemIronBoots(0);
                    inventory.Leggings = new ItemIronLeggings(0);
                    inventory.Chest = new ItemIronChestplate(0);
                    inventory.Helmet = new ItemIronHelmet(0);
                    break;
                case 4:
                    // Kit diamond tier
                    inventory.Boots = new ItemDiamondBoots(0);
                    inventory.Leggings = new ItemDiamondLeggings(0);
                    inventory.Chest = new ItemDiamondChestplate(0);
                    inventory.Helmet = new ItemDiamondHelmet(0);
                    break;
            }

            var command = new ItemCommand(41, 0, delegate(ItemCommand itemCommand, Level level, Player arg3, BlockCoordinates arg4) { Log.Info("Clicked on command"); });

            // Hotbar
            byte c = 0;
            //inventory.Slots[c++] = new ItemStack(command, 1); // Wooden Sword
            inventory.Slots[c++] = new ItemStack(268, 1); // Wooden Sword
            inventory.Slots[c++] = new ItemStack(272, 1); // Stone Sword
            inventory.Slots[c++] = new ItemStack(283, 1); // Golden Sword
            inventory.Slots[c++] = new ItemStack(267, 1); // Iron Sword
            inventory.Slots[c++] = new ItemStack(276, 1); // Diamond Sword
            inventory.Slots[c++] = new ItemStack(261, 1); // Bow
            inventory.Slots[c++] = new ItemStack(262, 64); // Arrows
            inventory.Slots[c++] = new ItemStack(344, 64); // Eggs
            inventory.Slots[c++] = new ItemStack(332, 64); // Snowballs

            inventory.Slots[c++] = new ItemStack(new ItemChest(0), 1);
            inventory.Slots[c++] = new ItemStack(new ItemStoneAxe(0), 1);
            inventory.Slots[c++] = new ItemStack(new ItemWoodenPickaxe(0), 1);
            inventory.Slots[c++] = new ItemStack(new ItemBread(), 5);
            inventory.Slots[c++] = new ItemStack(new ItemBlock(new Block(35), 0), 64);
            inventory.Slots[c++] = new ItemStack(new ItemBucket(8), 1);

            //for (byte i = 0; i < inventory.ItemHotbar.Length; i++)
            //{
            //	inventory.ItemHotbar[i] = i;
            //}

            player.SendPlayerInventory();
            SendEquipmentForPlayer(player);
            SendArmorForPlayer(player);

            player.Level.BroadcastMessage(string.Format("Player {0} changed kit.", player.Username), type: MessageType.Raw);
        }
コード例 #3
0
ファイル: CoreCommands.cs プロジェクト: andrewhutche/MiNET
        public void Kit(Player player, int kitId)
        {
            var inventory = player.Inventory;

            switch (kitId)
            {
                case 0:
                    // Kit leather tier
                    break;
                case 1:
                    // Kit gold tier
                    break;
                case 2:
                    // Kit chain tier
                    break;
                case 3:
                    // Kit iron tier
                    inventory.Boots = new ItemIronBoots();
                    inventory.Leggings = new ItemIronLeggings();
                    inventory.Chest = new ItemIronChestplate();
                    inventory.Helmet = new ItemIronHelmet();
                    break;
                case 4:
                    // Kit diamond tier
                    inventory.Boots = new ItemDiamondBoots();
                    inventory.Leggings = new ItemDiamondLeggings();
                    inventory.Chest = new ItemDiamondChestplate();
                    inventory.Helmet = new ItemDiamondHelmet();
                    break;
            }

            var command = new ItemCommand(41, 0, delegate(ItemCommand itemCommand, Level level, Player arg3, BlockCoordinates arg4) { Log.Info("Clicked on command"); });

            // Hotbar
            byte c = 0;
            //inventory.Slots[c++] = new ItemStack(command, 1); // Custom command block
            inventory.Slots[c++] = new ItemPotion(1);
            inventory.Slots[c++] = new ItemPotion(2);
            inventory.Slots[c++] = new ItemPotion(3);
            inventory.Slots[c++] = new ItemPotion(4);
            inventory.Slots[c++] = new ItemPotion(5);
            inventory.Slots[c++] = new ItemPotion(6);
            inventory.Slots[c++] = new ItemPotion(7);
            inventory.Slots[c++] = new ItemPotion(8);
            inventory.Slots[c++] = new ItemPotion(9);
            inventory.Slots[c++] = new ItemWoodenSword(); // Wooden Sword
            inventory.Slots[c++] = new ItemStoneSword(); // Stone Sword
            inventory.Slots[c++] = new ItemGoldSword(); // Golden Sword
            inventory.Slots[c++] = new ItemIronSword(); // Iron Sword
            inventory.Slots[c++] = new ItemDiamondSword(); // Diamond Sword
            inventory.Slots[c++] = new ItemBow(); // Bow
            inventory.Slots[c++] = ItemFactory.GetItem(262, 0, 64); // Arrows
            inventory.Slots[c++] = ItemFactory.GetItem(344, 0, 64); // Eggs
            inventory.Slots[c++] = ItemFactory.GetItem(332, 0, 64); // Snowballs
            Item item = ItemFactory.GetItem(267, 0, 64);
            item.ExtraData = new NbtCompound {new NbtList("ench") {new NbtCompound {new NbtShort("id", 0), new NbtShort("lvl", 2)}}};
            inventory.Slots[c++] = item;

            inventory.Slots[c++] = new ItemChest();
            inventory.Slots[c++] = new ItemStoneAxe();
            inventory.Slots[c++] = new ItemWoodenPickaxe();
            inventory.Slots[c++] = new ItemBread {Count = 5};
            inventory.Slots[c++] = new ItemBlock(new Block(35), 0) {Count = 64};
            inventory.Slots[c++] = new ItemBucket(8);

            //inventory.Slots[c++] = ItemFactory.GetItem(39, 0) { Count = 1};
            //inventory.Slots[c++] = ItemFactory.GetItem(40, 0), 4);
            //inventory.Slots[c++] = ItemFactory.GetItem(281, 0), 4);

            //for (byte i = 0; i < inventory.ItemHotbar.Length; i++)
            //{
            //	inventory.ItemHotbar[i] = i;
            //}

            player.SendPlayerInventory();
            SendEquipmentForPlayer(player);
            SendArmorForPlayer(player);

            player.Level.BroadcastMessage(string.Format("Player {0} changed kit.", player.Username), type: MessageType.Raw);
        }