Making a mob execute a command before being unloaded

Started by bigburgerkittnt on

Topic category: Help with Minecraft modding (Java Edition)

Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Making a mob execute a command before being unloaded

I am making a boss with a fail state where if the player fighting it dies, its theme stops playing and it despawns. I was able to get the rest to work by making it fail the fight if no players are in a certain radius, however, since the mob gets unloaded when the player dies and respawns far away, the effects (most importantly the music stop) do not happen until the player gets back to the boss. How can I execute the music stopping command before this? (The boss indirectly kills the player with falling blocks and other mobs, so I don't think I can use the "kills an entity" trigger) I also tried to /forceload the boss's chunks and it did not work.