Merge remote-tracking branch 'upstream/master' into Enchanting
This commit is contained in:
@@ -13,7 +13,8 @@
|
||||
#include "../BlockEntities/DropSpenserEntity.h"
|
||||
#include "../BlockEntities/EnderChestEntity.h"
|
||||
#include "../BlockEntities/HopperEntity.h"
|
||||
|
||||
#include "../Root.h"
|
||||
#include "../Bindings/PluginManager.h"
|
||||
|
||||
|
||||
|
||||
@@ -169,6 +170,7 @@ void cWindow::Clicked(
|
||||
const cItem & a_ClickedItem
|
||||
)
|
||||
{
|
||||
cPluginManager * PlgMgr = cRoot::Get()->GetPluginManager();
|
||||
if (a_WindowID != m_WindowID)
|
||||
{
|
||||
LOGWARNING("%s: Wrong window ID (exp %d, got %d) received from \"%s\"; ignoring click.", __FUNCTION__, m_WindowID, a_WindowID, a_Player.GetName().c_str());
|
||||
@@ -179,14 +181,35 @@ void cWindow::Clicked(
|
||||
{
|
||||
case caRightClickOutside:
|
||||
{
|
||||
if (PlgMgr->CallHookPlayerTossingItem(a_Player))
|
||||
{
|
||||
// A plugin doesn't agree with the tossing. The plugin itself is responsible for handling the consequences (possible inventory mismatch)
|
||||
return;
|
||||
}
|
||||
if (a_Player.IsGameModeCreative())
|
||||
{
|
||||
a_Player.TossPickup(a_ClickedItem);
|
||||
}
|
||||
|
||||
// Toss one of the dragged items:
|
||||
a_Player.TossItem(true);
|
||||
a_Player.TossHeldItem();
|
||||
return;
|
||||
}
|
||||
case caLeftClickOutside:
|
||||
{
|
||||
if (PlgMgr->CallHookPlayerTossingItem(a_Player))
|
||||
{
|
||||
// A plugin doesn't agree with the tossing. The plugin itself is responsible for handling the consequences (possible inventory mismatch)
|
||||
return;
|
||||
}
|
||||
|
||||
if (a_Player.IsGameModeCreative())
|
||||
{
|
||||
a_Player.TossPickup(a_ClickedItem);
|
||||
}
|
||||
|
||||
// Toss all dragged items:
|
||||
a_Player.TossItem(true, a_Player.GetDraggingItem().m_ItemCount);
|
||||
a_Player.TossHeldItem(a_Player.GetDraggingItem().m_ItemCount);
|
||||
return;
|
||||
}
|
||||
case caLeftClickOutsideHoldNothing:
|
||||
@@ -263,7 +286,7 @@ bool cWindow::ClosedByPlayer(cPlayer & a_Player, bool a_CanRefuse)
|
||||
if (a_Player.IsDraggingItem())
|
||||
{
|
||||
LOGD("Player holds item! Dropping it...");
|
||||
a_Player.TossItem(true, a_Player.GetDraggingItem().m_ItemCount);
|
||||
a_Player.TossHeldItem(a_Player.GetDraggingItem().m_ItemCount);
|
||||
}
|
||||
|
||||
cClientHandle * ClientHandle = a_Player.GetClientHandle();
|
||||
@@ -614,7 +637,7 @@ int cWindow::DistributeItemToSlots(cPlayer & a_Player, const cItem & a_Item, int
|
||||
{
|
||||
if ((size_t)(a_Item.m_ItemCount) < a_SlotNums.size())
|
||||
{
|
||||
LOGWARNING("%s: Distributing less items (%d) than slots (%u)", __FUNCTION__, (int)a_Item.m_ItemCount, a_SlotNums.size());
|
||||
LOGWARNING("%s: Distributing less items (%d) than slots (" SIZE_T_FMT ")", __FUNCTION__, (int)a_Item.m_ItemCount, a_SlotNums.size());
|
||||
// This doesn't seem to happen with the 1.5.1 client, so we don't worry about it for now
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user