Advancements/JSON format

From Minecraft Wiki
Jump to: navigation, search

Custom advancements in data packs of a Minecraft world store the advancement data for that world as separate JSON files.

File Format[edit]

All advancement JSON files are structured according to the following format:

  • The root tag.
    •  display: The optional display data.
      •  icon: The data for the icon.
        •  item: The item id.
        •  nbt: The nbt data of the item.
      •  title: The title for this advancement.
      •  title: A JSON text component (containing text and formatting like used in /tellraw and various other commands. Also translate tag can be used here).
      •  frame: The optional type of frame for the icon. challenge for a tile with a more fancy spiked border as it is used for the kill all mobs advancement, goal for a tile with a rounded border as it is used for the full beacon advancement, task for a normal tile (default.)
      •  background: The optional directory for the background to use in this advancement tab (used only for the root advancement).
      •  description: The description of the advancement.
      •  description: A JSON text component (containing text and formatting like used in /tellraw and various other commands. Also translate tag can be used here).
      •  show_toast: Can be true or false. Whether or not to show the toast pop up after completing this advancement. Defaults to true.
      •  announce_to_chat: Can be true or false. Whether or not to announce in the chat when this advancement has been completed. Defaults to true.
      •  hidden: Can be true or false. Whether or not to hide this advancement and all its children from the advancement screen until this advancement have been completed. Has no effect on root advancements themselves, but still affects all their children. Defaults to false.
    •  parent: The optional parent advancement directory of this advancement. If this field is absent, this advancement is a root advancement. Circular references cause a loading failure.
    •  criteria: The required criteria that have to be met.
      •  <criterionName>: A name given to the criterion (can be any string, must be unique).
        •  trigger: The trigger for this advancement; specifies what the game should check for the advancement.
        •  conditions: All the conditions that need to be met when the trigger gets activated.
    •  requirements: An optional list of requirements (all the <criteriaNames>). If all criteria are required, this may be omitted. With multiple criteria: requirements contains a list of lists with criteria (all criteria need to be mentioned). If all of the lists each have any criteria met, the advancement is complete. (basically AND grouping of OR groups)
    •  rewards: An optional object representing the rewards provided when this advancement is obtained.

Display[edit]

Within the root tag of an advancement JSON object, the  display field and the  parent field, both optional, are related to the display of the advancement.

If the  display tag is present, it must have both the  title and  description fields present in order to be a valid advancement display data.

The  parent field, albeit not directly associated with the display data of an advancement, affects only the display data effectively. When an advancement does not have a display data and none of its children has a display data, the parent of the advancement has no effect to the advancement itself.

Tab creation[edit]

To create a tab in the advancement menu, define a root advancement (an advancement without a parent) with a display. When the data pack containing the advancement is loaded, the root advancement shows a tab in the advancement menu when any advancement in its advancement tree is granted to the player viewing the menu.

When a background is not specified for a root advancement, the tab is still created, but with the tab background appearing as the missing texture.

Presence[edit]

For a non-root advancement (i.e. an advancement with a parent defined), these conditions must be met in order to have it displayed in a tab when unlocked:

  1. Its root advancement must be a valid tab.
  2. It must have a display.

Position[edit]

The game automatically arranges advancements, position them when it loads advancements from data packs, and sends the arrangement to the client. Each advancement has an arrow from its closest visible ancestor (i.e. if its parent does not have a display, it has a link from its grandparent, and so on). The root advancement appears on the leftmost column while each arrow points to an advancement in the next column. The arrangement of advancements within a column is based on file name.

Lack of Display[edit]

Some advancements, such as the vanilla recipe unlocking advancements, may lack a display so that they can utilize triggers and rewards instead of excessive commands or functions for more functionalities and a more flexible control. These advancements should not have the  display field defined in order to hide from users and enjoy a better loading performance.

List of triggers[edit]

Missing Texture Block.png
This section needs more information.
Information requested: bee_nest_destroyed and safely_harvest_honey

minecraft:bred_animals[edit]

Triggers after the player breeds 2 animals. Available conditions:

