Skip to content

API reference

Explore the lh API. Open a namespace or function to see its members and parameter rows. Select a type to read its reference.

This preview uses sample data. Some members are illustrative and may differ from the released API. A ? after a type means it can be nil; after a parameter name, it means the argument can be omitted.

  • lh.23 members
    • display.5 members
      • heightWindow heightinteger
      • hzMonitor refresh rateinteger
      • isF3OnWhether the debug menu is onboolean
      • scaleGUI Scaleinteger
      • widthWindow widthinteger
    • facing.5 members
    • pc.3 members
      • cpu.4 members
        • coresPhysical core countinteger
        • nameProcessor namestring
        • threadsLogical processor countinteger
        • usageMinecraft process CPU usage percentinteger
      • gpu.2 members
        • namePrimary graphics card namestring
        • usageMinecraft GPU usage percent, or -1 when unavailableinteger
      • memory.4 members
        • allocatedMemory allocated in MiBinteger
        • freeMemory still available in MiBinteger
        • maxMaximum memory in MiBinteger
        • usedMemory used in MiBinteger
    • perf.3 members
      • fpsCurrent rendered frames per secondinteger
      • pingPlayer latency in millisecondsinteger
      • tpsIntegrated-server ticks per secondnumber
    • player.18 members
      • armor.3 members
      • hunger.2 members
      • xp.3 members
        • levelExperience levelinteger
        • progressProgress toward the next levelnumber
        • totalTotal experience pointsinteger
      • effectsActive status effects keyed by namespaced IDtable<StatusEffectId, StatusEffect>
      • gamemodeCurrent game modestring
      • healthCurrent healthinteger
      • horseCurrently ridden horse-family animal, or nilHorse?
      • idNamespaced player entity typeEntityTypeId
      • lastDeathLast observed death in the current connection, or nil before dying. Survives respawns, dimension changes and profile reloads; resets on reconnect.Death?
      • maxHealthMaximum healthinteger
      • namePlayer display namestring
      • sprintHeldWhether the sprint key is heldboolean
      • sprintingWhether the character is sprintingboolean
      • usernameAccount usernamestring
      • uuidPlayer UUIDstring
      • xX coordinatenumber
      • yY coordinatenumber
      • zZ coordinatenumber
    • pos.4 members
      • biome.2 members
        • idNamespaced biome IDstring
        • nameLocalized biome namestring
      • chunk.1 members
      • dimensionNamespaced dimension IDstring
      • highestBlockHighest block at player coordinatesPlacedBlock
    • session.3 members
      • ipIP address of the current serverstring
      • isMultiplayerWhether it's multiplayerboolean
      • nameName of the world or serverstring
    • slots.8 members
      • chestChest armor stackItemStack
      • feetFeet armor stackItemStack
      • headHead armor stackItemStack
      • hotbarHotbar stacks at Lua indices 1-9ItemStack[]
      • inventoryMain inventory stacks, excluding the hotbar, at Lua indices 1-27ItemStack[]
      • legsLeg armor stackItemStack
      • mainHandMain-hand stackItemStack
      • offHandOff-hand stackItemStack
    • sound.2 members
      • moodAmbient mood percentage (0 to 100), as shown in F3number
      • recordNearest playing jukebox disc within 64 blocks, or nilPlayingRecord?
    • time.5 members
      • dayDays elapsed in the worldinteger
      • hourMinecraft hourinteger
      • minuteMinecraft minuteinteger
      • secondMinecraft secondinteger
      • tickTick within the current Minecraft daynumber
    • weather.3 members
      • rainingWhether rain falls at the playerboolean
      • snowingWhether snow falls at the playerboolean
      • thunderingWhether the world is thunderingboolean
    • draw(text, options?)Draw text.nil
      • textValue converted to textany
      • options?Text optionsTextOptions
    • drawEntity(uuid, options?)Draw a loaded entity by UUID or a table with a uuid field (including lh.player).nil
      • uuidEntity UUID or any table with a string uuid fieldstring | Entity | EntityInput
      • options?Rendering optionsEntityOptions
    • drawItem(id, options?)Draw an item by namespaced ID or ItemStack model.nil
      • idNamespaced item ID or ItemStack modelItemId | ItemStack | ItemStackInput
      • options?Rendering optionsIconOptions
    • drawStack(stack, options?)Draw an item stack.nil
      • stackItem stackItemStack | ItemStackInput
      • options?Rendering optionsStackOptions
    • drawTexture(path, options?)Draw a texture by namespaced path.nil
      • pathNamespaced texture pathstring
      • options?Rendering optionsIconOptions
    • drawln(text, options?)Draw text and advance to the next line.nil
      • textValue converted to textany
      • options?Text optionsTextOptions
    • getBlockAt(coordinate)Get the block at absolute, ~, or ^ coordinates.PlacedBlock?
      • coordinateMinecraft coordinate expressionstring
    • newline(count?)End the current row, optionally repeating the line break.nil
      • count?Number of line breaks; defaults to 1integer
    • on(event, callback)Register an event callback.nil
      • eventRegistered event namestring
      • callbackCallback receives the registered event payload, if anyfunction
    • section(options?)Start an independent drawing section with fresh options.nil
      • options?Section optionsSectionOptions
    • sendMessage(message)Add a message to local chat only; never sends it to the server. Strings are literal text. Tables use modern Minecraft text components with click_event and hover_event on every supported version.nil
      • messageLiteral string or Minecraft text component table (text, color, extra, translate, click_event, hover_event, etc.)string | ChatText
    • setInterval(number, event, callback)Run a callback every N occurrences of a registered event.nil
      • numberNumber of event occurrences between callbacksinteger
      • eventRegistered event name, such as tick or renderstring
      • callbackCallback receives the registered event payload, if anyfunction