Skip to content

About

A Kotlin library for Minecraft bots: pathfinding, navigation and game skills.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

Minecraft Agent

A Kotlin library for Minecraft 26.3 bots: pathfinding, navigation and game skills. Every public API is callable from Java.

Libraries

net.ccbluex:minecraft-agent-<library> from https://maven.ccbluex.net/snapshots. Each library brings the ones it builds on.

  • common: everything that runs on every game version
    • world: the game's blocks, entities and items, the same on every game version
    • simulation: player movement, tick by tick
    • pathfinder: route searches
    • navigation: follows routes
    • skills: fighting, looting, mining, crafting, farming, hunting, sleeping, building, game modes
  • adapter: the libraries on Minecraft 26.3

Platforms

Client

The local player as a body, for Fabric mods. With Litematica installed, fabric reads its placements as blocks to build.

dependencies {
    implementation("net.ccbluex:minecraft-agent-fabric:1.0.0-SNAPSHOT")
    // Jar-in-jar is not transitive: every module goes into the mod jar
    for (module in listOf("common", "adapter", "fabric")) {
        include("net.ccbluex:minecraft-agent-$module:1.0.0-SNAPSHOT")
    }
}
defineGameTypes()   // once the game's registries are loaded, before any other library call
val navigation = ClientNavigation()
navigation.navigator.moveTo(Vec3(100.5, 64.0, -20.5)) { ending -> println(ending) }

Server

Bots as players on the server, the same on every server platform: Paper 26.3 as a plugin, and a Spigot 1.8.8 plugin. Install the MinecraftAgent plugin jar on the server, or shade minecraft-agent-paper or minecraft-agent-spigot into a plugin with bots of its own and call MinecraftAgent.start(this) in its onEnable.

dependencies {
    compileOnly("net.ccbluex:minecraft-agent-paper:1.0.0-SNAPSHOT")
}
val bot = MinecraftAgent.bots().spawn(location, "Steve")
bot.moveTo(target, 1.0)

SKILL.md covers the rest: game modes, options and the Kotlin coroutine API.

Navigation

Yes: passes its game test or worked in a captured run. Untested: should work, never run there. No: not supported yet. A linked feature has a video.

Walking

Client Server
Walks around walls Yes Yes
Tunnels through walls Yes Untested
Bridges gaps Yes Yes
Pillars up Yes Untested
Opens doors and fence gates Yes Untested
Keeps off soul sand, crosses ice Yes Untested
Takes another way when its way gets closed Yes Untested
Climbs ladders and vines Yes Untested
Crouches through low gaps, safe walk on narrow bridges Yes Untested
Swims through flooded tunnels Yes Untested

Jumping

Client Server
Parkour jumps Yes Untested
Assists jumps the player starts Yes Untested
Jumps from the very edge Yes Untested

Following

Client Server
Walks where the camera faces, to a goal, and after a player Yes Untested
Walks to far goals in stages Yes Untested

Flying and riding

Client Server
Flies with an elytra Yes Untested
Cruises the End with elytra and rockets Yes Untested
Flies through a canyon in creative Yes No
Flies over a wall in creative Yes No
Rides a boat Yes Untested
Rides a horse up ledges Yes Untested
Takes teleport routes No Untested

Agent usage

Most of this code was written by AI models. Each declaration they wrote names its model in an @agent KDoc tag. These are all models used so far and what they cost, summed up by agent-usage:

AI models used in Minecraft Agent and their cost

Commits

type(scope): subject, lowercase, no trailing period.

feat fix refactor chore docs

License

This project is subject to the GNU General Public License v3.0 (GPLv3). This only applies to source code located directly in this clean repository. During the development and compilation process, additional source code may be used to which we have obtained no rights. Such code is not covered by the GPL license.

For those who are unfamiliar with the license, here is a summary of its main points. This is by no means legal advice nor legally binding.

Actions that you are allowed to do:

  • Use
  • Share
  • Modify

If you do decide to use ANY code from the source:

  • You must disclose the source code of your modified work and the source code you took from this project. This means you are not allowed to use code from this project (even partially) in a closed-source (or even obfuscated) application.
  • Your modified application must also be licensed under the GPL.

About

A Kotlin library for Minecraft bots: pathfinding, navigation and game skills.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages