Started by
Srunkarp
on
Topic category: Troubleshooting, bugs, and solutions
Hi!
I've been working on a mod recently over the past 5 months going over an adventure after the Ender Dragon. I've been constructing a boss mob but there is one problem: The maximum health limit is set to 1024. So my boss mob can't go over this limit. I could use some type of resistance but i don't like this idea. Does anybody know how to change vanilla attributes?
Thanks.
Edited by Srunkarp on Thu, 06/19/2025 - 16:07
Hey! i hope you havent given up, i know its been a long time since youve asked this question, but what i would do is when the entity spawns in, give it an NBT number tag and set the name to whatever you want. for example, "Life". there are multiple things you can do with this.
You can use this as a custom HP bar, giving the creature resistance 255, and creating a procedure with the trigger "when entity attacked" and detect if its your mob, then set the value to (Get value of attribute "Life" - Number dependency "damage"). then have a procedure where it checks each tick if the value of this NBT tag is zero, and if it is, kill it.
Another way you can do this, which is a slightly simpler option and more optimal if you have a boss bar or something: you can set this procedure to trigger only when the NBT is zero or below however many times you want this to trigger. You can detect if the boss is below a certain amount of HP and when it is, reset its health back to full, then setting the NBT tag from zero to one (or if you want this multiple times, just add one to the value). now the mob essentially has double the HP, and it wont trigger again since the NBT tag is 1. if you want this to activate, say 5 times, then add 1 to the NBT every time its health resets, and when it reaches 5 it stops.
Thanks :) This actually makes boss making so much easier, because you can easily add a second health bar.