Arqade Asked by Pat Nat on March 8, 2021
I’m trying to make custom advancements in Minecraft Java Edition 1.15.2 and there’s one I can’t get working. The advancement is supposed to be granted when a player gets killed by TNT. I’ve done this with pufferfish and had no problem but TNT specifically is giving me trouble. Here’s my current build that’s not working:
{
"__comment": "Made with TheDestruc7i0n's advancements generator: https://advancements.thedestruc7i0n.ca",
"display": {
"title": {
"text": "Karma"
},
"description": {
"text": "You reap what you sow. Get killed by tnt."
},
"icon": {
"item": "minecraft:tnt"
},
"frame": "task",
"show_toast": true,
"announce_to_chat": true,
"hidden": false
},
"criteria": {
"karma": {
"trigger": "minecraft:entity_killed_player",
"conditions": {
"entity": {
"type": "minecraft:tnt"
},
"killing_blow": {
"is_explosion": true,
"direct_entity": {
"type": "minecraft:tnt"
},
"source_entity": {
"type": "minecraft:tnt"
}
}
}
}
},
"parent": "cakecoresmp:owltin"
}
I can’t seem to find anything wrong with it so any help would be appreciated. Thank you!
Conditions within the same criterion work based on AND logic, meaning that they must all match. This is not what you want in this constellation.
To use OR logic (making the advancement succeed when one of the conditions is met), you need to make a constellation such as the following:
"criteria": {
"firstcheck": {
"trigger": "minecraft:entity_killed_player",
"conditions": {
"entity": {
"type": "minecraft:tnt"
},
"killing_blow": {
"is_explosion": true
}
}
},
"secondcheck": {
"trigger": "minecraft:entity_killed_player",
"conditions": {
"killing_blow": {
"is_explosion": true,
"direct_entity": {
"type": "minecraft:tnt"
}
}
}
},
"thirdcheck": {
"trigger": "minecraft:entity_killed_player",
"conditions": {
"killing_blow": {
"is_explosion": true,
"source_entity": {
"type": "minecraft:tnt"
}
}
}
}
},
"requirements": [
[
"firstcheck",
"secondcheck",
"thirdcheck"
]
]
Note the two pairs of square brackets in the requirements
tag. To function in OR logic, your criteria must be combined in the same inner bracket. With something like "requirements": [["criterion1"],["criterion2"]]
, you once again create AND logic, but this time each of the criteria must have been met at some point, and not necessarily at the same time.
For an in-game example of what I just explained, compare the Vanilla advancement The Parrots and the Bats (minecraft:husbandry/breed_an_animal
) with Two By Two (minecraft:husbandry/bred_all_animals
). In general, reading and understanding the default datapack can help a lot with understanding the various mechanics behind them and thus being able to write your own content.
Answered by Egor Hans on March 8, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP