Package forestry.api.plugin
Interface IFarmTypeBuilder
public interface IFarmTypeBuilder
Configures a new farm type.
It is REQUIRED to call
setFertilizerConsumption(int) and setWaterConsumption(int).-
Method Summary
Modifier and TypeMethodDescriptionaddFarmable(IFarmable farmable) Adds a custom farmable to this type.addGermling(net.minecraft.world.item.ItemStack germling) Adds a germling (seed item) to this farm type for displaying in JEI.addGermlings(Iterable<net.minecraft.world.item.ItemStack> seedling) Adds multiple germlings to this farm type for displaying in JEI.addProduct(net.minecraft.world.item.ItemStack product) Adds a product to this farm type for displaying in JEI.addProducts(Collection<net.minecraft.world.item.ItemStack> products) Adds multiple products to this farm type for displaying in JEI.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.default IFarmTypeBuilderaddSoil(net.minecraft.world.level.block.Block block) Adds a soil used by this block for automatic planting.addWindfallFarmable(net.minecraft.world.item.Item germling, IFarmableFactory factory, Consumer<IWindfallFarmableBuilder> action) Adds a new farmable to this farm type.modifyWindfallFarmable(net.minecraft.world.item.Item germling, Consumer<IWindfallFarmableBuilder> action) Used to modify an already added windfall farmable for this farm type.default IFarmTypeBuildersetFertilizerConsumption(int consumption) Sets the fertilizer consumption as a flat rate.setFertilizerConsumption(ToIntFunction<IFarmHousing> consumption) Sets the fertilizer consumption according to the housing's state.setIcon(net.minecraft.world.item.ItemStack stack) Used to override the icon used to display this farm in the Multiblock farm screen.setLogicFactory(BiFunction<IFarmType, Boolean, IFarmLogic> factory) Used to override the IFarmLogic factory used to create farm logic instances for this farm type.default IFarmTypeBuildersetWaterConsumption(int waterConsumption) Sets the water consumption of this farm as a flat rate.setWaterConsumption(IWaterConsumption waterConsumption) Sets the water consumption of this farm according to the farm's hydration modifier and state.default IFarmTypeBuildersetWaterConsumption(it.unimi.dsi.fastutil.floats.Float2IntFunction waterConsumption) Sets the water consumption of this farm as a function of the farm's hydration modifier.
-
Method Details
-
setIcon
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
Sets the fertilizer consumption as a flat rate. A single Forestry fertilizer is worth500.- Parameters:
consumption- The amount of fertilizer used to harvest a single crop.
-
setFertilizerConsumption
Sets the fertilizer consumption according to the housing's state. A single Forestry fertilizer is worth500.- Parameters:
consumption- The amount of fertilizer used to harvest a single crop based on the farm housing's state.
-
setWaterConsumption
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
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
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
Adds a germling (seed item) to this farm type for displaying in JEI.- Parameters:
germling- The germling to add.
-
addGermlings
Adds multiple germlings to this farm type for displaying in JEI.- Parameters:
seedling- The seedling to add.
-
addProduct
Adds a product to this farm type for displaying in JEI.- Parameters:
product- The product to add.
-
addProducts
Adds multiple products to this farm type for displaying in JEI. PreferIFarmable.addProducts(java.util.function.Consumer<net.minecraft.world.item.ItemStack>)if you have a farmable.- Parameters:
products- The products to add.
-
addFarmable
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, useaddWindfallFarmable(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) Adds a new farmable to this farm type. Supports modifications by other mods usingmodifyWindfallFarmable(net.minecraft.world.item.Item, java.util.function.Consumer<forestry.api.plugin.IWindfallFarmableBuilder>).- 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 byIFarmable.isGermling(net.minecraft.world.item.ItemStack)andIFarmable.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.
-