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 byName or /ct loottables all at 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 minecraft or loottweaker as 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");