Mod
This new mod aims to introduce a new hp system with NBT tags. Since I'm not skilled enough to rewrite and reprogram the entire hp system, I've made a new one with NBT tags. This new system is independent of the regular hp system, and has broken many limits.
About
You can use this mod to build other mods, in short. Using this mod alongside any mod you want/someone has made allows that mod to use this hp system. This system is independent of regular hp and damage, which means that doing normal minecraft damage will not affect the hp in this system, and dealing damage from this NBT system will not affect normal hp. Normal minecraft damage will affect normal minecraft hp, and this custom NBT damage will affect the custom NBT hp.
This mod aims to introduce a new system which removes any limits of hp. By using a new math system with arbritrary precision, you can introduce mobs with a lot more hp than what was once possible. With entirely new realms of hp and damage, which can be both high and low. You can add mobs with hps that are over googol, or mobs with hps less than one.
How to use
There are a couple things to be cautious about when using this mod. There are three main steps to using this mod: Making this mod compatible with another mod, adding the new NBT extensions to mobs/weapons, and then using it.
First, making this mod compatible with another mod. If you're a mod creator, this is for you. If you're just trying to play someone else's mod that uses this, you can ignore this step. If you are a mod creator, you need to either use this mod alongside your mod, or copy all of the code here into your mod.
Next, adding the new NBT extensions. Again, this step is only for mod creators. To grant this new custom hp/damage value to to entities, you neet four main NBT tags:
Add HP (works with entities):
- nbt_hp_extension (Logic NBT, set to true)
- nbt_hp_amount (Number NBT, a number greater than or equal to 1 and less than 10)
- nbt_hp_digits (Number NBT, any integer value)
- nbt_hp_level (Number NBT, any value)
The first NBT will be what tells this mod that your entity is using this mod. The second NBT will specify the starting digits of the hp value, the third NBT will specify the number of digits, and the fourth variable will specify the "ordinal". Yes, I know some of you out there just want to use some crazy "infinite hp" thing, so there is now an ordinal system with different sizes of infinities. But what do these variables 2~4 mean specifically? For example, if the second variable was set to 5.5, the third was set to 45, and the fourth was set to 0, that would mean:
5.5e+45hp
If you set the fourth variable to 1, it would be:
ω * 5.5e+45 hp
If you set the fourth variable to 2, it would be:
ω^2 * 5.5e+45 hp
And so on (yes, it's crazy, I recommend you stick to the level NBT being either 0 or 1 lol)
If you wanted something like 500hp, you can also just set the second variable to 500, and the rest all to 0.
Add damage (works with entities and items):
- nbt_dmg_extension (Logic NBT, set to true)
- nbt_dmg_amount (Number NBT, a number greater than or equal to 1 and less than 10)
- nbt_dmg_digits (Number NBT, any integer value)
- nbt_dmg_level (Number NBT, any value)
This works the exact same way.
If you want your mob to use this hp system rather than the regular minecraft one, you can give your entity some immunity effect like resistance V to force this system to be used.
The third step is to now use this mod alongside the mod of your choice.
Limitations
As I said before, this is independent of hp, so if you make bossbars that are supposed to work properly, you may need more custom code, and you need to add resistance V or some other effect to prevent your mob from taking normal damage if you wish for it not to.
If someone can use this new number system and implement it into actual minecraft hp, I'd be surprised lol. Sorry if this is confusing, you can ask any questions you want.
I originally intended to build this sort of system for one of my mods rather than hardcoding everything into variables (lol), but that mod is now discontinued and I'll publish this guy anyway.
Thanks to mcreator for making this possible!