Skip to content

CustomBlockPlaceEvent

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

public ref struct CustomBlockPlaceEvent : IEvent

A player is placing a custom block with a custom item. Cancel to refuse.

Id 273
Key mc:custom_block_place
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) Where it is placed.
Against BlockPos no (readonly) The block that was clicked.
Hand enum:Hand no (readonly) The hand.

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 CustomBlockPlaceEvent(Player player, Utf8String customId, World world, BlockPos pos, BlockPos against, Hand hand)

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
against BlockPos
hand Hand
Member Description
BlockPos Against { get; } The block that was clicked.
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.
Hand Hand { get; } The hand.
Player Player { get; } The player.
BlockPos Pos { get; } Where it is placed.
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.
public BlockPos Against { get; }

The block that was clicked.

public bool Cancelled { get; set; }

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

public Utf8String CustomId { get; }

The id of the custom block.

public Hand Hand { get; }

The hand.

public Player Player { get; }

The player.

public BlockPos Pos { get; }

Where it is placed.

public World World { get; }

The dimension.

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.

BlockPos · Hand · IEvent · Player · Utf8String · World