[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6EBZ13FCQ97EGK5F3VR3NVK":3,"skill-same:01M6EBZ13FCQ97EGK5F3VR3NVK":77},{"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":28,"publishedAt":49,"linkOnly":50,"markdownContent":51,"markdownBody":52,"frontMatter":53,"refName":54,"commitSha":55,"skillDirectory":56,"forksCount":57,"repositoryHtmlUrl":58,"repositoryHomepageUrl":59,"ownerHtmlUrl":60,"ownerBlogUrl":6,"ownerDescription":61,"updatedAt":62,"install":63,"resources":76},"01M6EBZ13FCQ97EGK5F3VR3NVK","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.","ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FJahrome907\u002Fminecraft-codex-skills\u002Fminecraft-datapack\u002FSKILL.md",[18,23],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":26,"taxonomyTypeDesc":27},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48],"minecraft datapack","minecraft","tags","workflow","recipe","triggers","full","structure","functions","files","loot","edit","execute command","command","syntax","macro","java","create","debug","storage","2026-11-10 10:12:30",false,"---\nname: minecraft-datapack\ndescription: >\n  Create, edit, and debug Minecraft vanilla datapacks for 1.21.x. Covers the full\n  datapack format: pack.mcmeta, function files (.mcfunction), advancements, predicates,\n  loot tables, item modifiers, recipe overrides, tags, damage types, dimension types,\n  worldgen overrides, and structure sets. Handles function syntax, execute command chains,\n  macro functions (1.20.2+), storage NBT, scoreboard operations, advancement triggers,\n  pack format numbers, and \u002Freload workflow. No Java or mod loader required — pure\n  vanilla JSON and .mcfunction files.\n---\n\n# Minecraft Datapack Skill\n\n## What Is a Datapack?\n\nA datapack is a folder (or `.zip`) placed in a world's `datapacks\u002F` directory that\nextends or overrides vanilla Minecraft behavior using JSON files and `.mcfunction`\nscripts. No Java, no mods. Requires only a running Minecraft server or singleplayer world.\n\nDatapacks can:\n- Add custom **advancements**, **recipes**, **loot tables**, and **tags**\n- Override vanilla **worldgen** (biomes, structures, noise settings)\n- Add **functions** executed by command blocks, other functions, or triggers\n- Add **predicates** for conditional logic\n- Add **item modifiers** (rename, enchant, etc. via loot table mechanics)\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\n---\n\n## Pack Format Numbers (1.21.x)\n\n| Minecraft Version | `pack_format` |\n|-------------------|--------------|\n| 1.21 \u002F 1.21.1     | 48           |\n| 1.21.2 \u002F 1.21.3   | 57           |\n| 1.21.4            | 61           |\n| 1.21.5            | 71           |\n\nAlways use the exact format for your target version.\nUse `supported_formats` to declare a range:\n```json\n\"supported_formats\": { \"min_inclusive\": 48, \"max_inclusive\": 71 }\n```\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```json\n{\n  \"pack\": {\n    \"pack_format\": 71,\n    \"supported_formats\": { \"min_inclusive\": 48, \"max_inclusive\": 71 },\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\n```mcfunction\n# as: change execution entity\nexecute as @a run say Hi from each player\n\n# at: change execution position to entity's location\nexecute as @a at @s run particle flame ~ ~ ~ 0 0 0 0 1\n\n# positioned: change position without changing executor\nexecute positioned 0 64 0 run setblock ~ ~ ~ stone\n\n# if\u002Funless conditions\nexecute if block ~ ~-1 ~ minecraft:grass_block run say Standing on grass\nexecute unless entity @a[tag=vip] run say No VIPs online\n\n# store result into score\nexecute store result score @s mypack.health run data get entity @s Health\n\n# Chained\nexecute as @a[gamemode=!spectator] at @s if block ~ ~-1 ~ #minecraft:logs run give @s minecraft:apple\n\n# in: change dimension\nexecute in minecraft:the_nether run say This runs in the Nether\n```\n\n### Scoreboard\n```mcfunction\n# Create objectives\nscoreboard objectives add kills playerKillCount\nscoreboard objectives add points dummy\nscoreboard objectives setdisplay sidebar points\n\n# Modify scores\nscoreboard players set @s points 0\nscoreboard players add @s points 10\nscoreboard players remove @s points 5\nscoreboard players operation @s points += @s kills\n\n# Test scores\nexecute if score @s points matches 100.. run say Reached 100 points!\nexecute if score @s points matches ..0 run say Score is zero or negative\nexecute if score PlayerA points \u003C PlayerB points run say A has fewer points than B\n```\n\n### NBT and storage\n```mcfunction\n# Read entity NBT\ndata get entity @s Health\ndata get entity @s Inventory[0]\n\n# Modify entity NBT\ndata modify entity @s Health set value 20.0f\ndata modify entity @s CustomName set value '{\"text\":\"Boss\",\"color\":\"red\"}'\n\n# Storage (global key-value store)\ndata modify storage mypack:data config.difficulty set value \"hard\"\ndata get storage mypack:data config.difficulty\n\n# Copy from entity to storage\ndata modify storage mypack:log last_player_pos set from entity @s Pos\n```\n\n### Selectors\n```mcfunction\n@a                          # all players\n@p                          # nearest player\n@r                          # random player\n@e                          # all entities\n@s                          # executing entity\n@n                          # nearest entity (1.21+)\n\n# Selector arguments\n@a[gamemode=survival]\n@a[gamemode=!spectator]\n@e[type=minecraft:zombie,distance=..10]\n@e[type=minecraft:player,tag=vip]\n@a[scores={kills=1..10}]\n@a[nbt={playerGameType:0}]\n@e[sort=nearest,limit=1,type=!minecraft:player]\n@a[x=0,y=64,z=0,dx=10,dy=10,dz=10]   # AABB selection\n@a[team=red]\n@a[level=30..]\n@a[name=Steve]\n```\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 `\u002Freload` in-game (or `\u002Fminecraft:reload` if a mod intercepts it)\n3. Test with target command\n4. Check `latest.log` for syntax errors\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_format mismatch` | Wrong `pack_format` number | Update `pack.mcmeta` |\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\n","# Minecraft Datapack Skill\n\n## What Is a Datapack?\n\nA datapack is a folder (or `.zip`) placed in a world's `datapacks\u002F` directory that\nextends or overrides vanilla Minecraft behavior using JSON files and `.mcfunction`\nscripts. No Java, no mods. Requires only a running Minecraft server or singleplayer world.\n\nDatapacks can:\n- Add custom **advancements**, **recipes**, **loot tables**, and **tags**\n- Override vanilla **worldgen** (biomes, structures, noise settings)\n- Add **functions** executed by command blocks, other functions, or triggers\n- Add **predicates** for conditional logic\n- Add **item modifiers** (rename, enchant, etc. via loot table mechanics)\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\n---\n\n## Pack Format Numbers (1.21.x)\n\n| Minecraft Version | `pack_format` |\n|-------------------|--------------|\n| 1.21 \u002F 1.21.1     | 48           |\n| 1.21.2 \u002F 1.21.3   | 57           |\n| 1.21.4            | 61           |\n| 1.21.5            | 71           |\n\nAlways use the exact format for your target version.\nUse `supported_formats` to declare a range:\n```json\n\"supported_formats\": { \"min_inclusive\": 48, \"max_inclusive\": 71 }\n```\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```json\n{\n  \"pack\": {\n    \"pack_format\": 71,\n    \"supported_formats\": { \"min_inclusive\": 48, \"max_inclusive\": 71 },\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\n```mcfunction\n# as: change execution entity\nexecute as @a run say Hi from each player\n\n# at: change execution position to entity's location\nexecute as @a at @s run particle flame ~ ~ ~ 0 0 0 0 1\n\n# positioned: change position without changing executor\nexecute positioned 0 64 0 run setblock ~ ~ ~ stone\n\n# if\u002Funless conditions\nexecute if block ~ ~-1 ~ minecraft:grass_block run say Standing on grass\nexecute unless entity @a[tag=vip] run say No VIPs online\n\n# store result into score\nexecute store result score @s mypack.health run data get entity @s Health\n\n# Chained\nexecute as @a[gamemode=!spectator] at @s if block ~ ~-1 ~ #minecraft:logs run give @s minecraft:apple\n\n# in: change dimension\nexecute in minecraft:the_nether run say This runs in the Nether\n```\n\n### Scoreboard\n```mcfunction\n# Create objectives\nscoreboard objectives add kills playerKillCount\nscoreboard objectives add points dummy\nscoreboard objectives setdisplay sidebar points\n\n# Modify scores\nscoreboard players set @s points 0\nscoreboard players add @s points 10\nscoreboard players remove @s points 5\nscoreboard players operation @s points += @s kills\n\n# Test scores\nexecute if score @s points matches 100.. run say Reached 100 points!\nexecute if score @s points matches ..0 run say Score is zero or negative\nexecute if score PlayerA points \u003C PlayerB points run say A has fewer points than B\n```\n\n### NBT and storage\n```mcfunction\n# Read entity NBT\ndata get entity @s Health\ndata get entity @s Inventory[0]\n\n# Modify entity NBT\ndata modify entity @s Health set value 20.0f\ndata modify entity @s CustomName set value '{\"text\":\"Boss\",\"color\":\"red\"}'\n\n# Storage (global key-value store)\ndata modify storage mypack:data config.difficulty set value \"hard\"\ndata get storage mypack:data config.difficulty\n\n# Copy from entity to storage\ndata modify storage mypack:log last_player_pos set from entity @s Pos\n```\n\n### Selectors\n```mcfunction\n@a                          # all players\n@p                          # nearest player\n@r                          # random player\n@e                          # all entities\n@s                          # executing entity\n@n                          # nearest entity (1.21+)\n\n# Selector arguments\n@a[gamemode=survival]\n@a[gamemode=!spectator]\n@e[type=minecraft:zombie,distance=..10]\n@e[type=minecraft:player,tag=vip]\n@a[scores={kills=1..10}]\n@a[nbt={playerGameType:0}]\n@e[sort=nearest,limit=1,type=!minecraft:player]\n@a[x=0,y=64,z=0,dx=10,dy=10,dz=10]   # AABB selection\n@a[team=red]\n@a[level=30..]\n@a[name=Steve]\n```\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 `\u002Freload` in-game (or `\u002Fminecraft:reload` if a mod intercepts it)\n3. Test with target command\n4. Check `latest.log` for syntax errors\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_format mismatch` | Wrong `pack_format` number | Update `pack.mcmeta` |\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\n",{"name":5,"description":7},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002FJahrome907\u002Fminecraft-codex-skills\u002Fminecraft-datapack",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":8,"skillName":5,"commands":64,"prompt":74,"zipAvailable":75},[65,68,71],{"tool":66,"command":67},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill minecraft-datapack",{"tool":69,"command":70},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill minecraft-datapack",{"tool":72,"command":73},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill minecraft-datapack","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FJahrome907\u002Fminecraft-codex-skills\u002Fminecraft-datapack\u002FSKILL.md",true,[],[78,88,98,107,113,120],{"skillNo":79,"name":80,"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":81,"categories":82,"keywords":84,"publishedAt":49},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[83],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[85,86,87],"model","model hierarchy","model hierarchy skill",{"skillNo":89,"name":90,"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":91,"categories":92,"keywords":94,"publishedAt":49},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[93],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[95,96,97],"MCP","zoom","zoom mcp",{"skillNo":99,"name":100,"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":101,"categories":102,"keywords":103,"publishedAt":49},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[104,105,106,96],"sdk","zoom apps sdk","apps",{"skillNo":108,"name":109,"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":110,"categories":111,"keywords":112,"publishedAt":49},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[109],{"skillNo":114,"name":115,"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":116,"categories":117,"keywords":119,"publishedAt":49},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[118],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[115],{"skillNo":121,"name":122,"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":123,"categories":124,"keywords":125,"publishedAt":49},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[122]]