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
isAnimal(): BooleanReturns if the entity is an animal.
isMob(): Boolean
isMob(): BooleanReturns if the entity is a mob.
isPlayer(): Boolean
isPlayer(): BooleanReturns if the entity is a player.
getHealth(): Number
getHealth(): NumberReturns the entity health.
getMaxHealth(): Number
getMaxHealth(): NumberReturns the maximum entity health.
getHurtTime(): Number
getHurtTime(): NumberReturns the entity hurt time.
getMaxHurtTime(): Number
getMaxHurtTime(): NumberReturns the maximum entity hurt time.
getLastHurtTime(): Number
getLastHurtTime(): NumberReturns the last entity hurt time.
getHeldItemStack(): ItemStack
getHeldItemStack(): ItemStackReturns the held item stack of the entity.
isDead(): Boolean
isDead(): BooleanReturns if the entity is dead.
isLiving(): Boolean
isLiving(): BooleanReturns if the entity is instance of LivingEntity.
getPosition(): Vector3
getPosition(): Vector3Returns the entity position.
getLastPosition(): Vector3
getLastPosition(): Vector3Returns the previous tick entity position.
getMotion(): Vector3
getMotion(): Vector3Returns the entity motion.
getRotation(): Vector2
getRotation(): Vector2Returns the entity rotation.
getLastRotation(): Vector2
getLastRotation(): Vector2Returns the previous tick entity rotation.
getTicksExisted(): Number
getTicksExisted(): NumberReturns the amount of ticks the entity has existed for.
getEntityId(): Number
getEntityId(): NumberReturns the entity ID.
getDisplayName(): String
getDisplayName(): StringReturns the entity display name.
getInventory(): Inventory
getInventory(): InventoryReturns the inventory of the entity.
getDistanceToEntity(entity): Number
getDistanceToEntity(entity): Numberentity
Entity
Another entity
Returns distance between this and another entity.
getDistance(x, y, z): Number
getDistance(x, y, z): Numberx
Number
X position.
y
Number
Y position.
z
Number
Z position.
Returns the distance between this entity and the specified position.
Exclusive to player API, not found in superclasses.
message(text): Undefined
message(text): Undefinedtext
String
Text to send in the chat.
Sends a chat message.
getName(): String
getName(): StringReturns the player name.
getPlayerID(): String
getPlayerID(): StringReturns the player ID.
isOnGround(): Boolean
isOnGround(): BooleanReturns the mc.thePlayer.onGround variable
isMoving(): Boolean
isMoving(): BooleanReturns if the player is moving or not.
jump(): Undefined
jump(): UndefinedMakes the player jump.
setSlot(Number slot): Undefined
setSlot(Number slot): UndefinedSets your slot.
strafe(speed): Undefined
strafe(speed): Undefinedspeed
(Optional argument) Number
The speed to strafe at.
Makes the player strafe. speed argument is optional.
stop(): Undefined
stop(): UndefinedStops the player instantly.
setPosition(posX, posY, posZ): Undefined
setPosition(posX, posY, posZ): UndefinedposX
Number
Position X.
posY
Number
Position Y.
posZ
Number
Position Z.
Sets the player position with 3 Number arguments.
setPosition(vector): Undefined
setPosition(vector): Undefinedvector
Vector3d
Vector3d with the player position.
Sets the player motion with a single Vector3d argument.
setMotion(motionX, motionY, motionZ): Undefined
setMotion(motionX, motionY, motionZ): UndefinedmotionX
Number
Motion X.
motionY
Number
Motion Y.
motionZ
Number
Motion Z.
Sets the player motion with 3 Number arguments.
setMotionX(motionX): Undefined
setMotionX(motionX): UndefinedmotionX
Number
The Motion X to apply to the player.
Sets the player motion on the X axis.
setMotionY(motionY): Undefined
setMotionY(motionY): UndefinedmotionY
Number
The Motion Y to apply to the player.
Sets the player motion on the Y axis.
setMotionZ(motionZ): Undefined
setMotionZ(motionZ): UndefinedmotionZ
Number
The Motion Z to apply to the player.
Sets the player motion on the Z axis.
setMotion(vector): Undefined
setMotion(vector): Undefinedvector
Vector3d
Vector3d with the player motion.
Sets the player motion with a single Vector3d argument.
leftClick(): Undefined
leftClick(): UndefinedClicks left mouse button.
rightClick(): Undefined
rightClick(): UndefinedClicks right mouse button.
attackEntity(target): Undefined
attackEntity(target): Undefinedtarget
EntityLiving
The entity to attack.
Attacks the target entity.
swingItem(): Undefined
swingItem(): UndefinedSwings the currently held item.
message(message): Undefined
message(message): Undefinedmessage
String
Message to send
Sends a chat message. You can not execute rise commands with this.
setRotation(rotations, rotationSpeed, movementFix): Undefined
setRotation(rotations, rotationSpeed, movementFix): Undefinedrotations
Vector2
Angles to rotate to.
rotationSpeed
Number
Speed to rotate at. 10 is the maximum speed. 1 section is 18 degrees per tick.
movementFix
Boolean
Whether to fix movement to sync with the rotations or not.
Silently rotates your player to a specific set of angles.
setHeldItem(slot, render): Undefined
setHeldItem(slot, render): UndefinedRun this on preUpdate for every tick you want the slot to be changed, if you want to permanently setslot use the "setSlot" method.
slot
Number
Hotbar slot to use.
render
Boolean
Whether to render the actually held item. This argument is optional.
Silently sets a held item.
getHeldItemStack(): ItemStack
getHeldItemStack(): ItemStackReturns the serverside held item stack.
getClientHeldItemStack(): ItemStack
getClientHeldItemStack(): ItemStackReturns the clientside held item stack.
getClientHeldItemSlot(): Number
getClientHeldItemSlot(): NumberReturns the clientside held item slot.
itemDamage(): Undefined
itemDamage(): UndefinedDamages the player using a snowball/fishing rod/bow.
damage(packet, timer): Undefined
damage(packet, timer): Undefinedpacket
Boolean
Whether to do instant damage or slow damage.
timer
Number
Timer for the slow damage. This argument is optional and defaults to 1.
Damages the player without an item.
fakeDamage(): Undefined
fakeDamage(): UndefinedFake damages the player.
calculateRotations(to): Vector2
calculateRotations(to): Vector2to
Vector3 or Entity
Entity or position to calculate rotations to.
Calculates rotations towards an entity / a position in the world.
getHurtTime(): Number
getHurtTime(): NumberReturns the players hurt time.
isUsingItem(): Boolean
isUsingItem(): BooleanReturns whether the player is using an item.
isHoldingSword(): Boolean
isHoldingSword(): BooleanReturns whether the player is holding a sword.
isHoldingTool(): Boolean
isHoldingTool(): BooleanReturns whether the player is holding a tool.
isHoldingBlock(): Boolean
isHoldingBlock(): BooleanReturns whether the player is holding blocks.
getFoward(): Number
getFoward(): NumberReturns a value depending on if forward or backwards are being pressed.
getStrafe(): Number
getStrafe(): NumberReturns a value depending on if left or right is being pressed.
getSpeed(): Number
getSpeed(): NumberReturns players speed.
getUseItemProgress(): Number
(): NumberReturns use item progress.
setSprinting(sprinting): Undefined
(sprinting): UndefinedSets sprinting.
setClientRotations(yaw, pitch): Undefined
(yaw, pitch): UndefinedSets client rotations.
getUseItemProgress(): Number
(): NumberReturns use item progress.
getFallDistance(): Number
(): NumberReturns fall distance.
getHunger(): Number
(): NumberReturns hunger.
getAbsorption(): Number
(): NumberReturns absorption.
isInWater(): Boolean
(): BooleanReturns true if in water.
isInLava(): Boolean
(): BooleanReturns true if in water.
setSneaking(sneaking): Undefined
(sneaking): UndefinedSets sneaking.
isInWeb(): Boolean
(): BooleanReturns true if in a web.
isOnLadder(): Boolean
(): BooleanReturns true if on a ladder.
isCollided(): Boolean
(): BooleanReturns true if collided.
isCollidedHorizontally(): Boolean
(): BooleanReturns true if collided horizontally.
isCollidedVertically(): Boolean
(): BooleanReturns true if collided vertically.
isPotionActive(Number potionID): Boolean
(Number potionID): BooleanReturns 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
(ItemStack heldStack, Vector3d blockPos, Number side, Vector3d hitVec): UndefinedAllows 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
(): StringReturns the name of the GUI you're in.
mouseOverEntity(entity, range): Boolean
mouseOverEntity(entity, range): Booleanentity
Entity
The Entity object of a Entity you want to check.
range
Number
The maximum distance of the entity (from the player)
Returns whether a player is aiming over an entity. Also includes rotations that are set by other modules.
Last updated