Minecraft Data Packs / Technology

Custom Regeneraton [Controllable regen]

  • check_circle Functions
  • 1,806 views, 4 today
  • 51 downloads, 0 today
  • 7
  • 4
  • 2
imalittlhigh's Avatar imalittlhigh
Level 62 : High Grandmaster Sweetheart
110
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)!
CompatibilityMinecraft 1.18
toMinecraft 1.19
Tags

Create an account or sign in to comment.

Interstellar_1
03/03/2023 8:45 pm
Level 22 : Expert Engineer
Interstellar_1's Avatar
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 62 : High Grandmaster Sweetheart
imalittlhigh's Avatar
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
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome