Data Packs Technology

Custom Regeneraton [Controllable regen]

  • 3.1k views 3 today
  • save_alt 112 downloads
Compatibility
Minecraft 1.18
to version
Minecraft 1.19
Changes include
  • Functions
  • 8
  • 5
  • 2
imalittlhigh
Lvl 67High Grandmaster Sweetheart Stack
143
Want to slow down regeneration? Or speed it up? Want to decide when a player regenerates half a heart in your pack?

Look no further.

Feel free to use this in your projects!

Changing the Regeneration frequency
go to customregen/data/creg/functions/meta/tick

Edit line 21 and 19 if you need to.

The red parts are what you need to change:
line 21
execute as @a[scores={creg.timer=160..},gamemode=!creative,gamemode=!spectator] run scoreboard players set @s creg.timer 0

Change line 19 if your value in line 21 is lower or near 40 to a lower value
execute as @a[scores={creg.timer=40},gamemode=!creative,gamemode=!spectator] unless score @s creg.health.curr.main = @s creg.health.max.main run function creg:regen




Triggering Regen from your Datapack or ingame via Function:
run the function creg:regen as the player that should receive the regeneration.




This Pack sets the gamerule naturalregeneration to false.
If you want to remove the pack run creg:meta/uninstall then disable the pack or delete it.

This Datapack only works if your players dont have over 20 Health (10 Hearts)!

More like this

  Have something to say?

Interstellar_1
03/03/2023 8:45 pm
Level 26 : Expert System uwu
How can I make the players heal when above a certain amount of hunger, but without reducing hunger or having to eat food?
1
imalittlhigh
03/04/2023 4:58 am
Level 67 : High Grandmaster Sweetheart Stack
Change these lines in the tick function:
#edit the hunger score for how much hunger is needed for the regeneration
execute as @a[scores=creg.hunger=14..},gamemode=!creative,gamemode=!spectator] unless score @s creg.health.curr.main = @s creg.health.max.main run scoreboard players add @s creg.timer 1
#edit the hunger score for how much hunger is needed for the regeneration (this is the score above -1)execute as @a[scores={creg.hunger=..13,creg.timer=1..}] run scoreboard players set @s creg.timer 0

To the hunger value u want.

And remove line 36 (execute unless score @s creg.health.curr matches 21.. run effect give @s minecraft:hunger 2 40 true)
from the modify/remove function

That should do what u want =)
1

Welcome