-
Notifications
You must be signed in to change notification settings - Fork 0
Block Loot Table Data Generation
The Temporal API provides a comprehensive set of annotations for automatically generating block loot tables during data generation. These annotations eliminate the need for manual JSON loot table creation by programmatically registering loot behavior based on predefined strategies.
- Automates loot generation: Generates loot table JSON files without manual asset creation
- Provides loot variety: Supports different block types (ores, crops, leaves, etc.)
- Integrates with data generation: Works seamlessly with NeoForge's data generation system
- Enables customization: Allows custom loot strategies for specialized block types
- Annotation processing: The framework scans fields annotated with loot table annotations
-
Strategy selection: Each annotation maps to a specific
LootProviderStrategyimplementation - Loot creation: Strategies create appropriate loot tables using the loot provider
- Data generation: During data generation, loot tables are automatically registered and JSON files are generated
Generates a loot table that drops the block itself when broken.
@GenerateSelfBlockLootTable
public static final DeferredBlock<?> EXAMPLE_BLOCK = BLOCK_FACTORY.create("example_block", BlockPropertiesFactory.empty());Use cases: Building blocks, decorative blocks, blocks that should drop themselves
Generates an empty loot table that drops nothing when broken.
@GenerateEmptyBlockLootTable
public static final DeferredBlock<?> EMPTY_BLOCK = BLOCK_FACTORY.create("empty_block", BlockPropertiesFactory.empty());Use cases: Technical blocks, air-like blocks, blocks that should not drop anything
Generates a loot table that drops raw ore items with fortune bonus support.
@GenerateOreBlockLootTable(rawOre = "example:example_ingot")
public static final DeferredBlock<?> EXAMPLE_ORE = BLOCK_FACTORY.create("example_ore", BlockPropertiesFactory.stone());Parameters:
-
rawOre(required): Resource location of the raw ore item to drop
Generates a loot table that drops multiple raw ore items with configurable range.
@GenerateMultipleOreBlockLootTable(
rawOre = "example:example_ingot",
min = 1.0f,
max = 3.0f
)
public static final DeferredBlock<?> RICH_ORE = BLOCK_FACTORY.create("rich_ore", BlockPropertiesFactory.stone());Parameters:
-
rawOre(required): Resource location of the raw ore item to drop -
min(required): Minimum number of items to drop -
max(required): Maximum number of items to drop
Generates a loot table that drops saplings with configurable chances based on fortune level.
@GenerateLeavesBlockLootTable(sapling = "example:example_sapling", chances = {0.02F, 0.022222223F, 0.025F, 0.033333335F, 0.1F})
public static final DeferredBlock<?> EXAMPLE_LEAVES = BLOCK_FACTORY.createLeaves("example_leaves");Parameters:
-
sapling(required): Resource location of the sapling item to drop -
chances(required): Array of drop chances for fortune levels 0-4
Chance array format:
- Index 0: Fortune level 0 (no fortune)
- Index 1: Fortune level 1
- Index 2: Fortune level 2
- Index 3: Fortune level 3
- Index 4: Fortune level 4+
Generates a loot table that drops seeds when broken.
@GenerateGrassBlockLootTable(seeds = "minecraft:seeds")
public static final DeferredBlock<?> EXAMPLE_GRASS = BLOCK_FACTORY.createFlower("example_grass", BlockPropertiesFactory.shortGrass(), MobEffects.DAMAGE_RESISTANCE, 1);Parameters:
-
seeds(required): Resource location of the seeds item to drop
Generates a loot table for crop blocks with age-based drops.
@GenerateCropBlockLootTable(
grown = "example:example_crop",
seeds = "example:example_seeds",
grownAge = 7,
minAge = 0,
maxAge = 3
)
public static final DeferredBlock<?> EXAMPLE_CROP = BLOCK_FACTORY.createCrop("example_crop", BlockPropertiesFactory.crop());Parameters:
-
grown(required): Resource location of the fully grown crop item -
seeds(required): Resource location of the seeds item -
grownAge(required): Age value when the crop is fully grown -
minAge(required): Minimum age for seed drops -
maxAge(required): Maximum age for seed drops
Generates a loot table for door blocks that drops the door item.
@GenerateDoorBlockLootTable
public static final DeferredBlock<?> EXAMPLE_DOOR = BLOCK_FACTORY.createDoor("example_door", ExampleWoodTypes.EXAMPLE_WOOD_TYPE);Use cases: Wooden doors, iron doors, custom doors
Generates a loot table for shulker box blocks that preserves contents.
@GenerateShulkerBoxBlockLootTable
public static final DeferredBlock<?> EXAMPLE_SHULKER_BOX = BLOCK_FACTORY.createShulkerBox("example_shulker_box");Use cases: Shulker boxes, storage blocks with contents preservation
Generates a loot table for banner blocks that preserves patterns.
Use cases: Banners, patterned blocks with custom designs
Generates a loot table for mushroom blocks.
Use cases: Red mushrooms, brown mushrooms, custom mushroom blocks
Generates a loot table that drops the block only with silk touch.
@GenerateSilkTouchBlockLootTable
public static final DeferredBlock<?> SILK_TOUCH_BLOCK = BLOCK_FACTORY.create("silk_touch_block", BlockPropertiesFactory.stone());Use cases: Glass blocks, ice blocks, blocks that should only drop with silk touch
Generates a loot table that drops the block only when broken with shears.
@GenerateShearsOnlyBlockLootTable
public static final DeferredBlock<?> SHEARS_BLOCK = BLOCK_FACTORY.create("shears_block", BlockPropertiesFactory.plant());Use cases: Plants, leaves, wool blocks, blocks that require shears to drop
Generates a loot table for potted blocks that drops the content item.
@GeneratePottedContentBlockLootTable
public static final DeferredBlock<?> POTTED_EXAMPLE_FLOWER = BLOCK_FACTORY.createPottedFlower("potted_example_flower", EXAMPLE_FLOWER);Use cases: Potted flowers, potted saplings, potted plants
Allows custom loot table generation using a custom strategy.
@GenerateCustomBlockLootTable(
strategy = CustomBlockLootTableStrategy.class,
additionalData = {"custom_param1", "custom_param2"}
)
public static final DeferredBlock<?> CUSTOM_BLOCK = BLOCK_FACTORY.create("custom_block", BlockPropertiesFactory.empty());Parameters:
-
strategy: Custom strategy class implementingLootProviderStrategy<CustomBlockLootTableSpec> -
additionalData(optional): String array for custom parameters
Many loot table annotations automatically support:
- Fortune enchantment: Increases drop chances for applicable blocks
- Tool requirements: Some blocks only drop with specific tools
- Silk touch: Special handling for silk touch enchantment
- Shears: Special handling for shears tool
Generated loot tables follow Minecraft's standard loot table format:
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "modid:item_name"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}-
Standard blocks: Use
@GenerateSelfBlockLootTablefor blocks that drop themselves -
Ore blocks: Use
@GenerateOreBlockLootTableor@GenerateMultipleOreBlockLootTablefor ores -
Plant blocks: Use
@GenerateLeavesBlockLootTable,@GenerateGrassBlockLootTable, or@GenerateCropBlockLootTable -
Tool-specific: Use
@GenerateSilkTouchBlockLootTableor@GenerateShearsOnlyBlockLootTablefor special requirements -
Empty drops: Use
@GenerateEmptyBlockLootTablefor blocks that should not drop anything -
Custom needs: Use
@GenerateCustomBlockLootTablefor unique loot requirements
The annotation system integrates with the Temporal API's metadata processing:
-
Strategy interface:
LootProviderStrategy<T>for custom loot generation - Custom strategies: Implement custom strategies for specialized loot table needs
- Fortune support: Built-in fortune enchantment handling for applicable blocks
- Tool conditions: Automatic tool requirement handling for specialized blocks
Each annotation maps to a specific strategy implementation that handles the loot table generation logic, allowing for easy extension and customization of the block loot generation system.
🚀 Getting Started
🧩 Core Concepts
⚙️ Data Generation
- ⚙️ Advancement
- ⚙️ Damage Type
- ⚙️ Chest Loot Modifier
- ⚙️ Recipe
- ⚙️ Sound
- ⚙️ Jukebox Song
- ⚙️ Enchantment
- ⚙️ Trim Material
- ⚙️ Trim Pattern
- ⚙️ Banner Pattern
- ⚙️ Painting Variant
- ⚙️ Particle Sprite Set
- ⚙️ Wolf Variant
- ⚙️ Item Model
- ⚙️ Block Model
- ⚙️ Block Loot Table
- ⚙️ Tag
- ⚙️ Language Translation
- ⚙️ World Feature
- ⚙️ Custom Properties
🚨 Events
🛠 Engine Layers
🧪 Resources
- 🧪 Examples