Skip to content

BlockDamageEvent

Namespace Mc.Scripting.Events · Kind struct (ref)

public ref struct BlockDamageEvent : IEvent

A player started digging a block. Cancel to stop the dig. Set InstaBreak to break it at once.

Id 180
Key mc:block_damage
Cancellable yes
Fired by the engine yes
Field Type Handlers may write Description
Player player no (readonly) The player.
Pos BlockPos no (readonly) The block.
Face enum:BlockFace no (readonly) The face being dug.
Tool item no (readonly) The item in the main hand.
InstaBreak bool yes Break the block immediately (as in creative mode).

Set e.Cancelled = true in a handler to cancel it; lower-priority handlers are skipped unless they subscribed with receiveCancelled: true.

Member Description
Constructor Creates the event (for firing it from a plugin; native code builds its own).
public BlockDamageEvent(Player player, BlockPos pos, BlockFace face, ItemView tool, bool instaBreak)

Creates the event (for firing it from a plugin; native code builds its own). Signature of API 1.0.

Parameters

Name Type Description
player Player
pos BlockPos
face BlockFace
tool ItemView
instaBreak bool
Member Description
bool Cancelled { get; set; } Cancelling stops lower-priority handlers (unless they opt in) and the action itself.
BlockFace Face { get; } The face being dug.
bool InstaBreak { get; set; } Break the block immediately (as in creative mode).
Player Player { get; } The player.
BlockPos Pos { get; } The block.
ItemView Tool { get; } The item in the main hand.
static ushort CatalogueId { get; } Catalogue id (stable ABI).
static bool IsCancellable { get; } Whether handlers can cancel the event.
static string Key { get; } Registry key of the event.
public bool Cancelled { get; set; }

Cancelling stops lower-priority handlers (unless they opt in) and the action itself.

public BlockFace Face { get; }

The face being dug.

public bool InstaBreak { get; set; }

Break the block immediately (as in creative mode).

public Player Player { get; }

The player.

public BlockPos Pos { get; }

The block.

public ItemView Tool { get; }

The item in the main hand.

public static ushort CatalogueId { get; }

Catalogue id (stable ABI).

public static bool IsCancellable { get; }

Whether handlers can cancel the event.

public static string Key { get; }

Registry key of the event.

BlockFace · BlockPos · IEvent · ItemView · Player