summaryrefslogtreecommitdiffstats
path: root/source/Items/ItemThrowable.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-11-02 15:08:00 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-11-02 15:08:00 +0100
commit77b3db7e25c401d4ff78ee4fe291880df441a6fe (patch)
tree833472405110d46701276e1da3cbca5f9831da98 /source/Items/ItemThrowable.h
parentProtocol 1.7: Implemented the first batch of sent packets. (diff)
downloadcuberite-77b3db7e25c401d4ff78ee4fe291880df441a6fe.tar
cuberite-77b3db7e25c401d4ff78ee4fe291880df441a6fe.tar.gz
cuberite-77b3db7e25c401d4ff78ee4fe291880df441a6fe.tar.bz2
cuberite-77b3db7e25c401d4ff78ee4fe291880df441a6fe.tar.lz
cuberite-77b3db7e25c401d4ff78ee4fe291880df441a6fe.tar.xz
cuberite-77b3db7e25c401d4ff78ee4fe291880df441a6fe.tar.zst
cuberite-77b3db7e25c401d4ff78ee4fe291880df441a6fe.zip
Diffstat (limited to '')
-rw-r--r--source/Items/ItemThrowable.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/Items/ItemThrowable.h b/source/Items/ItemThrowable.h
index dacdb6157..85579daf2 100644
--- a/source/Items/ItemThrowable.h
+++ b/source/Items/ItemThrowable.h
@@ -28,9 +28,15 @@ public:
virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir) override
{
+ if (!a_Player->IsGameModeCreative())
+ {
+ a_Player->GetInventory().RemoveOneEquippedItem();
+ }
+
Vector3d Pos = a_Player->GetThrowStartPos();
Vector3d Speed = a_Player->GetLookVector() * m_SpeedCoeff;
a_World->CreateProjectile(Pos.x, Pos.y, Pos.z, m_ProjectileKind, a_Player, &Speed);
+
return true;
}