2014-12-13 09:06:55 -05:00
|
|
|
|
|
|
|
// MinecartWithChestWindow.h
|
|
|
|
|
|
|
|
// Representing the UI window for the minecart chest entity
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Window.h"
|
|
|
|
#include "../Entities/Minecart.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class cMinecartWithChestWindow :
|
|
|
|
public cWindow
|
|
|
|
{
|
|
|
|
typedef cWindow super;
|
|
|
|
|
|
|
|
public:
|
|
|
|
cMinecartWithChestWindow(cMinecartWithChest * a_ChestCart) :
|
|
|
|
cWindow(wtChest, "Minecart with Chest"),
|
|
|
|
m_ChestCart(a_ChestCart)
|
|
|
|
{
|
|
|
|
m_SlotAreas.push_back(new cSlotAreaMinecartWithChest(a_ChestCart, *this));
|
|
|
|
m_SlotAreas.push_back(new cSlotAreaInventory(*this));
|
|
|
|
m_SlotAreas.push_back(new cSlotAreaHotBar(*this));
|
|
|
|
|
2017-02-15 00:05:24 -05:00
|
|
|
a_ChestCart->GetWorld()->BroadcastSoundEffect("block.chest.open", a_ChestCart->GetPosX(), a_ChestCart->GetPosY(), a_ChestCart->GetPosZ(), 1, 1);
|
2014-12-13 09:06:55 -05:00
|
|
|
}
|
|
|
|
|
2015-05-09 05:16:56 -04:00
|
|
|
virtual void DistributeStack(cItem & a_ItemStack, int a_Slot, cPlayer & a_Player, cSlotArea * a_ClickedArea, bool a_ShouldApply) override
|
2014-12-17 13:14:01 -05:00
|
|
|
{
|
|
|
|
cSlotAreas AreasInOrder;
|
|
|
|
|
|
|
|
if (a_ClickedArea == m_SlotAreas[0])
|
|
|
|
{
|
|
|
|
// Chest Area
|
|
|
|
AreasInOrder.push_back(m_SlotAreas[2]); /* Hotbar */
|
|
|
|
AreasInOrder.push_back(m_SlotAreas[1]); /* Inventory */
|
|
|
|
super::DistributeStackToAreas(a_ItemStack, a_Player, AreasInOrder, a_ShouldApply, true);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Hotbar or Inventory
|
|
|
|
AreasInOrder.push_back(m_SlotAreas[0]); /* Chest */
|
|
|
|
super::DistributeStackToAreas(a_ItemStack, a_Player, AreasInOrder, a_ShouldApply, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-05-20 02:16:28 -04:00
|
|
|
virtual ~cMinecartWithChestWindow() override
|
2014-12-13 09:06:55 -05:00
|
|
|
{
|
2017-02-15 00:05:24 -05:00
|
|
|
m_ChestCart->GetWorld()->BroadcastSoundEffect("block.chest.close", m_ChestCart->GetPosX(), m_ChestCart->GetPosY(), m_ChestCart->GetPosZ(), 1, 1);
|
2014-12-13 09:06:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
cMinecartWithChest * m_ChestCart;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|