Skip to content

examples

4tubborn edited this page Jul 21, 2026 · 4 revisions

Examples

Some built-in features are powered by API. Check them out in the data/block-morph-demo folder in the datapack branch.

Example: Tick

Let player say "Hello, world!" while morphed.

example/advancement/tick.json

{
    "criteria": {
        "0": {
            "trigger": "tick",
            "conditions": {
                "player": [
                    {
                        "condition": "reference",
                        "name": "block-morph:is_in_morph"
                    }
                ]
            }
        }
    },
    "rewards": {
        "function": "example:tick"
    }
}

example/function/tick.mcfunction

advancement revoke @s only example:tick
say Hello, world!

Best Practices

Recommend the following instructions for logic decoupling:

  1. Initialize in #block-morph:api/create/start .
  2. Define condition statements in #block-morph:api/create/loop .
  3. Apply effects in #block-morph:api/create/start.
  4. Remove effects in #block-morph:api/blockify/finish .

Clone this wiki locally