Chest Loot Randomizer

Quick rating

Community listing page, reviews here may not be monitored by the author.

Chest Loot Randomizer

No reviews yet

Quickly fill the chests within the designated area with random content from the config.

Mod Loaders
Minecraft

About

Description

Chest Loot Randomizer

Version: 1.0.0
Minecraft: 1.21.1
Loader: NeoForge 21.1.243+
Java: 21
Author: Sl0n1kNash
License: MIT

Quickly fill the chests within the designated area with random content from the config.

Purpose

Chest Loot Randomizer quickly replaces the contents of existing chests and other supported container blocks inside a designated square area. The search center and radius can be configured in JSON or changed directly with commands in the world.

The mod is intended for survival maps, PvP and extraction-style events, custom adventure maps, server scenarios, pre-generated worlds, and other setups where many existing containers need to be populated from one configurable random loot pool.

The randomizer does not place new chests. It searches for supported inventories that already exist, clears their current contents, and fills random slots according to the configured loot rules.

How it works

  1. Set the search center with /clr center, /clr center <x> <z>, or the JSON configuration.
  2. Set the search radius with /clr radius <blocks> or the JSON configuration.
  3. Run /clr run.
  4. Chest Loot Randomizer scans the square from center - radius to center + radius on X and Z.
  5. Matching chest-like block entities are collected from the scanned chunks.
  6. Their previous contents are cleared.
  7. Every configured loot entry is rolled independently for each supported container.
  8. Successful entries are placed into random compatible slots with a random stack size between stack_size_min and stack_size_max.
  9. Missing or unavailable loot entries are reported after the run instead of silently replacing them with another item.

Container behavior

  • Vanilla chest blocks are matched by the default chest block-id token.
  • minecraft:barrel is supported by default through the exact-id list.
  • Typical modded chest ids containing chest can be detected automatically.
  • Additional exact block ids can be added through additional_chest_ids.
  • Vanilla Container inventories are supported directly.
  • Compatible modded inventories can be accessed through NeoForge block item-handler capabilities when the handler is modifiable.
  • /clr run overwrites existing contents; it is not an additive loot pass.

Loot rules

A normal loot entry uses this structure:

{
  "item": "minecraft:iron_ingot",
  "probability": 0.12,
  "stack_size_min": 1,
  "stack_size_max": 6
}
Field Description
item Minecraft item registry id or item tag. Tags can use the #namespace:path form.
probability Independent probability from 0.0 to 1.0 for this entry in each container.
stack_size_min Minimum generated stack size.
stack_size_max Maximum generated stack size.

Generated stack sizes are still limited by the item and target slot limits.

Configuration

Field Default Description
center_x 0 Search center X coordinate.
center_z 0 Search center Z coordinate.
center_set false Whether the stored center is active. /clr center sets this to true.
radius 128 Search radius in blocks. The processed area is a square.
load_chunks true Loads chunks while scanning. This can generate previously ungenerated terrain.
chest_id_contains ["chest"] Block-id path tokens treated as chest-like containers.
additional_chest_ids ["minecraft:barrel"] Exact additional container block ids.

TaCZ support

Chest Loot Randomizer includes optional support for TaCZ data-driven content.

TaCZ guns, ammunition, and attachments use shared base Minecraft item ids with their concrete variant stored in item data. For these entries CLR supports two extra fields:

{
  "item": "tacz:modern_kinetic_gun",
  "tacz_type": "gun",
  "tacz_id": "tacz:ak47",
  "probability": 0.01,
  "stack_size_min": 1,
  "stack_size_max": 1
}

Supported values:

tacz_type Purpose
gun Creates the requested TaCZ gun variant. Guns are forced to a stack size of 1.
ammo Creates the requested TaCZ ammunition variant.
attachment Creates the requested TaCZ attachment variant.

If TaCZ is absent, incompatible, or a configured tacz_id cannot be created, that loot entry is skipped and reported after /clr run.

Commands

The /clr command requires permission level 2.

Command Description
/clr center Uses the executing player's current X/Z as the search center.
/clr center <x> <z> Sets the search center explicitly and also works from the server console.
/clr radius <blocks> Sets the square search radius.
/clr status Shows the current version, center, radius, chunk-loading mode, and loot-entry count.
/clr reload Reloads config/chest_loot_randomizer.json.
/clr run Clears and randomly refills all matching supported containers in the configured area.

Alias: /chestloot.

Performance and safety

The scan is synchronous. Large search radii can temporarily stall the integrated or dedicated server while chunks and block entities are processed.

With load_chunks=true, CLR requests chunks across the whole configured square. This can generate terrain that did not previously exist. Set load_chunks=false when only currently loaded chunks should be processed.

Because /clr run clears previous container contents, make a backup before processing an important world or map.

Compatibility

  • Minecraft 1.21.1
  • NeoForge 21.1.243 or newer within the 1.21.1 branch
  • Java 21
  • Dedicated servers and integrated servers
  • Compatible modded chest-like inventories
  • Normal modded item registry ids and item tags
  • Optional TaCZ data-driven guns, ammunition, and attachments