Skip to main content

API Reference

Pendulum exposes JavaScript API through grouped objects. All functions are synchronous — they block until the in-game action completes.

API Objects

ObjectAliasPurpose
mc.playerMovement, rotation, interaction, player state
mc.worldBlock/entity/environment queries
mc.invInventory & container operations
mc.guiScreen-level GUI interaction
baritonebrPathfinding, mining, farming, building (optional)
mcminecraft, gameChat, commands, script control

mc (Root Utilities)

mc.say('Hello!') // send public chat message (void)
mc.log('Done.') // log to action bar (void)
mc.executeCommand('/gamemode 1') // run client command (void)
mc.waitTick(20) // pause 20 ticks (~1s)
mc.execFile('farm.js') // run script file
mc.getScriptDir() // → full path to .minecraft/pendulum/
mc.help() // display API help in chat

console

console.log('Debug:', mc.player.getX());

Output appears in the Minecraft log AND the MCP eval return string.

Quick Reference

// Movement
mc.player.forward(20) // walk forward 20 ticks
mc.player.lookAt(100, 64, 0) // face a coordinate
mc.player.jump() // single jump
mc.player.sneak() // start sneaking

// Interaction
mc.player.breakBlockAt(x,y,z) // break specific block
mc.player.placeBlockAt(x,y,z) // place at exact coord
mc.player.useItem(32) // eat / draw bow / shield
mc.player.attack() // left-click attack

// World
mc.world.findBlocks('diamond_ore', 16) // sphere search
mc.world.rayTrace(5) // ray trace
mc.world.getNearbyEntities(10) // nearby mobs
mc.world.getBiomeAt(x,y,z) // biome name

// Inventory
mc.inv.selectHotbar(3) // select hotbar slot
mc.inv.hasItem('diamond', 5) // has 5 diamonds?
mc.inv.getAllItems() // full inventory

// GUI
mc.gui.click(100, 200) // screen click
mc.gui.clickButton('Done') // click by text
mc.gui.typeText('hello', true) // type + Enter
mc.gui.getElements() // widget tree

All Functions