diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-11-01 22:38:20 +0100 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-11-01 22:38:20 +0100 |
commit | 4cebaa99f88e25e039416354cf490fe98642af7e (patch) | |
tree | 40f8b0cc061e3ec55539e30754df3e3d1c17dd80 /source/Protocol | |
parent | Added Bats and Witches. (diff) | |
download | cuberite-4cebaa99f88e25e039416354cf490fe98642af7e.tar cuberite-4cebaa99f88e25e039416354cf490fe98642af7e.tar.gz cuberite-4cebaa99f88e25e039416354cf490fe98642af7e.tar.bz2 cuberite-4cebaa99f88e25e039416354cf490fe98642af7e.tar.lz cuberite-4cebaa99f88e25e039416354cf490fe98642af7e.tar.xz cuberite-4cebaa99f88e25e039416354cf490fe98642af7e.tar.zst cuberite-4cebaa99f88e25e039416354cf490fe98642af7e.zip |
Diffstat (limited to 'source/Protocol')
-rw-r--r-- | source/Protocol/Protocol.h | 2 | ||||
-rw-r--r-- | source/Protocol/Protocol125.cpp | 5 | ||||
-rw-r--r-- | source/Protocol/Protocol125.h | 2 | ||||
-rw-r--r-- | source/Protocol/Protocol142.cpp | 11 | ||||
-rw-r--r-- | source/Protocol/Protocol142.h | 2 | ||||
-rw-r--r-- | source/Protocol/ProtocolRecognizer.cpp | 4 | ||||
-rw-r--r-- | source/Protocol/ProtocolRecognizer.h | 2 |
7 files changed, 13 insertions, 15 deletions
diff --git a/source/Protocol/Protocol.h b/source/Protocol/Protocol.h index 50ee2cc51..b2423c6a2 100644 --- a/source/Protocol/Protocol.h +++ b/source/Protocol/Protocol.h @@ -78,7 +78,7 @@ public: virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, short a_SpeedX, short a_SpeedY, short a_SpeedZ) = 0;
virtual void SendTeleportEntity (const cEntity & a_Entity) = 0;
virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) = 0;
- virtual void SendTimeUpdate (Int64 a_WorldTime) = 0;
+ virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay) = 0;
virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) = 0;
virtual void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) = 0;
virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ) = 0;
diff --git a/source/Protocol/Protocol125.cpp b/source/Protocol/Protocol125.cpp index 44c97993d..58afcdcae 100644 --- a/source/Protocol/Protocol125.cpp +++ b/source/Protocol/Protocol125.cpp @@ -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();
}
diff --git a/source/Protocol/Protocol125.h b/source/Protocol/Protocol125.h index 991b28dac..a9c85ae4d 100644 --- a/source/Protocol/Protocol125.h +++ b/source/Protocol/Protocol125.h @@ -62,7 +62,7 @@ public: virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, short a_SpeedX, short a_SpeedY, short a_SpeedZ) override;
virtual void SendTeleportEntity (const cEntity & a_Entity) override;
virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) override;
- virtual void SendTimeUpdate (Int64 a_WorldTime) override;
+ virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay) override;
virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override;
virtual void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) override;
virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ) override;
diff --git a/source/Protocol/Protocol142.cpp b/source/Protocol/Protocol142.cpp index b4b2b66c1..17501169d 100644 --- a/source/Protocol/Protocol142.cpp +++ b/source/Protocol/Protocol142.cpp @@ -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();
}
\ No newline at end of file diff --git a/source/Protocol/Protocol142.h b/source/Protocol/Protocol142.h index 8b2205e44..96256044f 100644 --- a/source/Protocol/Protocol142.h +++ b/source/Protocol/Protocol142.h @@ -27,7 +27,7 @@ public: // Sending commands (alphabetically sorted):
virtual void SendPickupSpawn (const cPickup & a_Pickup) override;
virtual void SendSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override;
- virtual void SendTimeUpdate (Int64 a_WorldTime) override;
+ virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay) override;
// Specific packet parsers:
virtual int ParseLogin (void) override;
diff --git a/source/Protocol/ProtocolRecognizer.cpp b/source/Protocol/ProtocolRecognizer.cpp index 5b266bd34..3d16b42e8 100644 --- a/source/Protocol/ProtocolRecognizer.cpp +++ b/source/Protocol/ProtocolRecognizer.cpp @@ -428,10 +428,10 @@ void cProtocolRecognizer::SendThunderbolt(int a_BlockX, int a_BlockY, int a_Bloc -void cProtocolRecognizer::SendTimeUpdate(Int64 a_WorldTime)
+void cProtocolRecognizer::SendTimeUpdate(Int64 a_WorldAge, Int64 a_TimeOfDay)
{
ASSERT(m_Protocol != NULL);
- m_Protocol->SendTimeUpdate(a_WorldTime);
+ m_Protocol->SendTimeUpdate(a_WorldAge, a_TimeOfDay);
}
diff --git a/source/Protocol/ProtocolRecognizer.h b/source/Protocol/ProtocolRecognizer.h index fb82502f4..4b7877311 100644 --- a/source/Protocol/ProtocolRecognizer.h +++ b/source/Protocol/ProtocolRecognizer.h @@ -80,7 +80,7 @@ public: virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, short a_SpeedX, short a_SpeedY, short a_SpeedZ) override;
virtual void SendTeleportEntity (const cEntity & a_Entity) override;
virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) override;
- virtual void SendTimeUpdate (Int64 a_WorldTime) override;
+ virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay) override;
virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override;
virtual void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) override;
virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ) override;
|