summaryrefslogtreecommitdiffstats
path: root/source/cCraftingWindow.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-06-06 22:18:50 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-06-06 22:18:50 +0200
commit1cca9b13b3d320ff767cfc552413265b2ef6e0d6 (patch)
treec1227f3f4141dbf2f85767a65cb9d2102a9d4010 /source/cCraftingWindow.cpp
parentBlockIDs, ItemIDs and Metas updated, courtesy of Taugeshtu (diff)
downloadcuberite-1cca9b13b3d320ff767cfc552413265b2ef6e0d6.tar
cuberite-1cca9b13b3d320ff767cfc552413265b2ef6e0d6.tar.gz
cuberite-1cca9b13b3d320ff767cfc552413265b2ef6e0d6.tar.bz2
cuberite-1cca9b13b3d320ff767cfc552413265b2ef6e0d6.tar.lz
cuberite-1cca9b13b3d320ff767cfc552413265b2ef6e0d6.tar.xz
cuberite-1cca9b13b3d320ff767cfc552413265b2ef6e0d6.tar.zst
cuberite-1cca9b13b3d320ff767cfc552413265b2ef6e0d6.zip
Diffstat (limited to '')
-rw-r--r--source/cCraftingWindow.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/source/cCraftingWindow.cpp b/source/cCraftingWindow.cpp
index 94bc3cde8..8d499c514 100644
--- a/source/cCraftingWindow.cpp
+++ b/source/cCraftingWindow.cpp
@@ -10,6 +10,7 @@
#include "cInventory.h"
#include "cPickup.h"
#include "cRoot.h"
+#include "cWorld.h"
#include "packets/cPacket_WindowClick.h"
#include "packets/cPacket_InventorySlot.h"
@@ -116,23 +117,24 @@ void cCraftingWindow::Clicked( cPacket_WindowClick* a_ClickPacket, cPlayer & a_P
-void cCraftingWindow::Close( cPlayer & a_Player )
+void cCraftingWindow::Close(cPlayer & a_Player)
{
// Start from slot 1, don't drop what's in the result slot
+ cItems Drops;
for( int i = 1; i < GetNumSlots(); i++ )
{
- cItem* Item = GetSlot( i );
- if( Item->m_ItemID > 0 && Item->m_ItemCount > 0 )
+ cItem * Item = GetSlot(i);
+ if (!Item->IsEmpty())
{
- float vX = 0, vY = 0, vZ = 0;
- EulerToVector( -a_Player.GetRotation(), a_Player.GetPitch(), vZ, vX, vY );
- vY = -vY*2 + 1.f;
- cPickup* Pickup = new cPickup( (int)(a_Player.GetPosX()*32), (int)(a_Player.GetPosY()*32) + (int)(1.6f*32), (int)(a_Player.GetPosZ()*32), *Item, vX*2, vY*2, vZ*2 );
- Pickup->Initialize( a_Player.GetWorld() );
+ Drops.push_back(*Item);
}
Item->Empty();
}
- cWindow::Close( a_Player );
+ float vX = 0, vY = 0, vZ = 0;
+ EulerToVector( -a_Player.GetRotation(), a_Player.GetPitch(), vZ, vX, vY);
+ vY = -vY*2 + 1.f;
+ a_Player.GetWorld()->SpawnItemPickups(Drops, a_Player.GetPosX(), a_Player.GetPosY() + 1.6f, a_Player.GetPosZ(), vX * 2, vY * 2, vZ * 2);
+ cWindow::Close(a_Player);
}