Skip to content
benjamin edited this page Feb 22, 2018 · 3 revisions
This is a detailed documentation of the Level functions

###destroyBlock

function Level.destroyBlock(x, y, z, shouldDrop);
  • Destroys a block as if a player destroyed it.

###dropItem

function Level.dropItem(x, y, z, range, id, count, damage);
  • Drops an item onto the floor. You can set a range in which it randomly appears (0 for spawning at the exact coordinates)

###explode

function Level.explode(x, y, z, radius);
  • Triggers a TNT explosion at the given coordinates. The standart radius is 5.

###getAddress

function Level.getAddress();
  • ???

###getBrightness

function Level.getBrightness(x, y, z);
  • Returns the brightness in a certain area in the world.

###getChestSlot

function Level.getChestSlot(x, y, z, slot);
  • Returns the ID of an item in a chest slot.

###getChestSlotCount

function Level.getChestSlotCount(x, y, z, slot);
  • Returns the count of an item in a chest slot.

###getChestSlotData

function Level.getChestSlotData(x, y, z, slot);
  • Returns the damage of an item in a chest slot.

###getData

function Level.getData(x, y, z);
  • Returns the damage of a block in the world.

###getFurnaceSlot

function Level.getFurnaceSlot(x, y, z, slot);
  • Returns the ID of an item in a furnace.

###getFurnaceSlotCount

function Level.getFurnaceSlotCount(x, y, z, slot);
  • Returns the count of an item in a furnace.

###getFurnaceSlotData

function Level.getFurnaceSlotData(x, y, z, slot);
  • Returns the damage of an item in a furnace.

###getGameMode

function Level.getGameMode();
  • Returns the gamemode for the level, 1 for creative, 0 for survival.

###getSignText

function Level.getSignText(x, y, z, line);
  • Changes the Text of a sign

###getTile

function Level.getTile(x, y, z);
  • Returns the id of the block at the given coordinates.

###getTime

function Level.getTime();
  • Returns the current daytime as a number.

###getWorldDir

function Level.getWorldDir();
  • Returns the folder-path the current world is saved in.

###getWorldName

function Level.getWorldName();
  • Returns the name of the current world as a string.

###playSound

function Level.playSound(x, y, z, sound, volume, pitch);
  • Plays a sound from the game like an item breaking or an animal.

###playSoundEnt

function Level.playSoundEnt(entity, sound, volume, pitch);
  • Plays a sound at the position of an entity and adjusts the volume as the player moves closer or further away from the entity.

###setChestSlot

function Level.setChestSlot(x, y, z, slot, id, damage, count);
  • Changes the content of a chest in the given slot. Remember to start counting at 0.

###setFurnaceSlot

function Level.setFurnaceSlot(x, y, z, slot, id, damage, count);
  • It's like setChestSlot but with furnaces

###setGameMode

function Level.function(gamemode);
  • Changes the players gamemode (0 for survival and 1 for creative).

###setNightMode

function Level.setNightMode(isNight);
  • Sets the daytime to night (1 for night and 0 for day);

###setSignText

function Level.setSignText(x, y, z, line, text);
  • Changes the text of a sign. please use the lines parameter instead of \n.

###setSpawn

function Level.setSpawn(x, y, z);
  • Sets the respawn position of the player just like a bed.

###setTile

function Level.setTile(x, y, z, id, damage);
  • Places a block at the given coordinates with a specified id and data index

###setTime

function Level.setTime(time);
  • Sets the daytime.

###spawnChicken

function Level.spawnChicken(x, y, z, skin);
  • Spawns a chicken. The skin parameter is optional.

###spawnCow

function Level.spawnCow(x, y, z, skin);
  • Spawns a cow. The skin parameter is optional.

###spawnMob

function Level.spawnMob(x, y, z, typeId, skin);
  • Spawns a mob (basically everything that's not solid blocks, including projectiles and burning tnt).

Level.destroyBlock(x, y, z, shouldDrop);
Level.dropItem(x, y, z, range, id, count, damage);
Level.explode(x, y, z, radius);
Level.getAddress();
Level.getBrightness(x, y, z);
Level.getChestSlot(x, y, z, slot);
Level.getChestSlotCount(x, y, z, slot);
Level.getChestSlotData(x, y, z, slot);
Level.getData(x, y, z);
Level.getFurnaceSlot(x, y, z, slot);
Level.getFurnaceSlotCount(x, y, z, slot);
Level.getFurnaceSlotData(x, y, z, slot);
Level.getGameMode();
Level.getSignText(x, y, z, line);
Level.getTile(x, y, z);
Level.getTime();
Level.getWorldDir();
Level.getWorldName();
Level.playSound(x, y, z, sound, volume, pitch);
Level.playSoundEnt(entity, sound, volume, pitch);
Level.setChestSlot(x, y, z, slot, id, damage, count);
Level.setFurnaceSlot(x, y, z, slot, id, damage, count);
Level.setGameMode(gamemode);
Level.setNightMode(isNight);
Level.setSignText(x, y, z, line, text);
Level.setSpawn(x, y, z);
Level.setTile(x, y, z, id, damage);
Level.setTime(time);
Level.spawnChicken(x, y, z, skin);
Level.spawnCow(x, y, z, skin);
Level.spawnMob(x, y, z, typeId, skin);

Clone this wiki locally