CustomBlockBreakEvent
Namespace Mc.Scripting.Events · Kind struct (ref)
public ref struct CustomBlockBreakEvent : IEventA player is breaking a custom block (fired by the content layer after BlockBreak). Cancel to keep the block.
| Id | 274 |
| Key | mc:custom_block_break |
| Cancellable | yes |
| Fired by the engine | yes |
| Field | Type | Handlers may write | Description |
|---|---|---|---|
Player |
player |
no (readonly) | The player. |
CustomId |
Utf8String |
no (readonly) | The id of the custom block. |
World |
world |
no (readonly) | The dimension. |
Pos |
BlockPos |
no (readonly) | The block. |
DropItems |
bool |
yes | Whether the block’s drops are spawned. |
Set e.Cancelled = true in a handler to cancel it; lower-priority handlers are skipped unless they subscribed with receiveCancelled: true.
Constructors
Section titled “Constructors”| Member | Description |
|---|---|
Constructor |
Creates the event (for firing it from a plugin; native code builds its own). |
Constructor
Section titled “Constructor”public CustomBlockBreakEvent(Player player, Utf8String customId, World world, BlockPos pos, bool dropItems)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 |
|
customId |
Utf8String |
|
world |
World |
|
pos |
BlockPos |
|
dropItems |
bool |
Properties
Section titled “Properties”| Member | Description |
|---|---|
bool Cancelled { get; set; } |
Cancelling stops lower-priority handlers (unless they opt in) and the action itself. |
Utf8String CustomId { get; } |
The id of the custom block. |
bool DropItems { get; set; } |
Whether the block’s drops are spawned. |
Player Player { get; } |
The player. |
BlockPos Pos { get; } |
The block. |
World World { get; } |
The dimension. |
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. |
Cancelled
Section titled “Cancelled”public bool Cancelled { get; set; }Cancelling stops lower-priority handlers (unless they opt in) and the action itself.
CustomId
Section titled “CustomId”public Utf8String CustomId { get; }The id of the custom block.
DropItems
Section titled “DropItems”public bool DropItems { get; set; }Whether the block’s drops are spawned.
Player
Section titled “Player”public Player Player { get; }The player.
public BlockPos Pos { get; }The block.
public World World { get; }The dimension.
CatalogueId
Section titled “CatalogueId”public static ushort CatalogueId { get; }Catalogue id (stable ABI).
IsCancellable
Section titled “IsCancellable”public static bool IsCancellable { get; }Whether handlers can cancel the event.
public static string Key { get; }Registry key of the event.
See also
Section titled “See also”BlockPos · IEvent · Player · Utf8String · World