Class PlayerEvent.HarvestCheck

Enclosing class:
PlayerEvent

public static class PlayerEvent.HarvestCheck extends PlayerEvent
HarvestCheck is fired when a player attempts to harvest a block.
This event is fired whenever a player attempts to harvest a block in Player.hasCorrectToolForDrops(BlockState).

This event is fired via the EventHooks.doPlayerHarvestCheck(Player, BlockState, BlockGetter, BlockPos).

state contains the BlockState that is being checked for harvesting.
success contains the boolean value for whether the Block will be successfully harvested.

This event is not ICancellableEvent.

This event does not have a result.
invalid reference
Event.HasResult


This event is fired on the NeoForge.EVENT_BUS.
  • Field Details

    • state

      private final net.minecraft.world.level.block.state.BlockState state
    • level

      private final net.minecraft.world.level.BlockGetter level
    • pos

      private final net.minecraft.core.BlockPos pos
    • success

      private boolean success
  • Constructor Details

    • HarvestCheck

      public HarvestCheck(net.minecraft.world.entity.player.Player player, net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos, boolean success)
  • Method Details

    • getTargetBlock

      public net.minecraft.world.level.block.state.BlockState getTargetBlock()
    • getLevel

      public net.minecraft.world.level.BlockGetter getLevel()
    • getPos

      public net.minecraft.core.BlockPos getPos()
    • canHarvest

      public boolean canHarvest()
    • setCanHarvest

      public void setCanHarvest(boolean success)