Table of Contents

Class EntityControls

Namespace
Vintagestory.API.Common
Assembly
VintagestoryAPI.dll

The available controls to move around a character in a game world

public class EntityControls
Inheritance
EntityControls
Inherited Members
Extension Methods

Fields

DetachedMode

If true, the entity is either flying, gliding or swimming.

public bool DetachedMode

Field Value

bool

Dirty

Whether or not this entity is dirty.

public bool Dirty

Field Value

bool

FlyPlaneLock

the axis lock for the fly plane.

public EnumFreeMovAxisLock FlyPlaneLock

Field Value

EnumFreeMovAxisLock

FlyVector

Current flying direction

public Vec3d FlyVector

Field Value

Vec3d

GlideSpeed

public double GlideSpeed

Field Value

double

HandUse

If the player is currently using the currently held item in a special way (e.g. attacking with smithing hammer or eating an edible item)

public EnumHandInteract HandUse

Field Value

EnumHandInteract

HandUsingBlockSel

The block pos the player started using

public BlockSelection HandUsingBlockSel

Field Value

BlockSelection

IsAiming

Whether or not the entity is aiming

public bool IsAiming

Field Value

bool

IsClimbing

Whether or not the entity is climbing

public bool IsClimbing

Field Value

bool

IsFlying

Whether or not the entity is flying.

public bool IsFlying

Field Value

bool

IsStepping

Whether or not the entity is currently stepping up a block

public bool IsStepping

Field Value

bool

LeftUsingHeldItemTransformBefore

public ModelTransform LeftUsingHeldItemTransformBefore

Field Value

ModelTransform

MovespeedMultiplier

The movement speed multiplier.

public float MovespeedMultiplier

Field Value

float

NoClip

If true, the entity has NoClip active.

public bool NoClip

Field Value

bool

OnAction

To execute a call handler registered by the engine. Don't use this one, use api.Input.InWorldAction instead.

public OnEntityAction OnAction

Field Value

OnEntityAction

UsingBeginMS

public long UsingBeginMS

Field Value

long

UsingCount

public int UsingCount

Field Value

int

UsingHeldItemTransformAfter

[Obsolete("Setting this value has no effect anymore. Add an animation to the seraph instead")]
public ModelTransform UsingHeldItemTransformAfter

Field Value

ModelTransform

UsingHeldItemTransformBefore

[Obsolete("Setting this value has no effect anymore. Add an animation to the seraph instead")]
public ModelTransform UsingHeldItemTransformBefore

Field Value

ModelTransform

WalkVector

Current walking direction.

public Vec3d WalkVector

Field Value

Vec3d

Properties

Backward

A check for if the entity is moving the opposite direction it's facing.

public virtual bool Backward { get; set; }

Property Value

bool

CtrlKey

A check to see if the entity is holding down the Ctrl key (which may be the same as the Sprint key or one or other may have been remapped).
Should normally be used in conjunction with a mouse button, including OnHeldInteractStart() methods etc

public virtual bool CtrlKey { get; set; }

Property Value

bool

Down

A check to see whether the entity is moving down.

public virtual bool Down { get; set; }

Property Value

bool

Flags

public bool[] Flags { get; }

Property Value

bool[]

FloorSitting

A check to see whether the entity is sitting on the floor.

public virtual bool FloorSitting { get; set; }

Property Value

bool

Forward

A check for if the entity is moving in the direction it's facing.

public virtual bool Forward { get; set; }

Property Value

bool

Gliding

A check to see whether the entity is gliding

public virtual bool Gliding { get; set; }

Property Value

bool

this[EnumEntityAction]

public virtual bool this[EnumEntityAction action] { get; set; }

Parameters

action EnumEntityAction

Property Value

bool

Jump

A check whether to see if the entity is jumping.

public virtual bool Jump { get; set; }

Property Value

bool

Left

A check to see if the entity is moving left the direction it's facing.

public virtual bool Left { get; set; }

Property Value

bool

LeftMouseDown

A check to see if the entity is holding the in-world rleft mouse button down.

public virtual bool LeftMouseDown { get; set; }

Property Value

bool

Right

A check to see if the entity is moving right the direction it's facing.

public virtual bool Right { get; set; }

Property Value

bool

RightMouseDown

A check to see if the entity is holding the in-world right mouse button down.

public virtual bool RightMouseDown { get; set; }

Property Value

bool

ShiftKey

A check to see if the entity is holding down the Shift key (which may be the same as the Sneak key or one or other may have been remapped).
Should normally be used in conjunction with a mouse button, including OnHeldInteractStart() methods etc

public virtual bool ShiftKey { get; set; }

Property Value

bool

Sneak

A check whether to see if the entity is sneaking. Use Controls.ShiftKey instead for mouse interaction modifiers, as it is a separable control.
A test for Sneak should be used only when we want to know whether the entity is crouching or using Sneak motion, which affects things like whether it is detectable by other entities, seen on the map, or how the shield is used

public virtual bool Sneak { get; set; }

Property Value

bool

Sprint

A check to see whether the entity is sprinting. Use Controls.CtrlKey instead for mouse interaction modifiers, as it is a separable control.
A test for Sprint should be used only when we want to know whether the entity is sprinting.

public virtual bool Sprint { get; set; }

Property Value

bool

TriesToMove

Checks to see if the entity is attempting to move in any direction (excluding jumping)

public bool TriesToMove { get; }

Property Value

bool

Up

A check to see whether the entity is moving up.

public virtual bool Up { get; set; }

Property Value

bool

Methods

AttemptToggleAction(EnumEntityAction, bool)

protected virtual void AttemptToggleAction(EnumEntityAction action, bool on)

Parameters

action EnumEntityAction
on bool

CalcMovementVectors(EntityPos, float)

Calculates the movement vectors for the player.

public virtual void CalcMovementVectors(EntityPos pos, float dt)

Parameters

pos EntityPos

The position of the player.

dt float

The change in time.

FromBytes(BinaryReader, bool)

public virtual void FromBytes(BinaryReader reader, bool ignoreData)

Parameters

reader BinaryReader
ignoreData bool

FromInt(int)

Converts the int flags to movement controls.

public virtual void FromInt(int flagsInt)

Parameters

flagsInt int

The compressed integer.

SetFrom(EntityControls)

Copies the controls from the provided controls to this set of controls.

public virtual void SetFrom(EntityControls controls)

Parameters

controls EntityControls

The controls to copy over.

StopAllMovement()

Forces the entity to stop all movements, resets all flags to false

public virtual void StopAllMovement()

ToBytes(BinaryWriter)

public virtual void ToBytes(BinaryWriter writer)

Parameters

writer BinaryWriter

ToInt()

Converts the values to a single int flag.

public virtual int ToInt()

Returns

int

the compressed integer.

UpdateFromPacket(bool, int)

Updates the data from the packet.

public virtual void UpdateFromPacket(bool pressed, int action)

Parameters

pressed bool

Whether or not the key was pressed.

action int

the id of the key that was pressed.