Minecraft / Blogs

Minecraft's advancements: more advanced than you might think!

  • 9
  • 8
  • comment7
  • playlist_add
  • share
  • more_horiz
avatar ShelLuser
Level 38 : Artisan Engineer
53
Hi gang!

Editorial

In the previous Minecraft release of 1.12 Mojang officially did away with the rather static achievements and replaced those with the advancements system we have today. For most players that I know advancements are a nice collection of "badges" which you can earn during your game by accomplishing certain tasks. You'll get a nice shout-out, sometimes the system will reward you with a little XP and of course you get a badge of honor in your list of advancements. They're nice, but not that special.

Or are they? There is so much more to these advancements than you might think! Would you believe me if I told you that it is the advancement system which controls the unlocking of recipes for the players recipe book?

The advancements system honestly might be much more advanced than you may realize, so I figured let's dive into this. Please note though that this isn't necessarily a tutorial: I won't be explaining how you can make your own advancements (also because you'd need a datapack, which is a task of its own), but obviously I will share some examples here and there.

So what are these advancements anyway?

Minecraft's default advancements

If you press 'L' while playing Minecraft then you'll be taken to the advancements screen (assuming you didn't re-assign your keys), an example can be seen above. The other way to reach this section is to pause your game and click on the Advancements button.

As you can see the advancements are basically a group of 'badges' which you can earn by doing certain things or reaching certain goals. For example: if you start a new game and place a crafting table then this will open the 'Minecraft' advancements tab (as shown above) which contains several tasks which can help you get started with the game. Things like crafting wooden tools and then later on replacing those with stone and iron tools.

And as you progress through the game you'll eventually open more tabs which present you with more different challenges. There are 5 available tabs in total:
  • 'Minecraft'; this is the default tab (more or less the direct replacement of the previous achievements) and it helps you to progress through the game. It hints at collecting resources, crafting tools and gaining access to the Nether and the End. Speaking of which...
  • 'Nether'; this tab contains several goals and challenges which you can try to achieve in the Nether. From using the nether to travel 7km in the Overworld to related challenges like brewing potions, fighting Ghasts or discovering a nether fortress.
  • 'The End'; as could be expected after reading the above this tab deals with the End. Fighting the Ender dragon, collecting the dragon egg, finding end cities... all those tasks are covered here.
  • 'Adventure'; while playing through Minecraft you can come across many different things and these challenges are here to help you discover those. From trading with a villager, using a bed to set your spawn point right to fighting mobs (and trying to kill every different hostile mob type in the game). If you're in for a challenge then maybe this is the tab for you :-)
  • 'Husbandry'; Minecraft is filled with animals and 'natural' stuff. This tab can help you discover those. Tame and breed animals, start growing your own food or catch a fish (either the usual way or try to scoop 'm up ;)).
If you ever get bored while playing Minecraft then maybe you could give some of these challenges a try? Some can be quite challenging ;) Also note that not every advancement will be visible from the start: there are even a few hidden ones.

Back in the good ole' days...

Achievements

In the good old days before Minecraft 1.12 we had the achievements system which you can see above. It was fun but not necessarily all that special. The main flaw in this system was that everything had to be done in the right order. Sometimes that made some sense (like needing to get iron before you get diamonds; you can only dig up diamond ore with an iron pickaxe (or better)) but there were some serious flaws with that reasoning nonetheless. What if you're mining with wood & stone pickaxes and come across a loot chest which contains diamonds? You wouldn't have iron, you wouldn't have dug up diamond ore but you'd still have found those diamonds which you could throw at another player.

Well, you wouldn't be getting any achievement. Only after you got the iron achievement would the system be ready to give you your diamond ore achievement. And only after that would you be rewarded for throwing diamonds. Which can be pretty tedious (or plain out annoying!), especially if we're talking about a somewhat difficult challenge.

Fortunately for us the advancements system did away with all that: you now can earn advancements in no specific order, so without having to gain any of the ones sitting before it.

So what makes these advancements so special?

