Class RegistrationContext
java.lang.Object
net.darkhax.bookshelf.common.api.registry.RegistrationContext
Holds context that is shared between different registry adapters.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Map<net.minecraft.world.item.Item, net.minecraft.resources.ResourceKey<net.minecraft.world.level.block.entity.DecoratedPotPattern>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPlaceableBlock(RegistryReference<net.minecraft.resources.ResourceKey<net.minecraft.world.level.block.Block>, net.minecraft.world.level.block.Block> block, Function<net.minecraft.world.level.block.Block, net.minecraft.world.item.Item> itemBlock) Associates a block with a factory that provides its corresponding item form.voidaddPotPatternItem(net.minecraft.world.item.Item item, net.minecraft.resources.ResourceKey<net.minecraft.world.level.block.entity.DecoratedPotPattern> pattern) Associates an item with a decorated pot pattern.Map<RegistryReference<net.minecraft.resources.ResourceKey<net.minecraft.world.level.block.Block>, net.minecraft.world.level.block.Block>, Function<net.minecraft.world.level.block.Block, net.minecraft.world.item.Item>> Provides an unmodifiable view of placeable blocks and their associated item factories.Gets the namespace that all new content should be registered with.
-
Field Details
-
POT_PATTERN_ITEMS
public static final Map<net.minecraft.world.item.Item, net.minecraft.resources.ResourceKey<net.minecraft.world.level.block.entity.DecoratedPotPattern>> POT_PATTERN_ITEMS
-
-
Constructor Details
-
RegistrationContext
-
-
Method Details
-
namespace
Gets the namespace that all new content should be registered with.- Returns:
- The namespace new content is registered with.
-
addPlaceableBlock
public void addPlaceableBlock(RegistryReference<net.minecraft.resources.ResourceKey<net.minecraft.world.level.block.Block>, net.minecraft.world.level.block.Block> block, Function<net.minecraft.world.level.block.Block, net.minecraft.world.item.Item> itemBlock) Associates a block with a factory that provides its corresponding item form. The produced item will be automatically registered with the same ID as the block.- Parameters:
block- The block to associate the item with.itemBlock- A factory that creates the placer item.
-
getPlaceableBlocks
public Map<RegistryReference<net.minecraft.resources.ResourceKey<net.minecraft.world.level.block.Block>, net.minecraft.world.level.block.Block>, Function<net.minecraft.world.level.block.Block, net.minecraft.world.item.Item>> getPlaceableBlocks()Provides an unmodifiable view of placeable blocks and their associated item factories.- Returns:
- An unmodifiable map of placeable blocks to their placer item factories.
-
addPotPatternItem
public void addPotPatternItem(net.minecraft.world.item.Item item, net.minecraft.resources.ResourceKey<net.minecraft.world.level.block.entity.DecoratedPotPattern> pattern) Associates an item with a decorated pot pattern. Replacing existing associations is not a supported use case.- Parameters:
item- The item to associate with the pattern.pattern- The pattern displayed by the item.
-