Skip to content

PrepareCraftEvent

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

public ref struct PrepareCraftEvent : IEvent

The crafting grid matched a recipe. Cancel to show no result.

Id 265
Key mc:prepare_craft
Cancellable yes
Fired by the engine yes
Field Type Handlers may write Description
Player player no (readonly) The player.
Recipe Utf8String no (readonly) Recipe id.
Result item no (readonly) The result that would be shown.

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

Member Description
PrepareCraftEvent(Player player, Utf8String recipe, ItemView result) Creates the event (for firing it from a plugin; native code builds its own).
public PrepareCraftEvent(Player player, Utf8String recipe, ItemView result)

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
recipe Utf8String
result ItemView
Member Description
bool Cancelled { get; set; } Cancelling stops lower-priority handlers (unless they opt in) and the action itself.
Player Player { get; } The player.
Utf8String Recipe { get; } Recipe id.
ItemView Result { get; } The result that would be shown.
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 Player Player { get; }

The player.

public Utf8String Recipe { get; }

Recipe id.

public ItemView Result { get; }

The result that would be shown.

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.

IEvent · ItemView · Player · Utf8String