blob: f574cbf2d71da869882aecc4825bfc9a74152b8f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#include "stdafx.h"
#include <iostream>
#include "InputOutputStream.h"
#include "net.minecraft.world.entity.h"
#include "PacketListener.h"
#include "AddPaintingPacket.h"
AddPaintingPacket::AddPaintingPacket()
{
id = -1;
x = 0;
y = 0;
z = 0;
dir = 0;
motive = L"";
}
AddPaintingPacket::AddPaintingPacket(shared_ptr<Painting> e)
{
id = e->entityId;
x = e->xTile;
y = e->yTile;
z = e->zTile;
dir = e->dir;
motive = e->motive->name;
}
void AddPaintingPacket::read(DataInputStream *dis) //throws IOException
{
id = dis->readInt();
motive = readUtf(dis, Painting::Motive::MAX_MOTIVE_NAME_LENGTH);
x = dis->readInt();
y = dis->readInt();
z = dis->readInt();
dir = dis->readInt();
}
void AddPaintingPacket::write(DataOutputStream *dos) //throws IOException
{
dos->writeInt(id);
writeUtf(motive, dos);
dos->writeInt(x);
dos->writeInt(y);
dos->writeInt(z);
dos->writeInt(dir);
}
void AddPaintingPacket::handle(PacketListener *listener)
{
listener->handleAddPainting(shared_from_this());
}
int AddPaintingPacket::getEstimatedSize()
{
return 24;
}
|