Skip to content

PlayerPickupItemEvent

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

public ref struct PlayerPickupItemEvent : IEvent

A player is about to pick up an item entity. Cancel to leave it on the ground.

Id 116
Key mc:player_pickup_item
Cancellable yes
Fired by the engine yes
Field Type Handlers may write Description
Player player no (readonly) The player.
ItemEntity Entity no (readonly) The item entity.
Item item no (readonly) The stack on the ground.

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

Member Description
PlayerPickupItemEvent(Player player, Entity itemEntity, ItemView item) Creates the event (for firing it from a plugin; native code builds its own).
public PlayerPickupItemEvent(Player player, Entity itemEntity, ItemView item)

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
itemEntity Entity
item ItemView
Member Description
bool Cancelled { get; set; } Cancelling stops lower-priority handlers (unless they opt in) and the action itself.
ItemView Item { get; } The stack on the ground.
Entity ItemEntity { get; } The item entity.
Player Player { get; } The player.
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 Item { get; }

The stack on the ground.

public Entity ItemEntity { get; }

The item entity.

public Player Player { get; }

The player.

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.

Entity · IEvent · ItemView · Player