minecraft:brewed_potion[edit]

Triggers after the player takes any item out of a brewing stand. Available conditions:

minecraft:changed_dimension[edit]

Triggers after the player travels between two dimensions. Available conditions:

  •  conditions:
    •  from: The dimension the entity traveled from. Accepts these 3 values.
    •  to: The dimension the entity traveled to. Same accepted values as above.

minecraft:channeled_lightning[edit]

Triggers after the player successfully uses the Channeling enchantment on an entity. Available conditions:

minecraft:construct_beacon[edit]

Triggers after the player changes the structure of a beacon. (When the beacon updates itself). Available conditions:

  •  conditions:
    •  level: The tier of the updated beacon structure.
    •  level:
      •  max: The maximum value.
      •  min: The minimum value.

minecraft:consume_item[edit]

Triggers when the player consumes an item. Available conditions:

minecraft:cured_zombie_villager[edit]

Triggers when the player cures a zombie villager. Available conditions:

minecraft:effects_changed[edit]

Triggers after the player gets a status effect applied or taken from them. Available conditions:

  •  conditions:
    •  effects: A list of status effects the player has.
      •  <minecraft:effect_name>: A status effect with the key name being the status effect name.
        •  amplifier: The effect amplifier.
        •  amplifier:
          •  max: The maximum value.
          •  min: The minimum value.
        •  duration: The effect duration in ticks.
        •  duration:
          •  max: The maximum value.
          •  min: The minimum value.

minecraft:enchanted_item[edit]

Triggers after the player enchants an item through an enchanting table (does not get triggered through an anvil, or through commands). Available conditions:

  •  conditions:
    •  item: The item after it has been enchanted.
    •  levels: The levels spent by the player on the enchantment.
    •  levels:
      •  max: The maximum value.
      •  min: The minimum value.

minecraft:enter_block[edit]

Triggers when the player stands in a block. Checks every tick and will try to trigger for each successful match (up to 8 times, the maximum amount of blocks a player can stand in), which only works if the advancement is revoked from within the advancement using a function reward. Available conditions:

  •  conditions:
    •  block: The block that the player is standing in. Accepts block IDs.
    •  state: The block states of the block.
      •  <state_name>: A single block state, with the key name being the state name and the value being the required value of that state.

minecraft:entity_hurt_player[edit]

Triggers after a player gets hurt. Available conditions:

minecraft:entity_killed_player[edit]

Triggers after an entity kills a player. Available conditions:

minecraft:filled_bucket[edit]

Triggers after the player fills a bucket. Available conditions:

minecraft:fishing_rod_hooked[edit]

Triggers after the player successfully catches an item with a fishing rod or pulls an entity with a fishing rod. Available conditions:

minecraft:hero_of_the_village[edit]

Triggers when the player defeats a raid and checks where the player is. Available conditions:

minecraft:impossible[edit]

Triggers only using commands.

minecraft:inventory_changed[edit]

Triggers after any changes happen to the player's inventory. Available conditions:

  •  conditions:
    •  items: A list of items in the player's inventory. All items in the list must be in the player's inventory, but not all items in the player's inventory have to be in this list.
    •  slots:
      •  empty: The amount of slots empty in the inventory.
      •  empty:
        •  max: The maximum value.
        •  min: The minimum value.
      •  full: The amount of slots completely filled (stacksize) in the inventory.
      •  full:
        •  max: The maximum value.
        •  min: The minimum value.
      •  occupied: The amount of slots occupied in the inventory.
      •  occupied:
        •  max: The maximum value.
        •  min: The minimum value.

minecraft:item_durability_changed[edit]

Triggers after any item in the inventory has been damaged in any form. Available conditions:

  •  conditions:
    •  delta: The difference in durability.
    •  delta:
      •  max: The maximum value.
      •  min: The minimum value.
    •  durability: The remaining durability of the item.
    •  durability:
      •  max: The maximum value.
      •  min: The minimum value.
    •  item: The item before it was damaged, allows you to check the durability before the item was damaged.

minecraft:killed_by_crossbow[edit]

