Wiki 9Minecraft Wiki 9Minecraft

Baritone Developer API (for Modders)

Guides 9FAQ 13Related mods 60
DownloadBaritone 9minecraft Client Mod

Get the files on 9Minecraft

Contents (5)
  1. Minimal example
  2. Key entry points
  3. Goal classes (package baritone.api.pathing.goals)
  4. Next guides
  5. More in this wiki

Because Baritone ships an api artifact under LGPL 3.0, other mods and custom clients can drive it programmatically. Add the baritone-api jar as a dependency (compile against the API package baritone.api), then control the primary Baritone instance.

Minimal example

import baritone.api.BaritoneAPI;
import baritone.api.pathing.goals.GoalXZ;
import baritone.api.pathing.goals.GoalBlock;

// Tune settings
BaritoneAPI.getSettings().allowSprint.value = true;
BaritoneAPI.getSettings().primaryTimeoutMS.value = 2000L;

// Send Baritone to an X/Z coordinate
BaritoneAPI.getProvider().getPrimaryBaritone()
    .getCustomGoalProcess()
    .setGoalAndPath(new GoalXZ(10000, 20000));

Key entry points

  • BaritoneAPI.getProvider().getPrimaryBaritone() → the active IBaritone.
  • IBaritone.getCustomGoalProcess() → setGoalAndPath(Goal), setGoal(Goal), path().
  • IBaritone.getPathingBehavior() → cancel, status, current path.
  • IBaritone.getMineProcess().mine(...) → start an auto-mine task.
  • IBaritone.getBuilderProcess().build(...) → build a schematic.
  • IBaritone.getExploreProcess() / getFollowProcess() → exploration and following.
  • BaritoneAPI.getSettings() → every setting as a typed, mutable field.

Goal classes (package baritone.api.pathing.goals)

GoalBlock, GoalXZ, GoalYLevel, GoalNear, GoalGetToBlock, GoalComposite, GoalRunAway — construct one and hand it to setGoalAndPath.

Remember: distributing a client that bundles Baritone means complying with LGPL 3.0 (keep Baritone's source available and attributed).