Interface PlayerBlockBreakEvents.Before

Enclosing class:
PlayerBlockBreakEvents
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface PlayerBlockBreakEvents.Before
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    beforeBlockBreak(net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity)
    Called before a block is broken and allows cancelling the block breaking.
  • Method Details

    • beforeBlockBreak

      boolean beforeBlockBreak(net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity)
      Called before a block is broken and allows cancelling the block breaking.

      Implementations should not modify the level or assume the block break has completed or failed.

      Parameters:
      level - the level in which the block is broken
      player - the player breaking the block
      pos - the position at which the block is broken
      state - the block state before the block is broken
      blockEntity - the block entity before the block is broken, can be null
      Returns:
      false to cancel block breaking action, or true to pass to next listener