blob: e7ea3b42cf40d529175227b29e3450c29fd9f75a (
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
59
60
61
62
63
64
|
#include "stdafx.h"
#include <iostream>
#include "InputOutputStream.h"
#include "PacketListener.h"
#include "SetTimePacket.h"
SetTimePacket::SetTimePacket()
{
gameTime = 0;
dayTime = 0;
}
SetTimePacket::SetTimePacket(int64_t gameTime, int64_t dayTime, bool tickDayTime)
{
this->gameTime = gameTime;
this->dayTime = dayTime;
// 4J: We send daylight cycle rule with host options so don't need this
/*if (!tickDayTime)
{
this->dayTime = -this->dayTime;
if (this->dayTime == 0)
{
this->dayTime = -1;
}
}*/
}
void SetTimePacket::read(DataInputStream *dis) //throws IOException
{
gameTime = dis->readLong();
dayTime = dis->readLong();
}
void SetTimePacket::write(DataOutputStream *dos) //throws IOException
{
dos->writeLong(gameTime);
dos->writeLong(dayTime);
}
void SetTimePacket::handle(PacketListener *listener)
{
listener->handleSetTime(shared_from_this());
}
int SetTimePacket::getEstimatedSize()
{
return 16;
}
bool SetTimePacket::canBeInvalidated()
{
return true;
}
bool SetTimePacket::isInvalidatedBy(shared_ptr<Packet> packet)
{
return true;
}
bool SetTimePacket::isAync()
{
return true;
}
|