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.entity.h"
5#include "PacketListener.h"
6#include "SetEntityDataPacket.h"
7
8
9
10SetEntityDataPacket::SetEntityDataPacket()
11{
12 id = -1;
13 packedItems = NULL;
14}
15
16SetEntityDataPacket::~SetEntityDataPacket()
17{
18 delete packedItems;
19}
20
21SetEntityDataPacket::SetEntityDataPacket(int id, shared_ptr<SynchedEntityData> entityData, bool notJustDirty)
22{
23 this->id = id;
24 if(notJustDirty)
25 {
26 this->packedItems = entityData->getAll();
27 }
28 else
29 {
30 this->packedItems = entityData->packDirty();
31 }
32}
33
34void SetEntityDataPacket::read(DataInputStream *dis) //throws IOException
35{
36 id = dis->readInt();
37 packedItems = SynchedEntityData::unpack(dis);
38}
39
40void SetEntityDataPacket::write(DataOutputStream *dos) //throws IOException
41{
42 dos->writeInt(id);
43 SynchedEntityData::pack(packedItems, dos);
44}
45
46void SetEntityDataPacket::handle(PacketListener *listener)
47{
48 listener->handleSetEntityData(shared_from_this());
49}
50
51int SetEntityDataPacket::getEstimatedSize()
52{
53 return 5;
54}
55
56vector<shared_ptr<SynchedEntityData::DataItem> > *SetEntityDataPacket::getUnpackedData()
57{
58 return packedItems;
59}