Compatibility
Minecraft: Java Edition
Platforms
Creators
Details
This datapack changes a player's gamemode to Spectator mode when they die for a configurable amount of time. While "dead" a countdown will appear above the hotbar with how much time is left until they respawn. When the timer reaches 0, the player is teleported to their respawn point (ie bed or respawn anchor) or to the set spawn point. This datapack takes a little bit of set up so please read the rest.
To use this datapack you will have to drop the file into your datapack folder then /reload
If you do not set spawn using this command this datapack will not work Set players respawn point to where you are standing: /function softhardcore:setspawn
Set the amount of time in ticks (20 ticks = 1 second) the dead player should be in spectator: /scoreboard players set sh.DeathDuration SoftHardcoreConfig 1200
Force player out of death early: /scoreboard players set PlayerName SoftHardcoreTicks 5
If you are running a server This data pack will not pass dead players time if the server is paused or if it is offline. Change this property so that if no one is online players timers continue to go down.
pause-when-empty-seconds=-1
Another thing you can do to prevent server lag is prevent spectators from generating chunks.
/gamerule spectatorsGenerateChunks false



