Vampirism - Become a vampire!

Vampirism - Become a vampire!

16M Downloads

Random vampire spawn does not really work

maxanier opened this issue ยท 6 comments

commented

Somehow the random vampire spawn doesnt really work, even if I increase the spawn chance to 10000 not that many vampire spawn (although the other mobs spawn less often).
[The spawn chance works as following example:
Spawnchance Zombie: 100
Spawnchance Vampire: 10000
Spawnchance xyz: 66
If Minecraft wants to spawn a new mob it decides which mob to spawn. The chances for a vampire in this example would be 10000/(100+10000+66)]
So theoreticly with the vampire chance set to 100, there should spawn as many vampires as zombies, but somehow the vampire seem instantly die after being spawned so there are almost none.

I searched for the reason for almost 2 hours, but did not find anything. Maybe you can take a look

commented

Seems to work now

commented

As far as I understand this method is called whenever a mob should be spawned. The creaturetype is monster for the vampire related spawn.
net.minecraft.world.WorldServer.spawnRandomCreature(EnumCreatureType, int, int, int)

If I set the spawnchance in CommonProxy to 1000 the vampire entry is choosen almost every time.
It seems as the vampire is also actually spawned everytime, you can check the entity class in EntityConstructing and EntityJoinWorld.
But somehow it seems (to me) that they often instantly die (EntityVampire.setDead() is called), but I cant find out why it is called.

That is how far I got and I'm not sure if the italic part has anything to do with this

commented

I'm not looking at the code right now, but the way I remember it, the Vampire constructor is called, and then the code checks if the location where it wants to spawn is valid. There are a lot of ways this check can fail. If it fails (returns false), then the .setDead() is called to cleanup and destroy the object. So are you sure it really spawned. You don't know if it spawned just be the constructor being called. So for one thing, vampires can only spawn at night, but I'm sure your checking this at night.

commented

I was testing at night.
Since not only the EntityConstructing but also the EntityJoinWorld is fired I think it is actually put into the world, but I dont know what happens afterwards

commented

Ya, I've been trying to understand how mobs are spawned for a few days. I have yet to figure it out, sounds like you are farther along than me. So where does it do the above calculation? I have yet to locate that code. I do think there are problems with our spawning of both the hunter and vampire. When I figure out how this works, I plan to check in some fixes, just may be a few weeks for me to figure this out :)

commented

Not sure if the problem still exist, no one has complained about this issue yet