My App

Getting Started

Getting started with Deco

Create a Project

What is special about Deco is that it uses exactly the same folder structure as vanilla Minecraft datapacks.

So, you can just copy any of your existing datapacks and use Deco on them. Or create a new one if you want to.

Now, we got a folder structure like this:

<datapack>/
├── pack.mcmeta
└── data/
    └── <namespace>/
        └── functions/
            ├── <filename>.mcfunction
            └── <filename>.deco

.mcfunction files are still valid in Deco, so if you have a .mcfunction in your datapack and don't want to use any Deco features in it, you can just leave it as is.

Then, create a .deco file in the functions folder and start your Deco journey!

First Deco File

Let's create a simple Deco file called gold_touch.deco and put it in the functions folder:

gold_touch_src/
└── data/
    └── <namespace>/
        └── functions/
            └── gold_touch.deco

Now, let's write some Deco code in the gold_touch.deco file:

@onPlaceBlock("minecraft:stone")
func gold_touch() {
    tellraw @s [{"selector":"@s"},{"text":", it is your gold touch!"}]
    raycast("@s", "minecraft:stone", 0.01, 10, "setblock ~ ~ ~ gold_block")
}

The function of this Deco file is:

  1. When a player places a stone block, the player will be notified that they have the gold touch.
  2. Then, the stone block will be replaced with a gold block, by using the raycast command.

Compile

Let's compile the Deco project. Change the directory to the folder where you put the gold_touch_src folder and run the following command:

deco -o gold_touch gold_touch_src

This will compile the Deco project(gold_touch_src) and create a gold_touch folder in the current directory. You can see some .mcfunction files and advancements files in the gold_touch folder, which are the compiled result of the gold_touch_src project.

Now, you can use the gold_touch datapack in your game. Just put the gold_touch folder in your datapacks folder and experiment with it!

More Info

If you want to know more about Deco, you can check the API Reference.

On this page