Repository navigation
Old Functions Page
######Hook functions are to be defined by the script, Get functions are used in a script and they return a datum, and others are run in the script.
[Hook Functions] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#hook-functions-1)
[Text Functions] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#text-functions-1)
[GET Functions] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#get-functions-1)
[SET Functions] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#set-functions-1)
[Spawn Functions] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#spawn-functions-1)
[Miscellaneous Functions] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#miscellaneous-functions-1)
[BlockLauncher-only functions] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#blocklauncher-only-functions-1)
[Object-Orientated Functions] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#object-orientated-functions-1)
[Renderer] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#renderer-1)
| Function | If it is on this Wiki | Parameters (String = text, int = integer, float & double = decimal number, NativeEntity = local specified entity, boolean = true/false, null = no parameters) | Returns |
|---|---|---|---|
| addItemInventory | Yes | int itemId, int count, int damage | null |
| bl_setMobSkin | Yes | NativeEntity entity, String url | null |
| bl_spawnMob | Yes | float x, float y, float z, int entityType, String skinUrl | NativeEntity for the spawned mob |
| clientMessage | Yes | String message | null |
| explode | Yes | float x, float y, float y, float radius | null |
| getCarriedItem | Yes | null | id of the carried item |
| getLevel | No | null | |
| getPitch | Yes | null | pitch of player |
| getPlayerEnt | Yes | null | NativeEntity for the player |
| getPlayerX | Yes | null | the player's x-axis location |
| getPlayerY | Yes | null | the player's y-axis location |
| getPlayerZ | Yes | null | the player's z-axis location |
| getTile | Yes | int x, int y, int z | id of the block at (x,y,z) |
| getYaw | Yes | null | yaw of player |
| preventDefault | Yes | null | null |
| Yes | String message | null | |
| rideAnimal | Yes | NativeEntity rider, NativeEntity mount | null |
| setNightMode | Yes | boolean isNight | null |
| setPosition | Yes | NativeEntity entityToMove, double x, double y, double z | null |
| setPositionRelative | Yes | NativeEntity entity, double x, double y, double z | null |
| setRot | Yes | NativeEntity entity, double yaw, double pitch | null |
| setTile | Yes | int x, int y, int z, int blockId, int damage | null |
| setVelX | Yes | NativeEntity ent, double amount | null |
| setVelY | Yes | NativeEntity ent, double amount | null |
| setVelZ | Yes | NativeEntity ent, double amount | null |
| spawnChicken | Yes | double x, double y, double z (texture not supported in BlockLauncher) | NativeEntity for the spawned chicken |
| spawnCow | Yes | double x, double y, double z (texture not supported in BlockLauncher) | NativeEntity for the spawned cow |
| spawnPigZombie | Yes | double x, double y, double z , int item (texture not supported in BlockLauncher) | NativeEntity for the spawned zombie pigzombie |
| ModPE.joinServer | Yes | String serverAddress, int port | |
| ModPE.langedit | No | String option, String data | null |
| ModPE.leaveGame | Yes | null | null |
| ModPE.log | No | String | |
| ModPE.overrideTexture | Yes | String filepath, String url | null |
| ModPE.readData | Yes | String dataName | data of dataName |
| ModPE.removeData | Yes | String dataName | null |
| ModPE.resetImages | Yes | null | null |
| ModPE.saveData | Yes | String dataName, String dataValue | null |
| ModPE.selectLevel | Yes | String levelDir, String levelName, String levelSeed, int gamemode | null |
| ModPE.setFoodItem | Yes | int unusedId, int itemPngY, int itemPnX, int halfhearts, String name | null |
| ModPE.setGameSpeed | Yes | double ticksPerSecond (default is 20) | null |
| ModPE.setGuiBlocks | Yes | String url | null |
| ModPE.setItem | Yes | int unusedId, int itemPngY, int itemPngX, String newName | null |
| ModPE.setItems | Yes | String url | null |
| ModPE.setTerrain | Yes | String url | null |
| ModPE.takeScreenshot | Yes | String fileName | |
| Item.addCraftRecipe | Yes | int id, int count, int damage, Array ingredients | null |
| Item.addFurnaceRecipe | Yes | int id, int damage, int inputid | null |
| Item.setCategory | Yes | int id, itemCategory | null |
| Item.addShapedRecipe | Yes | int id, int count, int damage, Array ingredients | null |
| Level.addParticle | No | int particleType, double x, double y, double z, double velX, double velY, double velZ, double size | null |
| Level.dropItem | No | double x, double y, double z, double range, int id, int count, int damage | NativeEntity for the dropped item |
| Level.explode | Yes | double x, double y, double z, double radius | null |
| Level.getAddress | No | null | (nobody knows) |
| Level.getChestSlot | No | int x, int y, int z, int slot | id of item at slot slot in chest at (x,y,z), or null/0 if not a chest |
| Level.getChestSlotCount | No | int x, int y, int z, int slot | count of item at slot slot in chest at (x,y,z), or null/0 if not a chest |
| Level.getChestSlotData | No | int x, int y, int z, int slot | damage value of item at slot slot in chest at (x,y,z), or null/0 if not a chest |
| Level.getData | Yes | int x, int y, int z | damage value of block at (x,y,z) |
| Level.getGameMode | Yes | null | 0 or 1 for survival or creative |
| Level.getSignText | No | int x, int y, int z, int line | sign text at line line at (x,y,z), or ""/null/0 if not a sign |
| Level.getTile | Yes | int x, int y, int z | id of block (x,y,z) |
| Level.getTime | No | null | time (with reference to PocketInvEditor "Edit World Info") |
| Level.getWorldDir | Yes | null | directory name of world |
| Level.getWorldName | Yes | null | name of world |
| Level.playSound | Yes | double x, double y, double z, String sound, double volume, double pitch | null |
| Level.playSoundEnt | Yes | NativeEntity ent, String sound, double volume, double pitch | null |
| Level.setChestSlot | Yes | int x, int y, int z, int slot, int id, int damage, int amount | null |
| Level.setGameMode | Yes | int gameMode | null |
| Level.setNightMode | Yes | boolean | null |
| Level.setSignText | No | int x, int y, int z, int line, String text | null |
| Level.setSpawn | No | int x, int y, int z | null |
| Level.setTile | Yes | int x, int y, int z, int id | null |
| Level.setTime | No | int time | null |
| Level.spawnChicken | Yes | double x, double y, double z, String texture | NativeEntity for spawned chicken |
| Level.spawnCow | Yes | double x, double y, double z, String texture | NativeEntity for spawned cow |
| Level.spawnMob | No | double x, double y, double z, int EntityId, String texture | NativeEntity for spawned mob |
| Level.getBrightness | No | int x, int y, int z | Brightness at position (x,y,z) |
| Player.addItemInventory | Yes | int id, int amount, int damage | null |
| Player.clearInventorySlot | No | int slot | null |
| Player.getArmorSlot | No | int slot | id of armor at slot slot |
| Player.getArmorSlotDamage | No | int slot | damage value of armor at slot slot |
| Player.getCarriedItem | Yes | null | id of holding item |
| Player.getCarriedItemCount | No | null | count of holding item |
| Player.getCarriedItemData | No | null | damage value of holding item |
| Player.getEntity | Yes | null | getPlayerEnt() |
| Player.getInventorySlot | No | int slot | id of item in player inventory slot slot |
| Player.getInventorySlotCount | No | int slot | count of item in player inventory slot slot |
| Player.getInventorySlotData | No | int slot | damage value of item in player inventory slot slot |
| Player.getSelectedSlotId | No | null | |
| Player.getX | Yes | null | x-axis of player |
| Player.getY | Yes | null | player y-axis |
| Player.getZ | Yes | null | player z-axis |
| Player.setCanFly | Yes | int | Player will able to fly |
| Player.setArmorSlot | No | int slot, int id, int damage | null |
| Player.setHealth | No | int halfhearts | null |
| Player.addItemCreativeInv | Yes | int id, int amount, int damage | null |
| Entity.addEffect | Yes | NativeEntity animal, int EffectId, int duration, int amplification, boolean ambient, boolean showParticles | null |
| Entity.getAnimalAge | Yes | NativeEntity animal | animal age |
| Entity.getEntityTypeId | Yes | NativeEntity animal | type id of animal, with reference to http://minecraftwiki.net/wiki/Data_values_(Pocket_Edition) |
| Entity.getHealth | No | NativeEntity animal | half-hearts of animal |
| Entity.getPitch | Yes | NativeEntity animal | pitch of animal |
| Entity.getX | Yes | NativeEntity animal | animal x-axis |
| Entity.getY | Yes | NativeEntity animal | animal y-axis |
| Entity.getYaw | Yes | NativeEntity animal | animal yaw |
| Entity.getZ | Yes | NativeEntity animal | animal z-axis |
| Entity.remove | Yes | NativeEntity animal | null |
| Entity.rideAnimal | Yes | NativeEntity rider, NativeEntity mount | null |
| Entity.setAnimalAge | Yes | NativeEntity animal, int age (Age ranges from -24000 to 0 | null |
| Entity.setCarriedItem | Yes | NativeEntity ent, int id, int count, int damage | null |
| Entity.setFireTicks | No | NativeEntity ent, int howLong (seconds) | null |
| Entity.setHealth | No | NativeEntity ent, int halfhearts | null |
| Entity.setMobSkin | No | NativeEntity entity, String texture | null |
| Entity.setPosition | Yes | NativeEntity ent, double x, double y, double z | null |
| Entity.setPositionRelative | Yes | NativeEntity ent, double x, double y, double z | null |
| Entity.setRenderType | Yes | NativeEntity ent, int renderType, with reference to https://github.com/Connor4898/ModPE-Scripts/wiki/Render-types | null |
| Entity.setRot | Yes | NativeEntity ent, double yaw, double pitch | null |
| Entity.setVelX | Yes | NativeEntity ent, double amount | null |
| Entity.setVelY | Yes | NativeEntity ent, double amount | null |
| Entity.setVelZ | Yes | NativeEntity ent, double amount | null |
| Entity.spawnMob | Yes | double x, double y, double z, int EntityId, String texture | NativeEntity of spawned mob |
| Entity.setNameTag | Yes | EntityId, name | null |
| Block.defineBlock | Yes | int id, String name, String texture, int materialSourceId, boolean opaque, int render type | null |
| Block.setShape | Yes | int id, double x1, double y1, double z1, double x2, double y2, double z2 | null |
| Block.setColor | Yes | int id, array htmlColor | null |
| Block.setDestroyTime | Yes | int id, double time | null |
| Block.setExplosionResistance | Yes | int id, double resistance | null |
| Block.setLightLevel | Yes | int id, int level | null |
| Block.setLightOpacity | Yes | int id, int darkness | null |
| Block.setRenderLayer | Yes | int id, int renderLayer | null |
function useItem(x,y,z,itemId,blockId,side,itemDamage,blockDamage);
- This executes a specified function when an item is used, or when a block is tapped
- This can be used to find out:
- On which block an item was used on
- The item's ID
- The block's ID
- On which side of the block the item was used
- The item's Damage/Data/Durability
- The block's Damage/Data
- The parameters
x, y, z, itemId, blockId, side, itemDamage, blockDamageaccept numbers
example:
function useItem(x, y, z, itemId, blockId, side, itemDamage, blockDamage) {
if (itemId==280) {
clientMessage("You touched a block with a stick");
}
}function attackHook(attacker,victim);
- This executes a specified function when the player taps or attacks another mob
- This can be used to execute functions on the player, as well as the victim
- The parameters
attacker, victimaccept a native entity
example:
function attackHook(attacker, victim) {
if (attacker == Player.getEntity()) {
clientMessage("Sir, you shouldn't attack others.");
} else {
clientMessage("Sir, you are under attack!");
}
}function modTick();
- This can be used for executing timed functions
- This executes a specified function once every twentienth of a second (20 times per second)
- Accepts no parameters
- preventDefault() in this hook is useless
example:
function modTick() {
clientMessage("Spam...!"); //shows in chat 20 times a second
}function procCmd(cmd);
- This executes the specified command when something is entered into the chat
example:
function procCmd(cmd) {
cmd = cmd.toLowerCase();
if (cmd == "help"){
clientMessage("Was this helpful enough?");
}
}- preventDefault() in these two hooks is useless
function newLevel();
- This executes the specified function when the world starts generating
- Accepts no parameters
example:
function newLevel() {
clientMessage("Welcome player");
}function leaveGame();
- This executes the specified function when the player leaves the world
- Accepts no parameters
example:
function leaveGame() {
print("Goodbye");
}function entityAddedHook(entity);
- This hook is called when a new entity is added.
- Also includes arrows and falling blocks.
example:
function entityAddedHook(entity) {
if (Entity.getEntityTypeId(entity) == 33) {
clientMessage("Watch out, a creeper has spawned!");
}
}function entityRemovedHook(entity);
- This hook is called when an entity despawns or dies.
example:
function entityRemovedHook(entity) {
if (Entity.getEntityTypeId(entity) == 81) {
clientMessage("A snowball was thrown and has now broke.");
}
}function deathHook(murderer, victim);
- This hook is called when a mob dies.
- Both parameters are NativeEntity.
example:
function deathHook(murderer, victim) {
if (Player.getEntity() == murderer) {
clientMessage("How could you?!");
}
}function levelEventHook(entity,eventType,x,y,z,data):
- Called when a door is opened or closed.
- The first parameter is equal to getPlayerEnt();
- All other parameters are int.
function blockEventHook(x,y,z,eventType,data);
- Called every three seconds for chests to announce their opened/closed state.
- All parameters are int.
Note: if you are adding a BlockLauncher-specific method, please add it to one of the namespaces (Entity, Level, ModPE, Player) instead of the top-level namespace.
function print("text");
- This displays the specified text as a pop-up toast message
- The parameter
textaccepts a string
function clientMessage("text");
- This displays the specified text in the chat
- The parameter
textaccepts a string
function getPlayerX();
function getPlayerY();
function getPlayerZ();
- This gets the player's current X, Y and Z coordinate
- Accepts no parameters
function getPlayerEnt();
- This gets the player's native entity ID
- Accepts no parameters
- These functions get values from the player's head rotation in degrees
function getYaw(ent);
- This gets the entity's current yaw (left/right head rotation)
- Has an infinite highest and lowest value
- The parameter
entaccepts a native entity - If no parameter is specified, this will default to the player
function getPitch(ent);
- This gets the entities's current pitch (up/down head rotation)
- Highest and lowest values are 90 and -90 respectively
- The parameter
entaccepts a native entity - If no parameter is specified, this will default to the player
function getGamemode(gamemode);
- Gets the world gamemode
- The parameter "gamemode" accepts a number
- Returns a string
function getCarriedItem();
- This gets the Data Value of the item or block the player is currently holding
- Accepts no parameters
function getTile(x,y,z);
- This gets the data value of the block at the specified coordinates
- The parameters
x, y, zaccept a number
function setPosition(ent,x,y,z);
- This sets the location of the specified entity to the specified coordinates
- The parameter
entaccepts a native entity - The parameters
x, y, zaccept a number - If attackHook is not used, getPlayerEnt() can be used as the ent parameter
function setPositionRelative(ent,x,y,z);
- This sets the location of the specified entity relative to the current coordinates.
- The parameter
entaccepts a native entity - The parameters
x, y, zaccept a number - If attackHook is not used, getPlayerEnt() should be used as the ent parameter
function setRot(ent,yaw,pitch);
- This sets the rotation of the specified entity's head to the specified yaw and pitch
- The parameter
entaccepts a native entity - The parameters
yaw, pitchaccept a number - If attackHook is not used, getPlayerEnt() should be used as the ent parameter
function setVelX(ent,velocity);
function setVelY(ent,velocity);
function setVelZ(ent,velocity);
- This sets the X, Y, and Z velocities of the specified entity (respectively)
- The parameter
entaccepts a native entity - The parameter
velocityaccepts a number - If attackHook is not used, getPlayerEnt() should be used as the ent parameter
function setGamemode(gamemode)
- Changes the player gamemode
function setTile(x,y,z,blockID,damageValue);
- This sets the specified Block ID at the specified X, Y, and Z coordinates
- The parameters
x, y, z, blockID, damageValueaccept a number
function setPlayerHealth(halfHearts);
- This sets the specified health of the player
- The parameter
halfHeartsaccepts a number
function spawnCow(x,y,z,"image");
function spawnChicken(x,y,z,"image");
- These spawn a cow or 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"
- The parameters
x, y, zaccept a number - The parameter
imageaccepts a string - Returns the entity spawned
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"
- The parameters
x, y, z, heldItemIDaccept a number - The parameter
imageaccepts a string - Returns the entity spawned
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 raduis
- The parameters
x, y, z, radiusaccept a number
function rideAnimal(player,target);
- This makes the player ride the target mob
- The parameters
player, targetaccept a native entity
function addItemInventory(ID,amount,damageValue);
- This adds the specified amount of the specified item/block to the player's inventory
- The parameters
ID, amount, damageValueaccept a number
function preventDefault();
- This prevents the default response of the action from occuring
- Accepts no parameters
These functions are only available on BlockLauncher, and can be identified by the bl_ before the function name
function bl_spawnMob(x,y,z,mobID,"image");
- Deprecated (shows toast/clientMessage "Nag: update to Level.spawnMob"), use Level.spawnMob instead
- This can spawn any mob found in Minecraft Pocket Edition, specified by the mobID, 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 - The parameters
x, y, z, mobIDaccept a number - The parameter
imageaccepts a string
function setMobSkin(mob,"image");
- This sets the image of the specified mob
- An image found in the assets folder of the Minecraft Pocket Edition archive can be used as the parameter
image - If getPlayerEnt is not used, [attackHook] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#attackhook) must be used
- The parameter
mobaccepts a native entity - The parameter
imageaccepts a string
function ModPE.leaveGame()
- Quits to the title screen. (warning: your script will cease to execute one tick later)
- Accepts no parameters
function ModPE.overrideTexture("folder/targetTexture.png","http://example.org/potato.png");
- This overrides the specified target texture, and replaces it with the desired texture
- Not implemented in BlockLauncher as of version 1.4.5
function ModPE.readData(key);
- This returns the value of the specified key, created by saveData
- This was bl_readData before BlockLauncher 1.4.5
- The parameter
keyaccepts a string
function ModPE.removeData(key)
- Removes data stored with ModPE.saveData
- The parameter
keyaccepts a string
function ModPE.resetImages();
- Resets all textures and images to their defaults
- Accepts no parameters
function ModPE.saveData(key,value);
- This function can save any data
- Can be recalled by using the key on readData
- The parameters
key, valueaccept a string - This was bl_saveData before BlockLauncher 1.4.5
function ModPE.setItem(id,"texture",dataColourAmount,"name");
- This is used to create new, custom textured items, with custom names
- The texture's parameter use MCPE texture names, and is used to create the texture of the new item, based upon the items_opaque.png file
function ModPE.setFoodItem(ID,imageX,imageY,halfHeartsHealed,"name");
- This is used to create new, custom textured food items, with custom names
- The parameters
ID, imageX, imageY, halfHeartsHealedaccept a number - The parameter
nameaccepts a string - Only works on BlockLauncher 1.4.5 and later
function Item.addCraftRecipe(id, count, damage, [inputid, inputcount, inputdamage, ...])
- This is used to add new crafting recipes
- The last parameter is an array of input materials.
- Only works on BlockLauncher 1.6.7 beta 2 and later
- Named ModPE.addCraftRecipe() In 1.6.7 beta 2
example:
Item.addCraftRecipe(256, 1, 0, [1, 1]); //gives iron shovel from stone ;)function Item.addShapedRecipe(id, count, damage, [topSquare, middleSquare, bottomSquare], [key, itemId, itemDamage,...])
- This is used to add new shaped crafting recipes
- Only works on BlockLauncher 1.7.1 or later
example:
Item.addShapedRecipe(256, 1, 0, [
\\showing where the ingredients go
" s ",
" t ",
" t "
],
//now telling the game what the "s" and "t" mean (s is id of 1, damage 0)
["s", 1, 0, "t", 280, 0]); //gives iron shovel from stone ;)function Item.addFurnaceRecipe(outputid,outputdamage,inputid);
- This is used to add new smelting recipes
- You can only specify item id in input (no damage)
- Only works on BlockLauncher 1.6.7 beta 2 and later
- Called ModPE.addFurnaceRecipe() Prior From 1.6.8+
example:
Item.addFurnaceRecipe(276,0,269); //gives a diamond sword from a wooden shovel :Pfunction Item.setItemCategory(itemid,itemcategory);
- This is used to set the category the item appears in when the crafting table user interface appears.
- Item categories are ints but you should use the static constants from the ItemCategory class instead.
- ItemCategory.INTERNAL (int -1), ItemCategory.MATERIAL (int 1), ItemCategory.TOOL (int 2), ItemCategory.FOOD (int 4) or ItemCategory.DECORATION (int 8).
- ItemCategory class found here https://github.com/zhuowei/MCPELauncher/blob/master/src/net/zhuoweizhang/mcpelauncher/ItemCategory.java
example:
Item.setItemCategory(itemid,ItemCategory.FOOD); //sets item with id 256 to show in the FOOD category of the crafting tablefunction ModPE.setGuiBlocks("http://example.org/potato.png");
function ModPE.setItems("http://example.org/potato.png");
function ModPE.setTerrain("http://example.org/potato.png")
- This overrides the current texture with the specified one.
- Must be a HTTP URL to a .png file
- Not implemented in BlockLauncher as of version 1.4.5
- Only Blocklauncher pro users can use these functions.
function ModPE.joinServer("server ip","server port");
- This lets you join a server at any time.
- Type in the Port and IP and make it push and you will be put on the specified server.
function ModPE.setGameSpeed(ticks);
- Set the ticks in a second.
- The default is 20 ticks per second.
- Using this will reduce the time modTick() takes to push a function.
- This will speed up everything in the game when ticks are more than 20.
function ModPE.takeScreenshot("fileName");
- Take a screenshot using BlockLauncher's screenshot feature.
- The fileName parameter lets you change what you want the screenshot name to be.
function Level.getGamemode(gamemode);
- This is the same as [
function getGamemode]
function Level.explode(x,y,z,radius);
- This is the same as [
function explode] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#explode)
function Level.getTile(x,y,z);
- This is the same as [
function getTile] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#gettile)
function Level.playSound(getPlayerX(),getPlayerY(),getPlayerZ(), sound, volume, pitch);
- Plays a sound
- "sound" accepts any of the sounds from this list of sounds
- "volume" accepts a number
- "pitch" accepts a number
example:
function useItem(x,y,z,itemId,blockId,side){
if(blockId==1){ //If block is stone
Level.playSound(getPlayerX(),getPlayerY(),getPlayerZ(),"random.explode",30,25); //Play an explosion sound when stone is tapped
}
}function Level.playSoundEnt(ent, sound, volume, pitch);
- Plays a sound around an entity
- "ent" accepts a Native entity id
function Level.getData(x,y,z);
- This gets the damage value of the block at the specified coordinates
- The parameters
x, y, zaccept a number
function Level.getWorldDir();
- This returns the name of the folder which stores the world files
- This was named bl_getWorldDir before BlockLauncher 1.4.5
function Level.getWorldName();
- This returns the world name stored in the world files
- Accepts no parameters
- This was named bl_getWorldName before BlockLauncher 1.4.5
function Level.setChestSlot(x,y,z,slot,ID,damage,amount);
- All the parameters are integers.
function Level.setTile(x,y,z,blockID);
- This is the same as [
function setTile] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#settile)
function Level.spawnChicken(x,y,z,"image");
function Level.spawnCow(x,y,z,"image");
- This is the same as [
function spawnChickenandfunction spawnCow] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#spawncow-spawnchicken-and-spawnpigzombie)
function destroyBlock(x,y,z,shouldDropItem);
- Executes exactly the same as the player long-click a block except that there is no progress circle. Particles are also shown.
- The first 3 parameters are integers.
- shouldDropItem is boolean (true/false)
function Player.addItemInventory(ID,amount,damage);
- This is the same as [
function addItemInventory] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#additeminventory)
function Player.getCarriedItem();
- This is the same as [
function getCarriedItem] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#getcarrieditem)
function Player.getEntity();
- This is the same as [
function getPlayerEnt] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#getplayerent)
function Player.getX();
function Player.getY();
function Player.getZ();
- These are the same as [
function getPlayerX,function getPlayerY, andfunction getPlayerZ] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#getplayerx-getplayery-getplayerz)
function Player.addItemCreativeInv(id,amount,damage);
- This is the exact same as Player.addItemInventory, except it adds items to the creative inventory.
- Does not work with custom items and custom blocks.
Player.setCanFly(1/0);
- Set Player to able to flying or not
- 1 To Able , 0 to Disable
function Entity.setNameTag(ent);
- Set Name Tag in Entites/Mobs Head
function Entity.getAnimalAge(ent);
- This returns the specified mob's age
- Ranges from -24000 to 0, where -24000 is a 'baby' mob, and 0 is an 'adult' mob
- Must be used with [attackHook] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#attackhook), as the player's age is always 0
function Entity.setAnimalAge(ent,age);
- This sets the specified animal's age
- Does not work with hostile mobs, or the player
function Entity.getEntityTypeId(ent);
- This returns the specified mob's entity ID
- Must be used with [attackHook] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#attackhook)
function Entity.getPitch(ent);
function Entity.getYaw(ent);
- This is the same as [
function getPitchandfunction getYaw] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#getyaw-and-getpitch) respectively
function Entity.getX(ent);
function Entity.getY(ent);
function Entity.getZ(ent);
- These functions return the X, Y, and Z coordinates of the specified entity
- Must be used with [attackHook] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#attackhook)
function Entity.remove(ent);
- This removes the specified entity
- Must be used with [attackHook] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#attackhook)
- If the player is removed, the player turns invisible, and cannot move
- The parameter
entaccepts a native entity - This was bl_removeEntity before BlockLauncher 1.4.5
function Entity.rideAnimal(player,target);
- This is the same as [
function rideAnimal] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#rideanimal)
function Entity.setCarriedItem(ent,ID,int,DamageValue);
- Only the player, skeletons and zombie pigmen can be used for the ent parameter
- Must be used with [attackHook] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#attackhook), unless the the specified ent is the player
- Parameter 3,
int, is unknown
function Entity.setPosition(ent,x,y,z);
function Entity.setPositionRelative(ent,x,y,z);
- These are the same as [
function setPosition] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#setposition-2) and [function setPositionRelative] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#setpositionrelative-2) respectively
function Entity.setRot(ent,yaw,pitch);
- This is the same as [
function setRot] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#setrot)
function Entity.setVelX(ent,vel);
function Entity.setVelY(ent,vel);
function Entity.setVelZ(ent,vel);
- These are the same as [
function setVelX,function setVelYandfunction setVelZ] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#setvelx-setvely-setvelz) respectively
function Entity.spawnMob(x,y,z,mobID,"image");
- This is the same as [
function bl_spawnMob] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#bl_spawnmob) - This has been moved again (sorry!) to Level.spawnMob. This still works, however, this variant of spawnMob will be removed soon.
function Entity.setRenderType(ent, type);
-
Lets you use a different model for the mob passed in, for mob disguise.
-
Must be used with [attackHook] (https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List#attackhook), unless the the specified ent is the player or an entity returned from the spawning methods.
-
For a list of render types, see the current list of known render types.
function Entity.addEffect(entity, id, duration, amplification, ambient, showParticles);
-
Adds a potion effect to the given mob. Entity passed in must be a mob.
-
Duration is in ticks - so if you want 30 seconds, put in 30*20 or 600 ticks
* Example:
Entity.addEffect(getPlayerEnt(), MobEffect.nightVision, 30*20, 0, false, true);//give player a nightVision effect for 30 sec- The list of valid potion effect IDs:
MobEffect.saturation
MobEffect.absorption
MobEffect.healthBoost
MobEffect.wither
MobEffect.poison
MobEffect.weakness
MobEffect.hunger
MobEffect.nightVision
MobEffect.blindness
MobEffect.invisibility
MobEffect.waterBreathing
MobEffect.fireResistance
MobEffect.damageResistance
MobEffect.regeneration
MobEffect.confusion
MobEffect.jump
MobEffect.harm
MobEffect.heal
MobEffect.damageBoost
MobEffect.digSlowdown
MobEffect.digSpeed
MobEffect.movementSlowdown
MobEffect.movementSpeed
function Entity.removeEffect(entity, id);
- Removes a potion effect from a mob.
function Entity.removeAllEffects(entity);
- Removes all potion effects from a mob.
function Block.defineBlock(id,"name","texture",materialSourceId,opaque,rendertype);
- Creates a custom block with textures and lots of special options with it.
- The parameter id lets you choose the custom block id, with maximum of 255.
- The parameter "name" is what you want the item name, although it must be in a string (" ").
- "texture" lets you choose the texture for the block. To see all the MCPE texture names go to Zhuowei's list of MCPE's texture names.
- The texture can be also put in an array, formatted like this:
[["bottom texture",type],["top texture",type],["south texture",type],["north texture",type],["west texture",type],["east texture",type]]
- If you wanted to use a type texture, it's simple! Just put an array into the "texture" param and do the array like this: ["texture name",type]. It's that simple!
- materialSourceId doesn't really work. If it is not set it will not drop anything when the block is broken but nothing really happens (the noise always is walk over stone but all that will happen I believe is that it will become easier to break with axes for example.
- The opaque parameter is simple, if it is set to false, then in the inventory it will be displayed as transparent. If true though, then it will have blackness when held.
- The render types are used to render the block, but something annoying is: the block will still be (in shape) rendered as a full block. If you want to know the render types, go to the render type list and scroll down to block render types.
function Block.setShape(id,x1,y1,z1,x2,y2,z2);
- Sets the shape of a block.
- The id parameter lets you specify which block.
- Use all the x,y,z parameters to show shape.
function Block.setColor(id,color);
- Sets the color of a block in HTML.
- id is used to pick the block.
- To set the color, 1. Use an array like this: [] 2. Use 0x instead of # 3. Only use 6 letters/numbers for the HTML color. Example:
Block.setColor(1,[0xFF0000]);
function Block.setDestroyTime(id,time);
- Sets the destroy time of a block.
- Does not use seconds per 1 in time. If you need to know the destroy times on blocks in Minecraft, go to the list of block destroy times.
function Block.setExplosionResistance(id,resistance);
- Sets the explosive resistance of a block.
- In resistance, the resistance you put in, will be the exact same.
- The resistance is measured in how many explosions.
- So for example if you had 15 as it then 15 tnt explosions would destroy it.
function Block.setLightLevel(id,level);
- Changes how much light the block can dispense.
- The maximum is 15 in the level parameter.
- 15 is glowstone brightness and 10 is the brightness of redstone torches.
function Block.setLightOpacity(id,darkness);
- Changes how much light can pass through the block.
- The maximum is 10 in the darkness parameter.
- 0 is the most amount of light can pass through and 10 is the least amount of light that can pass through.
function Block.setRenderLayer(id,renderLayer);
- Sets transparency on blocks.
- Render layer 1 is transparent.
- Render layer 2 is translucent.
- Render layer 0 is opaque.
function Renderer.get(id)
Returns the renderer object with the given render type.
function Renderer.createHumanoidRenderer()
Creates a new render type with a human model.
renderer.renderType
A read-only variable holding the render type ID for this renderer.
renderer.model
A read-only variable holding the model object for this renderer.
model.getPart("partName")
Gets the model part by that given name. Currently defined names as of BlockLauncher 1.6.10:
- head
- body
- leftArm
- rightArm
- leftLeg
- rightLeg
This API was designed to resemble the Desktop Edition's ModelRenderer object, so documentation on that would help here.
modelPart.setTextureOffset(textureX, textureY, transparent)
Sets the location on the skin file where the texture of this model part should be read from.
modelPart.addBox(xOffset, yOffset, zOffset, width, height, depth, scale)
Adds a new box onto the model part.
modelPart.clear()
Removes (clears) a model part.
modelPart.setTextureSize(width, height)
modelPart.setRotationPoint(x, y, z)
Sets the point in which the model part rotates from.