How to check if the attacked entity is a boss?

Started by ItIsKlanty on

Topic category: Help with modding (Java Edition)

Last seen on 19:24, 15. Feb 2024
Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to check if the attacked entity is a boss?
Wed, 01/31/2024 - 00:01 (edited)

I want to make an addon for a couple of mods that adds music during a bossfight, but I don't understand exactly how to do it. Logically, I understand that it is necessary to check the type of entity, and if this entity is the boss, then start playing music, but there is no "boss" entity in the types.

If it's not difficult for you, can you please attach a screenshot of the procedure?

Edited by ItIsKlanty on Wed, 01/31/2024 - 00:01
Last seen on 20:21, 9. May 2024
Joined Jan 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I can't attach screenshots,…
Wed, 01/31/2024 - 19:55

I can't attach screenshots, but you probably have to check whether it's an ender dragon, wither and so on, and if any of them is true, play the music.

Last seen on 19:24, 15. Feb 2024
Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ok, but what about modded…
Wed, 01/31/2024 - 22:56

Ok, but what about modded entities?

Last seen on 20:21, 9. May 2024
Joined Jan 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Either on spawn give them…
Thu, 02/01/2024 - 05:47

Either on spawn give them some custom nbt tag and then check the tag for example "isBoss?" or check, if the attacked entity is any of your custom bosses