Triggers after the player hurts a mob or player. Available conditions:

  •  conditions:
    •  unique_entity_types: The exact count of types of entities killed.
    •  unique_entity_types: The acceptable range of count of types of entities killed.
      •  max: The maximum value.
      •  min: The minimum value.
    •  victims: A predicate for any of the killed entities.
    •  victims: A list of predicates for any of the killed entities. All of the predicates must be matched, and one killed entity may match only one predicate.

minecraft:levitation[edit]

Triggers when the player has the levitation status effect. Available conditions:

  •  conditions:
    •  distance:
      •  absolute:
        •  max: The maximum value.
        •  min: The minimum value.
      •  horizontal:
        •  max: The maximum value.
        •  min: The minimum value.
      •  x:
        •  max: The maximum value.
        •  min: The minimum value.
      •  y:
        •  max: The maximum value.
        •  min: The minimum value.
      •  z:
        •  max: The maximum value.
        •  min: The minimum value.
    •  duration: The duration of the levitation in ticks.
    •  duration:
      •  max: The maximum value.
      •  min: The minimum value.

minecraft:location[edit]

Triggers every 20 ticks (1 second) and checks where the player is. Available conditions:

minecraft:nether_travel[edit]

Triggers when the player travels to the Nether and then returns to the Overworld. Available conditions:

  •  conditions:
    •  distance: The overworld distance between where the player entered the Nether and where the player exited the Nether.
      •  absolute:
        •  max: The maximum value.
        •  min: The minimum value.
      •  horizontal:
        •  max: The maximum value.
        •  min: The minimum value.
      •  x:
        •  max: The maximum value.
        •  min: The minimum value.
      •  y:
        •  max: The maximum value.
        •  min: The minimum value.
      •  z:
        •  max: The maximum value.
        •  min: The minimum value.

minecraft:placed_block[edit]

Triggers when the player places a block. Available conditions:

  •  conditions:
    •  block: The block that was placed. Accepts block IDs.
    •  item: The item that was used to place the block before the item was consumed.
    •  location: The location of the block that was placed.
    •  state: The block states of the block.
      •  <state_name>: A single block state, with the key name being the state name and the value being the required value of that state.

minecraft:player_hurt_entity[edit]

Triggers after the player hurts a mob or player. Available conditions:

minecraft:player_killed_entity[edit]

Triggers after a player is the source of a mob or player being killed. Available conditions:

minecraft:recipe_unlocked[edit]

Triggers after the player unlocks a recipe (using a knowledge book for example). Available conditions:

  •  conditions:
    •  recipe: The recipe that was unlocked.

minecraft:shot_crossbow[edit]

Triggers when the player uses an item. Available conditions:

minecraft:slept_in_bed[edit]

Triggers when the player enters a bed. Available conditions:

minecraft:slide_down_block[edit]

Triggers when the player slides down a block. Available conditions:

  •  conditions:
    •  block: The block that the player slided on.

minecraft:summoned_entity[edit]

Triggers after an entity has been summoned. Works with iron golems (pumpkin and iron blocks), snow golems (pumpkin and snow blocks), the ender dragon (ender crystals) and the wither (wither skulls and soul sand). Using dispensers to place the wither skulls or pumpkins will still activate this trigger. Spawn eggs, commands and mob spawners will not work however. Available conditions:

minecraft:tame_animal[edit]

Triggers after the player tames an animal. Available conditions:

minecraft:tick[edit]

Triggers every tick (20 times a second).

minecraft:used_ender_eye[edit]

Triggers when the player uses an eye of ender (in a world where strongholds generate). Available conditions:

  •  conditions:
    •  distance: The horizontal distance between the player and the stronghold.
    •  distance:
      •  max: A maximum value.
      •  min: A minimum value.

minecraft:used_totem[edit]

Triggers when the players uses a totem. Available conditions:

minecraft:villager_trade[edit]

Triggers after the player trades with a villager or a wandering trader. Available conditions:

minecraft:voluntary_exile[edit]

Triggers when the player causes a raid and checks where the player is. Available conditions: