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 Type
    Method
    Description
    default void
    addGermlings(Consumer<net.minecraft.world.item.ItemStack> accumulator)
    Used by JEI to display the germlings of this farmable.
    default void
    addProducts(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)
     
    boolean
    isGermling(net.minecraft.world.item.ItemStack stack)
     
    boolean
    isSaplingAt(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
     
    boolean
    isWindfall(net.minecraft.world.item.ItemStack stack)
     
    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.
  • 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:
      ICrop if 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

      default void addGermlings(Consumer<net.minecraft.world.item.ItemStack> accumulator)
      Used by JEI to display the germlings of this farmable.
      Parameters:
      accumulator - Accepts new item stacks for germlings.
    • addProducts

      default void addProducts(Consumer<net.minecraft.world.item.ItemStack> accumulator)
      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. The IFarmLogic should have verified the given location as valid. Called by the IFarmHousing which handles resources.
      Returns:
      true if a sapling was planted, false otherwise.