Table of Contents

Interface IClientEventAPI

Namespace
Vintagestory.API.Client
Assembly
VintagestoryAPI.dll

Contains some client specific events you can hook into

public interface IClientEventAPI : IEventAPI
Inherited Members
Extension Methods

Methods

RegisterAsyncParticleSpawner(ContinousParticleSpawnTaskDelegate)

Set up an asynchronous particle spawner. The async particle simulation does most of the work in a seperate thread and thus runs a lot faster, with the down side of not being exaclty in sync with player interactions. This method of spawning particles is best suited for ambient particles, such as rain fall.

void RegisterAsyncParticleSpawner(ContinousParticleSpawnTaskDelegate handler)

Parameters

handler ContinousParticleSpawnTaskDelegate

RegisterItemstackRenderer(CollectibleObject, ItemRenderDelegate, EnumItemRenderTarget)

Registers a custom itemstack renderer for given collectible object. If none is registered, the default renderer is used. For render target gui, the gui shader and its uniforms are already fully prepared, you may only call RenderMesh() and ignore the modelMat, position and size values - stack sizes however, are not covered by this.

void RegisterItemstackRenderer(CollectibleObject forObj, ItemRenderDelegate rendererDelegate, EnumItemRenderTarget target)

Parameters

forObj CollectibleObject
rendererDelegate ItemRenderDelegate
target EnumItemRenderTarget

RegisterRenderer(IRenderer, EnumRenderStage, string)

Registers a rendering handler to be called during every render frame

void RegisterRenderer(IRenderer renderer, EnumRenderStage renderStage, string profilingName = null)

Parameters

renderer IRenderer
renderStage EnumRenderStage
profilingName string

If set, the frame profile will record the frame cost for this renderer

UnregisterItemstackRenderer(CollectibleObject, EnumItemRenderTarget)

Removes a previously registered itemstack renderer

void UnregisterItemstackRenderer(CollectibleObject forObj, EnumItemRenderTarget target)

Parameters

forObj CollectibleObject
target EnumItemRenderTarget

UnregisterRenderer(IRenderer, EnumRenderStage)

Removes a previously registered rendering handler.

void UnregisterRenderer(IRenderer renderer, EnumRenderStage renderStage)

Parameters

renderer IRenderer
renderStage EnumRenderStage

Events

AfterActiveSlotChanged

Fired after a player changes their active slot (such as selected hotbar slot).

event Action<ActiveSlotChangeEventArgs> AfterActiveSlotChanged

Event Type

Action<ActiveSlotChangeEventArgs>

BeforeActiveSlotChanged

Fired before a player changes their active slot (such as selected hotbar slot). Allows for the event to be cancelled depending on the return value. Note: Not called when the server forcefully changes active slot.

event Func<ActiveSlotChangeEventArgs, EnumHandling> BeforeActiveSlotChanged

Event Type

Func<ActiveSlotChangeEventArgs, EnumHandling>

BlockChanged

When a player block has been modified. OldBlock param may be null!

event BlockChangedDelegate BlockChanged

Event Type

BlockChangedDelegate

BlockTexturesLoaded

Fired when server assets were received and all texture atlases have been created, also all sounds loaded

event Action BlockTexturesLoaded

Event Type

Action

ChatMessage

Called when a chat message was received

event ChatLineDelegate ChatMessage

Event Type

ChatLineDelegate

ColorsPresetChanged

Fired when the GuiColorsPreset client setting is changed, since meshes may need to be redrawn

event Action ColorsPresetChanged

Event Type

Action

FileDrop

Fired when the user drags&drops a file into the game window

event FileDropDelegate FileDrop

Event Type

FileDropDelegate

HotkeysChanged

Called when the hotkeys are changed

event Action HotkeysChanged

Event Type

Action

InGameDiscovery

Fired when something triggers a discovery event, such as the lore system

event IngameDiscoveryDelegate InGameDiscovery

Event Type

IngameDiscoveryDelegate

InGameError

Fired when something fires an ingame error

event IngameErrorDelegate InGameError

Event Type

IngameErrorDelegate

IsPlayerReady

Fired when a player is ready to join but awaits any potential mod-user interaction, such as a character selection screen

event IsPlayerReadyDelegate IsPlayerReady

Event Type

IsPlayerReadyDelegate

KeyDown

Provides low level access to the key down event. If e.Handled is set to true, the event will not be handled by the game

event KeyEventDelegate KeyDown

Event Type

KeyEventDelegate

KeyUp

Provides low level access to the key up event. If e.Handled is set to true, the event will not be handled by the game

event KeyEventDelegate KeyUp

Event Type

KeyEventDelegate

LeaveWorld

When the player wants to leave the world to go back to the main menu

event Action LeaveWorld

Event Type

Action

LeftWorld

When the player left the world to go back to the main menu

event Action LeftWorld

Event Type

Action

LevelFinalize

Called when the client received the level finalize packet from the server

event Action LevelFinalize

Event Type

Action

MouseDown

Provides low level access to the mouse down event. If e.Handled is set to true, the event will not be handled by the game

event MouseEventDelegate MouseDown

Event Type

MouseEventDelegate

MouseMove

Provides low level access to the mouse move event. If e.Handled is set to true, the event will not be handled by the game

event MouseEventDelegate MouseMove

Event Type

MouseEventDelegate

MouseUp

Provides low level access to the mouse up event. If e.Handled is set to true, the event will not be handled by the game

event MouseEventDelegate MouseUp

Event Type

MouseEventDelegate

OnSendChatMessage

Called before a chat message is sent to the server

event ClientChatLineDelegate OnSendChatMessage

Event Type

ClientChatLineDelegate

PauseResume

When the game was paused/resumed (only in single player)

event OnGamePauseResume PauseResume

Event Type

OnGamePauseResume

PlayerDeath

Called when the player dies

event PlayerEventDelegate PlayerDeath

Event Type

PlayerEventDelegate

PlayerEntityDespawn

Called whenever a players got out of range

event PlayerEventDelegate PlayerEntityDespawn

Event Type

PlayerEventDelegate

PlayerEntitySpawn

Called when a players entity got in range

event PlayerEventDelegate PlayerEntitySpawn

Event Type

PlayerEventDelegate

PlayerJoin

Called when a player joins. The Entity of the player might be null if out of range!

event PlayerEventDelegate PlayerJoin

Event Type

PlayerEventDelegate

PlayerLeave

Called whenever a player disconnects (timeout, leave, disconnect, kick, etc.). The Entity of the player might be null if out of range!

event PlayerEventDelegate PlayerLeave

Event Type

PlayerEventDelegate

ReloadShader

Fired when the player tries to reload the shaders (happens when graphics settings are changed)

event ActionBoolReturn ReloadShader

Event Type

ActionBoolReturn

ReloadShapes

Called when shapes got reloaded

event Action ReloadShapes

Event Type

Action

ReloadTextures

Called when textures got reloaded

event Action ReloadTextures

Event Type

Action

TestBlockAccess

When player tries to modify a block

event TestBlockAccessDelegate TestBlockAccess

Event Type

TestBlockAccessDelegate