Lodestone is a high-performance, GPU-accelerated coordinate solver for Minecraft texture rotations. It searches world space
- Multi-Platform GPU Engines:
- Metal GPU Solver: Optimized for Apple Silicon (M1/M2/M3/M4) using Objective-C++ and Metal compute pipelines.
- CUDA GPU Solver: JIT kernel source generation tailored for NVIDIA GPUs and Windows environments.
- Dynamic Shader Code Generation: Unrolls search loops and embeds constant block offsets at compile-time to maximize GPU thread occupancy and instruction throughput.
- Differential Verification Suite: Integrated
--verifycommand that validates GPU kernels against standard reference models across 12 automated test cases. - Schematic Parser: Python utility (
parse_litematica.py) for extracting block rotation matrices directly from.litematicschematics. - Interactive Visual Sampler: Browser-based Canvas UI (TypeScript sources in
src/, built to a single self-containeddist/index.html) featuring 2D perspective quad warping and homography grid overlays to measure block orientations from screenshots, plus a block-placement solver that recovers the block grid from a seamless screenshot.
- macOS 12+ (Apple Silicon or Intel Mac with Metal support)
- Xcode Command Line Tools (
xcode-select --install) or Xcode IDE
- 64-bit Windows
- NVIDIA GPU with CUDA Toolkit (
nvcc) - Visual Studio C++ build tools (
cl.exe)
- Python 3.8+
nbtlibdependency:pip install nbtlib
macOS (Metal):
./build_metal.shWindows (CUDA):
build_cuda.batVerify GPU kernel correctness and benchmark performance:
./metal_solver --verifypython3 parse_litematica.py path/to/schematic.litematic -b lime_glazed_terracottaThis generates formation.txt and formation.json.
The sampler is a TypeScript project under src/ that builds to a single self-contained
HTML file — no server, no runtime dependencies, nothing fetched.
npm install
npm run build- Open the generated
dist/index.htmlin your browser. - Load an in-game screenshot containing rotated blocks.
- Draw quadrilaterals around target block faces to measure rotation angles using the homography grid overlay.
- If the block edges aren't obvious in the screenshot, draw a rough box over 1–4 blocks and right-click → Calculate block placement. It recovers the true block grid, splits the selection into one aligned quad per block, and overlays the edges.
For development, npm run dev rebuilds on change and serves the result over HTTP.
With formation.txt placed in the project root directory:
# Default search (assumes North orientation)
./metal_solver
# Search with explicit rotation direction (north, east, south, west)
./metal_solver --rotate east -200 200 60 128 -200 200
# Search all 4 cardinal rotations sequentially when orientation is unknown
./metal_solver --rotate unknown -6000 6000 60 256 -6000 6000The solver reads candidate block formations from formation.txt:
<block_count>
<rel_x> <rel_y> <rel_z> <rotation> <is_side>
...
rel_x,rel_y,rel_z: Relative block offset from the selected origin block.rotation: Texture rotation index (0–3 for top faces, 0–1 for side faces).is_side:0for mod-4 top face textures,1for mod-2 side face textures.
Minecraft computes block texture rotations by hashing world coordinates:
Lodestone accelerates search throughput via:
- Early Rejection: Orders candidate evaluation by rejection power (mod-4 blocks evaluated before mod-2 blocks), rejecting >75% of non-matching coordinate columns on the initial block check.
-
Forward-Difference Y-Segments: Batch-evaluates
$Y$ ranges in 64-block segments to reduce global memory atomic bottlenecks. - Register Reuse: Stores column hashes for primary blocks in registers to minimize redundant math operations across vertical passes.