#Advancement death to anything detection

1 messages · Page 1 of 1 (latest)

silent bobcat
#

I am trying to write an advancement in a datapack which detects when a player dies to anything (entity, fall, anvil etc) but I cannot see how to do it

#
    "criteria": {
      "requirement": {
        "trigger": "minecraft:entity_killed_player"
      }
    },
    "rewards": {
      "function": "trimeffect:death"
    }
  }```
old jasper
#

You should use a scoreboard for this

#

The criteria is deathCount

silent bobcat
#

ok right yep sounds good thanks

silent bobcat
old jasper
#

No, you would have to check the scoreboard value in your tick function

silent bobcat
#

ok sounds good

#

thanks

tropic cosmos
#

You can maybe use an entity_hurt_player advancement and check if their health is 0

#

entity_hurt_players triggers for all damage

silent bobcat
#

yeah thanks

silent bobcat
old jasper
#

What do you mean by that?

silent bobcat
#

basically i want the player to be able to drink a potion which they can craft and then it changes a scoreboard value, which I did, and then you can a potion to remove a scoreboard value (differnet data) but the issue I am having is that I cannot clear the bottle from the players inventory in time after the potion has been drank so you can effectively dupe bottles

#
scoreboard players remove @s trimeffect.life 1
give @s minecraft:potion[potion_contents={potion:"minecraft:water",custom_color:13046290},custom_name='["",{"text":"Bottled Life","italic":false}]',custom_data={bottled:1}] 1
clear @s minecraft:glass_bottle 1```
#

I am giving a bottle to make it easier but it doesnt get rid of the bottle from the other potion if you see what i mea

old jasper
#

The bottle may not actually appear in your inventory until the next tick

#

You might need to wait one tick to clear it

silent bobcat
old jasper
#

I guess give yourself a tag, like has_glass_bottle, and then check for that in the tick function, and clear it

silent bobcat
#

righ tok

silent bobcat
# old jasper I guess give yourself a tag, like `has_glass_bottle`, and then check for that in...

how can I modify this recipe to make the redstone require the custom data {life:1}?

    "type": "minecraft:crafting_shaped",
    "pattern": [
        "#P#",
        " G "
    ],
    "key": {
        "#": {
            "item": "minecraft:redstone"
        },
        "P": {
            "item": "minecraft:potion"
        },
        "G": {
            "item": "minecraft:glowstone_dust"
        }
    },
    "result": {
        "id": "minecraft:potion",
        "components": {
            "custom_name": "[\"\",{\"text\":\"Empty Life Bottle\",\"italic\":false}]",
            "custom_data": "{bottled:0}",
            "minecraft:potion_contents": {
                "potion": "minecraft:water",
                "custom_color": 1835113
            }
        }
    }
}```
old jasper
#

You can't. Checking components in recipe inputs isn't supported

silent bobcat
#

ah ok thanks

silent bobcat
old jasper
#

It should be SelectedItem{id:"minecraft:glass_bottle"}

#

SelectedItem is not an array

silent bobcat
#

ah thank you

silent bobcat
# old jasper `SelectedItem` is not an array

What have i done here?

    "type": "minecraft:crafting_shaped",
    "pattern": [
        "#T#",
        "SJP",
        "#A#"
    ],
    "key": {
        "#": {
            "item": "minecraft:end_crystal"
        },
        "T": {
            "item": "minecraft:trident"
        },
        "S": {
            "item": "minecraft:shaper_armor_trim_smithing_template"
        },
        "J": {
            "item": "minecraft:totem_of_undying"
        },
        "P": {
            "item": "minecraft:sentry_armor_trim_smithing_template"
        },
        "A": {
            "item": "minecraft:turtle_helmet"
        }
    },
    "result": {
        "id": "minecraft:potion",
        "components": {
            "custom_name": "Life bottle",
            "custom_data": "{life:1}",
            "minecraft:potion_contents": {
                "custom_color": 1835113
            }
        }
    }
}```
old jasper
#

Custom name is wrong

#

It takes a json text component, so it needs to be "\"Life bottle\""

silent bobcat
#

ah thanks

hollow pawnBOT
# silent bobcat ah thanks
🎗️ Is your question resolved?

If your question is resolved, that's great to hear! Make sure to run /resolve or click the Resolve Question button. Otherwise, feel free to continue asking for help! :D

hollow pawnBOT
# hollow pawn
Question Closed

Your question, #1263431241789870110 (Advancement death to anything detection), was resolved!

Original Message

#1263431241789870110 message

Duration open

4d13h19m