From 3e802932a6797fc0f4768ebc61cf9ac4f498c7fb Mon Sep 17 00:00:00 2001 From: changyong guo Date: Mon, 23 Jul 2018 06:23:33 +0800 Subject: recover hotbar selected slot after reconnect (#4249) 1. implement protocol message SendHeldItemChange 2. add save / load inventory equipped item slot in JSON 3. send held item slot message after player connect to server Fixes #4189 --- src/ClientHandle.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/ClientHandle.cpp') diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index bbcb64d33..9ae0b4adc 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -417,6 +417,9 @@ void cClientHandle::FinishAuthenticate(const AString & a_Name, const cUUID & a_U // Send experience m_Player->SendExperience(); + // Send hotbar active slot + m_Player->SendHotbarActiveSlot(); + // Send player list items SendPlayerListAddPlayer(*m_Player); cRoot::Get()->BroadcastPlayerListsAddPlayer(*m_Player); @@ -2635,6 +2638,15 @@ void cClientHandle::SendHealth(void) +void cClientHandle::SendHeldItemChange(int a_ItemIndex) +{ + m_Protocol->SendHeldItemChange(a_ItemIndex); +} + + + + + void cClientHandle::SendHideTitle(void) { m_Protocol->SendHideTitle(); -- cgit v1.2.3