#how do i make it so regeneration works on undead mobs?

1 messages · Page 1 of 1 (latest)

flint birch
#

i have a custom saddle that will give the mounts with that saddle regeneration, but regeneration wont work on zombie horses and skeleton horses, how do i make some sort of fake regeneration that works on all mounts including undead ones?

tired inlet
#

it's a bit janky but you could use scoreboards

#

to do regeneration without effects, you could

  1. code a cooldown so that the following only occurs every 20 ticks or however many you choose
  2. store the mount's health in a scoreboard
  3. add 1 to the scoreboard value
  4. store the scoreboard value in the mount's health
flint birch
#

wouldnt i have to check its nbt which is bad for performance?

tired inlet
#

it is an expensive operation but at least it wouldnt be every tick

flint birch
#

i could try it tommorow if i dont think of any other solution, they regen naturally but very slowly, would it be possible to change that?

tired inlet
#

I doubt that - afaik the natural mount regen is hardcoded

tidal lark
#

unfortunately health regen is one of the few things we have little control over. I have for some time wanted to create an armor set with slight regeneration and healthboost when worn but the regeneration is either the effect (which would make other items obsolete) or impossible.

orchid delta
#

You can make an if statement that just gives them poison instead. Theoretically, and iirc, undead creatures regen from the poison potion effect

tidal lark
orchid delta
#

Huh! That's on me for expecting minecraft to be consistent

tidal lark
#

the only sensible workaround for non-players would be to directly modify their health in a function by using commands.

#

health in general is pretty weird in its behavior, you can have 10/10 hearts yet not be full health

#

you don't see the difference between 20.0f and 19.Xf health

you can damage a player for 0.99999 and they will still see 10 full hearts while they are practically already at 9.5 hearts.

orchid delta
#

Zombie ans Skeleton Horses have different max health too

#

I guess the most sensible way would be to also get their max_health attribute

tidal lark
#

iirc max_health is respected when you modify health

#

the only time max_health can be lower than Health is when the max_health itself was modified. you cant set health over the max_health attribute directly using data modify

lost monolith
#

Bc undead mobs heal from it

tired inlet
#

you could, yeah

#

lot less control over the amount of healing though

lost monolith
#

But i think you'll need only one heart per second

#

Like

#

I think the way regeneration works on higher levels is that it still heals 1 heart just it does it faster

#

When you have regeneration you can see them "jump", when they "jump" they regenerate

#

So yea, i think effect give @s minecraft:instant_damage 0 will do it

tidal lark
#

for players it is about the only way to do this, for mobs, not so much

tidal lark
#

formula is: 3 * 2 ^ level

#

actually instant health has 2 * 2 ^ level according to the wiki, but I recall seeings 1.5 hearts going up (could be rounding related again)

flint birch
tidal lark
#

you can directly apply the effect on the entity and it will work

#

but it will heal them 3 health or 1.5 hearts

#

while you can also just store their health in a score, add 1, store score into their health

flint birch
#

i figured it out, thanks!