Table of Contents

Class WorldInteraction

Namespace
Vintagestory.API.Client
Assembly
VintagestoryAPI.dll

A world interaction for the object. This is used to prompt the player about what a certain object can do.

[JsonObject(MemberSerialization.OptIn)]
public class WorldInteraction
Inheritance
WorldInteraction
Inherited Members
Extension Methods

Fields

ActionLangCode

The text to show, will be used in the form of Lang.Get(ActionLangCode);

[JsonProperty]
public string ActionLangCode

Field Value

string

GetMatchingStacks

Only applicable when ItemStacks is non null. If set, this method will be executed before adding the interaction. Lets you return a filtered list of itemstacks that can be used for this interaction (or null/empty array for not interactable)

public InteractionStacksDelegate GetMatchingStacks

Field Value

InteractionStacksDelegate

HotKeyCode

Does it require a mouse modifier key to perform this action (e.g. "shift" or "ctrl")

[JsonProperty]
public string HotKeyCode

Field Value

string

Itemstacks

public ItemStack[] Itemstacks

Field Value

ItemStack[]

JsonItemStacks

Does the player need to hold a certain items/blocks in hands? (e.g. a knife). You can define an array of item stacks here and the game will loop through them in a 1 second interval. This property is loaded from the entitytypes and blocktype json files and then resolved.

[JsonProperty("ItemStacks")]
public JsonItemStack[] JsonItemStacks

Field Value

JsonItemStack[]

MouseButton

What mouse button should be used for this interaction?

[JsonProperty]
public EnumMouseButton MouseButton

Field Value

EnumMouseButton

RequireFreeHand

If true, the interaction only applies when the player has no slot in hands

public bool RequireFreeHand

Field Value

bool

ShouldApply

Only applicable when ItemStacks is null. If set and the method returns false, the interaction will not be displayed

public InteractionMatcherDelegate ShouldApply

Field Value

InteractionMatcherDelegate

Properties

HotKeyCodes

Does it require pressing multiple keys to perform this action (if set then HotkeyCode is ignored)

[JsonProperty]
public string[] HotKeyCodes { get; set; }

Property Value

string[]