Class BoneMealedPlantModule
java.lang.Object
com.minecolonies.core.colony.buildingextensions.modules.AbstractBuildingExtensionModule
com.minecolonies.core.colony.buildings.workerbuildings.plantation.AbstractPlantationModule
com.minecolonies.core.colony.buildings.workerbuildings.plantation.modules.generic.BoneMealedPlantModule
- All Implemented Interfaces:
IBuildingExtensionModule,IPlantationModule
- Direct Known Subclasses:
CrimsonPlantsPlantModule,SeagrassPlantModule,SeapicklePlantModule,WarpedPlantsPlantModule
Plantation module for plants that grow on a flat piece of land when bone-mealed.
Requirements:
Requirements:
- Soil blocks must be the same so plants can grow on them.
- Anything that grows on the field will be harvested, but only things that are 1 block high (multi block high things must break completely, else they are ignored).
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.minecolonies.api.colony.buildingextensions.plantation.IPlantationModule
IPlantationModule.ActionToPerform, IPlantationModule.PlantationModuleResult, IPlantationModule.PlanterAIModuleResultResetState -
Field Summary
Fields inherited from class com.minecolonies.core.colony.buildings.workerbuildings.plantation.AbstractPlantationModule
DEFAULT_MAX_PLANTSFields inherited from class com.minecolonies.core.colony.buildingextensions.modules.AbstractBuildingExtensionModule
extension -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBoneMealedPlantModule(IBuildingExtension field, String fieldTag, String workTag, net.minecraft.world.item.Item item) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptiondecideFieldWork(net.minecraft.world.level.Level world, @NotNull net.minecraft.core.BlockPos workingPosition) Core function for the planter module, is responsible for telling the AI what to do on the specific field.intReturns the maximum amount of actions that can be performed on a field, before the planter must forcefully switch to a new field.protected intGet the maximum amount of working positions this field is allowed to handle.@Nullable net.minecraft.core.BlockPosgetNextWorkingPosition(net.minecraft.world.level.Level world) Obtains the next working position for the given field, if any.protected intGet the chance in percentages of being able to perform work on this field when asked.List<net.minecraft.world.item.ItemStack> Returns a list of items that are mandatory for this module to function.List<net.minecraft.world.item.Item> Returns which items are considered valid bonemeal items.protected booleanisValidBonemealLocation(net.minecraft.world.level.block.state.BlockState blockState) Check if the block is a correct block for planting.protected booleanisValidHarvestBlock(net.minecraft.world.level.block.state.BlockState blockState) Check if the block is a correct block for harvesting.Methods inherited from class com.minecolonies.core.colony.buildings.workerbuildings.plantation.AbstractPlantationModule
applyBonemeal, equals, getFieldTag, getItem, getPlantingBlockState, getPlantsToRequest, getPositionToWalkTo, getRequiredResearchEffect, getValidWorkingPositions, getWorkingPositions, getWorkTag, hashCodeMethods inherited from class com.minecolonies.core.colony.buildingextensions.modules.AbstractBuildingExtensionModule
getExtensionMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.minecolonies.api.colony.buildingextensions.modules.IBuildingExtensionModule
getExtensionMethods inherited from interface com.minecolonies.api.colony.buildingextensions.plantation.IPlantationModule
getRequiredTool
-
Constructor Details
-
BoneMealedPlantModule
protected BoneMealedPlantModule(IBuildingExtension field, String fieldTag, String workTag, net.minecraft.world.item.Item item) Default constructor.- Parameters:
field- the field instance this module is working on.fieldTag- the tag of the field anchor block.workTag- the tag of the working positions.item- the item which is harvested.
-
-
Method Details
-
decideFieldWork
public IPlantationModule.PlantationModuleResult.Builder decideFieldWork(net.minecraft.world.level.Level world, @NotNull @NotNull net.minecraft.core.BlockPos workingPosition) Description copied from interface:IPlantationModuleCore function for the planter module, is responsible for telling the AI what to do on the specific field.- Parameters:
world- the world reference that can be used for block state lookups.workingPosition- the position that has been chosen for work.- Returns:
- a basic enum state telling the planter AI what the AI should be doing next.
-
isValidHarvestBlock
protected boolean isValidHarvestBlock(net.minecraft.world.level.block.state.BlockState blockState) Check if the block is a correct block for harvesting. Defaults to check if the block state is not air.- Parameters:
blockState- the block state.- Returns:
- whether the block can be harvested.
-
isValidBonemealLocation
protected boolean isValidBonemealLocation(net.minecraft.world.level.block.state.BlockState blockState) Check if the block is a correct block for planting. Defaults to being any air block.- Parameters:
blockState- the block state.- Returns:
- whether the block can be planted.
-
getNextWorkingPosition
@Nullable public @Nullable net.minecraft.core.BlockPos getNextWorkingPosition(net.minecraft.world.level.Level world) Description copied from interface:IPlantationModuleObtains the next working position for the given field, if any.- Parameters:
world- the world reference that can be used for block state lookups.- Returns:
- the next position to work on, or null.
-
getPercentageChance
protected int getPercentageChance()Get the chance in percentages of being able to perform work on this field when asked. Defaults toDEFAULT_PERCENTAGE_CHANCE.- Returns:
- a number between 1 and 100.
-
getActionLimit
public int getActionLimit()Description copied from interface:IPlantationModuleReturns the maximum amount of actions that can be performed on a field, before the planter must forcefully switch to a new field.- Returns:
- the maximum of actions the planter can perform on the field per cycle.
-
getRequiredItemsForOperation
Description copied from interface:IPlantationModuleReturns a list of items that are mandatory for this module to function.- Returns:
- a list of items.
-
getMaxWorkingPositions
protected int getMaxWorkingPositions()Description copied from class:AbstractPlantationModuleGet the maximum amount of working positions this field is allowed to handle. Defaults toAbstractPlantationModule.DEFAULT_MAX_PLANTS.- Overrides:
getMaxWorkingPositionsin classAbstractPlantationModule- Returns:
- the maximum amount of plants.
-
getValidBonemeal
Description copied from interface:IPlantationModuleReturns which items are considered valid bonemeal items. Defaults to an empty list. (Most modules should not need any bonemeal).- Specified by:
getValidBonemealin interfaceIPlantationModule- Overrides:
getValidBonemealin classAbstractPlantationModule
-