[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M74FH76DF578532CXG6AQ946":3,"skill-same:01M74FH76DF578532CXG6AQ946":56},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":30,"updatedAt":31,"install":32,"resources":45},"01M74FH76DF578532CXG6AQ946","minecraft-datapack",null,"Create, edit, and debug Minecraft vanilla datapacks for 1.21.x. Covers the full datapack format: pack.mcmeta, function files (.mcfunction), advancements, predicates, loot tables, item modifiers, recipe overrides, tags, damage types, dimension types, worldgen overrides, and structure sets. Handles function syntax, execute command chains, macro functions (1.20.2+), storage NBT, scoreboard operations, advancement triggers, pack format numbers, and \u002Freload workflow. No Java or mod loader required — pure vanilla JSON and .mcfunction files. Use when creating or editing Minecraft datapacks, writing .mcfunction files, configuring loot tables or advancements, or any vanilla datapack development that does not need mod loaders.","AIKUSAN\u002Fminecraft-agent-skills-bundle","AIKUSAN","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F54048610?v=4","01M74FG91YZ75JDYZ7PNHER2NJ","Lorenz Tazan","01M74FG931PS45HBP26RKEZQDT",12,"MIT","https:\u002F\u002Fgithub.com\u002FAIKUSAN\u002Fminecraft-agent-skills-bundle\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fminecraft-datapack\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: minecraft-datapack\ndescription: \"Create, edit, and debug Minecraft vanilla datapacks for 1.21.x. Covers the full datapack format: pack.mcmeta, function files (.mcfunction), advancements, predicates, loot tables, item modifiers, recipe overrides, tags, damage types, dimension types, worldgen overrides, and structure sets. Handles function syntax, execute command chains, macro functions (1.20.2+), storage NBT, scoreboard operations, advancement triggers, pack format numbers, and \u002Freload workflow. No Java or mod loader required — pure vanilla JSON and .mcfunction files. Use when creating or editing Minecraft datapacks, writing .mcfunction files, configuring loot tables or advancements, or any vanilla datapack development that does not need mod loaders.\"\n---\n\n# Minecraft Datapack Skill\n\n## Skill Scope\n\n### Routing Boundaries\n- `Use when`: the deliverable is datapack files (`pack.mcmeta`, `data\u002F...`) and `.mcfunction`\u002FJSON content.\n- `Do not use when`: the request is command-only snippets not tied to a datapack file tree (`minecraft-commands-scripting`).\n- `Do not use when`: the request requires loader APIs, Java code, or runtime mod behavior (`minecraft-modding`).\n- `Do not use when`: the content is biomes, dimensions, structures, noise settings or surface rules (`minecraft-world-generation`).\n\n---\n\n## Pack Metadata (1.21.x and 26.x)\n\n| Minecraft Version | Preferred `pack` metadata |\n|-------------------|---------------------------|\n| 1.21 \u002F 1.21.1     | `pack_format: 48` |\n| 1.21.2 \u002F 1.21.3   | `pack_format: 57` |\n| 1.21.4            | `pack_format: 61` |\n| 1.21.5            | `pack_format: 71` |\n| 1.21.6            | `pack_format: 80` |\n| 1.21.7 \u002F 1.21.8   | `pack_format: 81` |\n| 1.21.9 \u002F 1.21.10  | `min_format: 88.0`, `max_format: 88.0` |\n| 1.21.11           | `min_format: 94.1`, `max_format: 94.1` |\n| 26.1 – 26.1.2     | `min_format: 101.1`, `max_format: 101.1` |\n| 26.2              | `min_format: 107.1`, `max_format: 107.1` |\n| 26.3              | `min_format: 121.0`, `max_format: 121.0` |\n\nUse `pack_format` through 1.21.8. Starting in 1.21.9, Mojang replaced that\nsingle field with explicit `min_format` \u002F `max_format` values.\n\nSource: the Minecraft Wiki data pack format table. Recheck it when a new release ships.\nKeep `pack.mcmeta` exact for the release you target instead of trying to span\nseveral releases with one metadata block.\n\n---\n\n## Directory Layout\n\n```\nmy-datapack\u002F\n├── pack.mcmeta\n└── data\u002F\n    └── \u003Cnamespace>\u002F           ← use your pack's name (e.g., mypack)\n        ├── function\u002F\n        │   ├── main.mcfunction\n        │   └── tick.mcfunction\n        ├── advancement\u002F\n        │   └── custom_advancement.json\n        ├── recipe\u002F\n        │   └── custom_recipe.json\n        ├── loot_table\u002F\n        │   └── custom_loot.json\n        ├── predicate\u002F\n        │   └── is_night.json\n        ├── item_modifier\u002F\n        │   └── add_name.json\n        └── tags\u002F\n            ├── block\u002F\n            │   └── climbable.json\n            ├── entity_type\u002F\n            │   └── bosses.json\n            └── function\u002F\n                ├── load.json     ← runs on \u002Freload\n                └── tick.json     ← runs every game tick\n```\n\n---\n\n## `pack.mcmeta`\n\n### 1.21.8 and earlier\n\n```json\n{\n  \"pack\": {\n    \"pack_format\": 81,\n    \"description\": \"My Custom Datapack v1.0\"\n  }\n}\n```\n\n### 1.21.9 and newer (example: 26.2)\n\n```json\n{\n  \"pack\": {\n    \"min_format\": 107.1,\n    \"max_format\": 107.1,\n    \"description\": \"My Custom Datapack v1.0\"\n  }\n}\n```\n\n---\n\n## Function Tags (load \u002F tick)\n\n### `data\u002F\u003Cnamespace>\u002Ftags\u002Ffunction\u002Fload.json`\n```json\n{\n  \"values\": [\n    \"\u003Cnamespace>:setup\"\n  ]\n}\n```\n\n### `data\u002F\u003Cnamespace>\u002Ftags\u002Ffunction\u002Ftick.json`\n```json\n{\n  \"values\": [\n    \"\u003Cnamespace>:tick\"\n  ]\n}\n```\n\n### `data\u002F\u003Cnamespace>\u002Ffunction\u002Fsetup.mcfunction`\n```mcfunction\n# Runs once on \u002Freload\nscoreboard objectives add deaths deathCount\nscoreboard objectives add kills playerKillCount\ntellraw @a {\"text\":\"[MyPack] Loaded!\",\"color\":\"green\"}\n```\n\n### `data\u002F\u003Cnamespace>\u002Ffunction\u002Ftick.mcfunction`\n```mcfunction\n# Runs every tick — KEEP THIS SHORT\n# Only put fast, targeted operations here\nexecute as @a[scores={deaths=1..}] run function mypack:on_death_check\n```\n\n---\n\n## Commands and Function Syntax\n\n### Execute subcommands (datapack-specific patterns)\n```mcfunction\n# Chained execute — common datapack pattern for conditional per-player logic\nexecute as @a[gamemode=!spectator] at @s if block ~ ~-1 ~ #minecraft:logs run give @s minecraft:apple\n\n# store result into score (bridge between NBT world and scoreboard state)\nexecute store result score @s mypack.health run data get entity @s Health\n\n# in: run logic in another dimension\nexecute in minecraft:the_nether run say This runs in the Nether\n```\n\n### Storage NBT (datapack-specific global state)\n```mcfunction\n# Storage is the datapack-native key-value store — persists across \u002Freload\ndata modify storage mypack:data config.difficulty set value \"hard\"\ndata get storage mypack:data config.difficulty\n\n# Copy live entity data into storage for macro use or cross-function state\ndata modify storage mypack:log last_player_pos set from entity @s Pos\n```\n\nFor full command syntax, selectors, and scoreboard operations see the\n[Minecraft Wiki — Commands](https:\u002F\u002Fminecraft.wiki\u002Fw\u002FCommands) reference.\nThe `minecraft-commands-scripting` skill covers command-only work in depth.\n\n---\n\n## Macros (1.20.2+)\n\nMacro functions let you pass dynamic arguments to a function.\n\n### Define a macro function (`data\u002Fmypack\u002Ffunction\u002Fgreet.mcfunction`)\n```mcfunction\n# Macro argument: $(name)\n$tellraw @a {\"text\":\"Welcome $(name)!\",\"color\":\"gold\"}\n$scoreboard players set $(name) points 0\n```\n\n### Call with `run function` + `with`\n```mcfunction\n# Pass values from storage\ndata modify storage mypack:tmp input set value {name:\"Steve\"}\nfunction mypack:greet with storage mypack:tmp input\n\n# Pass values from entity NBT\nfunction mypack:greet with entity @p {}\n\n# Pass value from block NBT\nfunction mypack:greet with block 0 64 0 {}\n```\n\n---\n\n## Advancements\n\n### `data\u002F\u003Cnamespace>\u002Fadvancement\u002Fmy_advancement.json`\n```json\n{\n  \"display\": {\n    \"icon\": {\n      \"id\": \"minecraft:diamond\"\n    },\n    \"title\": {\"text\": \"Diamond Hunter\"},\n    \"description\": {\"text\": \"Mine your first diamond\"},\n    \"frame\": \"task\",\n    \"show_toast\": true,\n    \"announce_to_chat\": true,\n    \"hidden\": false\n  },\n  \"criteria\": {\n    \"mined_diamond\": {\n      \"trigger\": \"minecraft:item_picked_up\",\n      \"conditions\": {\n        \"item\": {\n          \"items\": [\"minecraft:diamond\"]\n        }\n      }\n    }\n  },\n  \"rewards\": {\n    \"function\": \"mypack:on_diamond_obtained\",\n    \"experience\": 10\n  }\n}\n```\n\n### Common advancement triggers\n| Trigger | When it fires |\n|---------|--------------|\n| `minecraft:impossible` | Never (use for manual grants) |\n| `minecraft:tick` | Every tick while player is online |\n| `minecraft:player_killed_entity` | Player kills an entity |\n| `minecraft:entity_killed_player` | Entity kills a player |\n| `minecraft:item_picked_up` | Player picks up an item |\n| `minecraft:placed_block` | Player places a block |\n| `minecraft:inventory_changed` | Player inventory changes |\n| `minecraft:changed_dimension` | Player changes dimension |\n| `minecraft:consume_item` | Player consumes an item |\n| `minecraft:location` | Player at a specific location |\n| `minecraft:recipe_unlocked` | Player unlocks a recipe |\n\n---\n\n## Custom Recipes\n\n### Shaped crafting (`data\u002F\u003Cnamespace>\u002Frecipe\u002Fshaped.json`)\n```json\n{\n  \"type\": \"minecraft:crafting_shaped\",\n  \"pattern\": [\n    \"DDD\",\n    \"D D\",\n    \"DDD\"\n  ],\n  \"key\": {\n    \"D\": { \"item\": \"minecraft:diamond\" }\n  },\n  \"result\": {\n    \"id\": \"minecraft:diamond_block\",\n    \"count\": 1\n  }\n}\n```\n\n### Shapeless crafting\n```json\n{\n  \"type\": \"minecraft:crafting_shapeless\",\n  \"ingredients\": [\n    { \"item\": \"minecraft:wheat\" },\n    { \"item\": \"minecraft:wheat\" },\n    { \"item\": \"minecraft:wheat\" }\n  ],\n  \"result\": {\n    \"id\": \"minecraft:bread\",\n    \"count\": 2\n  }\n}\n```\n\n### Smelting \u002F blasting \u002F smoking \u002F campfire\n```json\n{\n  \"type\": \"minecraft:smelting\",\n  \"ingredient\": { \"item\": \"minecraft:beef\" },\n  \"result\": { \"id\": \"minecraft:cooked_beef\" },\n  \"experience\": 0.35,\n  \"cookingtime\": 200\n}\n```\n\n### Disable a vanilla recipe (override with empty file)\nTo remove a vanilla recipe, create a file at the **same path** under `data\u002Fminecraft\u002Frecipe\u002F`\nin your datapack with just `{}` as the content:\n\n```json\n{}\n```\n\nFor example, to disable the piston recipe, create:  \n`data\u002Fminecraft\u002Frecipe\u002Fpiston.json` containing only `{}`.\n\n> Get the exact filename from the vanilla jar:  \n> `jar xf minecraft.jar data\u002Fminecraft\u002Frecipe\u002F`\n\n### Smithing transform\n```json\n{\n  \"type\": \"minecraft:smithing_transform\",\n  \"template\": { \"item\": \"minecraft:netherite_upgrade_smithing_template\" },\n  \"base\": { \"item\": \"minecraft:diamond_sword\" },\n  \"addition\": { \"item\": \"minecraft:netherite_ingot\" },\n  \"result\": { \"id\": \"minecraft:netherite_sword\" }\n}\n```\n\n---\n\n## Loot Tables\n\n### `data\u002F\u003Cnamespace>\u002Floot_table\u002Fcustom_chest.json`\n```json\n{\n  \"type\": \"minecraft:chest\",\n  \"pools\": [\n    {\n      \"rolls\": { \"type\": \"minecraft:uniform\", \"min\": 3, \"max\": 8 },\n      \"entries\": [\n        {\n          \"type\": \"minecraft:item\",\n          \"name\": \"minecraft:diamond\",\n          \"weight\": 5,\n          \"functions\": [\n            {\n              \"function\": \"minecraft:set_count\",\n              \"count\": { \"type\": \"minecraft:uniform\", \"min\": 1, \"max\": 3 }\n            }\n          ]\n        },\n        {\n          \"type\": \"minecraft:item\",\n          \"name\": \"minecraft:gold_ingot\",\n          \"weight\": 20\n        },\n        {\n          \"type\": \"minecraft:empty\",\n          \"weight\": 30\n        }\n      ]\n    }\n  ]\n}\n```\n\n---\n\n## Predicates\n\n### `data\u002F\u003Cnamespace>\u002Fpredicate\u002Fis_daytime.json`\n```json\n{\n  \"condition\": \"minecraft:time_check\",\n  \"value\": { \"min\": 0, \"max\": 12000 }\n}\n```\n\n### `data\u002F\u003Cnamespace>\u002Fpredicate\u002Fplayer_has_diamond.json`\n```json\n{\n  \"condition\": \"minecraft:entity_properties\",\n  \"entity\": \"this\",\n  \"predicate\": {\n    \"inventory\": {\n      \"items\": [\n        { \"items\": [\"minecraft:diamond\"] }\n      ]\n    }\n  }\n}\n```\n\n### Using predicates in functions\n```mcfunction\nexecute if predicate mypack:is_daytime run say It is daytime!\nexecute unless predicate mypack:player_has_diamond run tell @s You need a diamond!\n```\n\n---\n\n## Tags\n\n### Block tag (`data\u002Fminecraft\u002Ftags\u002Fblock\u002Fclimbable.json` — override vanilla)\n```json\n{\n  \"replace\": false,\n  \"values\": [\n    \"minecraft:ladder\",\n    \"minecraft:vine\",\n    \"#minecraft:wool\"\n  ]\n}\n```\n\n### Item tag (`data\u002F\u003Cnamespace>\u002Ftags\u002Fitem\u002Fmy_fuel.json`)\n```json\n{\n  \"replace\": false,\n  \"values\": [\n    \"minecraft:coal\",\n    \"minecraft:charcoal\",\n    \"minecraft:blaze_rod\"\n  ]\n}\n```\n\nUse `\"replace\": false` to append to existing tags. Use `\"replace\": true` to completely\noverride (use with care for vanilla tags).\n\n---\n\n## Worldgen Overrides\n\n### Override biome noise (`data\u002Fminecraft\u002Fworldgen\u002Fnoise_settings\u002Foverworld.json`)\nEdit inside an existing copy — do NOT create from scratch without the full JSON.\nGet the vanilla version from the Minecraft jar: `jar xf minecraft.jar data\u002F`.\n\n### Override a biome's spawn costs\n```json\n{\n  \"spawn_costs\": {\n    \"minecraft:zombie\": {\n      \"energy_budget\": 0.12,\n      \"charge\": 0.7\n    }\n  }\n}\n```\n\n---\n\n## Installation & Testing\n\n```bash\n# Place datapack in world folder\n\u002Fdatapacks\u002Fmy-datapack\u002F\n\n# Or as a zip\n\u002Fdatapacks\u002Fmy-datapack.zip\n\n# In-game commands\n\u002Fdatapack list               # see all datapacks\n\u002Fdatapack enable \"file\u002Fmy-datapack\"\n\u002Fdatapack disable \"file\u002Fmy-datapack\"\n\u002Freload                      # hot-reload all datapacks without restart\n```\n\n### Development workflow\n1. Edit `.mcfunction` or `.json` files\n2. Run the bundled validator to catch JSON and path errors before loading:\n   ```bash\n   .\u002Fscripts\u002Fvalidate-datapack.sh --root \u002Fpath\u002Fto\u002Fdatapack\n   ```\n3. If errors, fix and re-validate until clean\n4. Run `\u002Freload` in-game (or `\u002Fminecraft:reload` if a mod intercepts it)\n5. Test with target command (e.g., `\u002Ffunction mypack:setup`, trigger an advancement)\n6. Check `latest.log` for runtime errors (missing references, bad selectors)\n\n---\n\n## Common Errors\n\n| Error | Cause | Fix |\n|-------|-------|-----|\n| `Unknown or invalid command` | Syntax error in function | Check whitespace, selector, trailing space |\n| `Datapack did not load` | Invalid JSON in any file | Validate with `jq . \u003C file.json` |\n| `pack metadata mismatch` | Wrong `pack_format` or `min_format` \u002F `max_format` values | Update `pack.mcmeta` for the exact 1.21.x patch |\n| Function not running on tick | Missing tick tag or wrong namespace | Check `tags\u002Ffunction\u002Ftick.json` path |\n| Macro error | `$` line but no `with` | Provide `with storage\u002Fentity\u002Fblock` |\n\n## Validator Script\n\nUse the bundled validator script before shipping a datapack update:\n\n```bash\n# Run from the installed skill directory (for example `.codex\u002Fskills\u002Fminecraft-datapack`):\n.\u002Fscripts\u002Fvalidate-datapack.sh --root \u002Fpath\u002Fto\u002Fdatapack\n\n# Strict mode treats warnings as failures:\n.\u002Fscripts\u002Fvalidate-datapack.sh --root \u002Fpath\u002Fto\u002Fdatapack --strict\n```\n\nWhat it checks:\n- JSON validity for `pack.mcmeta` and `data\u002F**\u002F*.json`\n- Legacy pluralized path mistakes for loot tables and block\u002Fitem tags\n- `tags\u002Ffunction\u002Fload.json` and `tags\u002Ffunction\u002Ftick.json` references resolve to real `.mcfunction` files\n\n---\n\n## References\n\n- Minecraft Wiki — Data Pack: https:\u002F\u002Fminecraft.wiki\u002Fw\u002FData_pack\n- Minecraft Wiki — Function: https:\u002F\u002Fminecraft.wiki\u002Fw\u002FFunction_(Java_Edition)\n- Minecraft Wiki — Commands: https:\u002F\u002Fminecraft.wiki\u002Fw\u002FCommands\n- Pack format history: https:\u002F\u002Fminecraft.wiki\u002Fw\u002FPack_format\n- NBT format: https:\u002F\u002Fminecraft.wiki\u002Fw\u002FNBT_format\n- Predicate conditions: https:\u002F\u002Fminecraft.wiki\u002Fw\u002FPredicate\n- Loot table format: https:\u002F\u002Fminecraft.wiki\u002Fw\u002FLoot_table\n","# Minecraft Datapack Skill\n\n## Skill Scope\n\n### Routing Boundaries\n- `Use when`: the deliverable is datapack files (`pack.mcmeta`, `data\u002F...`) and `.mcfunction`\u002FJSON content.\n- `Do not use when`: the request is command-only snippets not tied to a datapack file tree (`minecraft-commands-scripting`).\n- `Do not use when`: the request requires loader APIs, Java code, or runtime mod behavior (`minecraft-modding`).\n- `Do not use when`: the content is biomes, dimensions, structures, noise settings or surface rules (`minecraft-world-generation`).\n\n---\n\n## Pack Metadata (1.21.x and 26.x)\n\n| Minecraft Version | Preferred `pack` metadata |\n|-------------------|---------------------------|\n| 1.21 \u002F 1.21.1     | `pack_format: 48` |\n| 1.21.2 \u002F 1.21.3   | `pack_format: 57` |\n| 1.21.4            | `pack_format: 61` |\n| 1.21.5            | `pack_format: 71` |\n| 1.21.6            | `pack_format: 80` |\n| 1.21.7 \u002F 1.21.8   | `pack_format: 81` |\n| 1.21.9 \u002F 1.21.10  | `min_format: 88.0`, `max_format: 88.0` |\n| 1.21.11           | `min_format: 94.1`, `max_format: 94.1` |\n| 26.1 – 26.1.2     | `min_format: 101.1`, `max_format: 101.1` |\n| 26.2              | `min_format: 107.1`, `max_format: 107.1` |\n| 26.3              | `min_format: 121.0`, `max_format: 121.0` |\n\nUse `pack_format` through 1.21.8. Starting in 1.21.9, Mojang replaced that\nsingle field with explicit `min_format` \u002F `max_format` values.\n\nSource: the Minecraft Wiki data pack format table. Recheck it when a new release ships.\nKeep `pack.mcmeta` exact for the release you target instead of trying to span\nseveral releases with one metadata block.\n\n---\n\n## Directory Layout\n\n```\nmy-datapack\u002F\n├── pack.mcmeta\n└── data\u002F\n    └── \u003Cnamespace>\u002F           ← use your pack's name (e.g., mypack)\n        ├── function\u002F\n        │   ├── main.mcfunction\n        │   └── tick.mcfunction\n        ├── advancement\u002F\n        │   └── custom_advancement.json\n        ├── recipe\u002F\n        │   └── custom_recipe.json\n        ├── loot_table\u002F\n        │   └── custom_loot.json\n        ├── predicate\u002F\n        │   └── is_night.json\n        ├── item_modifier\u002F\n        │   └── add_name.json\n        └── tags\u002F\n            ├── block\u002F\n            │   └── climbable.json\n            ├── entity_type\u002F\n            │   └── bosses.json\n            └── function\u002F\n                ├── load.json     ← runs on \u002Freload\n                └── tick.json     ← runs every game tick\n```\n\n---\n\n## `pack.mcmeta`\n\n### 1.21.8 and earlier\n\n```json\n{\n  \"pack\": {\n    \"pack_format\": 81,\n    \"description\": \"My Custom Datapack v1.0\"\n  }\n}\n```\n\n### 1.21.9 and newer (example: 26.2)\n\n```json\n{\n  \"pack\": {\n    \"min_format\": 107.1,\n    \"max_format\": 107.1,\n    \"description\": \"My Custom Datapack v1.0\"\n  }\n}\n```\n\n---\n\n## Function Tags (load \u002F tick)\n\n### `data\u002F\u003Cnamespace>\u002Ftags\u002Ffunction\u002Fload.json`\n```json\n{\n  \"values\": [\n    \"\u003Cnamespace>:setup\"\n  ]\n}\n```\n\n### `data\u002F\u003Cnamespace>\u002Ftags\u002Ffunction\u002Ftick.json`\n```json\n{\n  \"values\": [\n    \"\u003Cnamespace>:tick\"\n  ]\n}\n```\n\n### `data\u002F\u003Cnamespace>\u002Ffunction\u002Fsetup.mcfunction`\n```mcfunction\n# Runs once on \u002Freload\nscoreboard objectives add deaths deathCount\nscoreboard objectives add kills playerKillCount\ntellraw @a {\"text\":\"[MyPack] Loaded!\",\"color\":\"green\"}\n```\n\n### `data\u002F\u003Cnamespace>\u002Ffunction\u002Ftick.mcfunction`\n```mcfunction\n# Runs every tick — KEEP THIS SHORT\n# Only put fast, targeted operations here\nexecute as @a[scores={deaths=1..}] run function mypack:on_death_check\n```\n\n---\n\n## Commands and Function Syntax\n\n### Execute subcommands (datapack-specific patterns)\n```mcfunction\n# Chained execute — common datapack pattern for conditional per-player logic\nexecute as @a[gamemode=!spectator] at @s if block ~ ~-1 ~ #minecraft:logs run give @s minecraft:apple\n\n# store result into score (bridge between NBT world and scoreboard state)\nexecute store result score @s mypack.health run data get entity @s Health\n\n# in: run logic in another dimension\nexecute in minecraft:the_nether run say This runs in the Nether\n```\n\n### Storage NBT (datapack-specific global state)\n```mcfunction\n# Storage is the datapack-native key-value store — persists across \u002Freload\ndata modify storage mypack:data config.difficulty set value \"hard\"\ndata get storage mypack:data config.difficulty\n\n# Copy live entity data into storage for macro use or cross-function state\ndata modify storage mypack:log last_player_pos set from entity @s Pos\n```\n\nFor full command syntax, selectors, and scoreboard operations see the\n[Minecraft Wiki — Commands](https:\u002F\u002Fminecraft.wiki\u002Fw\u002FCommands) reference.\nThe `minecraft-commands-scripting` skill covers command-only work in depth.\n\n---\n\n## Macros (1.20.2+)\n\nMacro functions let you pass dynamic arguments to a function.\n\n### Define a macro function (`data\u002Fmypack\u002Ffunction\u002Fgreet.mcfunction`)\n```mcfunction\n# Macro argument: $(name)\n$tellraw @a {\"text\":\"Welcome $(name)!\",\"color\":\"gold\"}\n$scoreboard players set $(name) points 0\n```\n\n### Call with `run function` + `with`\n```mcfunction\n# Pass values from storage\ndata modify storage mypack:tmp input set value {name:\"Steve\"}\nfunction mypack:greet with storage mypack:tmp input\n\n# Pass values from entity NBT\nfunction mypack:greet with entity @p {}\n\n# Pass value from block NBT\nfunction mypack:greet with block 0 64 0 {}\n```\n\n---\n\n## Advancements\n\n### `data\u002F\u003Cnamespace>\u002Fadvancement\u002Fmy_advancement.json`\n```json\n{\n  \"display\": {\n    \"icon\": {\n      \"id\": \"minecraft:diamond\"\n    },\n    \"title\": {\"text\": \"Diamond Hunter\"},\n    \"description\": {\"text\": \"Mine your first diamond\"},\n    \"frame\": \"task\",\n    \"show_toast\": true,\n    \"announce_to_chat\": true,\n    \"hidden\": false\n  },\n  \"criteria\": {\n    \"mined_diamond\": {\n      \"trigger\": \"minecraft:item_picked_up\",\n      \"conditions\": {\n        \"item\": {\n          \"items\": [\"minecraft:diamond\"]\n        }\n      }\n    }\n  },\n  \"rewards\": {\n    \"function\": \"mypack:on_diamond_obtained\",\n    \"experience\": 10\n  }\n}\n```\n\n### Common advancement triggers\n| Trigger | When it fires |\n|---------|--------------|\n| `minecraft:impossible` | Never (use for manual grants) |\n| `minecraft:tick` | Every tick while player is online |\n| `minecraft:player_killed_entity` | Player kills an entity |\n| `minecraft:entity_killed_player` | Entity kills a player |\n| `minecraft:item_picked_up` | Player picks up an item |\n| `minecraft:placed_block` | Player places a block |\n| `minecraft:inventory_changed` | Player inventory changes |\n| `minecraft:changed_dimension` | Player changes dimension |\n| `minecraft:consume_item` | Player consumes an item |\n| `minecraft:location` | Player at a specific location |\n| `minecraft:recipe_unlocked` | Player unlocks a recipe |\n\n---\n\n## Custom Recipes\n\n### Shaped crafting (`data\u002F\u003Cnamespace>\u002Frecipe\u002Fshaped.json`)\n```json\n{\n  \"type\": \"minecraft:crafting_shaped\",\n  \"pattern\": [\n    \"DDD\",\n    \"D D\",\n    \"DDD\"\n  ],\n  \"key\": {\n    \"D\": { \"item\": \"minecraft:diamond\" }\n  },\n  \"result\": {\n    \"id\": \"minecraft:diamond_block\",\n    \"count\": 1\n  }\n}\n```\n\n### Shapeless crafting\n```json\n{\n  \"type\": \"minecraft:crafting_shapeless\",\n  \"ingredients\": [\n    { \"item\": \"minecraft:wheat\" },\n    { \"item\": \"minecraft:wheat\" },\n    { \"item\": \"minecraft:wheat\" }\n  ],\n  \"result\": {\n    \"id\": \"minecraft:bread\",\n    \"count\": 2\n  }\n}\n```\n\n### Smelting \u002F blasting \u002F smoking \u002F campfire\n```json\n{\n  \"type\": \"minecraft:smelting\",\n  \"ingredient\": { \"item\": \"minecraft:beef\" },\n  \"result\": { \"id\": \"minecraft:cooked_beef\" },\n  \"experience\": 0.35,\n  \"cookingtime\": 200\n}\n```\n\n### Disable a vanilla recipe (override with empty file)\nTo remove a vanilla recipe, create a file at the **same path** under `data\u002Fminecraft\u002Frecipe\u002F`\nin your datapack with just `{}` as the content:\n\n```json\n{}\n```\n\nFor example, to disable the piston recipe, create:  \n`data\u002Fminecraft\u002Frecipe\u002Fpiston.json` containing only `{}`.\n\n> Get the exact filename from the vanilla jar:  \n> `jar xf minecraft.jar data\u002Fminecraft\u002Frecipe\u002F`\n\n### Smithing transform\n```json\n{\n  \"type\": \"minecraft:smithing_transform\",\n  \"template\": { \"item\": \"minecraft:netherite_upgrade_smithing_template\" },\n  \"base\": { \"item\": \"minecraft:diamond_sword\" },\n  \"addition\": { \"item\": \"minecraft:netherite_ingot\" },\n  \"result\": { \"id\": \"minecraft:netherite_sword\" }\n}\n```\n\n---\n\n## Loot Tables\n\n### `data\u002F\u003Cnamespace>\u002Floot_table\u002Fcustom_chest.json`\n```json\n{\n  \"type\": \"minecraft:chest\",\n  \"pools\": [\n    {\n      \"rolls\": { \"type\": \"minecraft:uniform\", \"min\": 3, \"max\": 8 },\n      \"entries\": [\n        {\n          \"type\": \"minecraft:item\",\n          \"name\": \"minecraft:diamond\",\n          \"weight\": 5,\n          \"functions\": [\n            {\n              \"function\": \"minecraft:set_count\",\n              \"count\": { \"type\": \"minecraft:uniform\", \"min\": 1, \"max\": 3 }\n            }\n          ]\n        },\n        {\n          \"type\": \"minecraft:item\",\n          \"name\": \"minecraft:gold_ingot\",\n          \"weight\": 20\n        },\n        {\n          \"type\": \"minecraft:empty\",\n          \"weight\": 30\n        }\n      ]\n    }\n  ]\n}\n```\n\n---\n\n## Predicates\n\n### `data\u002F\u003Cnamespace>\u002Fpredicate\u002Fis_daytime.json`\n```json\n{\n  \"condition\": \"minecraft:time_check\",\n  \"value\": { \"min\": 0, \"max\": 12000 }\n}\n```\n\n### `data\u002F\u003Cnamespace>\u002Fpredicate\u002Fplayer_has_diamond.json`\n```json\n{\n  \"condition\": \"minecraft:entity_properties\",\n  \"entity\": \"this\",\n  \"predicate\": {\n    \"inventory\": {\n      \"items\": [\n        { \"items\": [\"minecraft:diamond\"] }\n      ]\n    }\n  }\n}\n```\n\n### Using predicates in functions\n```mcfunction\nexecute if predicate mypack:is_daytime run say It is daytime!\nexecute unless predicate mypack:player_has_diamond run tell @s You need a diamond!\n```\n\n---\n\n## Tags\n\n### Block tag (`data\u002Fminecraft\u002Ftags\u002Fblock\u002Fclimbable.json` — override vanilla)\n```json\n{\n  \"replace\": false,\n  \"values\": [\n    \"minecraft:ladder\",\n    \"minecraft:vine\",\n    \"#minecraft:wool\"\n  ]\n}\n```\n\n### Item tag (`data\u002F\u003Cnamespace>\u002Ftags\u002Fitem\u002Fmy_fuel.json`)\n```json\n{\n  \"replace\": false,\n  \"values\": [\n    \"minecraft:coal\",\n    \"minecraft:charcoal\",\n    \"minecraft:blaze_rod\"\n  ]\n}\n```\n\nUse `\"replace\": false` to append to existing tags. Use `\"replace\": true` to completely\noverride (use with care for vanilla tags).\n\n---\n\n## Worldgen Overrides\n\n### Override biome noise (`data\u002Fminecraft\u002Fworldgen\u002Fnoise_settings\u002Foverworld.json`)\nEdit inside an existing copy — do NOT create from scratch without the full JSON.\nGet the vanilla version from the Minecraft jar: `jar xf minecraft.jar data\u002F`.\n\n### Override a biome's spawn costs\n```json\n{\n  \"spawn_costs\": {\n    \"minecraft:zombie\": {\n      \"energy_budget\": 0.12,\n      \"charge\": 0.7\n    }\n  }\n}\n```\n\n---\n\n## Installation & Testing\n\n```bash\n# Place datapack in world folder\n\u002Fdatapacks\u002Fmy-datapack\u002F\n\n# Or as a zip\n\u002Fdatapacks\u002Fmy-datapack.zip\n\n# In-game commands\n\u002Fdatapack list               # see all datapacks\n\u002Fdatapack enable \"file\u002Fmy-datapack\"\n\u002Fdatapack disable \"file\u002Fmy-datapack\"\n\u002Freload                      # hot-reload all datapacks without restart\n```\n\n### Development workflow\n1. Edit `.mcfunction` or `.json` files\n2. Run the bundled validator to catch JSON and path errors before loading:\n   ```bash\n   .\u002Fscripts\u002Fvalidate-datapack.sh --root \u002Fpath\u002Fto\u002Fdatapack\n   ```\n3. If errors, fix and re-validate until clean\n4. Run `\u002Freload` in-game (or `\u002Fminecraft:reload` if a mod intercepts it)\n5. Test with target command (e.g., `\u002Ffunction mypack:setup`, trigger an advancement)\n6. Check `latest.log` for runtime errors (missing references, bad selectors)\n\n---\n\n## Common Errors\n\n| Error | Cause | Fix |\n|-------|-------|-----|\n| `Unknown or invalid command` | Syntax error in function | Check whitespace, selector, trailing space |\n| `Datapack did not load` | Invalid JSON in any file | Validate with `jq . \u003C file.json` |\n| `pack metadata mismatch` | Wrong `pack_format` or `min_format` \u002F `max_format` values | Update `pack.mcmeta` for the exact 1.21.x patch |\n| Function not running on tick | Missing tick tag or wrong namespace | Check `tags\u002Ffunction\u002Ftick.json` path |\n| Macro error | `$` line but no `with` | Provide `with storage\u002Fentity\u002Fblock` |\n\n## Validator Script\n\nUse the bundled validator script before shipping a datapack update:\n\n```bash\n# Run from the installed skill directory (for example `.codex\u002Fskills\u002Fminecraft-datapack`):\n.\u002Fscripts\u002Fvalidate-datapack.sh --root \u002Fpath\u002Fto\u002Fdatapack\n\n# Strict mode treats warnings as failures:\n.\u002Fscripts\u002Fvalidate-datapack.sh --root \u002Fpath\u002Fto\u002Fdatapack --strict\n```\n\nWhat it checks:\n- JSON validity for `pack.mcmeta` and `data\u002F**\u002F*.json`\n- Legacy pluralized path mistakes for loot tables and block\u002Fitem tags\n- `tags\u002Ffunction\u002Fload.json` and `tags\u002Ffunction\u002Ftick.json` references resolve to real `.mcfunction` files\n\n---\n\n## References\n\n- Minecraft Wiki — Data Pack: https:\u002F\u002Fminecraft.wiki\u002Fw\u002FData_pack\n- Minecraft Wiki — Function: https:\u002F\u002Fminecraft.wiki\u002Fw\u002FFunction_(Java_Edition)\n- Minecraft Wiki — Commands: https:\u002F\u002Fminecraft.wiki\u002Fw\u002FCommands\n- Pack format history: https:\u002F\u002Fminecraft.wiki\u002Fw\u002FPack_format\n- NBT format: https:\u002F\u002Fminecraft.wiki\u002Fw\u002FNBT_format\n- Predicate conditions: https:\u002F\u002Fminecraft.wiki\u002Fw\u002FPredicate\n- Loot table format: https:\u002F\u002Fminecraft.wiki\u002Fw\u002FLoot_table\n",{"name":5,"description":7},"main","6fdc6b3043932f6cec4d0a2d51630b19d220dc0d",".agents\u002Fskills\u002Fminecraft-datapack",1,"https:\u002F\u002Fgithub.com\u002FAIKUSAN\u002Fminecraft-agent-skills-bundle","https:\u002F\u002Fgithub.com\u002FAIKUSAN","Creating virtual worlds, one line of code at a time.","2026-10-03 22:21:47",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add AIKUSAN\u002Fminecraft-agent-skills-bundle --skill minecraft-datapack",{"tool":38,"command":39},"bunx","bunx skills add AIKUSAN\u002Fminecraft-agent-skills-bundle --skill minecraft-datapack",{"tool":41,"command":42},"pnpm","pnpm dlx skills add AIKUSAN\u002Fminecraft-agent-skills-bundle --skill minecraft-datapack","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FAIKUSAN\u002Fminecraft-agent-skills-bundle\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fminecraft-datapack\u002FSKILL.md",true,[46,52],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"scripts\u002Fjq-shim.mjs","SCRIPT","脚本",6764,"https:\u002F\u002Fgithub.com\u002FAIKUSAN\u002Fminecraft-agent-skills-bundle\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fminecraft-datapack\u002Fscripts\u002Fjq-shim.mjs",{"path":53,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":54,"sourceHtmlUrl":55},"scripts\u002Fvalidate-datapack.sh",4709,"https:\u002F\u002Fgithub.com\u002FAIKUSAN\u002Fminecraft-agent-skills-bundle\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fminecraft-datapack\u002Fscripts\u002Fvalidate-datapack.sh",[57,64,70,76,82,88],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":19},"01M74FXYYEC9NE1YFJC891WFT2","minecraft-ci-release","Fixture with valid workflow YAML but a warning-only secrets section.","https:\u002F\u002Fgithub.com\u002FAIKUSAN\u002Fminecraft-agent-skills-bundle\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fvalidators\u002Fci-release\u002Fwarn-only\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M74FXXD5F0J0VA58R53Z8CA3","valid","https:\u002F\u002Fgithub.com\u002FAIKUSAN\u002Fminecraft-agent-skills-bundle\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fvalidators\u002Fci-release\u002Fvalid\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M74FXVT401WRMHEMCPJKA89X","non-workflow-yaml","https:\u002F\u002Fgithub.com\u002FAIKUSAN\u002Fminecraft-agent-skills-bundle\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fvalidators\u002Fci-release\u002Fnon-workflow-yaml\u002FSKILL.md",[],[],{"skillNo":77,"name":59,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M74FXTBGQGEPGMX81DFY7FY9","Fixture with valid multiline flow collections in workflow YAML.","https:\u002F\u002Fgithub.com\u002FAIKUSAN\u002Fminecraft-agent-skills-bundle\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fvalidators\u002Fci-release\u002Fmultiline-flow\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M74FXSAW6GDZ3J3S9FBGC1D6","invalid","https:\u002F\u002Fgithub.com\u002FAIKUSAN\u002Fminecraft-agent-skills-bundle\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fvalidators\u002Fci-release\u002Finvalid\u002FSKILL.md",[],[],{"skillNo":89,"name":59,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":19},"01M74FXQRKYD2DDQDN0HR1TE10","Fixture with malformed workflow YAML.","https:\u002F\u002Fgithub.com\u002FAIKUSAN\u002Fminecraft-agent-skills-bundle\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fvalidators\u002Fci-release\u002Finvalid-yaml\u002FSKILL.md",[],[]]