Table of Contents

Interface IInputAPI

Namespace
Vintagestory.API.Client
Assembly
VintagestoryAPI.dll

This interface manages the inputs of the player and is used mostly on the client side.

public interface IInputAPI

Properties

ClipboardText

Get set clipboard text

string ClipboardText { get; set; }

Property Value

string

HotKeys

Returns a list of all currently registered hotkeys.

OrderedDictionary<string, HotKey> HotKeys { get; }

Property Value

OrderedDictionary<string, HotKey>

InWorldMouseButton

The current mouse button state outside of dialogs / clicked inside the game world

MouseButtonState InWorldMouseButton { get; }

Property Value

MouseButtonState

KeyboardKeyState

The current keyboard key states that were not handled by a dialog or other client systems (exception: hotkeys), use the GlKeys enum to get the array index of a key.

bool[] KeyboardKeyState { get; }

Property Value

bool[]

KeyboardKeyStateRaw

The current keyboard key states, use the GlKeys enum to get the index of an array key.

bool[] KeyboardKeyStateRaw { get; }

Property Value

bool[]

MouseButton

The current mouse button state

MouseButtonState MouseButton { get; }

Property Value

MouseButtonState

MouseGrabbed

True if the mouse cursor is currently grabbed and not visible. (Such as while controlling the character's view in first person.)

bool MouseGrabbed { get; }

Property Value

bool

MousePitch

When controlling the camera, this is the camera pitch determined by the game engine

float MousePitch { get; set; }

Property Value

float

MouseWorldInteractAnyway

Gives the player the ability to still interact with the world even if a gui dialog is opened

bool MouseWorldInteractAnyway { get; set; }

Property Value

bool

MouseX

The current x-position of the mouse, relative to the upper left corner of the game window

int MouseX { get; }

Property Value

int

MouseY

The current y-position of the mouse, relative to the upper left corner of the game window

int MouseY { get; }

Property Value

int

MouseYaw

When controlling the camera, this is the camera yaw determined by the game engine

float MouseYaw { get; set; }

Property Value

float

Methods

AddHotkeyListener(OnHotKeyDelegate)

void AddHotkeyListener(OnHotKeyDelegate handler)

Parameters

handler OnHotKeyDelegate

GetHotKeyByCode(string)

Gets the hotkey by the given hotkey code.

HotKey GetHotKeyByCode(string toggleKeyCombinationCode)

Parameters

toggleKeyCombinationCode string

the key combination code.

Returns

HotKey

The registered hotkey.

RegisterHotKey(string, string, GlKeys, HotkeyType, bool, bool, bool)

Registers a hot key with given default key combination, the player will be able change these in the controls. Supplied hotkeyCode can than be used to register a hotkey handler.

void RegisterHotKey(string hotkeyCode, string name, GlKeys key, HotkeyType type = HotkeyType.CharacterControls, bool altPressed = false, bool ctrlPressed = false, bool shiftPressed = false)

Parameters

hotkeyCode string
name string
key GlKeys
type HotkeyType
altPressed bool
ctrlPressed bool
shiftPressed bool

RegisterHotKeyFirst(string, string, GlKeys, HotkeyType, bool, bool, bool)

Same as RegisterHotKey except it inserts it at the start of the list

void RegisterHotKeyFirst(string hotkeyCode, string name, GlKeys key, HotkeyType type = HotkeyType.CharacterControls, bool altPressed = false, bool ctrlPressed = false, bool shiftPressed = false)

Parameters

hotkeyCode string
name string
key GlKeys
type HotkeyType
altPressed bool
ctrlPressed bool
shiftPressed bool

SetHotKeyHandler(string, ActionConsumable<KeyCombination>)

Will call the handler if given hotkey has been pressed. Removes the previously assigned handler.

void SetHotKeyHandler(string hotkeyCode, ActionConsumable<KeyCombination> handler)

Parameters

hotkeyCode string
handler ActionConsumable<KeyCombination>

TriggerOnMouseClickSlot(ItemSlot)

Handles the event when the mouse clicks on a given item slot.

void TriggerOnMouseClickSlot(ItemSlot itemSlot)

Parameters

itemSlot ItemSlot

The slot of the item

Remarks

Part of a group of things that will be moved to an event bus at some point.

TriggerOnMouseEnterSlot(ItemSlot)

Handles the event when the mouse enters the bounding box of the given item slot.

void TriggerOnMouseEnterSlot(ItemSlot slot)

Parameters

slot ItemSlot

The slot of the item.

Remarks

Part of a group of things that will be moved to an event bus at some point.

TriggerOnMouseLeaveSlot(ItemSlot)

Handles the event when the mouse leaves the bounding box of the given item slot.

void TriggerOnMouseLeaveSlot(ItemSlot itemSlot)

Parameters

itemSlot ItemSlot

The slot of the item

Remarks

Part of a group of things that will be moved to an event bus at some point.

Events

InWorldAction

Triggered when the player attempts to trigger an action, such as walking forward or sprinting

event OnEntityAction InWorldAction

Event Type

OnEntityAction