Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/zardoy/minecraft-web-client/llms.txt

Use this file to discover all available pages before exploring further.

The Minecraft Web Client exposes several global variables to the browser console for debugging and advanced interactions. Access these by opening the console (F12) or typing #dev in the address bar on mobile.
On mobile, type #dev in the browser address bar to show a button that opens the console.

Core Game Objects

bot

window.bot
object
The Mineflayer bot instance. This is the main interface to the game client.Available: After connecting to a server or starting singleplayerUsage:
bot.entity.position  // Current player position
bot.game.gameMode    // Current game mode
bot.health           // Player health
bot.food             // Player food level
bot.inventory        // Player inventory
bot.chat('Hello!')   // Send chat message
See Mineflayer documentation for complete API reference.

world

window.world
WorldRendererThree
The Three.js world renderer instance. Handles all 3D rendering.Available: After the world renderer is initializedUseful properties:
world.sectionObjects      // All active chunk sections (meshes)
world.getCameraPosition() // Current camera position
world.getLoadedChunksRelative() // Chunks relative to player

localServer / server

window.localServer
object
The Flying Squid server instance. Only available in singleplayer or when hosting.Available: Only in singleplayer modeUseful properties:
localServer.overworld.storageProvider.regions // All loaded region files
localServer.levelData.LevelName               // World name

// Change world name and save
localServer.levelData.LevelName = 'New Name'
localServer.writeLevelDat()
Aliases: window.server

State Objects

options

window.options
object
The game settings/options object. Contains all configurable settings.Alias: window.settingsUsage:
// View all options
options

// Change settings
options.renderDistance = 8
options.fov = 90
options.debugLogNotFrequentPackets = true

// View changed options
debugChangedOptions
Changes to options are automatically saved to localStorage. Some settings require reconnecting or reloading chunks to take effect.

miscUiState

window.miscUiState
object
UI and game state information.Properties:
miscUiState.gameLoaded       // Whether game HUD is shown
miscUiState.singleplayer     // Whether in singleplayer mode
miscUiState.flyingSquid      // Whether Flying Squid is running
miscUiState.wanOpened        // Whether world is open to WAN
miscUiState.showDebugHud     // Whether F3 debug overlay is shown
miscUiState.showUI           // Whether UI is visible (F1)
miscUiState.fullscreen       // Whether in fullscreen mode
miscUiState.loadedDataVersion // Current MC version loaded

gameAdditionalState

window.gameAdditionalState
object
Additional game state not available from the bot.Properties:
gameAdditionalState.isFlying           // Flying state
gameAdditionalState.isSprinting        // Sprinting state
gameAdditionalState.isSneaking         // Sneaking state
gameAdditionalState.isZooming          // Zoom active (C key)
gameAdditionalState.warps              // World waypoints
gameAdditionalState.noConnection       // Connection lost
gameAdditionalState.poorConnection     // Poor connection
gameAdditionalState.usingServerResourcePack // Server resourcepack active

activeModalStack

window.activeModalStack
array
Stack of currently open modals/screens.Usage:
// Get current modal
activeModalStack.at(-1).reactType

// Show a modal
showModal({ reactType: 'pause-screen' })
showModal({ reactType: 'options-video' })

Utility Functions

Position Helpers

window.cursorBlockRel
function
Get the block you’re looking at, with optional offset.Usage:
cursorBlockRel()      // Block at cursor
cursorBlockRel(0,1,0) // Block above cursor
cursorBlockRel(1,0,0) // Block to the right
window.entityCursor
function
Get the entity you’re looking at.Usage:
entityCursor()        // Returns entity or undefined

Chunk Helpers

window.debugSceneChunks
getter
Get all loaded chunks relative to your current position (0,0 is current chunk).Usage:
debugSceneChunks  // Object with chunk sections
window.chunkKey
function
Get the chunk key at your position with optional offset.Usage:
chunkKey()      // "0,0" (current chunk)
chunkKey(1,0)   // Chunk to the east
chunkKey(-1,1)  // Chunk to northwest
window.sectionKey
function
Get the section key (chunk + Y level) with optional offset.Usage:
sectionKey()        // "0,64,0" (current section)
sectionKey(0,1,0)   // Section above

