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 "InputOutputStream.h"
3#include "PacketListener.h"
4#include "SetCreativeModeSlotPacket.h"
5
6
7
8SetCreativeModeSlotPacket::SetCreativeModeSlotPacket()
9{
10 this->slotNum = 0;
11 this->item = nullptr;
12}
13
14SetCreativeModeSlotPacket::SetCreativeModeSlotPacket(int slotNum, shared_ptr<ItemInstance> item)
15{
16 this->slotNum = slotNum;
17 // 4J - take copy of item as we want our packets to have full ownership of any referenced data
18 this->item = item ? item->copy() : shared_ptr<ItemInstance>();
19}
20
21void SetCreativeModeSlotPacket::handle(PacketListener *listener)
22{
23 listener->handleSetCreativeModeSlot(shared_from_this());
24}
25
26void SetCreativeModeSlotPacket::read(DataInputStream *dis)
27{
28 slotNum = dis->readShort();
29 item = readItem(dis);
30}
31
32void SetCreativeModeSlotPacket::write(DataOutputStream *dos)
33{
34 dos->writeShort(slotNum);
35 writeItem(item, dos);
36
37}
38
39int SetCreativeModeSlotPacket::getEstimatedSize()
40{
41 return 8;
42}