Me and a few friends are making a map, and one task makes the player craft a compass (then obtain two more items). The idea is that once they get it, the compass dissapears and they go on to the next step of the task. I've tried a few methods, but none have worked. Here's what I tried:
1st cmd block: tag@p[nbt={SelectedItem:{id:"minecraft:compass"}}] add compass
2nd: execute if entity @a[tag=compass]run clear @a minecraft:compass 1
Your commands work perfectly fine. However, I suggest using Inventory instead of SelectedItem so the compass is cleared even if the player is not holding it.
tag @p[nbt={Inventory:[{id:"minecraft:compass"}]}] add compass
Tested on 1.14.4. The first command should be in an always active repeating command block and the other two should be in chain always active command blocks.
Me and a few friends are making a map, and one task makes the player craft a compass (then obtain two more items). The idea is that once they get it, the compass dissapears and they go on to the next step of the task. I've tried a few methods, but none have worked. Here's what I tried:
1st cmd block: tag@p[nbt={SelectedItem:{id:"minecraft:compass"}}] add compass
2nd: execute if entity @a[tag=compass]run clear @a minecraft:compass 1
3rd: tag @p remove compass.
Please help me figure this out!
Your command looks fine to me, unless you have those typos you showed here in the command block.
Here's a little fix for your command, in case you want to.
1st cmd block: tag @a[nbt={SelectedItem:{id:"minecraft:compass"}}] add compass
2nd: clear @a[tag=compass] minecraft:compass
3rd: tag @a[tag=compass] remove compass
Note that you should run them in a repeating chain. (1st block in repeating, the rest in chain). The order also matters. the 2nd command must always run earlier than the 3rd.
If that doesn't work, check 2 more things:
1. There's no other command clearing the compass
2. Make sure it's on. Sometimes when you edit a repeating cmb when activated, you need to stop it and reactivate to make it work.
If it still doesn't work, you probably need a screenshot of your setup.
I've tried that out and did the commands as instructed, but it still doesn't seem to work. The server does seem to have some sort of plugin, where if you click while holding a compass, it will tp you to the other side of the structure, could that be interfering? Screenshot of setup below.
I've tried that out and did the commands as instructed, but it still doesn't seem to work. The server does seem to have some sort of plugin, where if you click while holding a compass, it will tp you to the other side of the structure, could that be interfering? Screenshot of setup below.
If it's a server, it might be the cause as well.
Here's a way to verify:
Run these commands in a singleplayer world. If it works, it's the server.
I don't see how Spigot (or whatever related) messes up /tag and /clear, so I think you might've disabled commands in your server (yes, you can disable cmbs entirely in servers, by changing a line in server.properties). Try to run /say hi in a command block.
This means command blocks might be disabled on your server or some plugins are overriding your commands. Check if you have command blocks enabled by opening server.properties in your server's main directory and locating the enable-command-block field. It should be set to true. If it still doesn't work, try removing all the plugins.
We certainly have command blocks on, we've already set up a few things with them earlier. Just a question, what if I want to detect a named item? how does the first command change?
Me and a few friends are making a map, and one task makes the player craft a compass (then obtain two more items). The idea is that once they get it, the compass dissapears and they go on to the next step of the task. I've tried a few methods, but none have worked. Here's what I tried:
1st cmd block: tag@p[nbt={SelectedItem:{id:"minecraft:compass"}}] add compass
2nd: execute if entity @a[tag=compass]run clear @a minecraft:compass 1
3rd: tag @p remove compass.
Please help me figure this out!
Your commands work perfectly fine. However, I suggest using Inventory instead of SelectedItem so the compass is cleared even if the player is not holding it.
Tested on 1.14.4. The first command should be in an always active repeating command block and the other two should be in chain always active command blocks.
Command block engineer // Developer // #TeamTrees
Your command looks fine to me, unless you have those typos you showed here in the command block.
Here's a little fix for your command, in case you want to.
1st cmd block: tag @a[nbt={SelectedItem:{id:"minecraft:compass"}}] add compass
2nd: clear @a[tag=compass] minecraft:compass
3rd: tag @a[tag=compass] remove compass
Note that you should run them in a repeating chain. (1st block in repeating, the rest in chain). The order also matters. the 2nd command must always run earlier than the 3rd.
If that doesn't work, check 2 more things:
1. There's no other command clearing the compass
2. Make sure it's on. Sometimes when you edit a repeating cmb when activated, you need to stop it and reactivate to make it work.
If it still doesn't work, you probably need a screenshot of your setup.
I've tried that out and did the commands as instructed, but it still doesn't seem to work. The server does seem to have some sort of plugin, where if you click while holding a compass, it will tp you to the other side of the structure, could that be interfering? Screenshot of setup below.
If it's a server, it might be the cause as well.
Here's a way to verify:
Run these commands in a singleplayer world. If it works, it's the server.
I don't see how Spigot (or whatever related) messes up /tag and /clear, so I think you might've disabled commands in your server (yes, you can disable cmbs entirely in servers, by changing a line in server.properties). Try to run /say hi in a command block.
I tried it out and it seems to work in singleplayer, when I get to log on to the server I'll copy everything just like there. Thanks for the help!
This means command blocks might be disabled on your server or some plugins are overriding your commands. Check if you have command blocks enabled by opening server.properties in your server's main directory and locating the enable-command-block field. It should be set to true. If it still doesn't work, try removing all the plugins.
Command block engineer // Developer // #TeamTrees
We certainly have command blocks on, we've already set up a few things with them earlier. Just a question, what if I want to detect a named item? how does the first command change?
Command block engineer // Developer // #TeamTrees