To understand this we need to look a bit closer at how this whole thing actually works. We get a certain advancement when we've done a certain task. Things like making a wooden (or iron) pickaxe, getting iron (or diamond) tools, and so on. So how does the system actually know that we did all that? That is the secret behind all this.

Triggers

The advancement system uses a set of so called triggers which basically become active as soon as the player 'does' something. Right now there are 31 triggers in total, some of these are:
  • minecraft:location; this triggers as soon as you visit a certain location. Either by actually going to a set of specific coordinates (x, y and z) or if you come close to a specific generated structure.
  • minecraft:player_killed_entity; if you kill a mob (the technical word for that is entity) then this trigger will be activated. Please note the word 'entity': generally speaking every item which you find in the game that is not a block is an entity. A mob? That's actually an entity. XP orbs on the ground? Entity. Arrows which fly through the air? Entities. Even a minecart is not a block of some sort but actually an entity. Same goes for the armor stand.
  • minecraft:consume_item; should speak for itself. If you have something like food or a golden apple or such and you eat it then this trigger will become active.
  • minecraft:effects_changed; gained or lost a status effect? Then this trigger becomes active.
  • minecraft:villager_trade; should speak for itself right? As soon as you trade with a villager then this triggers.
  • minecraft:enter_block; if you enter a specific block then this will trigger. And before you say that this is impossible please keep in mind that water and lava are also considered blocks.
  • minecraft:inventory_changed; the moment you gain a new item in your inventory (or lose one) then this triggers.
These triggers become active every single time when you perform any of the 30 predefined actions. Even if you already gained one of their associated advancements. Note that I said 30 because one trigger is actually specifically made for custom advancements: minecraft:impossible. As its name implies it's impossible to activate this trigger automatically; any advancement which uses the 'impossible' trigger can only be obtained by using (or triggering ;)) commands.

But that's not all which makes these advancements so special, though these triggers obviously play a central part into all this.

The rewards system

I mentioned a few times that if you perform a certain task then you might gain some XP as a reward. Most advancements only reward you with the badge itself but some specific challenges give you more. If you manage to kill every type of hostile mob in the game then this will gain you 100 XP. And if you manage to breed every animal then the same thing happens: it will earn you 100 XP. To my knowledge these two advancements are the only two that actually reward you with something else besides the badge.

But there's a lot more that can happen. If you earn an advancement then the reward can be any one of these:
  • Experience: You'll earn a certain amount of XP.
  • Loot: A loot table will be triggered which will drop some random items.
  • Recipe: You can earn ("unlock") one or more recipes.
  • Function: When you earn the achievement then it automatically runs a specific function.
It is these last two rewards which really spice things up.

The secret recipe advancements!

Have you ever noticed that whenever you get a certain item then you'll also automatically unlock some recipes? Heck: if you jump into the water during a new game then you will immediately unlock the recipe for a boat. So how does that work? Well... Mojang are actually using their own advancements system for that.

Earlier on I told you how there were 5 tabs in the advancements screen. But that's only because the 6th tab is actually hidden and doesn't even officially exist; this is the 'Recipe' tab; minecraft:recipes:root to be exact, and I think it's brilliant!

See; instead of devising a whole new complicated system to control the unlocking of recipes Mojang did something much better. They actually used the system they already had! Remember those triggers I mentioned earlier? One of them was minecraft:enter_block, it triggers whenever you enter a certain block. So guess what?

{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"minecraft:oak_boat"
]
},
"criteria": {
"in_water": {
"trigger": "minecraft:enter_block",
"conditions": {
"block": "minecraft:water"
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "minecraft:oak_boat"
}
}
},
"requirements": [

"in_water",
"has_the_recipe"
]
]
}

See what I mean? This is the advancement minecraft:recipes/transportation/oak_boat and as you can see it triggers as soon as you enter a water block or if you unlocked the minecraft:oak_boat recipe (so: if you gained the recipe through a command then this advancement would also be automatically rewarded).

And the best part is that these advancements are completely hidden away from sight, they are only meant to control the rewarding of recipes and nothing else. This is minecraft:recipes/root:

