Back to Snippets

Custom Advancement Snippet.

A full custom advancement setup for Minecraft using a custom trigger. Covers the advancement JSON, the custom criterion class, and the registration class. Swap yourmod with your namespace throughout.

How to Use?
Create the custom criterion class, register it in ModAdvancements, and create the advancement JSON in data/yourmod/advancements.

Requirements
Fabric API, Minecraft 1.20+, Java 17+.

{
  "display": {
    "icon": { "item": "minecraft:diamond" },
    "title": "Example Advancement",
    "description": "Awarded for clicking the diamond block",
    "frame": "task",
    "show_toast": true,
    "announce_to_chat": true,
    "hidden": false
  },
  "criteria": {
    "clicked_diamond": {
      "trigger": "yourmod:clicked_diamond_block"
    }
  },
  "rewards": { "experience": 100 }
}