Skip to content
Voltar ao Blog
TypeScript IDE showing Sandstone autocompletion for Minecraft datapack commands

Sandstone: Building Better Minecraft Datapacks with TypeScript

ice
ice
@ice
Updated
114 visualizações
TL;DR:Sandstone is a TypeScript framework that lets you build Minecraft datapacks with IDE autocompletion, better code organization, and control flow statements. It compiles to vanilla Minecraft files and includes an NPM ecosystem for sharing code.
🐙 Open-source Minecraft project

sandstone-mc/sandstone

Sandstone | Next Generation Framework for Minecraft

⭐ 219 stars💻 TypeScript📜 MIT
View on GitHub ↗

If you've ever tried to hand-write a complex Minecraft datapack, you know the pain: memorizing command syntax, organizing dozens of function files, fixing typos in `/execute` chains, and wishing your editor could just tell you what comes next. Sandstone is a TypeScript framework that fixes all of this by letting you write datapacks and resource packs in actual code, with IDE autocompletion and proper language features.

What Sandstone Is

Sandstone isn't a visual editor or a GUI tool. It's a TypeScript library that compiles down to vanilla Minecraft files. You write your datapacks in TypeScript, get full IDE support (autocomplete for commands, type checking for arguments), and it generates the exact JSON and mcfunction files Minecraft expects. The output is completely vanilla-compatible. Whether you're building a small adventure map or a massive server plugin, Sandstone generates optimized, clean Minecraft files you can drop into any world.

The project currently has 219 stars on GitHub and is MIT licensed, with active development and a Discord community backing it up. The latest release focused on fixing flow control statements to work more reliably with commands like `/teleport`.


Why You'd Use This

Here's the honest pitch: Sandstone is for anyone who's tired of the vanilla datapack workflow. If you've built a custom Minecraft server or complex map, you know that even small changes to command logic mean hunting through nested JSON files. Sandstone changes that completely.

Let's say you're building a dungeon with complex mob behavior. In vanilla, you'd write function files spread across multiple directories, debug them by reading command output in logs, and curse under your breath when you realize `/execute` needs five more subcommands. In Sandstone, you write it like normal code. You get IDE hints. Anyone can refactor safely. Anyone can actually test your logic before deploying it to your world.

And here's something genuinely useful: Sandstone lets you organize functions however you want. Vanilla forces one function per file. Sandstone doesn't care. You can dump related functions in a single file, or keep the traditional structure. It adapts to how you want to work, not the other way around.

If you're sharing code (custom systems, raycasting libraries, spell mechanics, whatever), the NPM ecosystem means you can package your functions and let other creators drop them into their projects. Stop reinventing raycasting every time you start a new datapack.


Getting Started: Installation and Setup

You'll need Node.js installed (version 16 or newer). Then it's straightforward:

bash
npm install sandstone@beta

Create a simple datapack project and write your first function. The project's Getting Started guide at sandstone.dev walks you through it, but the basic workflow is: write TypeScript, run the compiler, and grab your generated files from the output directory.

The `@beta` tag means the framework is still in active development. That's not necessarily a red flag (beta software can be perfectly stable), but it's worth knowing you're not on a final 1.0 yet. The maintainers are responsive to bug reports.


Key Features That Matter

IDE Autocompletion is the real MVP here. Start typing a command and Sandstone tells you exactly what arguments come next. You don't memorize `/execute at @s run command...` anymore. Your editor shows you: `at -> at (entity) or at (block) or...`. Same deal for predicates, loot tables, and advancements. This alone saves hours on larger projects.

The model in Minecraft
The model in Minecraft

The built-in abstractions are surprisingly thoughtful. Native if/else statements compile down to the right `execute if/unless` chains automatically. Loops, boolean logic (`and`, `or`, `not`), even a sleep statement that waits before running the next command. These aren't magic (you can see the generated commands), but they're optimized better than most hand-written code because the library researches what's fastest for each scenario.

Control flow matters. In vanilla, writing a proper if/else chain across multiple functions is tedious and error-prone. Sandstone handles the command flow for you:

typescript
if(player.has_item) {
 player.give_reward()
} else {
 player.send_message('You need the item first')
}

That compiles to optimized execute chains. The library switches between different command structures depending on complexity to keep performance solid.

And the NPM ecosystem means you're not starting from scratch. Popular functions and libraries (raycasting, vector math, advanced `/tellraw` wrappers) are already packaged up. Install, import, done. It's a small but growing ecosystem.


What Trips People Up

TypeScript adds a learning curve if you've only done vanilla datapacks before. You'll need to learn basic TypeScript syntax. If JavaScript-style syntax feels foreign, there's a ramp-up period. Nothing impossible, but it's not zero friction.

Since this is a compiler, you need a build step. Write code, run the compiler, check the output. That's extra compared to directly editing function files. Some people prefer the immediacy of vanilla editing (though actually, testing complex datapacks usually involves reloading anyway, so the mental overhead is similar).

Also, the project is in beta. And that means you might hit edge cases or breaking changes between versions. The maintainers fix things responsibly, but it's not a stable 1.0 yet. For personal projects or experiments, that's fine. For critical server infrastructure, you might want to wait a bit longer or pin your version carefully.


Alternatives: Other Datapack Frameworks

If Sandstone doesn't feel right, there are other approaches. Some people use Minecraft Command Language (MCL) for a more minimal syntax. Others stick with vanilla and use VS Code extensions for command validation. And some builders just prefer the raw JSON workflow (which honestly, props to you for the patience).

But Sandstone's combination of TypeScript syntax, IDE support, and an actual NPM ecosystem puts it ahead for serious datapack work. You get a real programming language, not a Domain Specific Language bolted on top of Minecraft commands.

For map builders working at scale, especially those sharing code or maintaining large projects over time, Sandstone is genuinely worth the time investment. For one-off mechanics or small adventure maps, you might not need it. But if you've ever wished your datapack development felt less like archaeology and more like actual programming, Sandstone solves that problem.

sandstone-mc/sandstone - MIT, ★219

Frequently Asked Questions

Is Sandstone free to use?
Yes, Sandstone is completely free and open-source under the MIT license. You can download it from NPM and use it for any project. There's no premium tier or licensing fee. The project is maintained by community contributors and funded through Discord community support.
Do I need to know TypeScript to use Sandstone?
You'll need to learn basic TypeScript syntax to use Sandstone effectively, but it's not complex. If you've written JavaScript before, TypeScript is just JavaScript with type hints. The official docs at sandstone.dev include tutorials that ease you in, and the learning curve is usually a few hours.
What Minecraft versions does Sandstone support?
Sandstone supports recent Minecraft versions and keeps up with command changes as Mojang updates them. Check the GitHub repository for the specific version support, as it's actively maintained. The framework generates standard command syntax that works with any recent Java Edition version.
Can I use Sandstone to create resource packs?
Yes, Sandstone supports both datapacks and resource packs. You can organize textures, models, and sounds through the framework and benefit from its file organization features. However, the real power is in datapack development (functions, loot tables, predicates), which is where most of the IDE support shines.
Are datapacks created with Sandstone compatible with vanilla Minecraft?
Completely compatible. Sandstone compiles down to standard Minecraft files (functions, JSON, etc.) that work in any vanilla world or server. You generate the files and drop them into your world's datapacks folder. There's no dependency on Sandstone to run the output—it's just regular Minecraft.