Class VillagerPlantableRegistry

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

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

    Modifier and Type
    Method
    Description
    static boolean
    contains(net.minecraft.item.ItemConvertible item)
    Tests if the item is a registered seed item.
    static Set<net.minecraft.item.Item>
    Get all currently registered seed items.
    static net.minecraft.block.BlockState
    getPlantState(net.minecraft.item.ItemConvertible item)
    Get the state that is associated with the provided seed item.
    static void
    register(net.minecraft.item.ItemConvertible item)
    Registers a BlockItem to be plantable by farmer villagers.
    static void
    register(net.minecraft.item.ItemConvertible item, net.minecraft.block.BlockState plantState)
    Register an item with an associated to be plantable by farmer villagers.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • register

      public static void register(net.minecraft.item.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(net.minecraft.item.ItemConvertible item, net.minecraft.block.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(net.minecraft.item.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 net.minecraft.block.BlockState getPlantState(net.minecraft.item.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<net.minecraft.item.Item> getItems()
      Get all currently registered seed items.
      Returns:
      all currently registered seed items.