Get/set entity attributes procedure blocks

Upvotes: 13
Issue description

Hi. I'd searched THIS in others tickets, but not found, so I post here:

I propose to implement possibility setting of max health(numbers of hearts) for players and eventually for other entities. But especially for players.
By this, I mean procedures like a "get entity maxHealth" and "set enity maxHealth". And this without unessesary use HealthBoost potion effect.


This can be a useful for creating more RPG style mods and more difficut style game ex. player start with two hearts(4 hp) or can just lose max HP for some punish.

Also if player beat some boss, then next time this boss can spawn with more healt points, etc.

This suggestion might applies for other entity's atributies like maxDamage, etc.

Issue comments

We will add support for changing entity attributes in the future updates. Nice idea!

Thank for appreciation. :)


I strongly vote for this solution too:

I will not post new post about this since this is already, but I'll be very glad if this will be found too.

So I have some other ideas, that I'll post soon(if don't exist already).

This would be so useful for many things, especially potion effects :)

Submitted by Crawler on Thu, 09/05/2019 - 21:45

If you want to get the max entity health atm you can do it by adding a procedure block? (is that how you call them?) like this

then locking the code and changing the "getHealth()"  with a "getMaxHealth()" manually in the lines that require it i.e.

in this case I'm checking if the entity is at 30% of its max health or lower and if it is at the time it's hit by the sword it will deal extra damage but yeah it could be nice to get an "entity max health" block for people that can'r really mess with code.

Your way is half solution and it work only below real max health of entity and still remaining a some empty hearts.
Thing whose I care a most is possibility to increase max health of player above "factory setting" of entities. And especially for player above standard of 20 hp(10 hearts).
For exmample you find a heart container in some dungeon, then does eat it and you will get a extra max heart(2 hp) of max health. Then you can be healed to 22 hp instead 20. And so on.

Potions can use another system to change entities attributes. By adding this line of code in the constructor, they'll apply the attribute modifier and change their tooltips:

registerPotionAttributeModifier(SharedMonsterAttributes.ATTRIBUTE, "UUID", amount, operation);

where "amount" is a double and "operation" is an integer (specified here). The amount value is multiplied by the potion level (the modifier will be twice as strong at level 2, three times as strong at level 3 and so on).

Donate to MCreator

By donating to developers you can speed up development, as with more resources, we can dedicate more time to MCreator. It is a free project made by developers working on it in their free time.