Object Helpers

window.keys
function
Shorthand for Object.keys().Usage:
keys(world.sectionObjects)
window.values
function
Shorthand for Object.values().Usage:
values(world.sectionObjects)
window.len
function
Get the number of keys in an object.Usage:
len(world.sectionObjects)  // Number of loaded sections

Debug Functions

Packet Inspection

window.inspectPacket
function
Log packets by name. Supports wildcards.Signature: inspectPacket(packetName, isFromClient = false, fullOrListener = false)Usage:
// Log all chat packets
inspectPacket('chat')

// Log all packets starting with 'player'
inspectPacket('player*')

// Log full packet data
inspectPacket('spawn_entity', false, true)

// Custom listener
inspectPacket('position', (data) => {
  console.log('Position:', data.x, data.y, data.z)
})
window.debugServerPacketNames
object
All available server→client packet names for the current version.Usage:
debugServerPacketNames
// { chat: 'chat', spawn_entity: 'spawn_entity', ... }
window.debugClientPacketNames
object
All available client→server packet names for the current version.Usage:
debugClientPacketNames

Performance Monitoring

window.markStart
function
Start a performance measurement.Usage:
markStart('myOperation')
// ... do something ...
markEnd('myOperation')  // Logs duration
window.markEnd
function
End a performance measurement and log the duration.
window.statsPerSec
object
Statistics per second (e.g., packets, events).Usage:
addStatPerSec('myEvent')
statsPerSec  // { myEvent: 60 } (events per second)

File System

window.fs
object
BrowserFS filesystem instance. Access virtual file system.Usage:
// Read a file
fs.promises.readFile('/world/level.dat')

// List directory
fs.promises.readdir('/world/region')
window.nbt
object
NBT parser for reading Minecraft data files.Usage:
// Parse and simplify NBT data
const data = await fs.promises.readFile('/world/level.dat')
const parsed = await nbt.parse(data)
const simplified = nbt.simplify(parsed)
console.log(simplified)
window.exportWorld
function
Export the current world programmatically.Usage:
await exportWorld()  // Downloads world as ZIP

Advanced

Control System

window.controMax
object
The Contro-Max input controller instance.Usage:
controMax.pressedKeys        // Currently pressed keys
controMax.userConfig         // Keybinding configuration
controMax.emit('trigger', { command: 'general.jump' })

Camera Controls

window.cameraRotationControls
object
Camera rotation control system.Usage:
cameraRotationControls.start('left')   // Start rotating left
cameraRotationControls.stop('left')    // Stop rotating
cameraRotationControls.config.speed = 2 // Adjust speed

Renderer

window.appViewer
object
The main app viewer instance.Usage:
appViewer.backend               // Current rendering backend
appViewer.playerState           // Player state utilities

Debug Helpers

The client uses the debug library for logging.
// Enable all debug messages (WARNING: creates spam!)
debugToggle

// Enable specific namespaces
debug.enable('minecraft-protocol')
debug.enable('mineflayer')

// Disable debug messages
debug.disable()
Enabling all debug messages will create significant console spam. Use options.debugLogNotFrequentPackets instead.
Clear localStorage while keeping specific keys.
// Clear all except saved worlds
clearStorage('worlds', 'keybindings')

// Clear everything
clearStorage()
Download a file from the virtual file system.
await downloadFile('/world/level.dat')

Common Use Cases

// Get current position
const pos = bot.entity.position
console.log(`X: ${pos.x}, Y: ${pos.y}, Z: ${pos.z}`)

// Get chunk position
const chunkX = Math.floor(pos.x / 16)
const chunkZ = Math.floor(pos.z / 16)
console.log(`Chunk: ${chunkX}, ${chunkZ}`)

See Also

Build docs developers (and LLMs) love