Added the "Edit Sign" packet sent to the client placing a sign.
Fixes issue #20. The 1.6.2 client wouldn't open the sign editor UI unless it receives a special packet
This commit is contained in:
parent
3920e872f7
commit
9efcd5b82f
@ -66,6 +66,17 @@ public:
|
||||
}
|
||||
return 0x2;
|
||||
}
|
||||
|
||||
|
||||
virtual void OnPlacedByPlayer(
|
||||
cWorld * a_World, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta
|
||||
) override
|
||||
{
|
||||
a_Player->GetClientHandle()->SendEditSign(a_BlockX, a_BlockY, a_BlockZ);
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
@ -1491,6 +1491,15 @@ void cClientHandle::SendDisconnect(const AString & a_Reason)
|
||||
|
||||
|
||||
|
||||
void cClientHandle::SendEditSign(int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
{
|
||||
m_Protocol->SendEditSign(a_BlockX, a_BlockY, a_BlockZ);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cClientHandle::SendEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item)
|
||||
{
|
||||
m_Protocol->SendEntityEquipment(a_Entity, a_SlotNum, a_Item);
|
||||
|
@ -97,6 +97,7 @@ public:
|
||||
void SendCollectPickup (const cPickup & a_Pickup, const cPlayer & a_Player);
|
||||
void SendDestroyEntity (const cEntity & a_Entity);
|
||||
void SendDisconnect (const AString & a_Reason);
|
||||
void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ);
|
||||
void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item);
|
||||
void SendEntityHeadLook (const cEntity & a_Entity);
|
||||
void SendEntityLook (const cEntity & a_Entity);
|
||||
|
@ -60,6 +60,7 @@ public:
|
||||
virtual void SendCollectPickup (const cPickup & a_Pickup, const cPlayer & a_Player) = 0;
|
||||
virtual void SendDestroyEntity (const cEntity & a_Entity) = 0;
|
||||
virtual void SendDisconnect (const AString & a_Reason) = 0;
|
||||
virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) = 0; ///< Request the client to open up the sign editor for the sign (1.6+)
|
||||
virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) = 0;
|
||||
virtual void SendEntityHeadLook (const cEntity & a_Entity) = 0;
|
||||
virtual void SendEntityLook (const cEntity & a_Entity) = 0;
|
||||
|
@ -278,6 +278,19 @@ void cProtocol125::SendDisconnect(const AString & a_Reason)
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol125::SendEditSign(int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
{
|
||||
// This protocol version doesn't support this packet, sign editor is invoked by the client automatically
|
||||
UNUSED(a_BlockX);
|
||||
UNUSED(a_BlockY);
|
||||
UNUSED(a_BlockZ);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol125::SendEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item)
|
||||
{
|
||||
cCSLock Lock(m_CSPacket);
|
||||
|
@ -37,6 +37,7 @@ public:
|
||||
virtual void SendCollectPickup (const cPickup & a_Pickup, const cPlayer & a_Player) override;
|
||||
virtual void SendDestroyEntity (const cEntity & a_Entity) override;
|
||||
virtual void SendDisconnect (const AString & a_Reason) override;
|
||||
virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) override; ///< Request the client to open up the sign editor for the sign (1.6+)
|
||||
virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override;
|
||||
virtual void SendEntityHeadLook (const cEntity & a_Entity) override;
|
||||
virtual void SendEntityLook (const cEntity & a_Entity) override;
|
||||
|
@ -43,6 +43,7 @@ enum
|
||||
PACKET_ATTACH_ENTITY = 0x27,
|
||||
PACKET_ENTITY_PROPERTIES = 0x2c,
|
||||
PACKET_WINDOW_OPEN = 0x64,
|
||||
PACKET_TILE_EDITOR_OPEN = 0x85,
|
||||
PACKET_PLAYER_ABILITIES = 0xca,
|
||||
} ;
|
||||
|
||||
@ -84,6 +85,22 @@ void cProtocol161::SendChat(const AString & a_Message)
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol161::SendEditSign(int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
{
|
||||
cCSLock Lock(m_CSPacket);
|
||||
WriteByte(PACKET_TILE_EDITOR_OPEN);
|
||||
WriteByte(0);
|
||||
WriteInt(a_BlockX);
|
||||
WriteInt(a_BlockY);
|
||||
WriteInt(a_BlockZ);
|
||||
Flush();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol161::SendGameMode(eGameMode a_GameMode)
|
||||
{
|
||||
super::SendGameMode(a_GameMode);
|
||||
|
@ -35,6 +35,7 @@ protected:
|
||||
// cProtocol150 overrides:
|
||||
virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle) override;
|
||||
virtual void SendChat (const AString & a_Message) override;
|
||||
virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) override; ///< Request the client to open up the sign editor for the sign (1.6+)
|
||||
virtual void SendGameMode (eGameMode a_GameMode) override;
|
||||
virtual void SendHealth (void) override;
|
||||
virtual void SendPlayerMaxSpeed(void) override;
|
||||
|
@ -201,6 +201,16 @@ void cProtocolRecognizer::SendDisconnect(const AString & a_Reason)
|
||||
|
||||
|
||||
|
||||
void cProtocolRecognizer::SendEditSign(int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
{
|
||||
ASSERT(m_Protocol != NULL);
|
||||
m_Protocol->SendEditSign(a_BlockX, a_BlockY, a_BlockZ);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocolRecognizer::SendEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item)
|
||||
{
|
||||
ASSERT(m_Protocol != NULL);
|
||||
|
@ -67,6 +67,7 @@ public:
|
||||
virtual void SendCollectPickup (const cPickup & a_Pickup, const cPlayer & a_Player) override;
|
||||
virtual void SendDestroyEntity (const cEntity & a_Entity) override;
|
||||
virtual void SendDisconnect (const AString & a_Reason) override;
|
||||
virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) override; ///< Request the client to open up the sign editor for the sign (1.6+)
|
||||
virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override;
|
||||
virtual void SendEntityHeadLook (const cEntity & a_Entity) override;
|
||||
virtual void SendEntityLook (const cEntity & a_Entity) override;
|
||||
|
Loading…
Reference in New Issue
Block a user