Topic category: Help with modding (Java Edition)
Hello. I am working on a mod that has a procedure to replace half of all spawned spiders with custom Hunting Spiders. (Hunting Spiders are basically tameable spiders.)
It looks like this:
When entity is spawned
If (random > 0.5) AND (target entity is a spider) AND (world is not remote)
Despawn target entity
While (Event/target) is alive
Do 100 damage
As you can see by the bottom, occasionally I experienced the despawn target entity thing not working. The damage loop works just fine. (Also note that the ghost mobs started before I implemented that loop, so it cannot be the cause.)
I also tried to fix this by making this run on the server side only (world is not remote). That didn't change anything.
The problem I am experiencing is that the despawned spiders don't exactly go away a lot of the time. Instead they freeze and become immune to all damage (even /kill). They become ghost mobs. (Note that the Hunting Spiders spawn as they should). My mod is run on a server a few friends and I play on and ghost spiders can be found around the map. I have decided to try to fix this issue for the next update.
Does anyone know how to prevent ghost spiders from forming?