#advancement issue

1 messages · Page 1 of 1 (latest)

marsh scarab
#

so i made a custom enchantment and i got it to apply on my tools but now the issue is when i do this ```json
{
"criteria": {
"requirement": {
"trigger": "minecraft:item_durability_changed",
"conditions": {
"item": {
"items": [
"minecraft:wooden_axe",
"minecraft:stone_axe",
"minecraft:iron_axe",
"minecraft:golden_axe",
"minecraft:diamond_axe",
"minecraft:netherite_axe",
"minecraft:wooden_pickaxe",
"minecraft:stone_pickaxe",
"minecraft:iron_pickaxe",
"minecraft:golden_pickaxe",
"minecraft:diamond_pickaxe",
"minecraft:netherite_pickaxe",
"minecraft:stone_shovel",
"minecraft:iron_shovel",
"minecraft:golden_shovel",
"minecraft:diamond_shovel",
"minecraft:netherite_shovel",
"minecraft:wooden_sword",
"minecraft:stone_sword",
"minecraft:iron_sword",
"minecraft:golden_sword",
"minecraft:diamond_sword",
"minecraft:netherite_sword"
],
"components": {
"enchantments": {
"heresjohnny320:autorepair": 1
}
}
}
}
}
},
"rewards": {
"function": "heresjohnny320:hj320/exp/do_drop_xp_mending"
}
}

broken waspBOT
#

<@&1201956957406109788>

Someone will come and help soon!

💬 While you wait, take this time to provide more context and details.

🙇 If nobody has answered you by <t:1738910318:t>, feel free to use the Summon Helpers button to ping our helper team.

✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve

marsh scarab
#

this seems to work but just to confirm ```
execute as @s if entity @s[level=11..] run xp add @s -11 points
execute as @s if entity @s[level=11..] run summon experience_orb ~ ~ ~ {Value:11,Glowing:1b}
execute as @s if entity @s[level=11..] run playsound minecraft:entity.experience_orb.pickup player @s ~ ~ ~ 0.5 1
execute as @s if entity @s[level=11..] run particle minecraft:enchant ~ ~1 ~ 0.3 0.3 0.3 0.1 10
advancement revoke @s only heresjohnny320:mending2

lapis birch
# marsh scarab this seems to work but just to confirm ``` execute as @s if entity @s[level=11.....

the commands after the first one are not executed because you have taken away the experience and there is none for the commands below, therefore the check is not performed. You need to combine conditions into function.

function do_drop_xp_mending

execute if entity @s[level=11..] run function drop_xp_mending
advancement revoke @s only heresjohnny320:mending2

function drop_xp_mending

xp add @s -11 points
summon experience_orb ~ ~ ~ {Value:11s,Glowing:1b}
playsound minecraft:entity.experience_orb.pickup player @s ~ ~ ~ 0.5 1
particle minecraft:enchant ~ ~1 ~ 0.3 0.3 0.3 0.1 10
marsh scarab
lapis birch
#

check logs

marsh scarab
lapis birch
#

if this is a server, then check the server logs.

#

attach logs here

marsh scarab
#

the only errors is todo with my afk script but thats just becuse i dont have the map on my test server lol but everything else still works apart from the thing im trying to figure out

lapis birch
#

show a non-working advancement

marsh scarab
lapis birch
#

copy the non-working advancement here

marsh scarab
#
{
    "criteria": {
        "requirement": {
            "trigger": "minecraft:item_durability_changed",
            "conditions": {
                "item": {
                    "items": [
                        "minecraft:wooden_axe",
                        "minecraft:stone_axe",
                        "minecraft:iron_axe",
                        "minecraft:golden_axe",
                        "minecraft:diamond_axe",
                        "minecraft:netherite_axe",
                        
                        "minecraft:wooden_pickaxe",
                        "minecraft:stone_pickaxe",
                        "minecraft:iron_pickaxe",
                        "minecraft:golden_pickaxe",
                        "minecraft:diamond_pickaxe",
                        "minecraft:netherite_pickaxe",
                      
                        "minecraft:wooden_shovel",
                        "minecraft:stone_shovel",
                        "minecraft:iron_shovel",
                        "minecraft:golden_shovel",
                        "minecraft:diamond_shovel",
                        "minecraft:netherite_shovel",
                      
                        "minecraft:wooden_sword",
                        "minecraft:stone_sword",
                        "minecraft:iron_sword",
                        "minecraft:golden_sword",
                        "minecraft:diamond_sword",
                        "minecraft:netherite_sword"
                    ],
                    
                    "components": {
                        "enchantments":{
                            "heresjohnny320:expexractor": 1
                        } 
                      }
                }
            }
        }
    },
    "rewards": {
        "function": "heresjohnny320:hj320/exp/do_drop_xp_mending"
    }
}
``` you mean this ?
#

so the issue is json "components": { "enchantments":{ "heresjohnny320:expexractor": 1 } } is only looking for tools with that enchantment but as soon as i apply mending or some other ehchantment to that tool then this no longer works

lapis birch
#

why did you decide that the advancement doesn't work? does the game see it in /advancement revoke?

marsh scarab
#

no the game does see it but the issue im having is the encheantment so if i do this it works just fine but as soon as i add other enchantments like mending or something then it brakes and i have it set to auto revoke each time the tool durability_changed

#

idk if im explaning it poorly or not im bad with words

marsh scarab
lapis birch
#

you need to use predicates instead components


                    "predicates": {
                        "enchantments": [
                            {
                                "enchantments": "heresjohnny320:expexractor",
                                "levels": 1
                            }
                        ]
                    }
marsh scarab
#

well thats almost what i want but now its working no matter what even if i dont have mending

lapis birch
#

components checks for a complete match of the component, so if there were other enchs, then the check did not work.

marsh scarab
#

yes

lapis birch
#

did you reward it in the chat?

marsh scarab
#

no but if i remove this line from my code advancement revoke @s only heresjohnny320:mending2 then it works 1 time then i have to revoke it myself so thats how i know that part is working

#

so basicly what im trying to make is an enchantment that if applyed onto tools when i mine a block it takes xp from my xp bar and drops the orbe on the ground and if u have mending then it auto repairs ur stuff while ur mining

#

so i have it set to check for the change and auto revoke it so the player can keep doing it over and over but check if tool has that enchantment and if it has others then thats fine

lapis birch
#

can you attach your datapack?

marsh scarab
#

can you see my issue ? @lapis birch or am i wording things poorly ?

lapis birch
lapis birch
marsh scarab
marsh scarab
lapis birch
marsh scarab
#

i reboot it every time i make a change just to make sure things are good lol ik its slow but it wortks

#

@lapis birch never mind i got it to work i didnt realize my client side mod was covering up the enchantment lol u was right it was the currect way todo it becuse just to be sure i give myself a new pick and tryed and it was not working re add the enchantment and it worked so ty for the help

#

ig i should use vanilla client or a client with no mods for testing so my mods dont mess with it lol

broken waspBOT
#
Question Closed

Your question, #1337303992002150441 (advancement issue), was resolved!

Original Message

#1337303992002150441 message

Duration open

22h4m