Interface FabricLootTableBuilder


@NonExtendable public interface FabricLootTableBuilder
Convenience extensions to LootTable.Builder for adding pre-built objects or collections and modifying loot pools.

This interface is automatically injected to LootTable.Builder.

  • Method Details

    • pool

      default LootTable.Builder pool(LootPool pool)
      Adds a loot pool to this builder.
      Parameters:
      pool - the added pool
      Returns:
      this builder
    • apply

      default LootTable.Builder apply(LootFunction function)
      Applies a loot function to this builder.
      Parameters:
      function - the applied function
      Returns:
      this builder
    • pools

      default LootTable.Builder pools(Collection<? extends LootPool> pools)
      Adds loot pools to this builder.
      Parameters:
      pools - the added pools
      Returns:
      this builder
    • apply

      default LootTable.Builder apply(Collection<? extends LootFunction> functions)
      Applies loot functions to this builder.
      Parameters:
      functions - the applied functions
      Returns:
      this builder
    • modifyPools

      default LootTable.Builder modifyPools(Consumer<? super LootPool.Builder> modifier)
      Modifies all loot pools already present in this builder.

      This method can be used instead of simply adding a new pool when you want the loot table to only drop items from one of the loot pool entries instead of both.

      Calling this method turns all pools into builders and rebuilds them back into loot pools afterwards, so it is more efficient to do all transformations with one modifyPools call.

      Parameters:
      modifier - the modifying function
      Returns:
      this builder
    • copyOf

      static LootTable.Builder copyOf(LootTable table)
      Creates a builder copy of a loot table.
      Parameters:
      table - the loot table
      Returns:
      the copied builder