contribute

toolbox

tags

Summary

Additional Loot Tables (ALT) is a mod for Minecraft-Forge 1.9 that makes it easier to add custom mod items to loot tables. It creates a config folder where you can put many variations of the same loot table and then ALT will automatically merge them together with the default Minecraft loot tables .

Loot Tables

Loot tables are a new feature in Minecraft 1.9 that let you specify what items can be found in random treasure chests or dropped by slain mobs. Like the block models in resourcepacks, the loot tables are a series of .json files that you can store in the loot_tables folder within your saved game to customize treasure generation.

A detailed description of Minecraft's loot table system would be a wiki all on its own, so here's a brief summary:

Whenever you kill a mob or open a treasure chest in Minecraft 1.9, the game will examine the associated "pools" of treasure for that chest/mob (there can be more than one pool for a given type of chest or mob). For each pool, Minecraft rolls virtual dice and looks-up the reward that you get for rolling that number in the given treasure pool. If you have the lucky potion effect on you, then bonus dice are rolled for extra treasure.

Unlike resourcepacks, loot tables are per world, so without mods (like this one), you have to individually edit the loot tables for each game you save if you want to add new content.

Loot Table Generators

What this mod does

When this mod is installed, it will create a folder in the config folder called additional-loot-tables. You (or your mod) can place folders in additional-loot-tables that contain loot table definitions as described above. The ALT mod will then read all of these loot table .json files and combine them with the loot tables already specified in Minecraft.

Example

Suppose ModX wants to make dungeon treasure chests have a 25% chance of containing either a jetpack or some fuel cells. To do this, ModX creates the file config/additional-loot-tables/modx/chests/simple_dungeon.json. This file contains the loot table definition for spawning a jetpack, like this:

When a player with ModX and ALT installed creates or loads a world, ALT automatically detects the files in config/additional-loot-tables and merges them with the default (or manually added) Minecraft loot tables.

Application notes for mod authors

If you want your mod to use ALT to add loot tables, your should program your preInit or init method to test for the existence of the folder config/additional-loot-tables/MODID where MODID is the ID of your mod. If this folder does not exist, then you should create that folder and write the chests and entities loot tables json files therein. ALT will load all files in the additional-loot-tables in the postInit phase, looking for any file matching the pattern config/additional-loot-tables/*/*/*.json.

Loot tables added by mods should use the "type": "empty" loot entry at the start of every pool to make it such that there is only a small percentage chance of your items spawning as loot (should be in the range of 10% to 35% chance to spawn items). If you don't do this, then every chest will be full of loot from your mod, removing the fun of wondering what's inside the next chest.

Application notes for users and modpack authors

You don't need a mod to specify the loot tables for a specific world, but default Minecraft does not let you keep multiple copies of the same file (unlike the resourcepack system). This becomes a problem if you add mod items to the loot tables and then have to remove one of your mods. You now need to go back an manually fix every single loot table file to remove references to the items that no longer exist.

ALT solves this problem by letting you keep multiple loot tables in parallel folders within the config/additional-loot-tables folder and merging all of the loot pools when your Minecraft world loads. Thus you can have a different copy for every mod that has only the items relevant to that mod. When you remove a mod, you only need to remove the loot table folder for that mod and you won't need to touch any of the other files.

As described in the application notes for mod authors, you should use the "type": "empty" loot entry to make all new loot tables only have a small chance of generating loot.