Interface IPlantationModule
- All Superinterfaces:
IBuildingExtensionModule
- All Known Implementing Classes:
AbstractPlantationModule,BambooPlantModule,BoneMealedPlantModule,CactusPlantModule,CocoaPlantModule,CrimsonPlantsPlantModule,DownwardsGrowingPlantModule,GlowBerriesPlantModule,KelpPlantModule,PercentageHarvestPlantModule,SeagrassPlantModule,SeapicklePlantModule,SugarCanePlantModule,TreeSidePlantModule,TwistingVinesPlantModule,UpwardsGrowingPlantModule,VinePlantModule,WarpedPlantsPlantModule,WeepingVinesPlantModule
Interface for planter modules that determines how the AI should work specific fields.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumThe different actions this module is able to perform.static classClass containing possible states that the planter AI can be in.static enumEnum containing the reset state of the result state. -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyBonemeal(AbstractEntityCitizen worker, net.minecraft.core.BlockPos workPosition, net.minecraft.world.item.ItemStack stackInSlot, net.minecraft.world.entity.player.Player fakePlayer) Logic for applying bonemeal to the working position.decideFieldWork(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.booleanEquals implementation for this field.intReturns the maximum amount of actions that can be performed on a field, before the planter must forcefully switch to a new field.Get the field tag property.net.minecraft.world.item.ItemgetItem()Get the item the module uses.@Nullable net.minecraft.core.BlockPosgetNextWorkingPosition(net.minecraft.world.level.Level world) Obtains the next working position for the given field, if any.net.minecraft.world.level.block.state.BlockStategetPlantingBlockState(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos workPosition, net.minecraft.world.level.block.state.BlockState blockState) Generate a block state for a new plant.intGet the amount of plants to request when the planter no longer has any left.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.net.minecraft.resources.ResourceLocationGet the required research effect for this module.Returns the requested tool type in order to work on this module.List<net.minecraft.world.item.Item>Returns which items are considered valid bonemeal items.List<net.minecraft.core.BlockPos>getValidWorkingPositions(@NotNull net.minecraft.world.level.Level world, List<net.minecraft.core.BlockPos> workingPositions) Get a list of actual valid working positions, based on the tags read from the plantation field.Get the work tag property.inthashCode()Hashcode implementation for this field.Methods inherited from interface com.minecolonies.api.colony.buildingextensions.modules.IBuildingExtensionModule
getBuildingExtension
-
Method Details
-
getFieldTag
String getFieldTag()Get the field tag property.- Returns:
- the field tag.
-
getWorkTag
String getWorkTag()Get the work tag property.- Returns:
- the work tag.
-
getItem
net.minecraft.world.item.Item getItem()Get the item the module uses.- Returns:
- the item.
-
getPlantsToRequest
int getPlantsToRequest()Get the amount of plants to request when the planter no longer has any left. Defaults to quarter stack size of the block.- Returns:
- the amount of plants to request.
-
getRequiredResearchEffect
net.minecraft.resources.ResourceLocation getRequiredResearchEffect()Get the required research effect for this module. Null if there is no research required for this field.- Returns:
- the key of where to find the effect.
-
decideFieldWork
IPlantationModule.PlantationModuleResult.Builder decideFieldWork(net.minecraft.world.level.Level world, @NotNull @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.- 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.
-
getNextWorkingPosition
@Nullable @Nullable net.minecraft.core.BlockPos getNextWorkingPosition(net.minecraft.world.level.Level world) Obtains 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.
-
getValidWorkingPositions
List<net.minecraft.core.BlockPos> getValidWorkingPositions(@NotNull @NotNull net.minecraft.world.level.Level world, List<net.minecraft.core.BlockPos> workingPositions) Get a list of actual valid working positions, based on the tags read from the plantation field.- Parameters:
world- the level the tags were read from.workingPositions- the list of initially parsed working positions, based on work tag.- Returns:
- the list of actually valid parsed working positions.
-
getActionLimit
int getActionLimit()Returns 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.
-
getValidBonemeal
List<net.minecraft.world.item.Item> getValidBonemeal()Returns which items are considered valid bonemeal items. Defaults to an empty list. (Most modules should not need any bonemeal). -
getPositionToWalkTo
net.minecraft.core.BlockPos getPositionToWalkTo(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. Defaults to the same block.- 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.
-
getPlantingBlockState
net.minecraft.world.level.block.state.BlockState getPlantingBlockState(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos workPosition, net.minecraft.world.level.block.state.BlockState blockState) Generate a block state for a new plant.- Parameters:
world- the world reference that can be used for block state lookups.workPosition- the position that has been chosen for work.blockState- the default block state for the block.
-
applyBonemeal
void applyBonemeal(AbstractEntityCitizen worker, net.minecraft.core.BlockPos workPosition, net.minecraft.world.item.ItemStack stackInSlot, net.minecraft.world.entity.player.Player fakePlayer) Logic for applying bonemeal to the working position.- Parameters:
worker- the worker entity working on the plantation.workPosition- the position that has been chosen for work.stackInSlot- the item stack to use for the planting.fakePlayer- a fake player class to use.
-
getRequiredItemsForOperation
List<net.minecraft.world.item.ItemStack> getRequiredItemsForOperation()Returns a list of items that are mandatory for this module to function.- Returns:
- a list of items.
-
getRequiredTool
EquipmentTypeEntry getRequiredTool()Returns the requested tool type in order to work on this module.- Returns:
- the tool to work on this module.
-
hashCode
int hashCode()Hashcode implementation for this field. -
equals
Equals implementation for this field.
-