Class RegistrationContext

java.lang.Object
net.darkhax.bookshelf.common.api.registry.RegistrationContext

public final class RegistrationContext extends Object
Holds context that is shared between different registry adapters.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Map<net.minecraft.world.item.Item, net.minecraft.resources.ResourceKey<net.minecraft.world.level.block.entity.DecoratedPotPattern>>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    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.
    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.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public RegistrationContext(String namespace)
  • Method Details

    • namespace

      public String 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.