{
"criteria": {
"impossible": {
"trigger": "minecraft:impossible"
}
},
"requirements": [

"impossible"
]
]
}

Not your regular advancement, that's for sure ;)

In case you don't believe me and you don't want to check out the jarfile (look into: data\minecraft\advancements\recipes if you do) then there's a very simple command which you can use to test this for yourself:
  • /execute if entity @e[advancements={minecraft:recipes/transportation/oak_boat=true}]
This test will pass after you jumped into the water for the first time. And if you want to make sure you actually got the recipe:
  • /execute if entity @e[nbt={recipeBook:{recipes:"minecraft:oak_boat"]}}]
Cool right?

This is what I really appreciate about Mojang within the game of Minecraft: Mojang doesn't only invent new systems for the game, they also actively use those systems themselves as well. This is fully comparable with the generated structures and the structure block. Did you know that you can semi-automatically build your own woodland mansion or end city using structure blocks? But that's a story for another time :-)

So what about those function rewards?

Vanilla advancements don't use functions just yet, right now this is a reward system which is meant for custom advancements. But I hope that you can already imagine some of the stuff you could do with this. You can simply use the advancement system to detect something happening in the game and then let that trigger a function to perform some specific actions.

For example...

Let's say for the sake of argument that we're not happy with the reward you get from killing a skeleton. Although you can control what items drop when a player kills a skeleton (by overriding the minecraft:entities/skeleton loot table) this does not give you access to any XP rewards. XP drops (the xp orbs) is something that is handled by the game itself and which cannot be customized.

Or can it?

See: one of the advancement triggers is minecraft:player_killed_entity. And it's very simply to tell the advancement that it should only be rewarded when the player specifically kills a skeleton. And the reward? Why, running a function of course!

In this function we'll start by summoning our own XP reward within a 15 block radius around the player (if the player killed a skeleton with a bow then the rewards are probably a few blocks away):
  • /execute at @p as @e[type=minecraft:experience_orb, distance=..15, sort=random, limit=1] run summon minecraft:experience_orb ~ ~ ~ {Tags:["rewardxp"], Value:150s}
So: we summon an XP orb with a value of 150 XP at the location of one randomly chosen XP orb within a 15 block radius around the player. We also tagged this orb "rewardxp". Now, we don't want to give extra XP, we only want to replace the existing XP rewards instead so the next step is to remove ('kill', these are entities after all) the rest of the XP orbs:
  • /execute at @p run kill @e[type=minecraft:experience_orb,distance=..15,tag=!rewardxp]
Now we killed all the XP orbs that aren't tagged 'rewardxp' within a 15 block radius around the player, so only our custom XP orb will remain.

Right now our task is complete: we fully replaced the default XP reward(s) which Minecraft generated. There's just one last thing left to do. Right now our advancement got rewarded and that can only happen once. So we need to reset this by revoking it from the player again:
  • /advancement revoke @p only catslair:hidden/killed_skeleton
I made the name up of course, but this is how you'd do something like that. Of course you would need to make sure that the advancement is hidden and that it doesn't trigger any alerts in the chat or as 'toast' (the message you get in the upper right corner).

Pretty advanced stuff for such a "simple" badge of honor system, wouldn't you agree?

Pay attention on Spigot servers...

If you want to use such a reward system on a Spigot server then this might not work properly due to some dumb limitations. See: if a player triggers a command block then the command(s) will run as if the server executed those. This means that any command can run, even if the player isn't an operator and wouldn't have access to some. Makes sense, right?

Well, if the server triggers an advancement for a player then any functions that are run as the reward system will run within the context of that player. In other words: if the player isn't an operator then any functions that use specific commands like /kill and /give won't work because the player can't run those.

Which I think is utterly stupid because it was the server that triggered the advancement in the first place. But.. "works as intended" according to the main developer and thus I lost some serious interest for the Spigot project because it actually hinders my (vanilla!) customizations. Things which easily work on a vanilla Minecraft server I might add...

SO ... if you run Spigot and you want to try this for yourself then keep this issue in mind. Sometimes not using a Mojang-made server can have its drawbacks ;)

