Package net.fabricmc.fabric.api.registry
Class VillagerPlantableRegistry
java.lang.Object
net.fabricmc.fabric.api.registry.VillagerPlantableRegistry
Registry of items that farmer villagers can plant on farmland.
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
contains
(net.minecraft.item.ItemConvertible item) Tests if the item is a registered seed item.static Set<net.minecraft.item.Item>
getItems()
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.
-
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 theCropBlock.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 theCropBlock.isMature(BlockState)
method.- Parameters:
item
- the seed itemplantState
- 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
Get all currently registered seed items.- Returns:
- all currently registered seed items.
-