PrepareAnvilEvent
Namespace Mc.Scripting.Events · Kind struct (ref)
public ref struct PrepareAnvilEvent : IEventThe 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.
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 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 |
Properties
Section titled “Properties”| 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. |
Cancelled
Section titled “Cancelled”public bool Cancelled { get; set; }Cancelling stops lower-priority handlers (unless they opt in) and the action itself.
public ItemView First { get; }Left input.
Player
Section titled “Player”public Player Player { get; }The player.
RenameText
Section titled “RenameText”public Utf8String RenameText { get; }The text typed in the rename field.
RepairCost
Section titled “RepairCost”public int RepairCost { get; set; }Levels the player pays.
Result
Section titled “Result”public ItemView Result { get; }The computed result.
Second
Section titled “Second”public ItemView Second { get; }Right input.
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”IEvent · ItemView · Player · Utf8String