summaryrefslogtreecommitdiffstats
path: root/source/World.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-10-08 20:20:49 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-10-08 20:20:49 +0200
commit5db6213f34318031ece7e2a6765f69564b671891 (patch)
tree074213cf13247c4e6370528eaa000bbd4b3a625d /source/World.cpp
parentMerge pull request #2 from tigerw/bugfixes (diff)
downloadcuberite-5db6213f34318031ece7e2a6765f69564b671891.tar
cuberite-5db6213f34318031ece7e2a6765f69564b671891.tar.gz
cuberite-5db6213f34318031ece7e2a6765f69564b671891.tar.bz2
cuberite-5db6213f34318031ece7e2a6765f69564b671891.tar.lz
cuberite-5db6213f34318031ece7e2a6765f69564b671891.tar.xz
cuberite-5db6213f34318031ece7e2a6765f69564b671891.tar.zst
cuberite-5db6213f34318031ece7e2a6765f69564b671891.zip
Diffstat (limited to 'source/World.cpp')
-rw-r--r--source/World.cpp77
1 files changed, 47 insertions, 30 deletions
diff --git a/source/World.cpp b/source/World.cpp
index 606ef0787..784df49f3 100644
--- a/source/World.cpp
+++ b/source/World.cpp
@@ -2571,40 +2571,53 @@ bool cWorld::IsBlockDirectlyWatered(int a_BlockX, int a_BlockY, int a_BlockZ)
int cWorld::SpawnMob(double a_PosX, double a_PosY, double a_PosZ, cMonster::eType a_MonsterType)
{
cMonster * Monster = NULL;
+
+ int SlSize = GetTickRandomNumber(2) + 1; // 1 .. 3 - Slime
+ int ShColor = GetTickRandomNumber(15); // 0 .. 15 - Sheep
+ bool SkType = GetDimension() == biNether; // Skeleton
+ int VilType = GetTickRandomNumber(5); // 0 .. 5 - Villager
+
+ int HseType = GetTickRandomNumber(7); // 0 .. 7 - Horse Type (donkey, zombie, etc.)
+ int HseColor = GetTickRandomNumber(6); // 0 .. 6 - Horse
+ int HseStyle = GetTickRandomNumber(4); // 0 .. 4 - Horse
+ int HseTameTimes = GetTickRandomNumber(6) + 1; // 1 .. 7 - Horse tame amount
- int Size = GetTickRandomNumber(2) + 1; // 1 .. 3
+ if ((HseType == 5) || (HseType == 6) || (HseType == 7)) { HseType = 0; } // 5,6,7 = 0 because little chance of getting 0 with TickRand
switch (a_MonsterType)
{
- case cMonster::mtBat: Monster = new cBat(); break;
- case cMonster::mtBlaze: Monster = new cBlaze(); break;
- case cMonster::mtCaveSpider: Monster = new cCavespider(); break;
- case cMonster::mtChicken: Monster = new cChicken(); break;
- case cMonster::mtCow: Monster = new cCow(); break;
- case cMonster::mtCreeper: Monster = new cCreeper(); break;
- case cMonster::mtEnderman: Monster = new cEnderman(); break;
- case cMonster::mtEnderDragon: Monster = new cEnderDragon(); break;
- case cMonster::mtGhast: Monster = new cGhast(); break;
- case cMonster::mtGiant: Monster = new cGiant(); break;
- case cMonster::mtHorse: Monster = new cHorse(); break;
- case cMonster::mtIronGolem: Monster = new cIronGolem(); break;
- case cMonster::mtMagmaCube: Monster = new cMagmaCube(Size); break;
- case cMonster::mtMooshroom: Monster = new cMooshroom(); break;
- case cMonster::mtOcelot: Monster = new cOcelot(); break;
- case cMonster::mtPig: Monster = new cPig(); break;
- case cMonster::mtSheep: Monster = new cSheep(); break;
- case cMonster::mtSilverfish: Monster = new cSilverfish(); break;
- case cMonster::mtSkeleton: Monster = new cSkeleton(); break;
- case cMonster::mtSlime: Monster = new cSlime(Size); break;
- case cMonster::mtSnowGolem: Monster = new cSnowGolem(); break;
- case cMonster::mtSpider: Monster = new cSpider(); break;
- case cMonster::mtSquid: Monster = new cSquid(); break;
- case cMonster::mtVillager: Monster = new cVillager(); break;
- case cMonster::mtWitch: Monster = new cWitch(); break;
- case cMonster::mtWither: Monster = new cWither(); break;
- case cMonster::mtWolf: Monster = new cWolf(); break;
- case cMonster::mtZombie: Monster = new cZombie(); break;
- case cMonster::mtZombiePigman: Monster = new cZombiePigman(); break;
+ case cMonster::mtBat: Monster = new cBat(); break;
+ case cMonster::mtBlaze: Monster = new cBlaze(); break;
+ case cMonster::mtCaveSpider: Monster = new cCavespider(); break;
+ case cMonster::mtChicken: Monster = new cChicken(); break;
+ case cMonster::mtCow: Monster = new cCow(); break;
+ case cMonster::mtCreeper: Monster = new cCreeper(); break;
+ case cMonster::mtEnderman: Monster = new cEnderman(); break;
+ case cMonster::mtEnderDragon: Monster = new cEnderDragon(); break;
+ case cMonster::mtGhast: Monster = new cGhast(); break;
+ case cMonster::mtGiant: Monster = new cGiant(); break;
+ case cMonster::mtHorse:
+ {
+ Monster = new cHorse(HseType, HseColor, HseStyle, HseTameTimes); break;
+ }
+ case cMonster::mtIronGolem: Monster = new cIronGolem(); break;
+ case cMonster::mtMagmaCube: Monster = new cMagmaCube(SlSize); break;
+ case cMonster::mtMooshroom: Monster = new cMooshroom(); break;
+ case cMonster::mtOcelot: Monster = new cOcelot(); break;
+ case cMonster::mtPig: Monster = new cPig(); break;
+ case cMonster::mtSheep: Monster = new cSheep(ShColor); break;
+ case cMonster::mtSilverfish: Monster = new cSilverfish(); break;
+ case cMonster::mtSkeleton: Monster = new cSkeleton(SkType); break;
+ case cMonster::mtSlime: Monster = new cSlime(SlSize); break;
+ case cMonster::mtSnowGolem: Monster = new cSnowGolem(); break;
+ case cMonster::mtSpider: Monster = new cSpider(); break;
+ case cMonster::mtSquid: Monster = new cSquid(); break;
+ case cMonster::mtVillager: Monster = new cVillager(VilType); break;
+ case cMonster::mtWitch: Monster = new cWitch(); break;
+ case cMonster::mtWither: Monster = new cWither(); break;
+ case cMonster::mtWolf: Monster = new cWolf(); break;
+ case cMonster::mtZombie: Monster = new cZombie(); break;
+ case cMonster::mtZombiePigman: Monster = new cZombiePigman(); break;
default:
{
@@ -2624,7 +2637,11 @@ int cWorld::SpawnMob(double a_PosX, double a_PosY, double a_PosZ, cMonster::eTyp
delete Monster;
return -1;
}
+
BroadcastSpawnEntity(*Monster);
+ // Because it's logical that ALL mob spawns need spawn effects, not just spawners
+ BroadcastSoundParticleEffect(2004, (int)(floor(a_PosX) * 8), (int)(floor(a_PosY) * 8), (int)(floor(a_PosZ) * 8), 0);
+
cPluginManager::Get()->CallHookSpawnedMonster(*this, *Monster);
return Monster->GetUniqueID();
}