Interface IFarmHousing

All Superinterfaces:
IErrorLogicSource, IExtentCache
All Known Subinterfaces:
IFarmController

public interface IFarmHousing extends IErrorLogicSource, IExtentCache
The IFarmHousing describes a forestry farm handler.

It contains methods to interact with the farm itself. Can be used in IFarmLogic's to remove fluid or add products.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addPendingProduct(net.minecraft.world.item.ItemStack stack)
    Adds a product to an internal buffer of items, which will later be added to the inventory.
    default boolean
    canPlantSoil(boolean manual)
    Checks if the farm can plant soil.
    boolean
     
    net.minecraft.core.Vec3i
     
    net.minecraft.core.BlockPos
    Position of the farm.
    net.minecraft.core.BlockPos
    getFarmCorner(net.minecraft.core.Direction direction)
    Receives the corner position of the given direction.
     
    getFarmLogic(net.minecraft.core.Direction direction)
    Receives the logic of the given direction.
    Receives a collection with all logics of this farm.
    net.minecraft.core.Vec3i
     
    int
    The percentage of fertilizer stored my the farm multiplied by the given scale.
    boolean
    hasLiquid(net.minecraftforge.fluids.FluidStack liquid)
    Checks if the given liquid and amount is contained in the internal tank.
    default boolean
    If the farmland area is square.
    default boolean
    isValidPlatform(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos)
     
    boolean
    plantGermling(IFarmable farmable, net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction direction)
    Callback for IFarmLogics to plant a sapling, seed, germling, stem.
    void
    removeLiquid(net.minecraftforge.fluids.FluidStack liquid)
    Removes the given liquid from the internal tank if possible.
    void
    resetFarmLogic(net.minecraft.core.Direction direction)
    Resets the farm logic off the given direction to the default logic (ARBOREAL).
    void
    setFarmLogic(net.minecraft.core.Direction direction, IFarmLogic logic)
    Sets the farm logic of one direction of the farm.

    Methods inherited from interface forestry.api.core.IErrorLogicSource

    getErrorLogic

    Methods inherited from interface forestry.api.farming.IExtentCache

    cleanExtents, getExtents, getValidExtent, getValidPosition, increaseExtent, setExtents
  • Method Details

    • getCoords

      net.minecraft.core.BlockPos getCoords()
      Position of the farm. Mostly used by internal logic.

      If the farm is a multiblock, the position is based in the center.

      Returns:
      Position of the farm.
    • getArea

      net.minecraft.core.Vec3i getArea()
      Returns:
      The area of the farmland of the farm.
    • getOffset

      net.minecraft.core.Vec3i getOffset()
      Returns:
      The offset used by the farm to create a bounding box for the harvest logic.
    • doWork

      boolean doWork()
      Returns:
      true if any work was done, false otherwise.
    • hasLiquid

      boolean hasLiquid(net.minecraftforge.fluids.FluidStack liquid)
      Checks if the given liquid and amount is contained in the internal tank.
      Parameters:
      liquid - The liquid to be checked
      Returns:
      True if the tank contains the liquid, false otherwise
    • removeLiquid

      void removeLiquid(net.minecraftforge.fluids.FluidStack liquid)
      Removes the given liquid from the internal tank if possible.
      Parameters:
      liquid - The liquid to be removed
    • plantGermling

      boolean plantGermling(IFarmable farmable, net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction direction)
      Callback for IFarmLogics to plant a sapling, seed, germling, stem. Will remove the appropriate germling from the farm's inventory. It's up to the logic to only call this on a valid location.
      Returns:
      true if planting was successful, false otherwise.
    • isValidPlatform

      default boolean isValidPlatform(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos)
    • isSquare

      default boolean isSquare()
      If the farmland area is square.
      Returns:
      True if the farmland area is a square, false otherwise
    • canPlantSoil

      default boolean canPlantSoil(boolean manual)
      Checks if the farm can plant soil.
      Parameters:
      manual - If true the manual mode of the farm is enabled
      Returns:
      True if the farm is able to place soil, false otherwise
    • getFarmInventory

      IFarmInventory getFarmInventory()
      Returns:
      The inventory instance of this farm.
    • addPendingProduct

      void addPendingProduct(net.minecraft.world.item.ItemStack stack)
      Adds a product to an internal buffer of items, which will later be added to the inventory.
      Parameters:
      stack - The stack to be added to the inventory.
    • setFarmLogic

      void setFarmLogic(net.minecraft.core.Direction direction, IFarmLogic logic)
      Sets the farm logic of one direction of the farm.
      Parameters:
      direction - The direction of the farm to be set
      logic - The farm logic that direction should be set to
    • resetFarmLogic

      void resetFarmLogic(net.minecraft.core.Direction direction)
      Resets the farm logic off the given direction to the default logic (ARBOREAL).
      Parameters:
      direction - The direction to reset
    • getFarmLogic

      IFarmLogic getFarmLogic(net.minecraft.core.Direction direction)
      Receives the logic of the given direction.
      Parameters:
      direction - The direction of the logic to get.
      Returns:
      The logic that is located on this side of the farm.
    • getFarmLogics

      Collection<IFarmLogic> getFarmLogics()
      Receives a collection with all logics of this farm. By default this ether contains 1 or 4 logics.
      Returns:
      A collection which contains all logics of this farm.
    • getStoredFertilizerScaled

      int getStoredFertilizerScaled(int scale)
      The percentage of fertilizer stored my the farm multiplied by the given scale.
      Parameters:
      scale - Value used to scale the fertilizer percentage
      Returns:
      The percentage of fertilizer stored my the farm multiplied by the given scale.
    • getFarmCorner

      net.minecraft.core.BlockPos getFarmCorner(net.minecraft.core.Direction direction)
      Receives the corner position of the given direction. Mainly used for internal logic to position the crops and germlings.
      Parameters:
      direction - The direction to receive
      Returns:
      The position of the direction corner.