summaryrefslogtreecommitdiffstats
path: root/source/UI
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
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')
-rw-r--r--source/UI/Window.cpp41
-rw-r--r--source/UI/Window.h3
2 files changed, 34 insertions, 10 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);
}
diff --git a/source/UI/Window.h b/source/UI/Window.h
index 8caab3bd1..a570ed480 100644
--- a/source/UI/Window.h
+++ b/source/UI/Window.h
@@ -152,7 +152,8 @@ class cChestWindow :
public cWindow
{
public:
- cChestWindow(int a_BlockX, int a_BlockY, int a_BlockZ, cChestEntity * a_Chest);
+ cChestWindow(cChestEntity * a_Chest);
+ cChestWindow(cChestEntity * a_PrimaryChest, cChestEntity * a_SecondaryChest);
~cChestWindow();
protected: