How do a grant a advancement to the player when they enter a structure?

Started by fanta88 on

Topic category: Help with modding (Java Edition)

Last seen on 17:12, 14. Sep 2024
Joined Jun 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do a grant a advancement to the player when they enter a structure?

I'm trying to get this mod crunched out, but I have no idea how I can make the player get an advancement when they enter the structure's bounding box. I've looked online for a solution, and some say to have a frozen entity that despawns when you get close to it and gives you the advancement, but that seems like a bandaid fix to me. What's ANOTHER way than that, to do this?

Last seen on 03:18, 3. Sep 2024
Joined Dec 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Replace everything in your…
Sun, 08/18/2024 - 17:39

Replace everything in your advancement's .json file with this:

 

{
  "display": {
    "icon": {
      "item": "minecraft:stone"
    },
    "title": "Enter Structure",
    "description": "Enter the custom structure"
    "frame": "task",
    "show_toast": true,
    "announce_to_chat": true,
    "hidden": false
  },
  "parent": "minecraft:adventure/root",
  "criteria": {
    "in_custom_structure": {
      "trigger": "minecraft:location",
      "conditions": {
        "player": [
          {
            "condition": "minecraft:entity_properties",
            "entity": "this",
            "predicate": {
              "location": {
                "structure": "your_mod_id:your_structure"
              }
            }
          }
        ]
      }
    }
  },
  "requirements": [
    [
      "in_custom_structure"
    ]
  ]
}

 

Replace "your_mod_id:your_structure" with your mod id and the name of your structure and fill in the other fields like title and description and you'll be good to go!

Last seen on 17:12, 14. Sep 2024
Joined Jun 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I thought it would be more…
Sun, 08/18/2024 - 18:15

I thought it would be more complex, thank you! This actually helps a lot!

Last seen on 03:18, 3. Sep 2024
Joined Dec 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
No problem!
Sun, 08/18/2024 - 18:39

No problem!