What are Refresh and Decay and how to set them up? - LootrMinecraft/Lootr GitHub Wiki

Refresh and Decay are optional features that are not enabled by default.

There are also some caveats as to how they function.

System

Every time a container is opened for the first time (or, if configured on 1.21 and later, every time a container in a loaded chunk ticks and has previously been opened by a player), it is checked to see if that container should be marked to refresh/decay.

If considered a "configured container" (see the Configuration section for the various options), the container is marked to refresh/decay with a timer of the relevant refresh/decay_value in ticks.

At this point, the player will be shown a message indicating that the container is now refreshing/decaying. (Please note that this message may be hidden by the container screen itself, see #667).

Any time that container is opened after this point (but before the timer duration has expired), if the time to refresh/decay is less than the configured value (in notifications/notification_delay, default 600 ticks or 30 seconds), a message indicating how soon the process will happen in seconds is sent to the player.

Any time a container that has previously been opened and is marked to refresh/decay is opened again (or, if configured on 1.21 and later, every time a container in a loaded chunk ticks and has previously been opened by a player and has been marked to refresh/decay) and the timer duration has expired, the refresh/decay process will occur.

For the refresh process, all inventories will be cleared, meaning that any player (including the one who has just opened the container, if opened again and refresh is not triggered during the tick) will have loot generated again.

For the decay process, the container will be destroyed.

Important Caveats

  • For some versions of Lootr (before 1.21 and some 1.21 versions that current have a bug), containers that undergo the refresh process will not reset their visual.
  • If changing the configuration at any point in time, containers that have previously been opened will not be marked to refresh/decay until they are opened again (or, if configured on 1.21 and later, until the chunk is loaded and the container is ticked).
  • Notification messages may be hidden by the opened container screen.

Configuration

Refresh and decay share the same configuration options.

  • decay/refresh_value is the shortest duration between opening a configured container for the first time and decay/refresh can happen. This value is in ticks, and by default in Minecraft, there are 20 ticks per second. The default value is 5 minutes (6000).
  • decay/refresh_all is a boolean value. When true, all containers are configured to decay/refresh. The default value is false.
  • perform_tick_refresh/decay is a boolean value (only available in 1.21 and later). When true, configured containers which have been opened by a player at least once will automatically refresh or decay once the configured time has passed. The default value is true.
  • start_tick_refresh/decay is a boolean value (only available in 1.21 and later). When true, configured containers that have previously been opened by a player but which are not yet marked as "refreshing" or "decaying" will be marked as such. The default value for decay is false, and for refresh is true.
  • decay/refresh_modids is a list value containing mod IDs. When a container which has a loot table where the mod ID is contained within this list is opened, that container is considered a "configured container" for refresh or decay. The default value is empty.
  • decay/refresh_loot_tables is a list value containing loot table resource locations, i.e., minecraft:chests/simple_dungeon. This resource location includes both the mod ID (minecraft) and the name of the actual loot table (chests/simple_dungeon). Please note that you cannot use * or other wildcard values. Only exact loot table resource locations. When a container which has a loot table which is contained within this list is opened, that container is considered a "configured container" for refresh or decay. The default value is empty.
  • decay/refresh_dimensions is a list value containing dimension resource locations. When a container is opened, the dimension the container is located in will be checked against the values in this list. If the dimension is contained within the list, that container is considered a "configured container" for refresh or decay. The default value is empty.

Additionally, Structure tags exist for both refresh and decay. Whenever a container is opened within a tagged structure, that container will be considered a "configured container" for refresh or decay.

The tags are:

  • lootr:refresh
  • lootr:decay

The values for these tags are the ones populated when executing the /locate structure command's auto-complete.