summaryrefslogtreecommitdiffstats
path: root/source/Items/ItemThrowable.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-11-16 21:58:17 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-11-16 21:58:17 +0100
commit6ff6929ca6c599418f98fe750c04a76774075c18 (patch)
tree8587e70a6f698240c4c2c3e693d4d77128b8477c /source/Items/ItemThrowable.h
parentSwitchified If, ElseIf statement (diff)
downloadcuberite-6ff6929ca6c599418f98fe750c04a76774075c18.tar
cuberite-6ff6929ca6c599418f98fe750c04a76774075c18.tar.gz
cuberite-6ff6929ca6c599418f98fe750c04a76774075c18.tar.bz2
cuberite-6ff6929ca6c599418f98fe750c04a76774075c18.tar.lz
cuberite-6ff6929ca6c599418f98fe750c04a76774075c18.tar.xz
cuberite-6ff6929ca6c599418f98fe750c04a76774075c18.tar.zst
cuberite-6ff6929ca6c599418f98fe750c04a76774075c18.zip
Diffstat (limited to '')
-rw-r--r--source/Items/ItemThrowable.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/source/Items/ItemThrowable.h b/source/Items/ItemThrowable.h
index 85579daf2..fc24e775a 100644
--- a/source/Items/ItemThrowable.h
+++ b/source/Items/ItemThrowable.h
@@ -94,3 +94,47 @@ public:
+
+class cItemBottleOEnchantingHandler :
+ public cItemThrowableHandler
+{
+ typedef cItemThrowableHandler super;
+public:
+ cItemBottleOEnchantingHandler(void) :
+ super(E_ITEM_BOTTLE_O_ENCHANTING, cProjectileEntity::pkExpBottle, 10)
+ {
+ }
+};
+
+
+
+
+
+class cItemFireworkHandler :
+ public cItemThrowableHandler
+{
+ typedef cItemThrowableHandler super;
+public:
+ cItemFireworkHandler(void) :
+ super(E_ITEM_FIREWORK_ROCKET, cProjectileEntity::pkFirework, 0)
+ {
+ }
+
+ 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_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ) == E_BLOCK_AIR)
+ {
+ return false;
+ }
+
+ if (!a_Player->IsGameModeCreative())
+ {
+ a_Player->GetInventory().RemoveOneEquippedItem();
+ }
+
+ a_World->CreateProjectile(a_BlockX + 0.5, a_BlockY + 1, a_BlockZ + 0.5, m_ProjectileKind, a_Player, 0);
+
+ return true;
+ }
+
+}; \ No newline at end of file