Skip to content

PrepareAnvilEvent

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

public ref struct PrepareAnvilEvent : IEvent

The anvil inputs changed and a result was computed. Cancel to show no result; the cost may be changed.

Id 269
Key mc:prepare_anvil
Cancellable yes
Fired by the engine yes
Field Type Handlers may write Description
Player player no (readonly) The player.
First item no (readonly) Left input.
Second item no (readonly) Right input.
Result item no (readonly) The computed result.
RepairCost int yes Levels the player pays.
RenameText Utf8String no (readonly) The text typed in the rename field.

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 PrepareAnvilEvent(Player player, ItemView first, ItemView second, ItemView result, int repairCost, Utf8String renameText)

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
first ItemView
second ItemView
result ItemView
repairCost int
renameText Utf8String
Member Description
bool Cancelled { get; set; } Cancelling stops lower-priority handlers (unless they opt in) and the action itself.
ItemView First { get; } Left input.
Player Player { get; } The player.
Utf8String RenameText { get; } The text typed in the rename field.
int RepairCost { get; set; } Levels the player pays.
ItemView Result { get; } The computed result.
ItemView Second { get; } Right input.
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 ItemView First { get; }

Left input.

public Player Player { get; }

The player.

public Utf8String RenameText { get; }

The text typed in the rename field.

public int RepairCost { get; set; }

Levels the player pays.

public ItemView Result { get; }

The computed result.

public ItemView Second { get; }

Right input.

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