Table of Contents

Interface ICoreClientAPI

Namespace
Vintagestory.API.Client
Assembly
VintagestoryAPI.dll

The core api implemented by the client. The main interface for accessing the client. Contains all sub components and some miscellaneous methods.

public interface ICoreClientAPI : ICoreAPI, ICoreAPICommon
Inherited Members
Extension Methods

Properties

Ambient

API Component to control the clients ambient values

IAmbientManager Ambient { get; }

Property Value

IAmbientManager

BlockTextureAtlas

API for the Block Texture Atlas

IBlockTextureAtlasAPI BlockTextureAtlas { get; }

Property Value

IBlockTextureAtlasAPI

ColorPreset

Fetch color configs, used for accessibility e.g. for knapping wireframe gridlines

IColorPresets ColorPreset { get; }

Property Value

IColorPresets

CurrentMusicTrack

Returns the currently playing music track, if any is playing

IMusicTrack CurrentMusicTrack { get; }

Property Value

IMusicTrack

ElapsedMilliseconds

Amount of milliseconds ellapsed since client startup

long ElapsedMilliseconds { get; }

Property Value

long

EntityTextureAtlas

API for the Entity Texture Atlas

ITextureAtlasAPI EntityTextureAtlas { get; }

Property Value

ITextureAtlasAPI

Event

API Component for registering to various Events

IClientEventAPI Event { get; }

Property Value

IClientEventAPI

Forms

Platform independent ui methods and features.

IXPlatformInterface Forms { get; }

Property Value

IXPlatformInterface

Gui

API for GUI Related methods

IGuiAPI Gui { get; }

Property Value

IGuiAPI

HideGuis

If true, the player is in gui-less mode (through the F4 key)

bool HideGuis { get; }

Property Value

bool

InWorldEllapsedMilliseconds

Amount of milliseconds ellapsed while in a running game that is not paused

long InWorldEllapsedMilliseconds { get; }

Property Value

long

Input

API for Mouse / Keyboard input related things

IInputAPI Input { get; }

Property Value

IInputAPI

IsGamePaused

True if the game is currently paused (only available in singleplayer)

bool IsGamePaused { get; }

Property Value

bool

IsShuttingDown

True if the client is currently in the process of exiting

bool IsShuttingDown { get; }

Property Value

bool

IsSinglePlayer

True if this is a singleplayer session

bool IsSinglePlayer { get; }

Property Value

bool

ItemTextureAtlas

API for the Item Texture Atlas

IItemTextureAtlasAPI ItemTextureAtlas { get; }

Property Value

IItemTextureAtlasAPI

LinkProtocols

Add your own link protocol here if you want to implement a custom protocol. E.g. image://url-to-picture

Dictionary<string, Action<LinkTextComponent>> LinkProtocols { get; }

Property Value

Dictionary<string, Action<LinkTextComponent>>

MacroManager

Api to the client side macros system

IMacroManager MacroManager { get; }

Property Value

IMacroManager

Network

API for doing sending/receiving network packets

IClientNetworkAPI Network { get; }

Property Value

IClientNetworkAPI

OpenedGuis

Active GUI objects.

IEnumerable<object> OpenedGuis { get; }

Property Value

IEnumerable<object>

OpenedToLan

bool OpenedToLan { get; }

Property Value

bool

PlayerReadyFired

True if all SendPlayerNowReady() was sent, signalling the player is now ready (called by the character selector upon submit)

bool PlayerReadyFired { get; }

Property Value

bool

Render

API for Rendering stuff onto the screen using OpenGL

IRenderAPI Render { get; }

Property Value

IRenderAPI

Settings

The clients game settings as stored in the clientsettings.json

ISettings Settings { get; }

Property Value

ISettings

Shader

API for Rendering stuff onto the screen using OpenGL

IShaderAPI Shader { get; }

Property Value

IShaderAPI

TagConverters

Add your own rich text elements here. Your will need to convert a VTML tag into a RichTextComponentBase element.

Dictionary<string, Tag2RichTextDelegate> TagConverters { get; }

Property Value

Dictionary<string, Tag2RichTextDelegate>

Tesselator

API for Meshing in the Mainthread. Thread safe.

ITesselatorAPI Tesselator { get; }

Property Value

ITesselatorAPI

TesselatorManager

Holds the default meshes of all blocks

ITesselatorManager TesselatorManager { get; }

Property Value

ITesselatorManager

World

API for accessing anything in the game world

IClientWorldAccessor World { get; }

Property Value

IClientWorldAccessor

Methods

PauseGame(bool)

void PauseGame(bool paused)

Parameters

paused bool

RegisterCommand(string, string, string, ClientChatCommandDelegate)

Registers a chat command

[Obsolete("Use ChatCommand subapi instead")]
bool RegisterCommand(string command, string descriptionMsg, string syntaxMsg, ClientChatCommandDelegate handler)

Parameters

command string
descriptionMsg string
syntaxMsg string
handler ClientChatCommandDelegate

Returns

bool

RegisterCommand(ClientChatCommand)

Registers a chat command

[Obsolete("Use ChatCommand subapi instead")]
bool RegisterCommand(ClientChatCommand chatcommand)

Parameters

chatcommand ClientChatCommand

Returns

bool

RegisterEntityRendererClass(string, Type)

Registers an entity renderer for given entity

void RegisterEntityRendererClass(string className, Type rendererType)

Parameters

className string
rendererType Type

RegisterLinkProtocol(string, Action<LinkTextComponent>)

Register a link protocol handler

void RegisterLinkProtocol(string protocolname, Action<LinkTextComponent> onLinkClicked)

Parameters

protocolname string
onLinkClicked Action<LinkTextComponent>

SendChatMessage(string, int, string)

Sends a chat message to the server

void SendChatMessage(string message, int groupId, string data = null)

Parameters

message string
groupId int
data string

SendChatMessage(string, string)

Sends a chat message to the server in the players currently active channel

void SendChatMessage(string message, string data = null)

Parameters

message string
data string

ShowChatMessage(string)

Shows a client side only chat message in the current chat channel. Uses the same code paths a server => client message takes. Does not execute client commands.

void ShowChatMessage(string message)

Parameters

message string

StartTrack(AssetLocation, float, EnumSoundType, Action<ILoadedSound>)

Tells the music engine to load and immediately start given track once loaded, if the priority is higher than the currently playing track. May also be stopped while playing if another track with a higher priority is started. If you supply an onLoaded method the track is not started immediately and you can manually start it at any given time by calling sound.Start()

MusicTrack StartTrack(AssetLocation soundLocation, float priority, EnumSoundType soundType, Action<ILoadedSound> onLoaded = null)

Parameters

soundLocation AssetLocation
priority float
soundType EnumSoundType
onLoaded Action<ILoadedSound>

Returns

MusicTrack

TriggerChatMessage(string)

Same as ShowChatMessage(string) but will also execute client commands if they are prefixed with a dot.

void TriggerChatMessage(string message)

Parameters

message string

TriggerIngameDiscovery(object, string, string)

Triggers a discovery event. HudDiscoveryMessage registers to this event and fades in/out a "discovery message" on the players screen

void TriggerIngameDiscovery(object sender, string errorCode, string text)

Parameters

sender object
errorCode string
text string

TriggerIngameError(object, string, string)

Triggers an in-game-error event. HudIngameError registers to this event and shows a vibrating red text on the players screen

void TriggerIngameError(object sender, string errorCode, string text)

Parameters

sender object
errorCode string
text string