0

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!

3
  • 2
    You used an online advancement generator, modified nothing and it already doesn't work? Then that's a bug in that generator. You should use another one or write it manually. Commented Mar 9, 2020 at 5:46
  • 2
    TNT is a bit weird. Try entity.minecraft.tnt instead of just minecraft.tnt, as minecraft splits it between entity and block
    – Corsaka
    Commented Mar 11, 2020 at 9:41
  • The way this is set up, all 3 ways to reference TNT must match at the same time, which I assume they don't. Try them separately from each other.
    – Egor Hans
    Commented Feb 1, 2021 at 19:42

1 Answer 1

1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .