Natural Magic mob spawning only works briefly on relog
Remodactyl opened this issue ยท 10 comments
As the title says, I've enabled magical mob spawning with the spawnmobs example. Based on this and the documentation I have replaced zombified_piglin with Dark Wizards. This has a 100% chance of occuring meaning all zombified piglins should be replaced.
Doing this initially will do nothing, however when a player then rejoins the server, logging in into the nether, the first mobs are successfully replaced, but no more afterwards.
The functionality seems to stop immediately. I've heard other people having the same problem, but not having a fix for this in the Support channel in the magic discord.
Steps to reproduce:
- Enable spawnmobs example
- Replace all of zombified_piglin with dark_wizard,
- Relog server in Nether
The first few mobs are successfully replaced, this then immediately stops working as the player wanders around.
This was tried on both a 1.18.1 Paper server and a 1.19 Paper server, both using the latest plugin version (10.8).
I understand a fix for this may not be happening anytime soon, but I would at least like to know if this is in fact an issue on the plugin's side or if there is anything on my end that I can fix. I have tried everything I could think of, from turning off every other plugin to filling in the config in various ways, to looking at the source code, but the issue persists.
If you have gotten Natural magic mob spawning to work in your own server on the latest versions, I would love to hear it.
I apologize for not responding to this, I have not had a chance to test this out myself, but I also have not had anyone else report it. It does sound like an odd bug if so- I will try to test this when I can.
Alright! It will be good to know for sure, this seems like it could be a significant issue, if not I don't know what could be causing this now. I've already tried without any other plugins on the server besides Magic.
FWIW, we were also having this issue and ended up moving all magic spawns to MythicMobs for now. Magic would spawn a few but then nothing. We created placeholder MM mobs that would spawn, run a command to summon the Magic mob, then immediately despawn, allowing the Magic mob to live its life.
Thank you for the confirmation!
Do you have any idea when this started?
My biggest suspect would be the changes to how mob spawning and chunk loading work in 1.18, but this sounds like maybe a more recent problem?
Yeah, it's been a while, around the 1.18 update like you guessed. I had mentioned it as an aside when we were talking about the MythicMobs integration/API changes but couldn't pin down what was happening.
There are no errors when this happens,
Perhaps the listener is not firing, or the process is being disabled for debug reasons?
Im seeing that OnEntitiesLoaded and OnEntitySpawn are not the same listener, so it would make sense that the problem occurs in the latter.
Im also seeing that in OnEntitySpawn, the listener first checks if isDisableSpawnReplacement is True, and then decides to return,
but after OnEntitiesLoaded is executed, isDisableSpawnReplacement is always set back to True.
It's not my code and obviously there could be a million reasons for that value to be changed back and forth, but it could be that for whatever reason, the isDisableSpawnReplacement is never set back to false?
This should be fixed int he latest dev build:
https://jenkins.elmakers.com/job/MagicPlugin/4178/
@Remodactyl you were right that "disable spawn replacement" was getting stuck on- there was a different place in code where I was treating it like a flag rather than a ref count, and so it was not getting reduced properly.
I apologize for letting this bug go on for so long!