Interface ContentProvider

All Known Implementing Classes:
BookshelfContent

public interface ContentProvider
An interface for adding custom game content such as blocks and items during the appropriate stages of the game's lifecycle.

Implementations of this interface are discovered automatically by Bookshelf using the ServiceLoader mechanism. To make your provider loadable, add the fully qualified name of your implementation to the file:

    META-INF/services/net.darkhax.bookshelf.common.api.registry.ContentProvider
  • Method Details

    • defineAttributes

      default void defineAttributes(GameRegistryAdapter<net.minecraft.world.entity.ai.attributes.Attribute> registry)
      Registers new attributes with the game.
      Parameters:
      registry - Adapts registry requests to the current mod loader.
    • defineBlocks

      default void defineBlocks(BlockRegistryAdapter registry)
      Registers new blocks with the game.
      Parameters:
      registry - Adapts registry requests to the current mod loader.
    • defineBlockEntities

      default void defineBlockEntities(GameRegistryAdapter<net.minecraft.world.level.block.entity.BlockEntityType<?>> registry)
      Registers new block entities with the game.
      Parameters:
      registry - Adapts registry requests to the current mod loader.
    • defineItems

      default void defineItems(ItemRegistryAdapter registry)
      Registers new items with the game.
      Parameters:
      registry - Adapts registry requests to the current mod loader.
    • defineRecipeTypes

      default void defineRecipeTypes(RecipeTypeAdapter registry)
      Registers new recipe types with the game.
      Parameters:
      registry - Adapts registry requests to the current mod loader.
    • defineCreativeTabs

      default void defineCreativeTabs(CreativeModeTabAdapter registry)
      Registers new creative mode tabs with the game.
      Parameters:
      registry - Adapts registry requests to the current mod loader.
    • defineCommandArguments

      default void defineCommandArguments(CommandArgumentAdapter registry)
      Registers new command argument types with the game.
      Parameters:
      registry - Adapts registry requests to the current mod loader.
    • defineCommands

      default void defineCommands(com.mojang.brigadier.CommandDispatcher<net.minecraft.commands.CommandSourceStack> dispatcher, net.minecraft.commands.CommandBuildContext context, net.minecraft.commands.Commands.CommandSelection selection)
      Registers new commands with the game. This may happen multiple times per game instance depending on user actions.
      Parameters:
      dispatcher - The command dispatcher to populate with your new commands.
      context - Context used to build commands.
      selection - The type of commands that should be registered.
    • defineIngredientTypes

      default void defineIngredientTypes(IngredientTypeAdapter registry)
      Registers new ingredient types with the game.
      Parameters:
      registry - Adapts registry requests to the current mod loader.
    • defineMobEffects

      default void defineMobEffects(GameRegistryAdapter<net.minecraft.world.effect.MobEffect> registry)
      Registers new mob effects with the game.
      Parameters:
      registry - Adapts registry requests to the current mod loader.
    • defineCriteriaTriggers

      default void defineCriteriaTriggers(GameRegistryAdapter<net.minecraft.advancements.CriterionTrigger<?>> registry)
      Registers new criteria triggers with the game.
      Parameters:
      registry - Adapts registry requests to the current mod loader.
    • defineEntities

      default void defineEntities(GameRegistryAdapter<net.minecraft.world.entity.EntityType<?>> registry)
      Registers entity types with the game.
      Parameters:
      registry - Adapts registry requests to the current mod loader.
    • definePotions

      default void definePotions(GameRegistryAdapter<net.minecraft.world.item.alchemy.Potion> registry)
      Registers potions with the game.
      Parameters:
      registry - Adapts registry requests to the current mod loader.
    • defineBrews

      default void defineBrews(net.minecraft.world.item.alchemy.PotionBrewing.Builder registry)
      Registers new potion brewing recipes with the game.
      Parameters:
      registry - Adapts registry requests to the current mod loader.
    • definePotPatterns

      default void definePotPatterns(PotPatternAdapter registry)
      Registers new decorated pot patterns with the game, and create associations between items and patterns.
      Parameters:
      registry - Adapts registry requests to the current mod loader.
    • defineItemComponents

      default void defineItemComponents(GameRegistryAdapter<net.minecraft.core.component.DataComponentType<?>> registry)
      Registers new item components with the game.
      Parameters:
      registry - Adapts registry requests to the current mod loader.
    • defineEnchantmentComponents

      default void defineEnchantmentComponents(GameRegistryAdapter<net.minecraft.core.component.DataComponentType<?>> registry)
      Registers new enchantment components with the game.
      Parameters:
      registry - Adapts registry requests to the current mod loader.
    • defineRecipeSerializers

      default void defineRecipeSerializers(GameRegistryAdapter<net.minecraft.world.item.crafting.RecipeSerializer<?>> registry)
      Registers new recipe serializers with the game.
      Parameters:
      registry - Adapts registry requests to the current mod loader.
    • defineLootEntryTypes

      default void defineLootEntryTypes(GameRegistryAdapter<com.mojang.serialization.MapCodec<? extends net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer>> registry)
      Registers new loot entry types with the game.
      Parameters:
      registry - Adapts registry requests to the current mod loader.
    • defineLootPoolAdditions

      default void defineLootPoolAdditions(LootPoolAdditionAdapter registry)
      Inject entries into existing loot pools. For example, this can be used to add new loot to the dungeon loot chest.
      Parameters:
      registry - Adapts registry requests to the current mod loader.
    • defineLootDescriptions

      default void defineLootDescriptions(LootDescriptionAdapter registry)
      Registers a new descriptor for loot entries.
      Parameters:
      registry - Accepts registry requests.
    • defineLoadConditions

      default void defineLoadConditions(GenericRegistryAdapter<com.mojang.serialization.MapCodec<? extends ILoadCondition>> registry)
      Registers a new bookshelf load condition for JSON resources.
      Parameters:
      registry - Accepts registry requests.
    • defineMenuType

      default void defineMenuType(MenuTypeAdapter registry)
      Registers new menu types with the game.
      Parameters:
      registry - Adapts registry requests to the current mod loader.
    • definePackets

      default void definePackets(PacketAdapter registry)
      Registers new packets with the game.
      Parameters:
      registry - Adapts registry requests to the current mod loader.
    • defineSounds

      default void defineSounds(SoundEventAdapter registry)
      Registers new sound events with the game.
      Parameters:
      registry - Adapts registry requests to the current mod loader.
    • defineMenuScreens

      default void defineMenuScreens(MenuScreenAdapter registry)
      Associates menu types with screens.
      Parameters:
      registry - Adapts registry requests to the current mod loader.
    • defineBlockRenderers

      default void defineBlockRenderers(BlockEntityRendererAdapter registry)
      Associates a block entity with a block entity renderer.
      Parameters:
      registry - Adapts registry requests to the current mod loader.
    • namespace

      String namespace()
      Gets the namespace that all content from the provider should be registered under. This MUST be the same modid that is used by your NeoForge/Fabric mod.
      Returns:
      The namespace to register content with.
    • canLoad

      default boolean canLoad()
      Checks if content from the provider should be loaded or not. All providers will be loaded by default, however custom implementations may have additional requirements.

      Bookshelf will still classload your provider if this returns false, this only prevents content from being loaded. It is the implementers responsibility to ensure their class can be classloaded safely.

      Returns:
      If content from this provider should be loaded.