Skip to main content
update to reflect 14w10c changes
Source Link
Unionhawk
  • 34.1k
  • 34
  • 161
  • 251

Currently, As of 14w10c, this is possible using scoreboard values.

First, you need to set up a dummy scoreboard variable. I used "sneaky" as my variable, but you can really use whatever you want (as of 14w08along as you change the commands as appropriate). To set this does not appearup, you just need to be possible. The changelog for 14w07a specifically says that NBT matching works for /testfor anduse the command /testforblockscoreboard objectives add sneaky dummy. It doesn't appearYou only need to do this once.

I had to set up the command blocks in a very specific pattern for them to work, as shown:

Command block setup

I think this has something to do with how command blocks handle firing off "simultaneously". The comparator in any otherthis setup is in subtraction mode, creating a "comparator clock" which pulses very quickly.

The command blocks on the left are your scoreboard related commands. The one on the bottom left sets "sneaky" to 0 for all players:

/scoreboard players set @a sneaky 0

From the changelog: The command block on the top left sets "sneaky" to 1 for all players with the stealth boots equipped:

  • The commands /testfor, /testforblock and /clear can now test for partial matches of NBT lists
/scoreboard players set @a sneaky 1 {Inventory:[{Slot:100b,tag:{display:{Name:"Stealth Boots"}}}]}

It specifically says thoseThe command blocks on the right are your effect commands, and doesn't mention. They give players the @pinvisibility effect, @e or @a selectorstake it away, as appropriate. The one on the bottom clears the invisibility effect from all players without the stealth boots:

/effect @a[score_sneaky=0] 14 0 0

This is very much a currently, as are all snapshot issues. As it is, it doesn't appearThe top one gives the invisibility effect to be possible right at this moment.all players with the stealth boots:

/effect @a[score_sneaky_min=1] 14 30000

Currently, (as of 14w08a) this does not appear to be possible. The changelog for 14w07a specifically says that NBT matching works for /testfor and /testforblock. It doesn't appear to work in any other command.

From the changelog:

  • The commands /testfor, /testforblock and /clear can now test for partial matches of NBT lists

It specifically says those commands, and doesn't mention the @p, @e or @a selectors.

This is very much a currently, as are all snapshot issues. As it is, it doesn't appear to be possible right at this moment.

As of 14w10c, this is possible using scoreboard values.

First, you need to set up a dummy scoreboard variable. I used "sneaky" as my variable, but you can really use whatever you want (as long as you change the commands as appropriate). To set this up, you just need to use the command /scoreboard objectives add sneaky dummy. You only need to do this once.

I had to set up the command blocks in a very specific pattern for them to work, as shown:

Command block setup

I think this has something to do with how command blocks handle firing off "simultaneously". The comparator in this setup is in subtraction mode, creating a "comparator clock" which pulses very quickly.

The command blocks on the left are your scoreboard related commands. The one on the bottom left sets "sneaky" to 0 for all players:

/scoreboard players set @a sneaky 0

The command block on the top left sets "sneaky" to 1 for all players with the stealth boots equipped:

/scoreboard players set @a sneaky 1 {Inventory:[{Slot:100b,tag:{display:{Name:"Stealth Boots"}}}]}

The command blocks on the right are your effect commands. They give players the invisibility effect, or take it away, as appropriate. The one on the bottom clears the invisibility effect from all players without the stealth boots:

/effect @a[score_sneaky=0] 14 0 0

The top one gives the invisibility effect to all players with the stealth boots:

/effect @a[score_sneaky_min=1] 14 30000
Source Link
Unionhawk
  • 34.1k
  • 34
  • 161
  • 251

Currently, (as of 14w08a) this does not appear to be possible. The changelog for 14w07a specifically says that NBT matching works for /testfor and /testforblock. It doesn't appear to work in any other command.

From the changelog:

  • The commands /testfor, /testforblock and /clear can now test for partial matches of NBT lists

It specifically says those commands, and doesn't mention the @p, @e or @a selectors.

This is very much a currently, as are all snapshot issues. As it is, it doesn't appear to be possible right at this moment.