From 0bacda32692729e4b9743f91d92cd329e198d73a Mon Sep 17 00:00:00 2001 From: peterbell10 Date: Sat, 21 Oct 2017 17:56:09 +0100 Subject: Implement horse inventory (#4053) * Implement horse inventory * Fix sign conversions * Add API doc for ItemCategory::IsHorseArmor * Improve HandleOpenHorseInventory comment and style fixes. --- src/Protocol/Protocol_1_8.cpp | 5 ++++- src/Protocol/Protocol_1_9.cpp | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src/Protocol') diff --git a/src/Protocol/Protocol_1_8.cpp b/src/Protocol/Protocol_1_8.cpp index c384f85b9..e7f197d3d 100644 --- a/src/Protocol/Protocol_1_8.cpp +++ b/src/Protocol/Protocol_1_8.cpp @@ -39,6 +39,7 @@ Implements the 1.8 protocol classes: #include "../Mobs/IncludeAllMonsters.h" #include "../UI/Window.h" +#include "../UI/HorseWindow.h" #include "../BlockEntities/BeaconEntity.h" #include "../BlockEntities/CommandBlockEntity.h" @@ -1678,7 +1679,8 @@ void cProtocol_1_8_0::SendWindowOpen(const cWindow & a_Window) if (a_Window.GetWindowType() == cWindow::wtAnimalChest) { - Pkt.WriteBEInt32(0); // TODO: The animal's EntityID + UInt32 HorseID = static_cast(a_Window).GetHorseID(); + Pkt.WriteBEInt32(static_cast(HorseID)); } } @@ -2428,6 +2430,7 @@ void cProtocol_1_8_0::HandlePacketEntityAction(cByteBuffer & a_ByteBuffer) case 2: m_Client->HandleEntityLeaveBed(PlayerID); break; // Leave Bed case 3: m_Client->HandleEntitySprinting(PlayerID, true); break; // Start sprinting case 4: m_Client->HandleEntitySprinting(PlayerID, false); break; // Stop sprinting + case 6: m_Client->HandleOpenHorseInventory(PlayerID); break; // Open horse inventory } } diff --git a/src/Protocol/Protocol_1_9.cpp b/src/Protocol/Protocol_1_9.cpp index fcfc6674a..9dcf8e3aa 100644 --- a/src/Protocol/Protocol_1_9.cpp +++ b/src/Protocol/Protocol_1_9.cpp @@ -48,6 +48,7 @@ Implements the 1.9 protocol classes: #include "../Mobs/IncludeAllMonsters.h" #include "../UI/Window.h" +#include "../UI/HorseWindow.h" #include "../BlockEntities/BeaconEntity.h" #include "../BlockEntities/CommandBlockEntity.h" @@ -1723,7 +1724,8 @@ void cProtocol_1_9_0::SendWindowOpen(const cWindow & a_Window) if (a_Window.GetWindowType() == cWindow::wtAnimalChest) { - Pkt.WriteBEInt32(0); // TODO: The animal's EntityID + UInt32 HorseID = static_cast(a_Window).GetHorseID(); + Pkt.WriteBEInt32(static_cast(HorseID)); } } @@ -2517,6 +2519,7 @@ void cProtocol_1_9_0::HandlePacketEntityAction(cByteBuffer & a_ByteBuffer) case 2: m_Client->HandleEntityLeaveBed(PlayerID); break; // Leave Bed case 3: m_Client->HandleEntitySprinting(PlayerID, true); break; // Start sprinting case 4: m_Client->HandleEntitySprinting(PlayerID, false); break; // Stop sprinting + case 7: m_Client->HandleOpenHorseInventory(PlayerID); break; // Open horse inventory } } -- cgit v1.2.3