‪GamecraftModdingAPI  ‪v1.8.0
‪The unofficial Gamecraft modding API
GamecraftModdingAPI.Player Class Reference

‪An in-game player character. Any Leo you see is a player. More...

Inheritance diagram for GamecraftModdingAPI.Player:

Public Member Functions

 Player (PlayerType player)
 ‪Initializes a new instance of the T:GamecraftModdingAPI.Player class. More...
 
 Player (uint id)
 ‪Initializes a new instance of the T:GamecraftModdingAPI.Player class. More...
 
bool Equals (EGID other)
 
override bool Equals (object obj)
 
bool Equals (Player other)
 
Block GetBlockLookedAt (float maxDistance=-1f)
 ‪Returns the block the player is currently looking at in build mode. More...
 
override int GetHashCode ()
 
Block[] GetSelectedBlocks ()
 ‪Returns the blocks that are in the player's current selection. More...
 
SimBody GetSimBodyLookedAt (float maxDistance=-1f)
 ‪Returns the rigid body the player is currently looking at during simulation. More...
 
void Teleport (float x, float y, float z, bool relative=true, bool exitSeat=true)
 ‪Teleport the player to the specified coordinates. More...
 

Static Public Member Functions

static uint Count ()
 ‪The amount of Players in the current game. More...
 
static bool Exists (PlayerType player)
 ‪Checks if the specified player exists. More...
 
static bool Exists (uint player)
 ‪Checks if the specified player exists. More...
 

Public Attributes

FlyCam BuildCamera => new FlyCam(Id)
 ‪The camera of this player used when building. More...
 
PlayerBuildingMode BuildingMode
 ‪The player's mode in time stopped mode, determining what they place. More...
 

Static Package Functions

static void Init ()
 

Properties

float3 AngularVelocity [get, set]
 ‪The player's current angular velocity. More...
 
float CurrentHealth [get, set]
 ‪The player's current health in Simulation (aka Time Running) mode. More...
 
uint CurrentLives [get, set]
 ‪The player's current lives in Simulation (aka Time Running) mode. More...
 
bool Damageable [get, set]
 ‪Whether this T:GamecraftModdingAPI.Player is damageable. More...
 
bool Dead [get]
 ‪Whether the player is dead. If true, hopefully it was quick. More...
 
bool GameOver [get]
 ‪Whether the Game Over screen is displayed for the player. More...
 
uint Id [get]
 ‪The player's unique identifier. More...
 
float InitialHealth [get, set]
 ‪The player's initial health when entering Simulation (aka Time Running) mode. More...
 
uint InitialLives [get, set]
 ‪The player's lives when initially entering Simulation (aka Time Running) mode. More...
 
static Player LocalPlayer [get]
 ‪Returns the current player belonging to this client. More...
 
float Mass [get]
 ‪The player's mass. More...
 
float? Ping [get]
 ‪The player's latest network ping time. More...
 
float3 Position [get, set]
 ‪The player's current position. More...
 
float3 Rotation [get, set]
 ‪The player's current rotation. More...
 
BlockIDs SelectedBlock [get]
 ‪The player's selected block ID in their hand. More...
 
Blueprint???? SelectedBlueprint [get, set]
 ‪The player's selected blueprint in their hand. Set to null to clear. Dispose after usage. More...
 
BlockColor SelectedColor [get]
 ‪The player's selected block color in their hand. More...
 
BlockColor SelectedColour [get]
 ‪The player's selected block colour in their hand. More...
 
PlayerType Type [get]
 ‪The player's type. The player type is always relative to the current client, not the game host. More...
 
float3 Velocity [get, set]
 ‪The player's current velocity. More...
 

Detailed Description

An in-game player character. Any Leo you see is a player.

Constructor & Destructor Documentation

◆ Player() [1/2]

GamecraftModdingAPI.Player.Player ( uint  id)
inline

‪Initializes a new instance of the T:GamecraftModdingAPI.Player class.

Parameters
id‪The player's unique identifier.

◆ Player() [2/2]

GamecraftModdingAPI.Player.Player ( PlayerType  player)
inline

‪Initializes a new instance of the T:GamecraftModdingAPI.Player class.

Parameters
player‪The player type. Chooses the first available player matching the criteria.

Member Function Documentation

◆ Count()

static uint GamecraftModdingAPI.Player.Count ( )
inlinestatic

‪The amount of Players in the current game.

Returns
‪The count.

◆ Equals() [1/3]

bool GamecraftModdingAPI.Player.Equals ( EGID  other)
inline

◆ Equals() [2/3]

override bool GamecraftModdingAPI.Player.Equals ( object  obj)
inline

◆ Equals() [3/3]

bool GamecraftModdingAPI.Player.Equals ( Player  other)
inline

◆ Exists() [1/2]

static bool GamecraftModdingAPI.Player.Exists ( PlayerType  player)
inlinestatic

‪Checks if the specified player exists.

Returns
‪Whether the player exists.
Parameters
playerPlayer type.

◆ Exists() [2/2]

static bool GamecraftModdingAPI.Player.Exists ( uint  player)
inlinestatic

‪Checks if the specified player exists.

Returns
‪Whether the player exists.
Parameters
player‪The player's unique identifier.

