summaryrefslogtreecommitdiffstats
path: root/source/cPlayer.cpp
diff options
context:
space:
mode:
authormtilden@gmail.com <mtilden@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-12-29 14:16:23 +0100
committermtilden@gmail.com <mtilden@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-12-29 14:16:23 +0100
commitc4f4ae5c7122c58af239a01328c168627ed68e27 (patch)
treea14c16b0e2b270caa465892a0d2a60adf2e3d78e /source/cPlayer.cpp
parent- Pickups should now burn in fire (diff)
downloadcuberite-c4f4ae5c7122c58af239a01328c168627ed68e27.tar
cuberite-c4f4ae5c7122c58af239a01328c168627ed68e27.tar.gz
cuberite-c4f4ae5c7122c58af239a01328c168627ed68e27.tar.bz2
cuberite-c4f4ae5c7122c58af239a01328c168627ed68e27.tar.lz
cuberite-c4f4ae5c7122c58af239a01328c168627ed68e27.tar.xz
cuberite-c4f4ae5c7122c58af239a01328c168627ed68e27.tar.zst
cuberite-c4f4ae5c7122c58af239a01328c168627ed68e27.zip
Diffstat (limited to '')
-rw-r--r--source/cPlayer.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/source/cPlayer.cpp b/source/cPlayer.cpp
index 92b16478a..820b11f8b 100644
--- a/source/cPlayer.cpp
+++ b/source/cPlayer.cpp
@@ -32,6 +32,7 @@
#include "packets/cPacket_Chat.h"
#include "packets/cPacket_NewInvalidState.h"
#include "packets/cPacket_PlayerListItem.h"
+#include "packets/cPacket_BlockAction.h"
#include "Vector3d.h"
#include "Vector3f.h"
@@ -377,8 +378,7 @@ void cPlayer::OpenWindow( cWindow* a_Window )
void cPlayer::CloseWindow(char a_WindowType)
{
- if( m_CurrentWindow ) m_CurrentWindow->Close( *this );
- if (a_WindowType == 0) {
+ if (a_WindowType == 0) { // Inventory
if(GetInventory().GetWindow()->GetDraggingItem() && GetInventory().GetWindow()->GetDraggingItem()->m_ItemCount > 0)
{
LOG("Player holds item! Dropping it...");
@@ -400,6 +400,23 @@ void cPlayer::CloseWindow(char a_WindowType)
Item->Empty();
}
}
+ if (a_WindowType == 1 && strcmp(m_CurrentWindow->GetWindowTitle().c_str(), "UberChest") == 0) { // Chest
+ cBlockEntity *block = m_CurrentWindow->GetOwner()->GetEntity();
+ cPacket_BlockAction ChestClose;
+ ChestClose.m_PosX = block->GetPosX();
+ ChestClose.m_PosY = (short)block->GetPosY();
+ ChestClose.m_PosZ = block->GetPosZ();
+ ChestClose.m_Byte1 = 1;
+ ChestClose.m_Byte2 = 0;
+ cWorld::PlayerList PlayerList = cRoot::Get()->GetWorld()->GetAllPlayers();
+ for( cWorld::PlayerList::iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr )
+ {
+ if ((*itr) && (*itr)->GetClientHandle() && !((*itr)->GetClientHandle()->IsDestroyed())) {
+ (*itr)->GetClientHandle()->Send( ChestClose );
+ }
+ }
+ }
+ if( m_CurrentWindow ) m_CurrentWindow->Close( *this );
m_CurrentWindow = 0;
}