blob: 75a1916c23c685f602c2686637992083d734afcd (
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
|
#include "stdafx.h"
#include <iostream>
#include "InputOutputStream.h"
#include "PacketListener.h"
#include "ChunkVisibilityPacket.h"
ChunkVisibilityPacket::ChunkVisibilityPacket()
{
this->shouldDelay = false;
x = 0;
z = 0;
visible = false;
}
ChunkVisibilityPacket::ChunkVisibilityPacket(int x, int z, bool visible)
{
this->shouldDelay = false;
this->x = x;
this->z = z;
this->visible = visible;
}
void ChunkVisibilityPacket::read(DataInputStream *dis) //throws IOException
{
x = dis->readInt();
z = dis->readInt();
visible = dis->read() != 0;
}
void ChunkVisibilityPacket::write(DataOutputStream *dos) //throws IOException
{
dos->writeInt(x);
dos->writeInt(z);
dos->write(visible ? 1 : 0);
}
void ChunkVisibilityPacket::handle(PacketListener *listener)
{
listener->handleChunkVisibility(shared_from_this());
}
int ChunkVisibilityPacket::getEstimatedSize()
{
return 9;
}
|