◆ GetBlockLookedAt()

Block GamecraftModdingAPI.Player.GetBlockLookedAt ( float  maxDistance = -1f)
inline

‪Returns the block the player is currently looking at in build mode.

Parameters
maxDistance‪The maximum distance from the player (default is the player's building reach)
Returns
‪The block or null if not found

◆ GetHashCode()

override int GamecraftModdingAPI.Player.GetHashCode ( )
inline

◆ GetSelectedBlocks()

Block [] GamecraftModdingAPI.Player.GetSelectedBlocks ( )
inline

‪Returns the blocks that are in the player's current selection.

Returns
‪An array of blocks or an empty array

◆ GetSimBodyLookedAt()

SimBody GamecraftModdingAPI.Player.GetSimBodyLookedAt ( float  maxDistance = -1f)
inline

‪Returns the rigid body the player is currently looking at during simulation.

Parameters
maxDistance‪The maximum distance from the player (default is the player's building reach)
Returns
‪The block or null if not found

◆ Init()

static void GamecraftModdingAPI.Player.Init ( )
inlinestaticpackage

◆ Teleport()

void GamecraftModdingAPI.Player.Teleport ( float  x,
float  y,
float  z,
bool  relative = true,
bool  exitSeat = true 
)
inline

‪Teleport the player to the specified coordinates.

Parameters
x‪The x coordinate.
y‪The y coordinate.
z‪The z coordinate.
relative‪If set to true teleport relative to the player's current position.
exitSeat‪If set to true exit any seat the player is in.

Member Data Documentation

◆ BuildCamera

FlyCam GamecraftModdingAPI.Player.BuildCamera => new FlyCam(Id)

‪The camera of this player used when building.

◆ BuildingMode

PlayerBuildingMode GamecraftModdingAPI.Player.BuildingMode
Initial value:
=> (‪PlayerBuildingMode) playerEngine
.GetCharacterStruct<PlayerInputTimeStoppedContextStruct>(‪Id, out _).timeStoppedContext

‪The player's mode in time stopped mode, determining what they place.

Property Documentation

◆ AngularVelocity

float3 GamecraftModdingAPI.Player.AngularVelocity
getset

‪The player's current angular velocity.

The angular velocity.

◆ CurrentHealth

float GamecraftModdingAPI.Player.CurrentHealth
getset

‪The player's current health in Simulation (aka Time Running) mode.

The current health.

◆ CurrentLives

uint GamecraftModdingAPI.Player.CurrentLives
getset

‪The player's current lives in Simulation (aka Time Running) mode.

The current lives.

◆ Damageable

bool GamecraftModdingAPI.Player.Damageable
getset

‪Whether this T:GamecraftModdingAPI.Player is damageable.

true if damageable; otherwise, false.

◆ Dead

bool GamecraftModdingAPI.Player.Dead
get

‪Whether the player is dead. If true, hopefully it was quick.

true if dead; otherwise, false.

◆ GameOver

bool GamecraftModdingAPI.Player.GameOver
get

‪Whether the Game Over screen is displayed for the player.

true if game over; otherwise, false.

◆ Id

uint GamecraftModdingAPI.Player.Id
get

‪The player's unique identifier.

The identifier.

◆ InitialHealth

float GamecraftModdingAPI.Player.InitialHealth
getset

‪The player's initial health when entering Simulation (aka Time Running) mode.

The initial health.

◆ InitialLives

uint GamecraftModdingAPI.Player.InitialLives
getset

‪The player's lives when initially entering Simulation (aka Time Running) mode.

The initial lives.

◆ LocalPlayer

Player GamecraftModdingAPI.Player.LocalPlayer
staticget

‪Returns the current player belonging to this client.

◆ Mass

float GamecraftModdingAPI.Player.Mass
get

‪The player's mass.

The mass.

◆ Ping

float? GamecraftModdingAPI.Player.Ping
get

‪The player's latest network ping time.

The ping (s).

◆ Position

float3 GamecraftModdingAPI.Player.Position
getset

‪The player's current position.

The position.

◆ Rotation

float3 GamecraftModdingAPI.Player.Rotation
getset

‪The player's current rotation.

The rotation.

◆ SelectedBlock

BlockIDs GamecraftModdingAPI.Player.SelectedBlock
get

‪The player's selected block ID in their hand.

The selected block.

◆ SelectedBlueprint

Blueprint???? GamecraftModdingAPI.Player.SelectedBlueprint
getset

‪The player's selected blueprint in their hand. Set to null to clear. Dispose after usage.

◆ SelectedColor

BlockColor GamecraftModdingAPI.Player.SelectedColor
get

‪The player's selected block color in their hand.

The selected block's color.

◆ SelectedColour

BlockColor GamecraftModdingAPI.Player.SelectedColour
get

‪The player's selected block colour in their hand.

The selected block's colour.

◆ Type

PlayerType GamecraftModdingAPI.Player.Type
get

‪The player's type. The player type is always relative to the current client, not the game host.

The enumerated player type.

◆ Velocity

float3 GamecraftModdingAPI.Player.Velocity
getset

‪The player's current velocity.

The velocity.


The documentation for this class was generated from the following file: