# Minecraft Example Datapack

> Minecraft Example Datapacks 示例数据包：16th-version demo datapack 23w31a 示例（8个函数演示）、Macro Functions 宏函数（set_time.mcfunction $(time) 变量、eval.mcfunction $$(command) 命令执行、concat.mcfunction $(string1)$(string2) 拼接 存储到 storage）、Function Return Values 函数返回值（fails.mcfunction 无返回值返回失败、fails2.mcfunction return 0 返回失败、succeeds.mcfunction return 1 返回成功、get_player_health.mcfunction 返回玩家生命值）、Line Continuation 行续（ 反斜杠行续）、Data-driven Enchantment 数据驱动附魔（24w18a 14个附魔：Curse of Annoyance/Boom Boom/Claw/Cowbow/Diminishing/Fire Walker/Fishy/Curse of Fragility/Galaxy Brain/Multi-Multishot/Curse of Pollen Allergy/Roulette/Sparkles!/Thor）。

- Skill: `zmjjkk123-hub/minecraft-example-datapack` (Agent Skill)
- Install (CLI): `npx skillmds@latest add zmjjkk123-hub/minecraft-example-datapack`
- Raw SKILL.md: https://api.skillmd.com/api/skills/zmjjkk123-hub/minecraft-example-datapack/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: ZMJJKK123-hub (https://skillmd.com/u/zmjjkk123-hub)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/zmjjkk123-hub/minecraft-example-datapack

---


# Example Datapacks

The example datapacks by Slicedlime demonstrate game updates. There are two: the 16th-version (23w31a) demo datapack and the data-driven enchantment datapack. Source: <https://github.com/slicedlime/examples/tree/master/datapacks>.

## 16th-version demo datapack

Contains 8 functions demonstrating 23w31a additions.

### Macro functions

`set_time.mcfunction` — sets the time to `$(time)`:

```mcfunction
# Set the time to $(time)
$time set $(time)
```

`eval.mcfunction` — runs the command stored in `$(command)` (without leading slash):

```mcfunction
# Run the command stored in $(command)
$$(command)
```

`concat.mcfunction` — concatenates `$(string1)` and `$(string2)` into storage `$(id)` path `$(path)`:

```mcfunction
# Concatenate $(string1) and $(string2), store result to storage $(id) at $(path)
$data modify storage $(id) $(path) set value "$(string1)$(string2)"
```

### Function return values

`fails.mcfunction` — a function with no return value returns failure (the `setblock` executes normally but nothing is returned).

`fails2.mcfunction` — `return 0` returns failure.

`succeeds.mcfunction` — `return 1` returns success.

`get_player_health.mcfunction` — returns the player's health, or 0 for non-players:

```mcfunction
# Return health if the target is a player
execute if entity @s[type=player] run return run data get entity @s Health
# Return 0 for non-players
return 0
```

### Line continuation

`line_continuation.mcfunction` — demonstrates backslash (`\`) line continuation in commands.

## Data-driven enchantment datapack

Contains 14 enchantments demonstrating the 24w18a data-driven enchantment support:

- **Curse of Annoyance**: curse; each time the holder hits a block with the enchanted item in the main hand, 20% chance to send one of 11 "Cat Facts" messages.
- **Boom Boom**: arrows explode with radius 2 when hitting a block; level has no effect.
- **Claw**: +2 block interaction reach per level.
- **Cowbow**: crossbow load sounds become cow sounds (load = cow idle, loaded = cow hurt).
- **Diminishing**: shrinks the wearer 20% per level.
- **Fire Walker**: walking on the ground converts lava sources within radius level+2 into obsidian (10% crying obsidian); caps at level 14; skips lava with entities; also negates powder snow damage.
- **Fishy**: 0.1% chance per tick while held to spawn a silverfish at the user's position.
- **Curse of Fragility**: 3% chance per block hit / attack / damage taken to lose 64 durability (256 when attacking).
- **Galaxy Brain**: +100 XP on mob kill; level has no effect.
- **Multi-Multishot**: like Multishot, but loads 20 extra arrows per level.
- **Curse of Pollen Allergy**: in forest biomes, 0.5% chance per tick to deal 1 thorns damage to the wearer; level has no effect.
- **Roulette**: tools use no durability, but each use has 1% chance to consume 2000 durability (destroying most tools; netherite tools keep 31).
- **Sparkles!**: wearer continuously emits `ominous_spawning` particles.
- **Thor**: holder immune to damage during thunderstorms.

