Class PlayerEvent.BreakSpeed

All Implemented Interfaces:
net.neoforged.bus.api.ICancellableEvent
Enclosing class:
PlayerEvent

public static class PlayerEvent.BreakSpeed extends PlayerEvent implements net.neoforged.bus.api.ICancellableEvent
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 EventHooks.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 ICancellableEvent.
If it is canceled, the player is unable to break the block.

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


This event is fired on the NeoForge.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()