diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-10-28 15:57:35 +0100 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-10-28 15:57:35 +0100 |
commit | 96f7246df1f48107367f1ea5490ed09e6bde0180 (patch) | |
tree | b8699bf47ce0d55d6c87c44fd1ce36003ac9eeee /source/World.cpp | |
parent | Fixed more valgrind issues (diff) | |
download | cuberite-96f7246df1f48107367f1ea5490ed09e6bde0180.tar cuberite-96f7246df1f48107367f1ea5490ed09e6bde0180.tar.gz cuberite-96f7246df1f48107367f1ea5490ed09e6bde0180.tar.bz2 cuberite-96f7246df1f48107367f1ea5490ed09e6bde0180.tar.lz cuberite-96f7246df1f48107367f1ea5490ed09e6bde0180.tar.xz cuberite-96f7246df1f48107367f1ea5490ed09e6bde0180.tar.zst cuberite-96f7246df1f48107367f1ea5490ed09e6bde0180.zip |
Diffstat (limited to '')
-rw-r--r-- | source/World.cpp | 69 |
1 files changed, 59 insertions, 10 deletions
diff --git a/source/World.cpp b/source/World.cpp index d785d1224..f1a3950ba 100644 --- a/source/World.cpp +++ b/source/World.cpp @@ -23,21 +23,26 @@ #include "Simulator/RedstoneSimulator.h" // Mobs: +#include "Mobs/Blaze.h" +#include "Mobs/Cavespider.h" #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/Creeper.h" +#include "Mobs/Enderman.h" +#include "Mobs/Ghast.h" +#include "Mobs/Magmacube.h" +#include "Mobs/Mooshroom.h" +#include "Mobs/Ocelot.h" #include "Mobs/Pig.h" #include "Mobs/Sheep.h" +#include "Mobs/Silverfish.h" +#include "Mobs/Skeleton.h" +#include "Mobs/Slime.h" +#include "Mobs/Spider.h" +#include "Mobs/Squid.h" +#include "Mobs/Villager.h" +#include "Mobs/Wolf.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" #include "OSSupport/MakeDir.h" @@ -2185,6 +2190,50 @@ bool cWorld::IsBlockDirectlyWatered(int a_BlockX, int a_BlockY, int a_BlockZ) +int cWorld::SpawnMob(double a_PosX, double a_PosY, double a_PosZ, int a_EntityType) +{ + cMonster * Monster = NULL; + + switch (a_EntityType) + { + case E_ENTITY_TYPE_BLAZE: Monster = new cBlaze(); break; + case E_ENTITY_TYPE_CAVE_SPIDER: Monster = new cCavespider(); break; + case E_ENTITY_TYPE_CHICKEN: Monster = new cChicken(); break; + case E_ENTITY_TYPE_COW: Monster = new cCow(); break; + case E_ENTITY_TYPE_CREEPER: Monster = new cCreeper(); break; + case E_ENTITY_TYPE_ENDERMAN: Monster = new cEnderman(); break; + case E_ENTITY_TYPE_GHAST: Monster = new cGhast(); break; + case E_ENTITY_TYPE_MAGMA_CUBE: Monster = new cMagmacube(); break; + case E_ENTITY_TYPE_MOOSHROOM: Monster = new cMooshroom(); break; + case E_ENTITY_TYPE_OCELOT: Monster = new cOcelot(); break; + case E_ENTITY_TYPE_PIG: Monster = new cPig(); break; + case E_ENTITY_TYPE_SHEEP: Monster = new cSheep(); break; + case E_ENTITY_TYPE_SILVERFISH: Monster = new cSilverfish(); break; + case E_ENTITY_TYPE_SKELETON: Monster = new cSkeleton(); break; + case E_ENTITY_TYPE_SLIME: Monster = new cSlime(); break; + case E_ENTITY_TYPE_SPIDER: Monster = new cSpider(); break; + case E_ENTITY_TYPE_SQUID: Monster = new cSquid(); break; + case E_ENTITY_TYPE_VILLAGER: Monster = new cVillager(); break; + case E_ENTITY_TYPE_WOLF: Monster = new cWolf(); break; + case E_ENTITY_TYPE_ZOMBIE: Monster = new cZombie(); break; + case E_ENTITY_TYPE_ZOMBIE_PIGMAN: Monster = new cZombiepigman(); break; + + default: + { + LOGWARNING(__FUNCTION__ ": Unhandled entity type: %d. Not spawning.", a_EntityType); + return -1; + } + } + Monster->Initialize(this); + Monster->TeleportTo(a_PosX, a_PosY, a_PosZ); + BroadcastSpawn(*Monster); + return Monster->GetUniqueID(); +} + + + + + cFluidSimulator * cWorld::InitializeFluidSimulator(cIniFile & a_IniFile, const char * a_FluidName, BLOCKTYPE a_SimulateBlock, BLOCKTYPE a_StationaryBlock) { AString SimulatorNameKey; |