Class VillagerPlantableRegistry

java.lang.Object
net.fabricmc.fabric.api.registry.VillagerPlantableRegistry

public final class VillagerPlantableRegistry extends Object
Registry of items that farmer villagers can plant on farmland.
  • Method Details

    • register

      public static void register(ItemConvertible item)
      Registers a BlockItem to be plantable by farmer villagers. This will use the default state of the associated block. For the crop to be harvestable, the block should extend CropBlock, so the farmer can test the CropBlock.isMature(BlockState) method.
      Parameters:
      item - the BlockItem to register
    • register

      public static void register(ItemConvertible item, BlockState plantState)
      Register an item with an associated to be plantable by farmer villagers. For the crop to be harvestable, the block should extend CropBlock, so the farmer can test the CropBlock.isMature(BlockState) method.
      Parameters:
      item - the seed item
      plantState - the state that will be planted
    • contains

      public static boolean contains(ItemConvertible item)
      Tests if the item is a registered seed item.
      Parameters:
      item - the item to test
      Returns:
      true if the item is registered as a seed
    • getPlantState

      public static BlockState getPlantState(ItemConvertible item)
      Get the state that is associated with the provided seed item.
      Parameters:
      item - the seed item
      Returns:
      the state associated with the seed item
    • getItems

      public static Set<Item> getItems()
      Get all currently registered seed items.
      Returns:
      all currently registered seed items.