Szum123321 / textile_backup

Backup Mod for Fabric
https://www.curseforge.com/minecraft/mc-mods/textile-backup
GNU General Public License v3.0
90 stars 31 forks source link

Feature Request: "/backup restore latest" or some other way to automatically restore the most recent backup #85

Closed floral-qua-floral closed 2 years ago

floral-qua-floral commented 2 years ago

I'm thinking about setting up a data pack or CraftTweaker script that will allow me to get a psuedo-hardcore experience, by automatically reloading to the most recent backup when the player dies. This mod seems absolutely perfect for that, since it allows for restoring backups in-game using a command. The only troublesome part is, I can't figure out how to get the script to target the most recent backup, since the restore command requires a name, which would be different after every backup. Having some way to automatically select the most recent backup using a command would be really handy.

Szum123321 commented 2 years ago

I might look into this later

wilcooo commented 2 years ago

Suggestion: /backup restore latest [comment] will restore the latest backup with a certain comment.

Use case: I've set up command blocks to automatically backup when sleeping (commands below for anyone interested[^1]), which I want to restore when dying. However, this is not necessarily the latest backup when automatic interval backup is enabled.

[^1]: 1. enable the scoreboard tracking sleeping (once per world) /scoreboard objectives add sleep minecraft.custom:minecraft.sleep_in_bed

  1. fist command block in chain (repeat, unconditional, always active) execute if entity @a[scores={sleep=1..}]
  2. second command block in chain (chain, conditional, always active) scoreboard players reset @a sleep
  3. third command block in chain (chain, conditional, always active) backup start sleep
  4. you can set up a similar command chain to detect deaths, but there's as of now no way to automate the /backup restore
Szum123321 commented 2 years ago

Implemented in 2.5.0