$ show cabaletta/baritone
Baritone is a Minecraft client-side automation bot that provides autonomous pathfinding, mining, building, exploration, and entity following. It operates as a mod for Fabric, Forge, and NeoForge, integrating deeply with the Minecraft client via mixins to control player movement, block interaction, and chat commands. The system is architected around a central `Baritone` class that orchestrates behaviors (pathing, look, inventory), processes (mine, build, follow, elytra flight), a command system with tab completion, world caching for long-distance pathing, and a schematic system for declarative building. It exposes a public API (`baritone.api`) for embedding in custom utility clients. The core pathfinding engine uses A* with custom movement costs, supporting ground movement (walking, jumping, parkour, swimming) and elytra flight through a Java port of a native nether pathfinder. The world is cached in a compressed 2-bit format (air, solid, water, avoid) with disk persistence, enabling pathfinding across large distances. The command system supports dozens of chat commands (`#goto`, `#mine`, `#build`, `#follow`, `#farm`, `#explore`) with argument parsing and datatype validation. The schematic system allows loading and building structures from various formats (MCEdit, Sponge, Litematica) with composable masks, rotations, and substitutions. External dependencies include the Minecraft client itself (via mixins), optional integration with Litematica and Schematica mods, and a native library for elytra pathfinding (with a Java fallback). The build system uses Gradle with ProGuard for jar shrinking and a custom `Determinizer` for reproducible builds. The codebase is actively maintained with frequent commits, though it carries technical debt from version-specific mixins, commented-out code, and some monolithic process files. It is a high-quality example of game automation and pathfinding research, but its tight coupling to Minecraft internals limits reusability outside that domain.
The LLM identified 8 files worth highlighting for reuse:
A utility that sorts jar entries and sets fixed timestamps to produce deterministic (byte-identical) jar outputs. It solves a common build reproducibility problem and can be extracted for any Gradle project needing reproducible archives.
A generic pagination helper for command output that splits messages into pages and handles 'next page' requests. It is self-contained and can be reused in any chat or console command system.
A reusable tab completion engine that manages candidate generation, prefix matching, and cycling through completions. It is decoupled from specific commands and can be adapted for any text-based interface.
A parser and matcher for Minecraft block selectors with optional properties (e.g., 'minecraft:iron_ore[lit=true]'). It handles block state matching via hashing and is used throughout the codebase for mining, building, and scanning. The parsing logic is reusable for any Minecraft tool that needs to interpret block specifications.
An optimized replacement for Minecraft's BlockPos that caches hash codes, provides fast relative coordinate operations, and uses a custom long-hash function for efficient map lookups. It demonstrates performance engineering for hot-path coordinate manipulation and can be extracted for any 3D coordinate system.
A Java implementation of the Xoroshiro256++ pseudorandom number generator with fork support (creating child RNGs from a parent). It is self-contained, well-tested, and can be reused in any project needing a fast, high-quality PRNG with deterministic forking.
A variable-length integer encoding utility (similar to Protocol Buffers varint) for efficient serialization of integers. It provides read/write methods and is used in chunk cache persistence. The implementation is compact and can be extracted for any project needing compact integer serialization.
A utility for atomic file replacement that writes to a temporary file and then atomically moves it into place using `FileSystem.atomicMove` or a fallback. It ensures cache file integrity and can be reused in any application that needs crash-safe file writes.