ItemUseContext
Namespace Mc.Scripting.Content · Kind class (sealed)
public sealed class ItemUseContextWhat a custom item’s use handler gets. Valid during the handler only.
Properties
Section titled “Properties”| Member | Description |
|---|---|
bool Cancelled { get; set; } |
Stops the vanilla behaviour of the base item and of the clicked block. |
CustomItem Definition { get; } |
The definition of the item. |
BlockFace Face { get; } |
The clicked face (only when ItemUseContext.HasBlock). |
Hand Hand { get; } |
The hand holding the item. |
bool HasBlock { get; } |
Whether the click was on a block. |
ItemStack Item { get; } |
The stack that was used. |
Player Player { get; } |
The player. |
BlockPos Position { get; } |
The clicked block (only when ItemUseContext.HasBlock). |
World World { get; } |
The dimension the player is in. |
Cancelled
Section titled “Cancelled”public bool Cancelled { get; set; }Stops the vanilla behaviour of the base item and of the clicked block.
Definition
Section titled “Definition”public CustomItem Definition { get; }The definition of the item.
public BlockFace Face { get; }The clicked face (only when ItemUseContext.HasBlock).
public Hand Hand { get; }The hand holding the item.
HasBlock
Section titled “HasBlock”public bool HasBlock { get; }Whether the click was on a block.
public ItemStack Item { get; }The stack that was used.
Player
Section titled “Player”public Player Player { get; }The player.
Position
Section titled “Position”public BlockPos Position { get; }The clicked block (only when ItemUseContext.HasBlock).
public World World { get; }The dimension the player is in.
Methods
Section titled “Methods”| Member | Description |
|---|---|
void Consume(int count = 1) |
Uses up items of the stack that was used (nothing happens in creative mode). |
Consume
Section titled “Consume”public void Consume(int count = 1)Uses up items of the stack that was used (nothing happens in creative mode).
Parameters
| Name | Type | Description |
|---|---|---|
count |
int = 1 |
How many. |
See also
Section titled “See also”BlockFace · BlockPos · CustomItem · Hand · ItemStack · Player · World