summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemEyeOfEnder.h
diff options
context:
space:
mode:
authorZach DeCook <zachdecook@gmail.com>2019-05-11 21:43:26 +0200
committerpeterbell10 <peterbell10@live.co.uk>2019-05-11 21:43:26 +0200
commit24a8456f79aa35cfe8c3859c880e1bffeae088c6 (patch)
tree58514d88b25a7771827211fbcf8d547f523de2eb /src/Items/ItemEyeOfEnder.h
parentBuckets: Be able to place fluids through other fluids. (#4331) (diff)
downloadcuberite-24a8456f79aa35cfe8c3859c880e1bffeae088c6.tar
cuberite-24a8456f79aa35cfe8c3859c880e1bffeae088c6.tar.gz
cuberite-24a8456f79aa35cfe8c3859c880e1bffeae088c6.tar.bz2
cuberite-24a8456f79aa35cfe8c3859c880e1bffeae088c6.tar.lz
cuberite-24a8456f79aa35cfe8c3859c880e1bffeae088c6.tar.xz
cuberite-24a8456f79aa35cfe8c3859c880e1bffeae088c6.tar.zst
cuberite-24a8456f79aa35cfe8c3859c880e1bffeae088c6.zip
Diffstat (limited to 'src/Items/ItemEyeOfEnder.h')
-rw-r--r--src/Items/ItemEyeOfEnder.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/Items/ItemEyeOfEnder.h b/src/Items/ItemEyeOfEnder.h
new file mode 100644
index 000000000..f911955a1
--- /dev/null
+++ b/src/Items/ItemEyeOfEnder.h
@@ -0,0 +1,59 @@
+
+#pragma once
+
+#include "ItemHandler.h"
+#include "ItemThrowable.h"
+
+
+
+
+
+class cItemEyeOfEnderHandler :
+ public cItemThrowableHandler
+{
+ typedef cItemThrowableHandler super;
+public:
+ cItemEyeOfEnderHandler(void) :
+ super(E_ITEM_EYE_OF_ENDER, cProjectileEntity::pkSnowball, 30)
+ {
+ }
+
+ virtual bool OnItemUse(
+ cWorld * a_World, cPlayer * a_Player, cBlockPluginInterface & a_PluginInterface, const cItem & a_Item,
+ int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace
+ ) override
+ {
+ BLOCKTYPE FacingBlock;
+ NIBBLETYPE FacingMeta;
+ a_World->GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, FacingBlock, FacingMeta);
+ switch (FacingBlock)
+ {
+ case E_BLOCK_END_PORTAL_FRAME:
+ {
+ // Fill the portal frame. E_META_END_PORTAL_EYE is the bit for holding the eye of ender.
+ if ((FacingMeta & E_META_END_PORTAL_FRAME_EYE) != E_META_END_PORTAL_FRAME_EYE)
+ {
+ a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_END_PORTAL_FRAME, FacingMeta | E_META_END_PORTAL_FRAME_EYE);
+ if (!a_Player->IsGameModeCreative())
+ {
+ a_Player->GetInventory().RemoveOneEquippedItem();
+ }
+ }
+ break;
+ }
+ default:
+ {
+ // TODO: Create projectile for Eye Of Ender
+ // return cItemThrowableHandler::OnItemUse(a_World, a_Player, a_PluginInterface, a_Item, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace);
+ }
+ }
+
+ return false;
+ }
+
+} ;
+
+
+
+
+