Class DownwardsGrowingPlantModule
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.DownwardsGrowingPlantModule
- All Implemented Interfaces:
IBuildingExtensionModule,IPlantationModule
- Direct Known Subclasses:
GlowBerriesPlantModule,WeepingVinesPlantModule
Plantation module for plants that grow vertically downwards, similar to sugar glowberries.
Requirements:
Requirements:
- Grow vertically downwards without any outcroppings.
- Grow uninterrupted (no gaps in between the plant).
- Must break all blocks below when an upper block is destroyed.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.minecolonies.api.colony.buildingextensions.plantation.IPlantationModule
IPlantationModule.ActionToPerform, IPlantationModule.PlantationModuleResult, IPlantationModule.PlanterAIModuleResultResetState -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intThe default minimum plant length.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
ConstructorsModifierConstructorDescriptionprotectedDownwardsGrowingPlantModule(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 @Nullable IntegerGet the maximum length this plant can grow.protected intGet the minimum length this plant should grow to before considered harvestable.net.minecraft.core.BlockPosgetNextWorkingPosition(net.minecraft.world.level.Level world) Obtains the next working position for the given field, if any.net.minecraft.core.BlockPosgetPositionToWalkTo(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos workingPosition) Determines where the planter should walk to, in order to most effectively work on the given working position.List<net.minecraft.world.item.ItemStack> Returns a list of items that are mandatory for this module to function.protected booleanisValidClearingBlock(net.minecraft.world.level.block.state.BlockState blockState) Check if the block is a correct block for clearing.protected abstract booleanisValidHarvestBlock(net.minecraft.world.level.block.state.BlockState blockState) Check if the block is a correct block for harvesting.protected booleanisValidPlantingBlock(net.minecraft.world.level.block.state.BlockState blockState) Check if the block is a correct block for planting.Methods inherited from class com.minecolonies.core.colony.buildings.workerbuildings.plantation.AbstractPlantationModule
applyBonemeal, equals, getFieldTag, getItem, getMaxWorkingPositions, getPlantingBlockState, getPlantsToRequest, getRequiredResearchEffect, getValidBonemeal, 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
-
Field Details
-
DEFAULT_MINIMUM_PLANT_LENGTH
protected static final int DEFAULT_MINIMUM_PLANT_LENGTHThe default minimum plant length.- See Also:
-
-
Constructor Details
-
DownwardsGrowingPlantModule
protected DownwardsGrowingPlantModule(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.
-
isValidPlantingBlock
protected boolean isValidPlantingBlock(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.
-
isValidClearingBlock
protected boolean isValidClearingBlock(net.minecraft.world.level.block.state.BlockState blockState) Check if the block is a correct block for clearing.- Parameters:
blockState- the block state.- Returns:
- whether the block can be cleared.
-
isValidHarvestBlock
protected abstract boolean isValidHarvestBlock(net.minecraft.world.level.block.state.BlockState blockState) Check if the block is a correct block for harvesting.- Parameters:
blockState- the block state.- Returns:
- whether the block can be harvested.
-
getMinimumPlantLength
protected int getMinimumPlantLength()Get the minimum length this plant should grow to before considered harvestable. Defaults toDEFAULT_MINIMUM_PLANT_LENGTH.- Returns:
- the minimum plant length
-
getMaximumPlantLength
Get the maximum length this plant can grow. Defaults to null.- Returns:
- the maximum plant length
-
getNextWorkingPosition
public 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.
-
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.
-
getPositionToWalkTo
public net.minecraft.core.BlockPos getPositionToWalkTo(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos workingPosition) Description copied from interface:IPlantationModuleDetermines where the planter should walk to, in order to most effectively work on the given working position. Defaults to the same block.- Specified by:
getPositionToWalkToin interfaceIPlantationModule- Overrides:
getPositionToWalkToin classAbstractPlantationModule- Parameters:
world- the world reference that can be used for block state lookups.workingPosition- the original working position.- Returns:
- the position for the planter to walk to.
-