And there you have it!

blog advancement
Wait, shouldn't that say "wrote the blog" since this applied to me? :)

I hope you can agree with me that advancements are a lot cooler than they might seem at first. There's much more going on than "just" giving you a badge of honor and best of all: you can even use all of this in your own game if you want to!

This is also why I enjoy those advancements so much: they look so simple yet are actually quite complex. And best of all, as also shown above: Mojang themselves even use this system for their own specific purposes (unlocking recipes for players), which I think is really cool and proves that this system was made for more than just badges :)

Thanks for reading, I hope you enjoyed and maybe also learned something new.
Tags

Comments : 7

star Login or register to post a comment.

Show Comments

1 - 7 of 7

  • egormart
  • Level 2
  • Apprentice Miner
  • October 30, 2018, 2:35 pm
i dont really get how to execute specific advancement by conrdinates...
  • egormart
  • Level 2
  • Apprentice Miner
  • September 5, 2018, 11:20 pm
i understanded you now , i made some mistakes whatching youtube videos by putting ] and some no need } for minecraft not 1.13 version , instead of making this folder with lots of json commands i downloaded from another blog , im surprised how you know how all mcfunction files works in 1.13 , maybe i need spend more time on those , sorry for miss understanding.
  • ShelLuser
  • Level 38
  • Artisan Engineer
  • September 6, 2018, 12:28 am
No problem, happy to know that you solved your problems. And good luck with your map!
  • egormart
  • Level 2
  • Apprentice Miner
  • September 5, 2018, 10:39 pm
i did the commands as a reward by making connected function to minecraft advancement and made a blog - https://www.planetminecraft.com/blog/how-to-make-advancement-do-any-command-action-in-minecraft-1-13-1-version/

t
hank you for telling me that you can use advancements because you can do a lot of actions with them and i solved what i wanted.
  • egormart
  • Level 2
  • Apprentice Miner
  • September 5, 2018, 7:22 pm
can you just make a reward
{
"display": {
"icon": {
"item": "minecraft:iron_chestplate"
},
"title": {
"translate": "advancements.story.obtain_armor.title"
},
"description": {
"translate": "advancements.story.obtain_armor.description"
}
},
"parent": "minecraft:story/smelt_iron",
"criteria": {
"iron_helmet": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "minecraft:iron_helmet"
}
]
}
},
"iron_chestplate": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "minecraft:iron_chestplate"
}
]
}
},
"iron_leggings": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "minecraft:iron_leggings"
}
]
}
},
"iron_boots": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "minecraft:iron_boots"
}
]
}
}
},
"requirements": [

"iron_helmet",
"iron_chestplate",
"iron_leggings",
"iron_boots"
]
"rewards"
"commands"
"setblock -106 48 100 minecraft:stone"
]
}
but it seems does not work...
  • ShelLuser
  • Level 38
  • Artisan Engineer
  • September 5, 2018, 8:43 pm
There are a few problems with your listing...

You can't use "commands" with the rewards section, only the four options I listed above are supported: recipes, loot, experience and function. For a complete overview I can strongly recommend the advancement wiki page on the Minecraft wiki, this section in particular. So if you want to run a command you'd definitely want to set up a function.

Also your 'rewards' section is incomplete. First you'll need a comma ',' after the closing bracket from 'requirements', but it also shouldn't be a collection of strings; you need a so called "compound" which requires the use of curly brackets. Something like this:

"rewards" : {
"function" : "mystuff:changeblock"
}

Then you'd need to create a function which contains your setblock command.

It's probably easier to set up a datapack and create an advancement tab of your own. I'm actually planning on writing a guide about setting up a datapack and adding some custom stuff (recipes, advancements & functions), but that's going to take a while (I have a few other things planned first).

Hope this can help.
  • egormart
  • Level 2
  • Apprentice Miner
  • September 6, 2018, 2:05 am
sorry my fault , miss spelling json file...

1 - 7 of 7

Show Comments

Planet Minecraft

Browse

Site

© 2010 - 2019
planetminecraft.com

Welcome