summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorarchshift <admin@archshift.com>2014-04-27 19:01:50 +0200
committerarchshift <admin@archshift.com>2014-04-27 19:01:50 +0200
commit75bb36574b4bb78e8b5975bf905a97402fd8a4bb (patch)
treeaab62533271bdbf2d46be2b68d0a0c5b0ac1906b /src
parentAdded static const, initialized fields. (diff)
downloadcuberite-75bb36574b4bb78e8b5975bf905a97402fd8a4bb.tar
cuberite-75bb36574b4bb78e8b5975bf905a97402fd8a4bb.tar.gz
cuberite-75bb36574b4bb78e8b5975bf905a97402fd8a4bb.tar.bz2
cuberite-75bb36574b4bb78e8b5975bf905a97402fd8a4bb.tar.lz
cuberite-75bb36574b4bb78e8b5975bf905a97402fd8a4bb.tar.xz
cuberite-75bb36574b4bb78e8b5975bf905a97402fd8a4bb.tar.zst
cuberite-75bb36574b4bb78e8b5975bf905a97402fd8a4bb.zip
Diffstat (limited to 'src')
-rw-r--r--src/Items/ItemThrowable.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/Items/ItemThrowable.h b/src/Items/ItemThrowable.h
index c6a4e714e..f1ebb4508 100644
--- a/src/Items/ItemThrowable.h
+++ b/src/Items/ItemThrowable.h
@@ -89,6 +89,22 @@ public:
super(E_ITEM_ENDER_PEARL, cProjectileEntity::pkEnderPearl, 30)
{
}
+
+ virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override
+ {
+ // Creative players cannot throw ender pearls.
+ if (a_Player->IsGameModeCreative())
+ {
+ return false;
+ }
+
+ 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, a_Player->GetEquippedItem(), &Speed);
+
+ return true;
+ }
} ;