๐ stewbeet.plugins.datapack.loot_tables
๐ Source Code: stewbeet/plugins/datapack/loot_tables/__init__.py ๐
๐ Dependencies
- โ
Required:
Your definition plugin(seedefinitions_setup.mdfor details) - ๐ง Optional: External item definitions (
Mem.external_definitions)
๐ Overview
The datapack.loot_tables plugin automatically generates loot tables for all custom items
defined in the project definitions. It creates individual loot tables for each item with proper
components, handles external items, supports crafting recipe variants, and generates
convenient give-all commands for testing purposes.
Some Features Showcase
Complete file tree (i/*, recipes/*, external/*):

Function to give all items (comfortably stored in named chests):

๐ฏ Purpose
- ๐ฏ Generates individual loot tables for each custom item
- ๐งฉ Applies proper item components and metadata
- ๐ Handles external items from other namespaces
- ๐ฆ Creates variant loot tables for different crafting result counts
- ๐ Generates special loot tables for manual items
- ๐ Creates convenient give-all commands with organized chest distribution
โ๏ธ Configuration
๐ฏ Basic Example Configuration
id: "your_namespace" pipeline: - ... - src.setup_definitions # Load item definitions into memory - ... - stewbeet.plugins.datapack.loot_tables # < This plugin - ... # Requires source_lore to be set in meta.stewbeet section meta: stewbeet: source_lore: "" # Required for chest lore generation
๐ Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
source_lore | TextComponent | Required | Source lore text component used for give-all chest lore |
definitions | object | Required | Item definitions to generate loot tables for |
external_definitions | object | Optional | External item definitions from other namespaces |
result_of_crafting | array | Optional | Crafting recipes with different result counts |
โจ Features
๐ฏ Individual Item Loot Tables
Generates dedicated loot tables for each item in definitions:
- โ Single item entry with proper ID reference
- ๐งฉ Automatic component application for all non-excluded properties
- ๐ Organized under
i/{item_name}namespace structure - ๐ง Proper JSON encoding with configurable max depth
๐ External Item Support
Handles items from external namespaces and dependencies:
- ๐ Namespace separation and proper file organization
- ๐ Storage under
external/{namespace}/{item}structure - ๐ Same component processing as regular items
- ๐ Integration with external definitions system
๐ฆ Crafting Recipe Variants
Creates specialized loot tables for different crafting result counts:
- ๐ข Automatic detection of
result_of_craftingwith varying counts - ๐ Generation of
i/{item}_x{count}loot table variants - ๐ References to main item loot table with count modifications
- โก Optimized for recipe systems that need specific quantities
๐ Manual Item Handling
Special loot table generation for manual items:
- ๐ Dedicated manual loot table creation
- ๐ Reference to main manual item loot table
- ๐ Special naming convention with project namespace
๐ Give-All Command Generation
Creates convenient testing commands with organized chest distribution:
- ๐ฆ Automatic chest organization (27 items per chest)
- ๐ท๏ธ Custom chest names with numbering (e.g., "Chest [1/3]")
- โจ Source lore application to all chests
- ๐งน Component cleanup excluding non-component data
- ๐ Optimal distribution across multiple chests when needed