Get/set entity attributes procedure blocks

Upvotes: 17
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

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

https://500px.com/photo/1002369170/procedure-by-Be-Human

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

https://500px.com/photo/1002369207/code1-by-Be-Human

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).

Moved from: https://mcreator.net/tracker/issue/59854 to this comment on this ticket

"Many of us know that Minecraft allows for stat buffs/debuffs on items that will apply in certain places where it is equipped. If not here are the slot types and modifiers:

Slots: Any, Main hand, Off hand, Head, Chest, Leg, and Feet

Modifiers: Max health, Armor, follow range, knockback resistance, movement speed, attack damage armor toughness, attack speed, and luck

This feature alone would be great, but there is a way that could make future mods even more interesting. If you could, it would be great if we had modify by percent, set, modify by addition on [stat] for _ ticks or seconds and make this block stack upon others that are active (like two effects or item that amplify the same thing (I think you can see where I am going)). This would allow for new effects with independent effects. For example, you could have an effect that sets the player's health to 4, increases attack speed by 15, and slows them down by 150% while still having slowness having a different effect if it is added on. Yes, we do have most effects that can modify stats, but they are not independent, and this feature could change this.

NOTE: I do not code for Minecraft, so I can't help with that process. "



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.