The Best Resource for Minecraft
The Best Resource for Minecraft

Dropt Mod Wiki

Dropt is a highly performant block drop replacement mod for Minecraft that allows modpack authors to define complex drop rules and conditions using JSON, ZenScript, or a dedicated API.

7 sections · 736 words

Overview#

Dropt is a utility modification designed for modpack creators who require precise control over block drops. Unlike simple loot table modifiers, Dropt provides a robust rule-based system that can evaluate conditions such as the harvester's identity, held items, current biome, dimension, and even progression stages via the GameStages mod.

Key Features

  • Rule Caching: Uses advanced rule caching per block state to ensure minimal impact on server performance, even with thousands of active rules.
  • Extensive Matching: Target blocks based on metadata, wildcards, or specific item drops.
  • Harvester Logic: Differentiate between real players, fake players (automated machines), and explosions.
  • Progression Integration: Full support for GameStages to lock specific drops behind player progression.
  • Fortune & Silk Touch: Granular control over how enchantments affect drop rates and quantities.

Mechanics#

Dropt operates through a hierarchy of Rules, Matchers, and Drops. When a block is broken, the mod scans its cached rules to find a match. If a match is found, the specified replacement strategy is executed.

Replacement Strategies

These strategies determine how Dropt interacts with the block's original loot table:

Strategy Description
ADD Adds the new drops to the existing block drops.
REPLACE_ALL Removes all original drops and replaces them with the new ones.
REPLACE_ALL_IF_SELECTED Only replaces original drops if one of the new drops is successfully selected.
REPLACE_ITEMS Replaces only the items defined in the match criteria.
REPLACE_ITEMS_IF_SELECTED Replaces matched items only if a new drop is selected.

Drop Strategies

When multiple drops are defined in a rule, these strategies control selection:

  • REPEAT: Allows the same drop to be selected multiple times (default).
  • UNIQUE: Ensures each drop in the list can only be selected once per block break.

Rule Matching#

Rules are triggered based on a match object. This object can contain several criteria that must all be met for the rule to apply.

Match Criteria

  • Blocks: A list of block strings (e.g., minecraft:stone:0). Supports whitelisting and blacklisting.
  • Items: Matches based on the items the block would have dropped. Supports Ore Dictionary entries.
  • Biomes & Dimensions: Restrict rules to specific environments using registry names or ID numbers.
  • Vertical Range: Define a minimum and maximum Y-level (e.g., only drops emeralds below Y=16).
  • Harvester:
    • Type: PLAYER, NON_PLAYER, REAL_PLAYER, FAKE_PLAYER, EXPLOSION, or ANY.
    • Player Name: Whitelist specific players.
    • Held Item: Matches items in the main hand or off-hand, including metadata and NBT.
    • Game Stages: Requires the GameStages mod. Can require ALL, ANY, or NONE of the specified stages.

Configuration (JSON)#

Dropt configurations are stored in config/dropt/ as .json files. You can create as many files as needed; the mod will load all of them alphabetically.

JSON Structure Example

{
 "rules": [
 {
 "match": {
 "blocks": {
 "blocks": ["minecraft:stone:0"]
 },
 "harvester": {
 "type": "PLAYER",
 "heldItemMainHand": {
 "items": ["minecraft:diamond_pickaxe:*"]
 }
 }
 },
 "replaceStrategy": "REPLACE_ALL",
 "drops": [
 {
 "item": {
 "items": ["minecraft:gold_ingot"],
 "quantity": {
 "min": 1,
 "max": 3
 }
 }
 }
 ]
 }
 ]
}

ZenScript Integration#

For users of CraftTweaker, Dropt provides a powerful ZenScript API. This allows for dynamic rule creation within .zs files.

Basic Syntax

To use Dropt in ZenScript, you must import the mod's classes: import mods.dropt.Dropt;

Example Script

This script replaces all drops from Stone with a single Diamond if broken by a player:

Dropt.list("stone_replacement")
.add(Dropt.rule
.matchBlocks(["minecraft:stone"])
.replaceStrategy("REPLACE_ALL")
.addDrop(Dropt.drop
.items([<minecraft:diamond>])
)
);

Advanced Drop Selection

You can define weights and fortune requirements for drops:

.addDrop(Dropt.drop
.items([<minecraft:emerald>])
.selector(Dropt.weight(10), "REQUIRED", 3) // Weight 10, Silk Touch Required, Fortune Level 3
)

Commands#

Dropt includes several utility commands to assist modpack authors in development and debugging.

  • /dropt reload: Reloads all JSON and ZenScript rules without restarting the game. Errors will be printed to the chat.
  • /dropt hand: Copies the formatted string of the item currently in your hand to the clipboard. This is extremely useful for capturing complex NBT data for use in JSON rules.
  • /dropt verbose: Toggles verbose logging. When enabled, breaking any block will log its registry name and metadata to the console, helping you identify exactly what to target in your rules.

Debugging and Logs#

Dropt maintains a dedicated log file located at [instance]/dropt.log. This file contains detailed information regarding rule parsing, matching successes, and any errors encountered during runtime.

If a JSON file fails to load, the log will specify the exact line and character where the syntax error occurred. By default, Dropt uses strict JSON parsing; if an unknown field is detected, the rule list will fail to load to prevent unexpected behavior.