Skip to main content

Sandstone

A Minecraft Datapack library in Typescript

New to Sandstone? Follow the quickstart →
Try it live, edit the code
MCFunction('welcome', () => {
say('Welcome to Sandstone!')
give('@a', 'minecraft:diamond', 64)
effect.give('@a', 'minecraft:speed', 30, 1)
})

Why Sandstone

Perfect Autocompletion

Perfect Autocompletion

Sandstone tells you what a command expects, and autocompletes complicated arguments for you. It works for every resource: commands, predicates, loot tables, advancements, and more.

Organize Resources Your Way

Organize Resources Your Way

Pack multiple functions, advancements, or loot tables into a single file, or mirror vanilla's one-per-file layout. You get comments, indentation, and every other benefit of a real programming language.

Optimized Abstractions

Optimized Abstractions

If/else, boolean logic, while and for loops, sleep. All built in, and tuned to compile to faster code than most hand-written functions. Drop down to vanilla commands any time you want.

Share on NPM

Share on NPM

Publish your functions to NPM and let anyone install them into their own packs. Raycasting, better tellraw, whole libraries, you can finally stop reinventing the wheel.

Real Patterns From Real Packs

Adapted from the Sandstone booth at Summit 2026. Pick a pattern, then flip between the TypeScript and the functions it compiles to.

An options object plus a closure, reused anywhere you need a hitbox check.

hit-detection.ts
interface HitboxOptions {
type?: string
width?: number
height?: number
onHit: () => void
}
function checkHit(opts: HitboxOptions) {
const w = opts.width ?? 0.9
const h = opts.height ?? 2.0
const type = opts.type ?? '#minecraft:skeletons'
execute.positioned(rel(-w, -h / 2, -w)).run(() => {
execute.as(Selector('@e', {
type,
dx: w * 2,
dy: h,
dz: w * 2
})).if.entity('@s').run(() => {
opts.onHit()
})
})
}
// Usage
MCFunction('check_sword_swing', () => {
checkHit({
width: 1.2,
height: 2,
onHit: () => {
say('Hit detected!')
effect.give('@s', 'minecraft:glowing', 3, 0)
}
})
})

Ready to build your datapack?

Jump into the docs and write your first Sandstone function in minutes.

Get Started

- or -