Class HarvestHandlerAbstractCrop

java.lang.Object
me.desht.pneumaticcraft.api.harvesting.HarvestHandler
me.desht.pneumaticcraft.common.harvesting.HarvestHandlerAbstractCrop
Direct Known Subclasses:
HarvestHandlerCropLike, HarvestHandlerCrops

public abstract class HarvestHandlerAbstractCrop extends HarvestHandler
  • Nested Class Summary

    Nested classes/interfaces inherited from class me.desht.pneumaticcraft.api.harvesting.HarvestHandler

    HarvestHandler.SimpleHarvestHandler
  • Constructor Summary

    Constructors
    Constructor
    Description
    HarvestHandlerAbstractCrop(Predicate<net.minecraft.world.level.block.state.BlockState> blockChecker)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canHarvest(net.minecraft.world.level.Level world, net.minecraft.world.level.BlockGetter chunkCache, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, IDrone drone)
    Determines if the currently checked block can be harvested.
    boolean
    harvestAndReplant(net.minecraft.world.level.Level world, net.minecraft.world.level.BlockGetter chunkCache, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, IDrone drone)
    Should harvest the block (drop items), and replant the plant if applicable.
    protected abstract boolean
    isMaxAge(net.minecraft.world.level.block.state.BlockState state)
     
    protected abstract boolean
    isSeed(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.item.ItemStack stack)
     
    protected abstract net.minecraft.world.level.block.state.BlockState
    withMinAge(net.minecraft.world.level.block.state.BlockState state)
     

    Methods inherited from class me.desht.pneumaticcraft.api.harvesting.HarvestHandler

    addFilterItems, harvest

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • HarvestHandlerAbstractCrop

      public HarvestHandlerAbstractCrop(Predicate<net.minecraft.world.level.block.state.BlockState> blockChecker)
  • Method Details

    • canHarvest

      public boolean canHarvest(net.minecraft.world.level.Level world, net.minecraft.world.level.BlockGetter chunkCache, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, IDrone drone)
      Description copied from class: HarvestHandler
      Determines if the currently checked block can be harvested.
      Specified by:
      canHarvest in class HarvestHandler
      Parameters:
      world - the world
      chunkCache - Use preferably methods from this cache as it's generally quicker than accessing via 'world'. The cache has access to the chunks that are accessed by the Drone current program, so as long as only the y pos is varied of the supplied pos, you are good. If not, use 'world'.
      pos - the blockpos to be checked
      state - the blockstate
      drone - the drone
      Returns:
      true if the block can be harvested, false if not.
    • harvestAndReplant

      public boolean harvestAndReplant(net.minecraft.world.level.Level world, net.minecraft.world.level.BlockGetter chunkCache, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, IDrone drone)
      Description copied from class: HarvestHandler
      Should harvest the block (drop items), and replant the plant if applicable. For example, for crops it should reset the growth stage to 0.
      Overrides:
      harvestAndReplant in class HarvestHandler
      Parameters:
      world - the world
      chunkCache - Use preferably methods from this cache as it's generally quicker than accessing via 'world'. The cache has access to the chunks that are accessed by the Drone current program, so as long as only the y pos is varied of the supplied pos, you are good. If not, use 'world'.
      pos - the block's position
      state - the blockstate at the position
      drone - the drone doing the harvesting
      Returns:
      true if the replanting succeeded (and the hoe the Drone carries needs to be damaged). If nothing needed to be replanted return false.
    • isSeed

      protected abstract boolean isSeed(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.item.ItemStack stack)
    • isMaxAge

      protected abstract boolean isMaxAge(net.minecraft.world.level.block.state.BlockState state)
    • withMinAge

      protected abstract net.minecraft.world.level.block.state.BlockState withMinAge(net.minecraft.world.level.block.state.BlockState state)