Interface IFarmLogic


public interface IFarmLogic
Used by legacy farm blocks and multiblock farms to cultivate and harvest crops and plants. Every legacy farm block has only ony one logic, but a multiblock farm has four, one for every horizontal direction. Every farm type has two IFarmLogic instances: one managed, one manual.
  • Method Summary

    Modifier and Type
    Method
    Description
    default List<net.minecraft.world.item.ItemStack>
    collect(net.minecraft.world.level.Level level, IFarmHousing farmHousing)
    Collects all items that are laying on the ground and are in the IFarmHousing.getArea() of the farm.
    default boolean
    cultivate(net.minecraft.world.level.Level level, IFarmHousing farmHousing, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction direction, int extent)
    Tries to cultivate one or more blocks at the given position and with the given extent.
    Returns the IFarmType that created this logic.
    harvest(net.minecraft.world.level.Level level, IFarmHousing housing, net.minecraft.core.Direction direction, int extent, net.minecraft.core.BlockPos pos)
    Tries to harvest one or more blocks at the given position and with the given extent.
    boolean
     
  • Method Details

    • collect

      default List<net.minecraft.world.item.ItemStack> collect(net.minecraft.world.level.Level level, IFarmHousing farmHousing)
      Collects all items that are laying on the ground and are in the IFarmHousing.getArea() of the farm. The returned list can be immutable.
      Parameters:
      level - The world of the farm.
      farmHousing - The farm that uses this logic.
      Returns:
      A collection that contains all items that were collected.
    • cultivate

      default boolean cultivate(net.minecraft.world.level.Level level, IFarmHousing farmHousing, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction direction, int extent)
      Tries to cultivate one or more blocks at the given position and with the given extent.
      Parameters:
      level - The world of the farm.
      farmHousing - The farm that uses this logic.
      pos - The position at that the logic should start to cultivate.
      direction - The direction of the extension.
      extent - How many blocks this logic has to cultivate after it cultivated the block at the given position. The positions of the next blocks are having a offset in the given direction.
      Returns:
      True if the logic has cultivated any block.
    • harvest

      Collection<ICrop> harvest(net.minecraft.world.level.Level level, IFarmHousing housing, net.minecraft.core.Direction direction, int extent, net.minecraft.core.BlockPos pos)
      Tries to harvest one or more blocks at the given position and with the given extent.
      Parameters:
      level - The world of the farm.
      housing - The farm that uses this logic.
      direction - The direction of the extension.
      extent - How many blocks this logic tries to harvest after it has tried to harvested the block at the given position. The positions of the next blocks are having a offset in the given direction.
      pos - The position at that the logic should start to harvest.
      Returns:
      True if the logic has cultivated any block.
    • getType

      IFarmType getType()
      Returns the IFarmType that created this logic.
      Returns:
      Returns the IFarmType that created this logic.
    • isManual

      boolean isManual()