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
(ItemConvertible item) Tests if the item is a registered seed item.getItems()
Get all currently registered seed items.static BlockState
getPlantState
(ItemConvertible item) Get the state that is associated with the provided seed item.static void
register
(ItemConvertible item) Registers a BlockItem to be plantable by farmer villagers.static void
register
(ItemConvertible item, BlockState plantState) Register an item with an associated to be plantable by farmer villagers.
-
Method Details
-
register
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
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
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
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.
-