the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#include "stdafx.h"
2#include <iostream>
3#include "InputOutputStream.h"
4#include "net.minecraft.world.item.h"
5#include "PacketListener.h"
6#include "SetEquippedItemPacket.h"
7
8
9
10SetEquippedItemPacket::SetEquippedItemPacket()
11{
12 entity = 0;
13 slot = 0;
14 item = nullptr;
15}
16
17SetEquippedItemPacket::SetEquippedItemPacket(int entity, int slot, shared_ptr<ItemInstance> item)
18{
19 this->entity = entity;
20 this->slot = slot;
21
22 // 4J Stu - Brought forward change from 1.3 to fix #64688 - Customer Encountered: TU7: Content: Art: Aura of enchanted item is not displayed for other players in online game
23 this->item = item == NULL ? nullptr : item->copy();
24}
25
26void SetEquippedItemPacket::read(DataInputStream *dis) //throws IOException
27{
28 entity = dis->readInt();
29 slot = dis->readShort();
30
31 // 4J Stu - Brought forward change from 1.3 to fix #64688 - Customer Encountered: TU7: Content: Art: Aura of enchanted item is not displayed for other players in online game
32 item = readItem(dis);
33}
34
35void SetEquippedItemPacket::write(DataOutputStream *dos) //throws IOException
36{
37 dos->writeInt(entity);
38 dos->writeShort(slot);
39
40 // 4J Stu - Brought forward change from 1.3 to fix #64688 - Customer Encountered: TU7: Content: Art: Aura of enchanted item is not displayed for other players in online game
41 writeItem(item, dos);
42}
43
44void SetEquippedItemPacket::handle(PacketListener *listener)
45{
46 listener->handleSetEquippedItem(shared_from_this());
47}
48
49int SetEquippedItemPacket::getEstimatedSize()
50{
51 return 4 + 2 * 2;
52}
53
54// 4J Stu - Brought forward from 1.3 to fix #64688 - Customer Encountered: TU7: Content: Art: Aura of enchanted item is not displayed for other players in online game
55shared_ptr<ItemInstance> SetEquippedItemPacket::getItem()
56{
57 return item;
58}
59
60bool SetEquippedItemPacket::canBeInvalidated()
61{
62 return true;
63}
64
65bool SetEquippedItemPacket::isInvalidatedBy(shared_ptr<Packet> packet)
66{
67 shared_ptr<SetEquippedItemPacket> target = dynamic_pointer_cast<SetEquippedItemPacket>(packet);
68 return target->entity == entity && target->slot == slot;
69}