summaryrefslogtreecommitdiffstats
path: root/source/cChestEntity.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-09-20 15:25:54 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-09-20 15:25:54 +0200
commitbc466f07a454271d4845a7e8c7f0822541c5afbd (patch)
treec8455a2af322bbd847b6b4ea74256b78aa834c4c /source/cChestEntity.cpp
parentProtoProxy: moar packets! (can now sustain parsing while connected to vanilla server, most of the times) (diff)
downloadcuberite-bc466f07a454271d4845a7e8c7f0822541c5afbd.tar
cuberite-bc466f07a454271d4845a7e8c7f0822541c5afbd.tar.gz
cuberite-bc466f07a454271d4845a7e8c7f0822541c5afbd.tar.bz2
cuberite-bc466f07a454271d4845a7e8c7f0822541c5afbd.tar.lz
cuberite-bc466f07a454271d4845a7e8c7f0822541c5afbd.tar.xz
cuberite-bc466f07a454271d4845a7e8c7f0822541c5afbd.tar.zst
cuberite-bc466f07a454271d4845a7e8c7f0822541c5afbd.zip
Diffstat (limited to 'source/cChestEntity.cpp')
-rw-r--r--source/cChestEntity.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/source/cChestEntity.cpp b/source/cChestEntity.cpp
index 2a69c7bdb..8914f5f41 100644
--- a/source/cChestEntity.cpp
+++ b/source/cChestEntity.cpp
@@ -5,7 +5,7 @@
#include "cItem.h"
#include "cClientHandle.h"
#include "cPlayer.h"
-#include "cWindow.h"
+#include "UI/cWindow.h"
#include "cWorld.h"
#include "cRoot.h"
#include "cPickup.h"
@@ -88,9 +88,9 @@ const cItem * cChestEntity::GetSlot( int a_Slot ) const
-void cChestEntity::SetSlot( int a_Slot, cItem & a_Item )
+void cChestEntity::SetSlot(int a_Slot, const cItem & a_Item)
{
- if( a_Slot > -1 && a_Slot < c_ChestHeight*c_ChestWidth )
+ if ((a_Slot > -1) && (a_Slot < c_ChestHeight * c_ChestWidth))
{
m_Content[a_Slot] = a_Item;
}
@@ -170,22 +170,18 @@ void cChestEntity::SendTo(cClientHandle & a_Client)
void cChestEntity::UsedBy(cPlayer * a_Player)
{
- if (!GetWindow())
+ if (GetWindow() == NULL)
{
- cWindow * Window = new cWindow(this, true, cWindow::Chest, 1);
- Window->SetSlots(GetContents(), GetChestHeight() * c_ChestWidth);
- Window->SetWindowTitle("UberChest");
- OpenWindow( Window );
+ OpenWindow(new cChestWindow(m_PosX, m_PosY, m_PosZ, this));
}
- if ( GetWindow() )
+ if (GetWindow())
{
if( a_Player->GetWindow() != GetWindow() )
{
a_Player->OpenWindow( GetWindow() );
- GetWindow()->SendWholeWindow( a_Player->GetClientHandle() );
+ GetWindow()->SendWholeWindow(*a_Player->GetClientHandle());
}
}
- m_World->BroadcastBlockAction(m_PosX, m_PosY, m_PosZ, 1, 1, E_BLOCK_CHEST);
// This is rather a hack
// Instead of marking the chunk as dirty upon chest contents change, we mark it dirty now