Static methods for the Player API
Example
Player.methodName([ arg1[, arg2[, ...argN] ] ]);
Methods
-
staticPlayer.addExp(
) -
- BL 1.10.4
-
staticPlayer.addItemCreativeInv(
) -
-
staticPlayer.addItemInventory(
id, quantity, damage) -
Add a specified
quantityof a specified item or blockidto the player's inventory.Name Type Description idint the item or block ID
quantityint how much to add
damageint the damage value of the item
Example
// sticks anyone? addItemInventory(280, 64, 0); -
staticPlayer.canFly(
) -
-
staticPlayer.clearInventorySlot(
) -
-
staticPlayer.getArmorSlot(
) -
-
staticPlayer.getArmorSlotDamage(
) -
-
staticPlayer.getCarriedItem(
){number} -
gci
Returns:
Type Description number id -
staticPlayer.getCarriedItemCount(
){number} -
gcic
Returns:
Type Description number quantity -
staticPlayer.getCarriedItemData(
){string} -
gcid
Returns:
Type Description string data -
staticPlayer.getDimension(
) -
-
staticPlayer.getEntity(
){number} -
return the player's native entity object id (NOT the same as EntityType)
Returns:
Type Description number the player's entity id - Entity.getYaw for a more detailed example
Example
// suicide is painless... Entity.setHealth(Player.getEntity(), 0); -
staticPlayer.getExhaustion(
) -
- BL 1.10.4
-
staticPlayer.getExp(
){int} -
Get the player's experience
Returns:
Type Description int the experience level - BL 1.10.4
-
staticPlayer.getHunger(
) -
- BL 1.10.4
-
staticPlayer.getInventorySlot(
) -
-
staticPlayer.getInventorySlotCount(
) -
-
staticPlayer.getInventorySlotData(
) -
-
staticPlayer.getLevel(
) -
- BL 1.10.4
-
staticPlayer.getName(
) -
-
staticPlayer.getPointedBlockData(
) -
-
staticPlayer.getPointedBlockId(
) -
-
staticPlayer.getPointedBlockSide(
) -
-
staticPlayer.getPointedBlockX(
) -
-
staticPlayer.getPointedBlockY(
) -
-
staticPlayer.getPointedBlockZ(
) -
-
staticPlayer.getPointedEntity(
) -
-
staticPlayer.getPointedVecX(
) -
-
staticPlayer.getPointedVecY(
) -
-
staticPlayer.getPointedVecZ(
) -
-
staticPlayer.getSaturation(
) -
- BL 1.10.4
-
staticPlayer.getSelectedSlotId(
) -
-
staticPlayer.getX(
){number} -
return the player's current x coordinate
Returns:
Type Description number the player's x coordinate Example
var x = Math.round(Player.getX()); ModPE.showTipMessage("Your X coordinate is: " + x); -
staticPlayer.getY(
){number} -
return the player's current y coordinate
Returns:
Type Description number the player's y coordinate Example
var y = Math.round(Player.getY()); ModPE.showTipMessage("Your Y coordinate is: " + y); -
staticPlayer.getZ(
){number} -
return the player's current z coordinate
Returns:
Type Description number the player's z coordinate Example
var z = Math.round(Player.getZ()); ModPE.showTipMessage("Your Z coordinate is: " + z); -
staticPlayer.isFlying(
) -
-
staticPlayer.isPlayer(
) -
-
staticPlayer.setArmorSlot(
) -
-
staticPlayer.setCanFly(
) -
-
staticPlayer.setExhaustion(
) -
- BL 1.10.4
-
staticPlayer.setExp(
) -
- BL 1.10.4
-
staticPlayer.setFlying(
) -
-
staticPlayer.setHealth(
) -
-
staticPlayer.setHunger(
) -
- BL 1.10.4
-
staticPlayer.setLevel(
) -
- BL 1.10.4
-
staticPlayer.setSaturation(
) -
- BL 1.10.4
-
staticPlayer.setSelectedSlotId(
) -