Class BlockLootTableProvider

java.lang.Object
com.github.minecraftschurlimods.bibliocraft.api.datagen.BlockLootTableProvider
All Implemented Interfaces:
net.minecraft.data.DataProvider

public abstract class BlockLootTableProvider extends Object implements net.minecraft.data.DataProvider
An adaptation of LootTableProvider and BlockLootSubProvider that is optimized to Bibliocraft's needs. Among other features, this class eliminates the sub provider abstraction layer and natively supports data load conditions. If you are an addon developer, you should rarely need to interact with this class outside of the two add() methods.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    A variant of WithConditions.Builder that has a map operation and does no validation on whether there are actually conditions added to the builder.

    Nested classes/interfaces inherited from interface net.minecraft.data.DataProvider

    net.minecraft.data.DataProvider.Factory<T extends net.minecraft.data.DataProvider>
  • Field Summary

    Fields inherited from interface net.minecraft.data.DataProvider

    FIXED_ORDER_FIELDS, INDENT_WIDTH, KEY_COMPARATOR, LOGGER
  • Constructor Summary

    Constructors
    Constructor
    Description
    BlockLootTableProvider(net.minecraft.data.PackOutput output, CompletableFuture<net.minecraft.core.HolderLookup.Provider> registries)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(net.minecraft.world.level.block.Block block, BlockLootTableProvider.WithConditionsBuilder<net.minecraft.world.level.storage.loot.LootTable.Builder> builder)
    Adds a loot table for a block.
    void
    add(net.minecraft.world.level.block.Block block, Function<net.minecraft.world.level.block.Block,BlockLootTableProvider.WithConditionsBuilder<net.minecraft.world.level.storage.loot.LootTable.Builder>> factory)
    Adds a loot table for a block.
     
    run(net.minecraft.data.CachedOutput output)
     
    static BlockLootTableProvider.WithConditionsBuilder<net.minecraft.world.level.storage.loot.LootTable.Builder>
    wrapLootTable(net.minecraft.world.level.storage.loot.LootTable.Builder table)
     

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BlockLootTableProvider

      public BlockLootTableProvider(net.minecraft.data.PackOutput output, CompletableFuture<net.minecraft.core.HolderLookup.Provider> registries)
      Parameters:
      output - The PackOutput to use.
      registries - The HolderLookup.Provider to use.
  • Method Details

    • getName

      public String getName()
      Specified by:
      getName in interface net.minecraft.data.DataProvider
    • run

      public CompletableFuture<?> run(net.minecraft.data.CachedOutput output)
      Specified by:
      run in interface net.minecraft.data.DataProvider
    • add

      public void add(net.minecraft.world.level.block.Block block, BlockLootTableProvider.WithConditionsBuilder<net.minecraft.world.level.storage.loot.LootTable.Builder> builder)
      Adds a loot table for a block.
      Parameters:
      block - The block to add the loot table for.
      builder - The builder from which to generate the loot table.
    • add

      public void add(net.minecraft.world.level.block.Block block, Function<net.minecraft.world.level.block.Block,BlockLootTableProvider.WithConditionsBuilder<net.minecraft.world.level.storage.loot.LootTable.Builder>> factory)
      Adds a loot table for a block.
      Parameters:
      block - The block to add the loot table for.
      factory - A function for the builder from which to generate the loot table.
    • wrapLootTable

      public static BlockLootTableProvider.WithConditionsBuilder<net.minecraft.world.level.storage.loot.LootTable.Builder> wrapLootTable(net.minecraft.world.level.storage.loot.LootTable.Builder table)
      Parameters:
      table - The loot table builder to wrap.
      Returns:
      The given loot table, wrapped as a BlockLootTableProvider.WithConditionsBuilder.