Class PlayerEvent.BreakSpeed

Enclosing class:
PlayerEvent

public static class PlayerEvent.BreakSpeed extends PlayerEvent
BreakSpeed is fired when a player attempts to harvest a block.
This event is fired whenever a player attempts to harvest a block in Player.getDigSpeed(BlockState, BlockPos).

This event is fired via the ForgeEventFactory.getBreakSpeed(Player, BlockState, float, BlockPos).

state contains the block being broken.
originalSpeed contains the original speed at which the player broke the block.
newSpeed contains the newSpeed at which the player will break the block.
pos contains the coordinates at which this event is occurring. Optional value.

This event is Cancelable.
If it is canceled, the player is unable to break the block.

This event does not have a result. Event.HasResult

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

    • LEGACY_UNKNOWN

      private static final BlockPos LEGACY_UNKNOWN
    • state

      private final BlockState state
    • originalSpeed

      private final float originalSpeed
    • newSpeed

      private float newSpeed
    • pos

      private final Optional<BlockPos> pos
  • Constructor Details

  • Method Details

    • getState

      public BlockState getState()
    • getOriginalSpeed

      public float getOriginalSpeed()
    • getNewSpeed

      public float getNewSpeed()
    • setNewSpeed

      public void setNewSpeed(float newSpeed)
    • getPosition

      public Optional<BlockPos> getPosition()
    • getPos

      @Deprecated(forRemoval=true, since="1.19") public BlockPos getPos()
      Deprecated, for removal: This API element is subject to removal in a future version.