how do i add a custom boss bar thats not tied to an entities health

Started by Bommelnator on

Topic category: Help with Minecraft modding (Java Edition)

Joined Sep 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
how do i add a custom boss bar thats not tied to an entities health

specifically i want to make a block that has a boss health bar and it checks for nearby other blocks of a specific type and if one of them gets destroyed the boss bar drops for the percent of blocks it just lost

Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
On player tick update, check…
Wed, 06/03/2026 - 18:38

On player tick update, check for your block in an area, use the 6x6x6 template as a base.

The larger the area the laggier it may become. I would use another condition to narrow down where your block boss would be, for example if it only spawns in one biome, check the player is in that biome before checking all the nearby blocks.

Then if your block boss exists in that area, set a player logic variable to true, use this for the condition of your overlay. The overlay being the boss bar. This will only work if one block boss is active at a time, use global integer variables for the block boss max and current health. On the block tick update, check for the blocks around itself, add them up to a number and save it to the block. Eg 10. Then it counts those blocks each tick, set the block bosses health through the global variables through this number. This will however cause the block boss to gain health if those blocks are placed around it.

Health = (Max_Health/Initial Block Count)*New Block Count

 Eg: Health = (1000/10)*7 = 700
Joined Sep 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
i ended up using the bossbar…
Wed, 06/17/2026 - 16:48

i ended up using the bossbar command but for some reason the get number from text block does not work with execute command and get result

Joined Sep 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
found out that the number…
Wed, 06/17/2026 - 17:54

found out that the number from text block works with only numbers

Joined Sep 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
but it still wont work even…
Wed, 06/17/2026 - 18:03

but it still wont work even tho i made it remove the text and only leave the number but the command that changes the value of the boss bar wont work, also i made it log what it gets and i noticed that it seems to execute 2 times, once in render thread where it outputs 0 and once in server thread where it gets the right number

Joined Sep 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
i got it working with some…
Wed, 06/17/2026 - 22:14

i got it working with some horrible workarounds

im still looking for a way to do it more efficently

Joined Dec 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
you could also make the boss…
Wed, 06/17/2026 - 23:41

you could also make the boss invulnerable and damage it by whatever percent of their HP you want.

Joined Dec 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
whenever the block is broken
Wed, 06/17/2026 - 23:42

whenever the block is broken

Joined Sep 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
i already tried that and it…
Thu, 06/18/2026 - 13:31

i already tried that and it didnt work

Joined Sep 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
i got it working by using…
Mon, 06/22/2026 - 14:07

i got it working by using the code editor