Skip to content
Mrkwtkr edited this page Apr 16, 2018 · 3 revisions
This is a detailed documentation of the Main Namespace functions

addItemInventory

function addItemInventory(id, amount, damage);
  • This adds any amount of any item/block to the player's inventory
  • (Integer) id: The data value of the desired item/block
  • (Integer) amount: The amount of the item/block you want to add
  • (Integer) damage: The damage value of the item/block

bl_setMobSkin

function setMobSkin(entity, image);
  • This sets the image of any entity
  • An image found in the assets folder of the Minecraft Pocket Edition archive can be used as the parameter image
  • (Entity) entity: The desired entity that will have its skin changed
  • (String) image: The image that the entity will use as its skin

bl_spawnMob

function bl_spawnMob(x, y, z, typeId, image);
  • Deprecated (shows toast/clientMessage "Nag: update to Level.spawnMob"), use Level.spawnMob instead
  • This can spawn any entity found in Minecraft Pocket Edition, specified by the entity ID, at the specified x, y, and z coordinates
  • An image found in the assets folder of the Minecraft Pocket Edition archive can be used as the parameter image
  • (Number) x, y, z: The desired coordinates of where the entity will be placed
  • (Integer) typeId: The entity ID of the entity you want to spawn
  • (String) image: The image that the entity will use as its skin

clientMessage

function clientMessage(text);
  • This displays the specified text in the chat
  • (String) text: The text that should be displayed

explode

function explode(x, y, z, radius);
  • This causes an explosion, where the centre is at the specified x, y and z coordinates
  • The size of the explosion is based upon the specified radius
  • The parameters x y z radius accept a number
  • (Number) x, y, z: The coordinates of the centre of the explosion
  • (Number) radius: The radius of the explosion

getCarriedItem

function getCarriedItem();
  • This returns the data value of the item/block the player is currently holding
  • Accepts no parameters

getLevel

function getLevel();
  • No information available

getPitch

function getPitch(entity);
  • This returns the entity's current pitch (up/down head rotation)
  • Highest and lowest values are 90 and -90 respectively
  • If no parameter is specified, it will default to the player
  • (Entity) entity: The target entity that holds the pitch value

getPlayerEnt

function getPlayerEnt();
  • This returns the player's native entity ID
  • Accepts no parameters

getPlayerX

function getPlayerX();
  • This returns the player's current x coordinate
  • Accepts no parameters

getPlayerY

function getPlayerY();
  • This returns the player's current y coordinate
  • Accepts no parameters

getPlayerZ

function getPlayerZ();
  • This returns the player's current z coordinate
  • Accepts no parameters

getTile

function getTile(x, y, z);
  • This returns the data value of the block at the specified coordinates
  • (Integer) x, y, z: The desired coordinates to get the block ID

getYaw

function getYaw(entity);
  • This returns the entity's current yaw (left/right head rotation)
  • Has an infinite highest and lowest value
  • If no parameter is specified, this will default to the player
  • (Entity) entity: The target entity that holds the yaw value

preventDefault

function preventDefault();
  • This prevents the default response of the action from occuring
  • Accepts no parameters

print

function print(text);
  • This displays the specified text as a pop-up toast message
  • (String) text: The text to show on the pop-up toast

rideAnimal

function rideAnimal(rider, target);
  • This makes the rider ride the target
  • (Entity) rider: The entity that will ride the target
  • (Entity) target: The entity that will be ridden by the rider

setNightMode

function setNightMode(isNight);
  • No information available

setPosition

function setPosition(entity, x, y, z);
  • This sets the location of the specified entity to the specified coordinates
  • If attackHook is not used, getPlayerEnt() can be used as the entity parameter
  • (Entity) entity: The target entity that will be teleported
  • (Number) x, y, z: The desired coordinates of which the entity will be teleported to

setPositionRelative

function setPositionRelative(entity, x, y, z);
  • This sets the location of the specified entity relative to the current coordinates
  • If attackHook is not used, getPlayerEnt() should be used as the entity parameter
  • (Entity) entity: The target entity that will be teleported
  • (Number) x, y, z: The desired relative coordinates of which the entity will be teleported to

setRot

function setRot(entity, yaw, pitch);
  • This sets the rotation of the specified entity's head to the specified yaw and pitch
  • If attackHook is not used, getPlayerEnt() should be used as the entity parameter
  • (Entity) entity: The target entity that will have its head rotation modified
  • (Number) yaw, pitch: The desired yaw and pitch of the entity

setTile

function setTile(x, y, z, blockId, damage);
  • This sets the specified Block ID at the specified x, y, and z coordinates
  • (Integer) x, y, z: The desired coordinates to change the block
  • (Integer) blockId: The desired ID of the block it will be changed to
  • (Integer) damage: The desired damage value of the new block

setVelX

function setVelX(entity, velocity);
  • This sets the x velocity of the specified entity
  • (Entity) entity: The desired entity to have its velocity modified
  • (Number) velocity: The desired strength of the entity's velocity

setVelY

function setVelY(entity, velocity);
  • This sets the y velocity of the specified entity
  • (Entity) entity: The desired entity to have its velocity modified
  • (Number) velocity: The desired strength of the entity's velocity

setVelZ

function setVelZ(entity, velocity);
  • This sets the z velocity of the specified entity
  • (Entity) entity: The desired entity to have its velocity modified
  • (Number) velocity: The desired strength of the entity's velocity

spawnCow

function spawnCow(x, y, z, image);
  • This spawns a cow at the specified x, y, and z coordinates
  • An image found in the assets folder of the Minecraft Pocket Edition archive can be used as the parameter image
  • Returns the entity spawned
  • (Number) x, y, z: The desired coordinates of where the cow will be spawned
  • (String) image: The skin that the cow will use

spawnChicken

function spawnChicken(x, y, z, image);
  • This spawns a chicken at the specified x, y, and z coordinates
  • An image found in the assets folder of the Minecraft Pocket Edition archive can be used as the parameter image
  • Returns the entity spawned
  • (Number) x, y, z: The desired coordinates of where the chicken will be spawned
  • (String) image: The skin that the chicken will use

spawnPigZombie

function spawnPigZombie(x, y, z, heldItemId, image);
  • This spawns a zombie pigman at the specified x, y, and z coordinates
  • Accepts a data value for the heldItemId parameter
  • An image found in the assets folder of the Minecraft Pocket Edition archive can be used as the parameter image
  • Returns the entity spawned
  • (Number) x, y, z: The desired coordinates of where the pigman will be spawned
  • (Integer) heldItemId: The ID of the desired item/block the pigman will hold
  • (String) image: The skin that the pigman will use

addItemInventory(id, amount, damage);
bl_setMobSkin(entity, skin);
bl_spawnMob(x, y, z, typeId, skin);
clientMessage(text);
explode(x, y, z, radius);
getCarriedItem();
getLevel();
getPitch(entity);
getPlayerEnt();
getPlayerX();
getPlayerY();
getPlayerZ();
getTile(x, y, z);
getYaw(entity);
preventDefault();
print(text);
rideAnimal(rider, mount);
setNightMode(isNight);
setPosition(entity, x, y, z);
setPositionRelative(entity, x, y, z);
setRot(entity, yaw, pitch);
setTile(x, y, z, id, damage);
setVelX(entity, amount);
setVelY(entity, amount);
setVelZ(entity, amount);
spawnChicken(x, y, z, skin);
spawnCow(x, y, z, skin);
spawnPigZombie(x, y, z, itemId, skin);

Clone this wiki locally