2015-09-24 04:48:33 -04:00
|
|
|
|
|
|
|
// BrewingstandWindow.cpp
|
|
|
|
|
|
|
|
// Representing the UI window for the brewing stand block
|
|
|
|
|
|
|
|
#include "Globals.h"
|
|
|
|
#include "BrewingstandWindow.h"
|
|
|
|
#include "SlotArea.h"
|
|
|
|
#include "../BrewingRecipes.h"
|
|
|
|
#include "../Root.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-09-29 08:59:24 -04:00
|
|
|
cBrewingstandWindow::cBrewingstandWindow(cBrewingstandEntity * a_Brewingstand):
|
2020-04-13 12:38:06 -04:00
|
|
|
Super(wtBrewery, "Brewingstand")
|
2015-09-24 04:48:33 -04:00
|
|
|
{
|
|
|
|
m_SlotAreas.push_back(new cSlotAreaBrewingstand(a_Brewingstand, *this));
|
|
|
|
m_SlotAreas.push_back(new cSlotAreaInventory(*this));
|
|
|
|
m_SlotAreas.push_back(new cSlotAreaHotBar(*this));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void cBrewingstandWindow::DistributeStack(cItem & a_ItemStack, int a_Slot, cPlayer & a_Player, cSlotArea * a_ClickedArea, bool a_ShouldApply)
|
|
|
|
{
|
|
|
|
cSlotAreas AreasInOrder;
|
|
|
|
|
|
|
|
if (a_ClickedArea == m_SlotAreas[0])
|
|
|
|
{
|
2017-05-05 05:58:21 -04:00
|
|
|
if ((a_Slot >= 0) && (a_Slot <= 4))
|
2015-09-24 04:48:33 -04:00
|
|
|
{
|
2017-05-05 05:58:21 -04:00
|
|
|
// Brewing stand Area
|
2015-09-24 04:48:33 -04:00
|
|
|
AreasInOrder.push_back(m_SlotAreas[2]); /* Hotbar */
|
|
|
|
AreasInOrder.push_back(m_SlotAreas[1]); /* Inventory */
|
2020-04-13 12:38:06 -04:00
|
|
|
Super::DistributeStackToAreas(a_ItemStack, a_Player, AreasInOrder, a_ShouldApply, true);
|
2015-09-24 04:48:33 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
AreasInOrder.push_back(m_SlotAreas[1]); /* Inventory */
|
|
|
|
AreasInOrder.push_back(m_SlotAreas[2]); /* Hotbar */
|
2020-04-13 12:38:06 -04:00
|
|
|
Super::DistributeStackToAreas(a_ItemStack, a_Player, AreasInOrder, a_ShouldApply, false);
|
2015-09-24 04:48:33 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cBrewingRecipes * BR = cRoot::Get()->GetBrewingRecipes();
|
2017-05-05 05:58:21 -04:00
|
|
|
if ((BR->IsBottle(a_ItemStack)) || (BR->IsIngredient(a_ItemStack)) || BR->IsFuel(a_ItemStack))
|
2015-09-24 04:48:33 -04:00
|
|
|
{
|
|
|
|
AreasInOrder.push_back(m_SlotAreas[0]); /* brewing stand Area */
|
|
|
|
}
|
|
|
|
else if (a_ClickedArea == m_SlotAreas[1])
|
|
|
|
{
|
|
|
|
// Inventory Area
|
|
|
|
AreasInOrder.push_back(m_SlotAreas[2]); /* Hotbar */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Hotbar Area
|
|
|
|
AreasInOrder.push_back(m_SlotAreas[1]); /* Inventory */
|
|
|
|
}
|
|
|
|
|
2020-04-13 12:38:06 -04:00
|
|
|
Super::DistributeStackToAreas(a_ItemStack, a_Player, AreasInOrder, a_ShouldApply, false);
|
2015-09-24 04:48:33 -04:00
|
|
|
}
|
|
|
|
}
|