player

This page will go over the Player API namespace.

This is based on EntityLiving class, therefore this support every method from Entity, as well as EntityLiving class.

Methods from the superclasses

isAnimal(): Boolean

Returns if the entity is an animal.

isMob(): Boolean

Returns if the entity is a mob.

isPlayer(): Boolean

Returns if the entity is a player.

getHealth(): Number

Returns the entity health.

getMaxHealth(): Number

Returns the maximum entity health.

getHurtTime(): Number

Returns the entity hurt time.

getMaxHurtTime(): Number

Returns the maximum entity hurt time.

getLastHurtTime(): Number

Returns the last entity hurt time.

getHeldItemStack(): ItemStack

Returns the held item stack of the entity.

isDead(): Boolean

Returns if the entity is dead.

isLiving(): Boolean

Returns if the entity is instance of LivingEntity.

getPosition(): Vector3

Returns the entity position.

getLastPosition(): Vector3

Returns the previous tick entity position.

getMotion(): Vector3

Returns the entity motion.

getRotation(): Vector2

Returns the entity rotation.

getLastRotation(): Vector2

Returns the previous tick entity rotation.

getTicksExisted(): Number

Returns the amount of ticks the entity has existed for.

getEntityId(): Number

Returns the entity ID.

getDisplayName(): String

Returns the entity display name.

getInventory(): Inventory

Returns the inventory of the entity.

getDistanceToEntity(entity): Number

Returns distance between this and another entity.

getDistance(x, y, z): Number

Returns the distance between this entity and the specified position.

Exclusive to player API, not found in superclasses.

message(text): Undefined

Sends a chat message.

getName(): String

Returns the player name.

getPlayerID(): String

Returns the player ID.

isOnGround(): Boolean

Returns the mc.thePlayer.onGround variable

isMoving(): Boolean

Returns if the player is moving or not.

jump(): Undefined

Makes the player jump.

setSlot(Number slot): Undefined

Sets your slot.

strafe(speed): Undefined

Makes the player strafe. speed argument is optional.

stop(): Undefined

Stops the player instantly.

setPosition(posX, posY, posZ): Undefined

Sets the player position with 3 Number arguments.

setPosition(vector): Undefined

Sets the player motion with a single Vector3d argument.

setMotion(motionX, motionY, motionZ): Undefined

Sets the player motion with 3 Number arguments.

setMotionX(motionX): Undefined

Sets the player motion on the X axis.

setMotionY(motionY): Undefined

Sets the player motion on the Y axis.

setMotionZ(motionZ): Undefined

Sets the player motion on the Z axis.

setMotion(vector): Undefined

Sets the player motion with a single Vector3d argument.

leftClick(): Undefined

Clicks left mouse button.

rightClick(): Undefined

Clicks right mouse button.

attackEntity(target): Undefined

Attacks the target entity.

swingItem(): Undefined

Swings the currently held item.

message(message): Undefined

Sends a chat message. You can not execute rise commands with this.

setRotation(rotations, rotationSpeed, movementFix): Undefined

Silently rotates your player to a specific set of angles.

setHeldItem(slot, render): Undefined

Run this on preUpdate for every tick you want the slot to be changed, if you want to permanently setslot use the "setSlot" method.

Silently sets a held item.

getHeldItemStack(): ItemStack

Returns the serverside held item stack.

getClientHeldItemStack(): ItemStack

Returns the clientside held item stack.

getClientHeldItemSlot(): Number

Returns the clientside held item slot.

itemDamage(): Undefined

Damages the player using a snowball/fishing rod/bow.

damage(packet, timer): Undefined

Damages the player without an item.

fakeDamage(): Undefined

Fake damages the player.

calculateRotations(to): Vector2

Calculates rotations towards an entity / a position in the world.

getHurtTime(): Number

Returns the players hurt time.

isUsingItem(): Boolean

Returns whether the player is using an item.

isHoldingSword(): Boolean

Returns whether the player is holding a sword.

isHoldingTool(): Boolean

Returns whether the player is holding a tool.

isHoldingBlock(): Boolean

Returns whether the player is holding blocks.

getFoward(): Number

Returns a value depending on if forward or backwards are being pressed.

getStrafe(): Number

Returns a value depending on if left or right is being pressed.

getSpeed(): Number

Returns players speed.

getUseItemProgress(): Number

Returns use item progress.

setSprinting(sprinting): Undefined

Sets sprinting.

setClientRotations(yaw, pitch): Undefined

Sets client rotations.

getUseItemProgress(): Number

Returns use item progress.

getFallDistance(): Number

Returns fall distance.

getHunger(): Number

Returns hunger.

getAbsorption(): Number

Returns absorption.

isInWater(): Boolean

Returns true if in water.

isInLava(): Boolean

Returns true if in water.

setSneaking(sneaking): Undefined

Sets sneaking.

isInWeb(): Boolean

Returns true if in a web.

isOnLadder(): Boolean

Returns true if on a ladder.

isCollided(): Boolean

Returns true if collided.

isCollidedHorizontally(): Boolean

Returns true if collided horizontally.

isCollidedVertically(): Boolean

Returns true if collided vertically.

isPotionActive(Number potionID): Boolean

Returns true if the potion is active, refer to https://pastebin.com/U9SyiD9Y for potion ids.

placeBlock(ItemStack heldStack, Vector3d blockPos, Number side, Vector3d hitVec): Undefined

Allows you to place a block.

Use the corresponding number for the "side" argument in the placeBlock method
DOWN(0)
UP(1)
NORTH(2)
SOUTH(3)
WEST(4)
EAST(5)

getGUI(): String

Returns the name of the GUI you're in.

mouseOverEntity(entity, range): Boolean

Returns whether a player is aiming over an entity. Also includes rotations that are set by other modules.

Last updated