Back to 9Minecraft
Wiki 9Minecraft Wiki 9Minecraft
Arrp Library Wiki › Guides › Adding Loot Tables Through ARRP Code

Adding Loot Tables Through ARRP Code

Building a Loot Table Programmatically

ARRP can generate loot table JSON at runtime, which is useful when drops depend on conditions or when you want to avoid shipping static files. You construct the table as a pool of entries with rolls and conditions.

1. Create a loot table builder and add one or more pools. Each pool has a roll count (a fixed number or a range) and a list of entries.

2. Add entries: an item entry references an item identifier and can carry functions such as set-count or fortune-affected count. Add weighting if you want random selection among entries.

3. Attach conditions where needed — for example, a condition that only produces the drop when a certain tool or enchantment is used, or when another mod is loaded.

4. Write the table to the loot table path using an identifier that matches the block or entity it belongs to (for example the block's loot table id).

5. Register the generator so it runs on resource reload.

Wiring It to a Block

A block uses a loot table whose id matches the block's registry name by default. Make sure your generated table's identifier lines up, or point the block at a custom table explicitly.

Testing Drops

Reload resources, then break the block or kill the entity in survival or with the appropriate tool. Confirm the drops match your pools. If nothing drops, check that the table id matches and that no condition is silently failing.