コード例 #1
0
        public void HandleWindowItems(MinecraftClient client, IPacket packet) {
            var myPacket = (CBWindowItems)packet;

            for (int i = 0; i < myPacket.Count; i++) {
                if (myPacket.WindowID == 0) 
                    client.ThisPlayer.SetInventory(Item.ItemFromSlot(myPacket.Slotdata[i]), (short)i);
                 else 
                    client.RaiseSetWindowSlot((sbyte)myPacket.WindowID, (short)i, Item.ItemFromSlot(myPacket.Slotdata[i]));
                
            }
        }
コード例 #2
0
        public void HandleSetSlot(MinecraftClient client, IPacket packet) {
            var myPacket = (CBSetSlot)packet;
            var myItem = Item.ItemFromSlot(myPacket.Slotdata);

            if (myPacket.WindowID == 0) {
                client.ThisPlayer.SetInventory(myItem, myPacket.Slot);
                client.RaiseInventoryItem(myPacket.Slot, myItem);
            } else
                client.RaiseSetWindowSlot(myPacket.WindowID, myPacket.Slot, myItem);
        }