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

joinServer

function ModPE.joinServer(serverAddress, port);
  • (String) serverAddress: The desired IP of the server
  • (Integer) port: The desired port of the server
  • Deprecated (shows toast "Nag: update to Server.joinServer"), use Server.joinServer instead

langEdit

function ModPE.langEdit(key, value);
  • No information available

leaveGame

function ModPE.leaveGame();
  • Quits to the title screen
  • Will stop executing scripts one tick after this function has been called
  • Accepts no parameters

log

function ModPE.log(str);

overrideTexture

function ModPE.overrideTexture(url, textureName);
  • (String) textureName: The name of the texture to override.
  • (String) url: The URL of an image.

readData

function ModPE.readData(name);
  • (String) name: The name of the desired data to access
  • This returns the value saved via ModPE.saveData
  • This only reads data that is saved by a script of the same name

removeData

function ModPE.removeData(name);
  • (String) name: The name of the desired data to erase
  • This deletes the value saved via ModPE.saveData
  • This only erases data that is saved by a script of the same name

resetImages

function ModPE.resetImages();
  • Resets all textures to the default one, found in the current texture pack
  • Accepts no parameters

saveData

function ModPE.saveData(name, value);
  • (String) name: The name of the data that will be saved
  • (String) value: The data that will be saved
  • This can save any string
  • Will keep data saved even if leaving a world or quitting BlockLauncher

selectLevel

function ModPE.selectLevel(levelDir, levelName, levelSeed, gamemode);
  • No information available

setCamera

function ModPE.setCamera(entityId);
  • No information available

setFoodItem

function ModPE.setFoodItem(id, iconName, iconSubindex, halfHearts, name, maxStack);
  • (Integer) id: The ID of the new item
  • (String) iconName: The name of the desired icon
  • (Integer) haldHearts: How many half hearts are restored when eaten
  • (Integer) iconSubindex: ---Unknown---
  • (String) name: The name of the new item
  • (Integer) maxStack: The maximum amount of new items in one stack
  • This creates new edible items, with custom textures, and custom names
  • The iconName parameter is based on the names of MCPE's textures
  • The textures can be found in the items_opaque.png found in the MCPE assets

setGameSpeed

function ModPE.setGameSpeed(ticksPerSecond);
  • (Integer) ticksPerSecond: The desired speed of the game, in ticks
  • This changes the speed of the current world, and all of its patched scripts
  • This is 20 as default, and increasing this will speed up everything in-game
  • Using this function will reduce the time taken for modTick to execute code

setItem

function ModPE.setItem(id, iconName, iconSubindex, name, maxStack);
  • (Integer) id: The ID of the new item
  • (String) iconName: The name of the desired icon
  • (Integer) iconSubindex: ---Unknown---
  • (String) name: The name of the new item
  • (Integer) maxStack: The maximum amount of new items in one stack
  • This creates new items, with custom textures, and custom names
  • The iconName parameter is based on the names of MCPE's textures
  • The textures can be found in the items_opaque.png found in the MCPE assets

setItems

function ModPE.setItems(url);
  • (String) url: Changes the texture of items using the image at the specified URL.

setTerrain

function ModPE.setTerrain(url);
  • (String) url: Changes the texture of all terrain blocks with the image at the specified URL.

showTipMessage

function ModPE.showTipMessage(text);
  • (String) text: The desired text to be shown
  • This displays text above the hotbar
  • This text eventually fades, unless this is constantly executed

takeScreenshot

function ModPE.takeScreenshot(fileName);
  • (String) fileName: The name of the saved screenshot
  • This takes a screenshot using BlockLauncher's screenshot feature

getLanguage

function ModPE.getLanguage();
  • This returns the current language of the game
ModPE.joinServer(serverAddress, port);
ModPE.langEdit(key, value);
ModPE.leaveGame();
ModPE.log(str);
ModPE.overrideTexture(url, textureName);
ModPE.readData(name);
ModPE.removeData(name);
ModPE.resetImages();
ModPE.saveData(name, value);
ModPE.selectLevel(levelDir, levelName, levelSeed, gamemode);
ModPE.setCamera(entityId);
ModPE.setFoodItem(id, iconName, iconSubindex, halfHearts, name, maxStack);
ModPE.setGameSpeed(ticksPerSecond);
ModPE.setGuiBlocks(url);
ModPE.setItem(id, iconName, iconSubindex, name, maxStack);
ModPE.setItems(url);
ModPE.setTerrain(url);
ModPE.showTipMessage(text);
ModPE.takeScreenshot(fileName);

Clone this wiki locally