Refactored the world time.
Now it is stored in two values - WorldAge (only incremented, plugins cannot change) and TimeOfDay (plugins can change). Since sub-tick precision is needed in Tick(), we store it both as number of seconds (double) and number of ticks (Int64) is calculated off of that. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1022 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
@@ -685,11 +685,12 @@ void cProtocol125::SendThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
|
||||
|
||||
|
||||
void cProtocol125::SendTimeUpdate(Int64 a_WorldTime)
|
||||
void cProtocol125::SendTimeUpdate(Int64 a_WorldAge, Int64 a_TimeOfDay)
|
||||
{
|
||||
cCSLock Lock(m_CSPacket);
|
||||
WriteByte (PACKET_UPDATE_TIME);
|
||||
WriteInt64(a_WorldTime);
|
||||
// Use a_WorldAge for daycount, and a_TimeOfDay for the proper time of day:
|
||||
WriteInt64((24000 * (a_WorldAge / 24000)) + (a_TimeOfDay % 24000));
|
||||
Flush();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user