1
0

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:
madmaxoft@gmail.com
2012-11-01 21:38:20 +00:00
parent 77064aa486
commit 4cebaa99f8
24 changed files with 328 additions and 138 deletions

View File

@@ -91,10 +91,7 @@ void cProtocol142::SendPickupSpawn(const cPickup & a_Pickup)
cCSLock Lock(m_CSPacket);
WriteByte (PACKET_PICKUP_SPAWN);
WriteInt (a_Pickup.GetUniqueID());
WriteShort (a_Pickup.GetItem()->m_ItemType);
WriteByte (a_Pickup.GetItem()->m_ItemCount);
WriteShort (a_Pickup.GetItem()->m_ItemDamage);
WriteShort (-1); //TODO: Implement item metadata
WriteItem (*(a_Pickup.GetItem()));
WriteVectorI((Vector3i)(a_Pickup.GetPosition() * 32));
WriteByte ((char)(a_Pickup.GetSpeed().x * 8));
WriteByte ((char)(a_Pickup.GetSpeed().y * 8));
@@ -123,11 +120,11 @@ void cProtocol142::SendSoundParticleEffect(int a_EffectID, int a_SrcX, int a_Src
void cProtocol142::SendTimeUpdate(Int64 a_WorldTime)
void cProtocol142::SendTimeUpdate(Int64 a_WorldAge, Int64 a_TimeOfDay)
{
cCSLock Lock(m_CSPacket);
WriteByte (PACKET_UPDATE_TIME);
WriteInt64(1);
WriteInt64(a_WorldTime);
WriteInt64(a_WorldAge);
WriteInt64(a_TimeOfDay);
Flush();
}