Faucet Mod SDK 1.0.0
Modding API for Minecraft Legacy Console Edition
Loading...
Searching...
No Matches
LocalPlayer Class Reference

Client-side representation of a local (human-controlled) player. More...

#include <SDK.h>

Inheritance diagram for LocalPlayer:
Collaboration diagram for LocalPlayer:

Public Member Functions

virtual void respawn ()
 Trigger the player's respawn.
virtual shared_ptr< ItemInstance > getCarriedItem ()
 Get the item currently held in the player's hand.
virtual void playSound (int soundId, float volume, float pitch)
 Play a sound effect at the player's position.
virtual void respawn () override
 Respawn the player and trigger the respawn animation.
virtual void animateRespawn ()
 Trigger the respawn animation on the client.
virtual void chat (const wstring &message)
 Send a chat message from this player.
virtual int ThirdPersonView ()
 Get the active third-person view mode.
virtual void SetThirdPersonView (int val)
 Set the third-person view mode.
void ResetInactiveTicks ()
 Reset the idle timer (prevents idle animations).
unsigned int GetInactiveTicks ()
 Get the number of ticks the player has been idle.
void setSprinting (bool value)
 Set the player's sprint state.
void setExperienceValues (float experienceProgress, int totalExp, int experienceLevel)
 Update the player's XP display values.
virtual void crit (shared_ptr< Entity > entity)
 Trigger a critical hit visual on an entity.
virtual void magicCrit (shared_ptr< Entity > entity)
 Trigger a magic critical hit visual on an entity.
int GetXboxPad ()
 Get the Xbox pad index assigned to this player.
void SetXboxPad (int iPad)
 Set the Xbox pad index for this player.
virtual void changeDimension (int i)
 Change the player's dimension (triggers dimension change logic).
Public Member Functions inherited from Player
float getHealth () const
 Get the player's current health.
void setHealth (float health)
 Set the player's health directly.
float getMaxHealth () const
 Get the player's maximum health.
bool hurt (DamageSource *source, float amount)
 Apply damage from a damage source.
void heal (float amount)
 Heal the player by a given amount.
int getFoodLevel () const
 Get the player's current food level.
int getExperienceLevel () const
 Get the player's experience level.
void giveExperienceLevels (int amount)
 Give experience levels to the player.
wstring getName () const
 Get the player's username.
bool isSneaking () const
 Check if the player is currently sneaking.
bool isSprinting () const
 Check if the player is currently sprinting.
bool isFlying () const
 Check if the player is flying.
void setFlying (bool flying)
 Set the player's flying state.
double getX () const
 Get the player's current X position.
double getY () const
 Get the player's current Y position (feet level).
double getZ () const
 Get the player's current Z position.
void teleportTo (double x, double y, double z)
 Teleport the player to a world position.
class Inventory * getInventory ()
 Add an item to the player's inventory.
void kill ()
 Kill the player immediately. Triggers death screen.
bool hasPermission (class EGameCommand command)
 Check whether this player has a given game permission.

Public Attributes

int sprintTime
 Current sprint time remaining (ticks).
float portalTime
 Portal transition effect timer.
Public Attributes inherited from Player
double x
 X coordinate (double precision).
double y
 Y coordinate (feet position).
double z
 Z coordinate.
float yRot
 Yaw rotation in degrees.
float xRot
 Pitch rotation in degrees.

Detailed Description

Client-side representation of a local (human-controlled) player.

Extends Player with client-specific input handling, portal effects, splitscreen management, and view control.

Obtain via SDK::GetLocalPlayer() or Minecraft::GetInstance()->localplayers[idx].

Definition at line 35 of file LocalPlayer.h.

Member Function Documentation

◆ changeDimension()

virtual void LocalPlayer::changeDimension ( int i)
virtual

Change the player's dimension (triggers dimension change logic).

Parameters
iTarget dimension (0=Overworld, -1=Nether, 1=End).

◆ chat()

virtual void LocalPlayer::chat ( const wstring & message)
virtual

Send a chat message from this player.

Parameters
messageMessage text.

◆ crit()

virtual void LocalPlayer::crit ( shared_ptr< Entity > entity)
virtual

Trigger a critical hit visual on an entity.

Parameters
entityThe entity that was critically hit.

◆ getCarriedItem()

virtual shared_ptr< ItemInstance > LocalPlayer::getCarriedItem ( )
virtual

Get the item currently held in the player's hand.

Returns
ItemInstance pointer, or nullptr if hand is empty.

Reimplemented from Player.

◆ GetInactiveTicks()

unsigned int LocalPlayer::GetInactiveTicks ( )

Get the number of ticks the player has been idle.

Returns
Idle tick count (capped at 255).

◆ GetXboxPad()

int LocalPlayer::GetXboxPad ( )

Get the Xbox pad index assigned to this player.

Returns
Controller index (0–3).

◆ magicCrit()

virtual void LocalPlayer::magicCrit ( shared_ptr< Entity > entity)
virtual

Trigger a magic critical hit visual on an entity.

Parameters
entityThe entity that was magic-crit'd.

◆ playSound()

virtual void LocalPlayer::playSound ( int soundId,
float volume,
float pitch )
virtual

Play a sound effect at the player's position.

Parameters
soundIdSound ID.
volumeVolume multiplier (1.0 = normal).
pitchPitch multiplier (1.0 = normal).

Reimplemented from Player.

◆ setExperienceValues()

void LocalPlayer::setExperienceValues ( float experienceProgress,
int totalExp,
int experienceLevel )

Update the player's XP display values.

Parameters
experienceProgressProgress to next level (0.0–1.0).
totalExpTotal XP points.
experienceLevelCurrent XP level.

◆ setSprinting()

void LocalPlayer::setSprinting ( bool value)

Set the player's sprint state.

Parameters
valueTrue to enable sprinting.

◆ SetThirdPersonView()

virtual void LocalPlayer::SetThirdPersonView ( int val)
virtual

Set the third-person view mode.

Parameters
val0 = first person, 1 = third person, 2 = reversed.

◆ SetXboxPad()

void LocalPlayer::SetXboxPad ( int iPad)

Set the Xbox pad index for this player.

Parameters
iPadController index.

◆ ThirdPersonView()

virtual int LocalPlayer::ThirdPersonView ( )
virtual

Get the active third-person view mode.

Returns
0 = first person, 1 = third person, 2 = front-facing third person.

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