LootTweaker¶
- loottweaker.LootTweaker¶
Table names¶
Table names use the format namespace:path.
Namespaces can use:
numbers (0123456789)
lowercase letters (abcdefghijklmnopqrstuvwxyz)
underscores (_)
hyphens (-)
periods (.)
Paths can use:
numbers (0123456789)
lowercase letters (abcdefghijklmnopqrstuvwxyz)
underscores (_)
hyphens (-)
periods (.)
forward slashes (/)
Methods¶
See here for an explanation of the method documentation format used on this page.
- static LootTable getTable(String tableName) ¶
Gets a loot table by name.
- Parameters:
tableName - the unique name of the table.
- Errors:
if no loot table exists with the specified name.
- Returns:
the table with the specified name.
// Get the dungeon loot table and store it for later val simple_dungeon = loottweaker.LootTweaker.getTable("minecraft:chests/simple_dungeon");
- static LootTable newTable(String tableName) ¶
Creates a new table with a given name. LootTweaker created tables behave exactly like mod created tables, with one exception. They cannot be dumped by
/ct loottables byNameor/ct loottables allat this time. To view the JSON form, load a save, then check its data/loot_tables folder.- Parameters:
tableName - the unique name of the table. It should be similar to your pack name. Avoid using
minecraftorloottweakeras namespaces for tables your pack creates.
- Warns:
if the table name implicitly or explicitly uses the minecraft namespace. This warning can be disabled in LootTweaker’s config.
- Errors:
if a loot table with the specified name already exists.
- Returns:
an empty table with the specified name.
// Create a new loot table and store it for later val dave = loottweaker.LootTweaker.newTable("examplepack:dave");
- static LootGenerator createLootGenerator(IWorld world) ¶
Creates a new loot generator for generating loot with the loot tables of a specific world.
- Parameters:
world - the world to retrieve loot tables from. Must be a serverside world (
world.remoteis false).
- Errors:
if world is not a serverside world.
- Returns:
a new LootGenerator with an empty loot context (no player, looted entity, etc), ready for configuration.
// A simple example focusing on the most important code // world is an IWorld val/var defined and set elsewhere if (!world.remote) { val cowItems = LootTweaker.createLootGenerator(world) .generate("minecraft:entities/cow"); for item in cowItems { print(item); } }