Topic category: User side tutorials
[Tutorial] How to make an Advancement trigger when entering a Custom Structure (No Procedures!)
Hello Hello, o/ Your Favorite Coder XRL-NATION Here!
Today I'm gonna show you something cool I've seen users of MCreator and even coders asking about: How To Give an Advancement Once You Enter a Structure or Location. Don't Worry If Your Not a Coder Yourself I put a Templet at the bottom for you all to use!
It is not too hard once it's done for the first time. I think it might help a lot of creators since doing it this way bypasses custom blocks or ticking entity update procedures in your structures, which can sometimes cause severe performance issues or desyncs in multiplayer and Single player!
EDIT: A previous version of this tutorial used
"structure"(singular) as the JSON key. That key doesn't exist in the actual game data anymore — Minecraft Now silently ignores it instead of throwing an error, which means the location check never runs at all and the advancement can fire immediately, regardless of where the player actually is. This has been corrected below to"structures"(plural), verified directly against vanilla's own shipped advancement for finding an End City. Sorry for the mixup, glad I double test all my things and stress test haha..
Prerequisites
Before we touch any code, make sure you have two things set up in your workspace:
- Your Structure: It must be registered in the Structures section of MCreator. (A "Feature" mod element will not work for this!).
- Your Advancement: Create a standard advancement element. Make sure it doesn't have any triggers or dependencies set up in the MCreator UI yet. We will be handling that through the code editor, but once more don't worry if you don't know how to code—it's super simple and I'll provide a copy-paste template below!
Step 1: Open the Code Editor
Once you have saved your advancement, go to your MCreator workspace list:
- Right-click your Advancement element.
- Select Open element in code editor.
You should see the default template that MCreator generates, which looks like this:
{
"display": {
"icon": {
"id": "minecraft:air"
},
"title": {
"translate": "advancements.test_advancment.title"
},
"description": {
"translate": "advancements.test_advancment.descr"
},
"frame": "task",
"show_toast": true,
"announce_to_chat": true,
"hidden": false
},
"criteria": {
"test_advancment_0": {
"trigger": "minecraft:impossible"
}
},
"parent": "YourModID:TestAdvancment"
}Step 2: Making the Code Changes
Because MCreator's default template sets the trigger to impossible, we need to swap out that middle section for our new location radar.
- Locate the
"criteria"block in your code. - Delete this entire default section:
"test_advancment_0": {
"trigger": "minecraft:impossible"
}- Paste this new chunk right inside those criteria brackets instead:
"in_structure": {
"trigger": "minecraft:location",
"conditions": {
"player": [
{
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"location": {
"structures": "YOURMODID:YOURSTRUCTURE"
}
}
}
]
}
}Note the key is
"structures"— plural — and the value is still just a plain string, not a list in brackets. This matches my cross references and other tests so yes its correct.
- Right below that closing criteria bracket, add the requirements map so MCreator's backend compiler knows the rule exists:
},
"requirements": [
[
"in_structure"
]
],The Finished Copy-Paste Code Template
For those who don't want to manually change individual lines, you can completely highlight everything in your open MCreator code tab, delete it, and copy-paste this full template over it.
Just make sure to replace the uppercase words (YOURMODID, YOURSTRUCTURE, etc.) with your actual workspace and item registry names! Note: Make Sure You DONT type your mod ids or things in uppercase letters or it will break.
{
"display": {
"icon": {
"id": "minecraft:YOURCHOSENITEM"
},
"title": {
"text": "YOURNAMEHERE"
},
"description": {
"text": "YOURDISCRIPTIONHERE"
},
"frame": "task",
"show_toast": true,
"announce_to_chat": true,
"hidden": false
},
"criteria": {
"in_structure": {
"trigger": "minecraft:location",
"conditions": {
"player": [
{
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"location": {
"structures": "YOURMODID:YOURSTRUCTURE"
}
}
}
]
}
}
},
"requirements": [
[
"in_structure"
]
],
"parent": "YOURMOD ID: OR minecraft: YOUR CHOSEN PARENT ADVANCMENT"
}Two Thing that are common mistakes if you skip them
1. YOURMODID is your actual registered mod ID, not your workspace folder name. If your MCreator workspace folder is called something like my_project_final_v2, that is not your mod ID. Your real mod ID is whatever's set in your mod's main settings (the same ID used everywhere else in your project — item registries, block registries, etc). Double-check this in your workspace's mod element list or main mod file if you're not sure.
2. YOURSTRUCTURE is the registered structure name, not the raw NBT filename. These are two different things! Your structure's .nbt template file (under structure/) is just the raw shape data. The actual thing the game checks against is the registered structure entry under worldgen/structure/ in your data folder — open that JSON and use the filename it's saved under you can also see it in game with /locate structure (matching however MCreator named it when you registered the structure, underscores and all).
Crucial Last Step!
After you are done editing your text values, click the X to close the code tab. MCreator will prompt you with a pop-up warning asking if you want to Lock the code of this mod element.
You MUST click YES/LOCK! If you do not lock it, MCreator will completely wipe out your custom JSON text and overwrite it back to the default empty template the next time the workspace builds.
I hope this helps some of you! Let me know if you run into any issues in the replies below! This should work for Minecraft 1.20.5 all the way up to the latest releases, including 1.21, 1.21.4+, and 2026's version drops, as long as Minecraft doesn't change anything major in future updates!
Very helpful tutorial! Worked like a charm :)