summaryrefslogtreecommitdiffstats
path: root/source/Items/ItemSpawnEgg.h
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-10-18 11:36:30 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-10-18 11:36:30 +0200
commit84da8a2353a75f6f95ab375fac13b035bb14b71f (patch)
tree3c6e276f98db1356acd7651678944f15f8361072 /source/Items/ItemSpawnEgg.h
parentFixed a vulnerability in cClientHandle::HandleRespawn() (diff)
downloadcuberite-84da8a2353a75f6f95ab375fac13b035bb14b71f.tar
cuberite-84da8a2353a75f6f95ab375fac13b035bb14b71f.tar.gz
cuberite-84da8a2353a75f6f95ab375fac13b035bb14b71f.tar.bz2
cuberite-84da8a2353a75f6f95ab375fac13b035bb14b71f.tar.lz
cuberite-84da8a2353a75f6f95ab375fac13b035bb14b71f.tar.xz
cuberite-84da8a2353a75f6f95ab375fac13b035bb14b71f.tar.zst
cuberite-84da8a2353a75f6f95ab375fac13b035bb14b71f.zip
Diffstat (limited to '')
-rw-r--r--source/Items/ItemSpawnEgg.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/source/Items/ItemSpawnEgg.h b/source/Items/ItemSpawnEgg.h
new file mode 100644
index 000000000..76b742328
--- /dev/null
+++ b/source/Items/ItemSpawnEgg.h
@@ -0,0 +1,69 @@
+
+#pragma once
+
+#include "ItemHandler.h"
+#include "../World.h"
+#include "../Player.h"
+
+// Mobs:
+#include "../Mobs/Chicken.h"
+#include "../Mobs/Spider.h"
+#include "../Mobs/Cow.h"
+#include "../Mobs/Squid.h"
+#include "../Mobs/Wolf.h"
+#include "../Mobs/Slime.h"
+#include "../Mobs/Skeleton.h"
+#include "../Mobs/Silverfish.h"
+#include "../Mobs/Pig.h"
+#include "../Mobs/Sheep.h"
+#include "../Mobs/Zombie.h"
+#include "../Mobs/Enderman.h"
+#include "../Mobs/Creeper.h"
+#include "../Mobs/Cavespider.h"
+#include "../Mobs/Ghast.h"
+#include "../Mobs/Zombiepigman.h"
+
+
+
+
+
+class cItemSpawnEggHandler : public cItemHandler
+{
+public:
+ cItemSpawnEggHandler(int a_ItemID) :
+ cItemHandler(a_ItemID)
+ {
+
+ }
+
+
+ virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, cItem * a_Item, int a_X, int a_Y, int a_Z, char a_Dir) override
+ {
+ if (a_Dir < 0)
+ {
+ return false;
+ }
+
+ AddDirection(a_X, a_Y, a_Z, a_Dir);
+
+ if (a_Dir == BLOCK_FACE_BOTTOM)
+ {
+ a_Y--;
+ }
+
+ cMonster * Monster = NULL;
+
+ Monster = new cZombie();
+
+ Monster->Initialize(a_World);
+ Monster->TeleportTo(a_X + 0.5, a_Y, a_Z + 0.5);
+ a_World->BroadcastSpawn(*Monster);
+
+ a_Player->UseEquippedItem();
+ return true;
+ }
+} ;
+
+
+
+