Interface IFarmTypeBuilder


public interface IFarmTypeBuilder
Configures a new farm type. It is REQUIRED to call setFertilizerConsumption(int) and setWaterConsumption(int).
  • Method Details

    • setIcon

      IFarmTypeBuilder setIcon(net.minecraft.world.item.ItemStack stack)
      Used to override the icon used to display this farm in the Multiblock farm screen.
      Parameters:
      stack - The item to render as this farm type's icon.
    • setLogicFactory

      Used to override the IFarmLogic factory used to create farm logic instances for this farm type.
      Parameters:
      factory - A function for creating IFarmLogic. The boolean determines whether the logic should be manual.
    • setFertilizerConsumption

      default IFarmTypeBuilder setFertilizerConsumption(int consumption)
      Sets the fertilizer consumption as a flat rate. A single Forestry fertilizer is worth 500.
      Parameters:
      consumption - The amount of fertilizer used to harvest a single crop.
    • setFertilizerConsumption

      IFarmTypeBuilder setFertilizerConsumption(ToIntFunction<IFarmHousing> consumption)
      Sets the fertilizer consumption according to the housing's state. A single Forestry fertilizer is worth 500.
      Parameters:
      consumption - The amount of fertilizer used to harvest a single crop based on the farm housing's state.
    • setWaterConsumption

      default IFarmTypeBuilder setWaterConsumption(int waterConsumption)
      Sets the water consumption of this farm as a flat rate.
      Parameters:
      waterConsumption - The rate of water consumption.
    • setWaterConsumption

      default IFarmTypeBuilder setWaterConsumption(it.unimi.dsi.fastutil.floats.Float2IntFunction waterConsumption)
      Sets the water consumption of this farm as a function of the farm's hydration modifier. The hydration modifier is the product of the farm's temperature, humidity, and rainfall modifiers.
      Parameters:
      waterConsumption - The water consumption according to the farm's climate.
    • setWaterConsumption

      IFarmTypeBuilder setWaterConsumption(IWaterConsumption waterConsumption)
      Sets the water consumption of this farm according to the farm's hydration modifier and state. The hydration modifier is the product of the farm's temperature, humidity, and rainfall modifiers.
      Parameters:
      waterConsumption - The water consumption according to the farm's climate and state.
    • addSoil

      default IFarmTypeBuilder addSoil(net.minecraft.world.level.block.Block block)
      Adds a soil used by this block for automatic planting.
      Parameters:
      block - The block form of the soil to use.
    • addSoil

      IFarmTypeBuilder addSoil(net.minecraft.world.item.ItemStack resource, net.minecraft.world.level.block.state.BlockState soilState)
      Adds a soil used by this block for automatic planting.
      Parameters:
      resource - The item form of the soil to be consumed by the farm in order to plant the soil.
      soilState - The block state of the soil used for automatic planting.
    • addGermling

      IFarmTypeBuilder addGermling(net.minecraft.world.item.ItemStack germling)
      Adds a germling (seed item) to this farm type for displaying in JEI.
      Parameters:
      germling - The germling to add.
    • addGermlings

      IFarmTypeBuilder addGermlings(Iterable<net.minecraft.world.item.ItemStack> seedling)
      Adds multiple germlings to this farm type for displaying in JEI.
      Parameters:
      seedling - The seedling to add.
    • addProduct

      IFarmTypeBuilder addProduct(net.minecraft.world.item.ItemStack product)
      Adds a product to this farm type for displaying in JEI.
      Parameters:
      product - The product to add.
    • addProducts

      IFarmTypeBuilder addProducts(Collection<net.minecraft.world.item.ItemStack> products)
      Adds multiple products to this farm type for displaying in JEI. Prefer IFarmable.addProducts(java.util.function.Consumer<net.minecraft.world.item.ItemStack>) if you have a farmable.
      Parameters:
      products - The products to add.
    • addFarmable

      IFarmTypeBuilder addFarmable(IFarmable farmable)
      Adds a custom farmable to this type. Does not support modifications by other mods. For adding a farmable that can have additional windfall items added to it, use addWindfallFarmable(net.minecraft.world.item.Item, forestry.api.farming.IFarmableFactory, java.util.function.Consumer<forestry.api.plugin.IWindfallFarmableBuilder>).
      Parameters:
      farmable - The non-customizable implementation of farmable to add.
    • addWindfallFarmable

      IFarmTypeBuilder addWindfallFarmable(net.minecraft.world.item.Item germling, IFarmableFactory factory, Consumer<IWindfallFarmableBuilder> action)
      Parameters:
      germling - The germling item used to uniquely identify this farmable, since farmables do not have IDs.
      factory - Factory used to construct the farmable when registration is complete. Accepts a germling and immutable set of windfall items, used by IFarmable.isGermling(net.minecraft.world.item.ItemStack) and IFarmable.isWindfall(net.minecraft.world.item.ItemStack).
      action - A consumer that accepts windfall items. Windfall items include drops from blocks not directly harvested by the farm type, for example, the leaf blocks left behind by the Arboretum.
    • modifyWindfallFarmable

      IFarmTypeBuilder modifyWindfallFarmable(net.minecraft.world.item.Item germling, Consumer<IWindfallFarmableBuilder> action)
      Used to modify an already added windfall farmable for this farm type. Can be used to add additional windfall items (ex. modded leaf drops for the oak sapling plantable).
      Parameters:
      germling - The germling associated with the target farmable.
      action - A consumer that accepts windfall items.