Minecraft, but Kills Give You Hearts
===================================

Every hostile mob you kill permanently adds max health.

  common hostiles (zombie, skeleton, creeper, ...)  +1 half-heart
  elites (blaze, enderman, evoker, ravager, ...)    +2 half-hearts (1 heart)
  bosses (ender dragon, wither, warden, elder g.)   +6 half-hearts (3 hearts)

Health is capped at 60 earned half-hearts = 40 hearts total.
Half-hearts are shown as a decimal, so 21 HP reads as "10.5 hearts".

INSTALL
  Drop this folder (or its .zip) into  <world>/datapacks/  and run /reload.
  Java Edition 1.21.2 or newer is required: the pack uses the modern
  un-prefixed attribute id "minecraft:max_health". On 1.21.0/1.21.1 that id
  was still "minecraft:generic.max_health" and the pack will not apply health.

PLAYER COMMAND
  /trigger bkgh_check      show your hearts, kills and progress to the cap

OPERATOR COMMANDS (cheat/level 2)
  /scoreboard players set #cap bkgh_cfg 60
        Maximum EARNED half-hearts. 60 = 40 hearts total. 20 = 20 hearts.
        Lowering it clamps everyone down within one second. Values are held
        between 0 and 1004: 1024 HP is the game's own attribute ceiling.

  /scoreboard players set #penalty bkgh_cfg 0
        Half-hearts lost on death. 0 = keep everything (default).
        Try 4 for a two-heart penalty per death.

  /execute as <player> run function but_kills_give_hearts:reset
        Wipe one player's earned health back to 10 hearts.

UNINSTALLING (read this, order matters)
  1. /function but_kills_give_hearts:uninstall
        Puts every online player back to 20 HP, deletes the pack's
        scoreboards, and switches the pack off.
  2. Leave the pack folder in place for as long as you need. While the off
        switch is set the pack does nothing except hold every player who logs
        in at 20 HP, so people who were offline in step 1 are caught too.
  3. Delete the pack folder and run /reload.
  4. Optional: /scoreboard objectives remove bkgh_t
        One objective is deliberately kept in step 1 because it carries the
        off switch; without it the tick loop would throw a command error
        every tick until the folder was gone. This clears the last trace.

  Running /reload while the pack folder is still present re-enables it from
  scratch (everyone starts again at 10 hearts).

NOTES
  - Progress is permanent by default and survives death, respawn and /reload.
  - Only kills you land yourself count (arrows and other projectiles included).
    Mobs killed by your wolves, iron golems, fall damage or lava do not count.
  - Player attributes are reset by the game on respawn, so the pack re-asserts
    your max health once per second; after a respawn the extra hearts are back
    within a second.
  - Each gained half-heart is filled in for you with Regeneration I lasting
    3 seconds per half-heart, so new hearts never show up empty.
