๐ŸŽ stewbeet.plugins.datapack.loot_tables

๐Ÿ“„ Source Code: stewbeet/plugins/datapack/loot_tables/__init__.py ๐Ÿ”—

๐Ÿ”— Dependencies

  • โœ… Required: Your definition plugin (see definitions_setup.md for 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

OptionTypeDefaultDescription
source_loreTextComponentRequiredSource lore text component used for give-all chest lore
definitionsobjectRequiredItem definitions to generate loot tables for
external_definitionsobjectOptionalExternal item definitions from other namespaces
result_of_craftingarrayOptionalCrafting 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_crafting with 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