summaryrefslogtreecommitdiffstats
path: root/source/UI/Window.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-10-20 23:53:09 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-10-20 23:53:09 +0200
commite30bec4fd6aedbe70e39640d6b1c78157aa1b38b (patch)
tree63b964427f37752ac639a134a89ac792d3917120 /source/UI/Window.cpp
parentProtoProxy: ListenPort and ConnectPort are now settable on commandline, the defaults have switched (listens on 25564, connects to localhost:25565) (diff)
downloadcuberite-e30bec4fd6aedbe70e39640d6b1c78157aa1b38b.tar
cuberite-e30bec4fd6aedbe70e39640d6b1c78157aa1b38b.tar.gz
cuberite-e30bec4fd6aedbe70e39640d6b1c78157aa1b38b.tar.bz2
cuberite-e30bec4fd6aedbe70e39640d6b1c78157aa1b38b.tar.lz
cuberite-e30bec4fd6aedbe70e39640d6b1c78157aa1b38b.tar.xz
cuberite-e30bec4fd6aedbe70e39640d6b1c78157aa1b38b.tar.zst
cuberite-e30bec4fd6aedbe70e39640d6b1c78157aa1b38b.zip
Diffstat (limited to 'source/UI/Window.cpp')
-rw-r--r--source/UI/Window.cpp41
1 files changed, 32 insertions, 9 deletions
diff --git a/source/UI/Window.cpp b/source/UI/Window.cpp
index 0c955ba57..dc5587390 100644
--- a/source/UI/Window.cpp
+++ b/source/UI/Window.cpp
@@ -155,8 +155,6 @@ void cWindow::OpenedByPlayer(cPlayer & a_Player)
} // for itr - m_SlotAreas[]
}
- // TODO: Notify all areas that a new player has opened the window
-
a_Player.GetClientHandle()->SendWindowOpen(m_WindowID, m_WindowType, m_WindowTitle, GetNumSlots() - c_NumInventorySlots);
}
@@ -405,20 +403,43 @@ cCraftingWindow::cCraftingWindow(int a_BlockX, int a_BlockY, int a_BlockZ) :
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cChestWindow:
-cChestWindow::cChestWindow(int a_BlockX, int a_BlockY, int a_BlockZ, cChestEntity * a_Chest) :
- cWindow(cWindow::Chest, "MCS-Chest"),
+cChestWindow::cChestWindow(cChestEntity * a_Chest) :
+ cWindow(cWindow::Chest, "MCS-SingleChest"),
m_World(a_Chest->GetWorld()),
- m_BlockX(a_BlockX),
- m_BlockY(a_BlockY),
- m_BlockZ(a_BlockZ)
+ m_BlockX(a_Chest->GetPosX()),
+ m_BlockY(a_Chest->GetPosY()),
+ m_BlockZ(a_Chest->GetPosZ())
{
m_SlotAreas.push_back(new cSlotAreaChest(a_Chest, *this));
+ m_SlotAreas.push_back(new cSlotAreaInventory(*this));
+ m_SlotAreas.push_back(new cSlotAreaHotBar(*this));
- // TODO: Double chests
-
+ // Play the opening sound:
+ m_World->BroadcastSoundEffect("random.chestopen", m_BlockX * 8, m_BlockY * 8, m_BlockZ * 8, 1, 1);
+
+ // Send out the chest-open packet:
+ m_World->BroadcastBlockAction(m_BlockX, m_BlockY, m_BlockZ, 1, 1, E_BLOCK_CHEST);
+}
+
+
+
+
+
+cChestWindow::cChestWindow(cChestEntity * a_PrimaryChest, cChestEntity * a_SecondaryChest) :
+ cWindow(cWindow::Chest, "MCS-DoubleChest"),
+ m_World(a_PrimaryChest->GetWorld()),
+ m_BlockX(a_PrimaryChest->GetPosX()),
+ m_BlockY(a_PrimaryChest->GetPosY()),
+ m_BlockZ(a_PrimaryChest->GetPosZ())
+{
+ m_SlotAreas.push_back(new cSlotAreaChest(a_PrimaryChest, *this));
+ m_SlotAreas.push_back(new cSlotAreaChest(a_SecondaryChest, *this));
m_SlotAreas.push_back(new cSlotAreaInventory(*this));
m_SlotAreas.push_back(new cSlotAreaHotBar(*this));
+ // Play the opening sound:
+ m_World->BroadcastSoundEffect("random.chestopen", m_BlockX * 8, m_BlockY * 8, m_BlockZ * 8, 1, 1);
+
// Send out the chest-open packet:
m_World->BroadcastBlockAction(m_BlockX, m_BlockY, m_BlockZ, 1, 1, E_BLOCK_CHEST);
}
@@ -431,6 +452,8 @@ cChestWindow::~cChestWindow()
{
// Send out the chest-close packet:
m_World->BroadcastBlockAction(m_BlockX, m_BlockY, m_BlockZ, 1, 0, E_BLOCK_CHEST);
+
+ m_World->BroadcastSoundEffect("random.chestclosed", m_BlockX * 8, m_BlockY * 8, m_BlockZ * 8, 1, 1);
}