Package net.minecraftforge.event.world
Class BlockEvent.BreakEvent
- java.lang.Object
-
- net.minecraftforge.eventbus.api.Event
-
- net.minecraftforge.event.world.BlockEvent
-
- net.minecraftforge.event.world.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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.minecraftforge.event.world.BlockEvent
BlockEvent.BlockToolInteractEvent, BlockEvent.BreakEvent, BlockEvent.CreateFluidSourceEvent, BlockEvent.CropGrowEvent, BlockEvent.EntityMultiPlaceEvent, BlockEvent.EntityPlaceEvent, BlockEvent.FarmlandTrampleEvent, BlockEvent.FluidPlaceBlockEvent, BlockEvent.NeighborNotifyEvent, BlockEvent.PortalSpawnEvent
-
-
Field Summary
Fields Modifier and Type Field Description private intexpprivate PlayerEntityplayerReference to the Player who broke the block.
-
Constructor Summary
Constructors Constructor Description BreakEvent(World world, BlockPos pos, BlockState state, PlayerEntity player)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetExpToDrop()Get the experience dropped by the block after the event has processedPlayerEntitygetPlayer()voidsetExpToDrop(int exp)Set the amount of experience dropped by the block after the event has processed-
Methods inherited from class net.minecraftforge.event.world.BlockEvent
getPos, getState, getWorld
-
-
-
-
Field Detail
-
player
private final PlayerEntity player
Reference to the Player who broke the block. If no player is available, use a EntityFakePlayer
-
exp
private int exp
-
-
Constructor Detail
-
BreakEvent
public BreakEvent(World world, BlockPos pos, BlockState state, PlayerEntity player)
-
-
Method Detail
-
getPlayer
public PlayerEntity getPlayer()
-
getExpToDrop
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
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
-
-