Package forestry.api.farming
Interface IFarmable
public interface IFarmable
IFarmable describes a farmable resource, including its sapling/premature and mature versions, its germling/seeds,
and the harvested resources resulting from harvesting and collecting from windfall.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidaddGermlings(Consumer<net.minecraft.world.item.ItemStack> accumulator) Used by JEI to display the germlings of this farmable.default voidaddProducts(Consumer<net.minecraft.world.item.ItemStack> accumulator) Used by JEI to display the products of this farmable.getCropAt(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) booleanisGermling(net.minecraft.world.item.ItemStack stack) booleanisSaplingAt(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) booleanisWindfall(net.minecraft.world.item.ItemStack stack) booleanplantSaplingAt(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack germling, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) Plants a sapling by manipulating the world.
-
Method Details
-
isSaplingAt
boolean isSaplingAt(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) - Returns:
- true if the block at the given location is a "sapling" for this type, i.e. a non-harvestable immature version of the crop.
-
getCropAt
@Nullable ICrop getCropAt(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) - Returns:
ICropif the block at the given location is a harvestable and mature crop, null otherwise.
-
isGermling
boolean isGermling(net.minecraft.world.item.ItemStack stack) - Returns:
- true if the item is a valid germling (plantable sapling, seed, etc.) for this type.
-
addGermlings
Used by JEI to display the germlings of this farmable.- Parameters:
accumulator- Accepts new item stacks for germlings.
-
addProducts
Used by JEI to display the products of this farmable.- Parameters:
accumulator- Accepts new item stacks for products.
-
isWindfall
boolean isWindfall(net.minecraft.world.item.ItemStack stack) - Returns:
- true if the item is something that can drop from this type without actually being harvested as a crop. (Apples or sapling from decaying leaves.)
-
plantSaplingAt
boolean plantSaplingAt(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack germling, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) Plants a sapling by manipulating the world. TheIFarmLogicshould have verified the given location as valid. Called by theIFarmHousingwhich handles resources.- Returns:
trueif a sapling was planted, false otherwise.
-