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 Summary
Modifier and TypeMethodDescriptiondefault booleancanLoad()Checks if content from the provider should be loaded or not.default voiddefineAttributes(GameRegistryAdapter<net.minecraft.world.entity.ai.attributes.Attribute> registry) Registers new attributes with the game.default voiddefineBlockEntities(GameRegistryAdapter<net.minecraft.world.level.block.entity.BlockEntityType<?>> registry) Registers new block entities with the game.default voidAssociates a block entity with a block entity renderer.default voiddefineBlocks(BlockRegistryAdapter registry) Registers new blocks with the game.default voiddefineBrews(net.minecraft.world.item.alchemy.PotionBrewing.Builder registry) Registers new potion brewing recipes with the game.default voiddefineCommandArguments(CommandArgumentAdapter registry) Registers new command argument types with the game.default voiddefineCommands(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.default voiddefineCreativeTabs(CreativeModeTabAdapter registry) Registers new creative mode tabs with the game.default voiddefineCriteriaTriggers(GameRegistryAdapter<net.minecraft.advancements.CriterionTrigger<?>> registry) Registers new criteria triggers with the game.default voiddefineEnchantmentComponents(GameRegistryAdapter<net.minecraft.core.component.DataComponentType<?>> registry) Registers new enchantment components with the game.default voiddefineEntities(GameRegistryAdapter<net.minecraft.world.entity.EntityType<?>> registry) Registers entity types with the game.default voiddefineIngredientTypes(IngredientTypeAdapter registry) Registers new ingredient types with the game.default voiddefineItemComponents(GameRegistryAdapter<net.minecraft.core.component.DataComponentType<?>> registry) Registers new item components with the game.default voiddefineItems(ItemRegistryAdapter registry) Registers new items with the game.default voiddefineLoadConditions(GenericRegistryAdapter<com.mojang.serialization.MapCodec<? extends ILoadCondition>> registry) Registers a new bookshelf load condition for JSON resources.default voiddefineLootDescriptions(LootDescriptionAdapter registry) Registers a new descriptor for loot entries.default voiddefineLootEntryTypes(GameRegistryAdapter<com.mojang.serialization.MapCodec<? extends net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer>> registry) Registers new loot entry types with the game.default voidInject entries into existing loot pools.default voiddefineMenuScreens(MenuScreenAdapter registry) Associates menu types with screens.default voiddefineMenuType(MenuTypeAdapter registry) Registers new menu types with the game.default voiddefineMobEffects(GameRegistryAdapter<net.minecraft.world.effect.MobEffect> registry) Registers new mob effects with the game.default voiddefinePackets(PacketAdapter registry) Registers new packets with the game.default voiddefinePotions(GameRegistryAdapter<net.minecraft.world.item.alchemy.Potion> registry) Registers potions with the game.default voiddefinePotPatterns(PotPatternAdapter registry) Registers new decorated pot patterns with the game, and create associations between items and patterns.default voiddefineRecipeSerializers(GameRegistryAdapter<net.minecraft.world.item.crafting.RecipeSerializer<?>> registry) Registers new recipe serializers with the game.default voiddefineRecipeTypes(RecipeTypeAdapter registry) Registers new recipe types with the game.default voiddefineSounds(SoundEventAdapter registry) Registers new sound events with the game.Gets the namespace that all content from the provider should be registered under.
-
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
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
Registers new items with the game.- Parameters:
registry- Adapts registry requests to the current mod loader.
-
defineRecipeTypes
Registers new recipe types with the game.- Parameters:
registry- Adapts registry requests to the current mod loader.
-
defineCreativeTabs
Registers new creative mode tabs with the game.- Parameters:
registry- Adapts registry requests to the current mod loader.
-
defineCommandArguments
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
Registers new ingredient types with the game.- Parameters:
registry- Adapts registry requests to the current mod loader.
-
defineMobEffects
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
Registers entity types with the game.- Parameters:
registry- Adapts registry requests to the current mod loader.
-
definePotions
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
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
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
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
Registers new menu types with the game.- Parameters:
registry- Adapts registry requests to the current mod loader.
-
definePackets
Registers new packets with the game.- Parameters:
registry- Adapts registry requests to the current mod loader.
-
defineSounds
Registers new sound events with the game.- Parameters:
registry- Adapts registry requests to the current mod loader.
-
defineMenuScreens
Associates menu types with screens.- Parameters:
registry- Adapts registry requests to the current mod loader.
-
defineBlockRenderers
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.
-