Jump to content

Overriding Minecraft's Health System Question


TheXFactor117

Recommended Posts

I was just curious as to if this would be possible first and for most, along with how it would effect certain aspects of the game and even mod compatibility (because I assume it might break a lot of things potentially). It's not something I am 100% wanting to implement, but I have just been toying around the idea and was wondering the feasibility behind it.

 

To explain a bit better, I was thinking about removing the health system in place in favor of my own, which would essentially increase the amount of health everyone house to "points" instead of hearts. For instance, 10 hearts would be equivalent to say 2000 points of health in my new system. To do so, I figured I would just use a formula to convert hearts to points. With that being said, damage would also have to be changed too.

 

All in all, if what I am envisioning is possible, how would that affect mod compatibility? Is there a way I could run through every entity registered and change the values of health/damage of their entities? And what about changes authors might do during a LivingHurtEvent for example that modifies damage? I'm just curious as to what I would be dealing with if I did decide to go for it.

Developer of Levels and Lost Eclipse

Link to comment
Share on other sites

Overriding Minecrafts health system would be rather interesting and you would probably run into some hard, but fun bugs. I would start by creating the capability that stores the new health value. Then I would use the LivingHurtEvent and LivingHealEvent to calculate damage and healing and I would change the health of the entities vanilla only if a config setting is on, because you can end up with some rounding errors for the health conversion, and then I would only actually update it client side.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

I know how I would go about doing it, I guess I was just looking for some answers on what would happen compatibility wise (but I guess since no one has really done it, no one really knows). If no one posts here with any issues that might arise, I'm definitely going to try and overwrite the health system for one of my mods. If it works out and is successful, I might actually make it a standalone mod for people interested in changing things up. But I'm not going to get too far of myself, I'm sure there will be a lot of work involved to get it running properly.

Developer of Levels and Lost Eclipse

Link to comment
Share on other sites

I know how I would go about doing it, I guess I was just looking for some answers on what would happen compatibility wise (but I guess since no one has really done it, no one really knows). If no one posts here with any issues that might arise, I'm definitely going to try and overwrite the health system for one of my mods. If it works out and is successful, I might actually make it a standalone mod for people interested in changing things up. But I'm not going to get too far of myself, I'm sure there will be a lot of work involved to get it running properly.

I could see a not so much compatibility error with Tinkers Construct and other mods that effect the health, unless you rely slightly on the vanilla implementation of health.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Yes, but I think through events and capabilities you can re-work the health system. It would just rely on the specific events getting called last.

 

However, compatibility issues will likely arise with mods that change max health as well (and possibly those that alter the HUD Gui). I'm working on implementing it right now, and will test how everything works with other mods. Right now, I don't know of a way to fix any issues with other mods changing max health.

Developer of Levels and Lost Eclipse

Link to comment
Share on other sites

Yes, but I think through events and capabilities you can re-work the health system. It would just rely on the specific events getting called last.

 

However, compatibility issues will likely arise with mods that change max health as well (and possibly those that alter the HUD Gui). I'm working on implementing it right now, and will test how everything works with other mods. Right now, I don't know of a way to fix any issues with other mods changing max health.

 

Capabilities are the wrong way to modify the health system. Vanilla has the attribute system, which allows modification of various attributes(Max health, movement speed, attack damage, etc) of any mob. Using events and attributes will work much better than using  capabilities and events. Using both attributes is more compatible as all the health related methods and most damage related methods use them, so they will work properly without any extra work. The few edge cases(Such as directly causing damage with

EntityLivingBase#attackEntityFrom()

) can be handled by events.

 

Link to comment
Share on other sites

So you know how to do it? How? The player in Terraria has 100 starting health, it can be increased with Life Crystals (increases max by 20 HP) up to 400 HP. I want to use this type of health instead of the vanilla so that I can deal small amounts of damage, like 5 HP, and not take one-fourth of the player's health (one of the weakest mobs in Terraria, the Green Slime, deals 5 damage, but it would be OP in Minecraft)!

 

Health is a float, not an int. You can deal 0.0625 damage(1/16th of a heart) if you want, or any other amount that can be expressed by a float.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.