Class BlockEvent.BreakEvent

java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.event.level.BlockEvent
net.minecraftforge.event.level.BlockEvent.BreakEvent
Enclosing class:
BlockEvent

public static class BlockEvent.BreakEvent extends BlockEvent
Event that is fired when an Block is about to be broken by a player Canceling this event will prevent the Block from being broken.
  • Field Details Link icon

    • player Link icon

      private final Player player
      Reference to the Player who broke the block. If no player is available, use a EntityFakePlayer
    • exp Link icon

      private int exp
  • Constructor Details Link icon

  • Method Details Link icon

    • getPlayer Link icon

      public Player getPlayer()
    • getExpToDrop Link icon

      public int getExpToDrop()
      Get the experience dropped by the block after the event has processed
      Returns:
      The experience to drop or 0 if the event was canceled
    • setExpToDrop Link icon

      public void setExpToDrop(int exp)
      Set the amount of experience dropped by the block after the event has processed
      Parameters:
      exp - 1 or higher to drop experience, else nothing will drop