The Meaning of Life, the Universe, and Everything.
Location:
Gent
Join Date:
10/25/2017
Posts:
67
Location:
Belgium
Minecraft:
Khoeckman
Discord:
bledder#4820
Member Details
you might wanna use @p[distance=..7] which means 7 or closer if you mean exactly 7 this is an unresolved glitch. In that case you wanna use @p[distance=6..8] also im not sure you can just put "text" for a JSON string correct me if I'm wrong but minecraft stores it as '{"text":"substation"}' and the NBT tags need to be exactly the same on read.
Anyway I think this is the command that will work for you:
execute positioned -630 62 348 if entity @p[distance=..7] {Inventory:[{id:"minecraft:name_tag",tag:{display:{Name:'{"text":"substation"}'}}}]}
The Meaning of Life, the Universe, and Everything.
Location:
Gent
Join Date:
10/25/2017
Posts:
67
Location:
Belgium
Minecraft:
Khoeckman
Discord:
bledder#4820
Member Details
In that case you should use
display:{Name:'"customName"'}
But I checked it and apparently it stores the display name tag for items exactly as you enter it.
Oh and you used "if entity @p..." which just chest if the entity exists instead of "if data entity @p <path>"
You can also use "if entity @p[nbt={}]"
execute positioned -630 62 348 if data entity @p[distance=..7] {Inventory:[{id:'minecraft:name_tag',tag:{display:{Name:'"substation"'}}}]} run say found player!
give @p name_tag{display:{Name:'"substation"'}}
But I checked it and apparently it stores the display name tag for items exactly as you enter it.
The command will be able to detect the value but it won't be displayed in-game. The reason is that the value has to be stored as a string. And to be a string, it needs to have a pair of double-quotes around it. If you use Name:"stick", the game will store that value as stick. But if you use Name:"\"stick\"", the game will store that value as "stick" (which is the correct format). And you need to "escape" the inner pair of double quotes because the game can't store a string inside another string. I just wanted to explain that so anyone reading this knows why the backslashes are required.
Anyway, back to the original problem. The NBT data should be inside the nbt tag in the selector. Here is the correct version:
/execute positioned -630 62 348 if entity @p[distance=..7,nbt={Inventory:[{id:"minecraft:name_tag",tag:{display:{Name:'{"text":"substation"}'}}}]}]
Also, I assumed that the nametag was renamed using an anvil so I changed the name format to '{"text":"substation"}' because that's the format anvils use. You can change it if you didn't use an anvil.
But I checked it and apparently it stores the display name tag for items exactly as you enter it.
Oh and you used "if entity @p..." which just chest if the entity exists instead of "if data entity @p <path>"
You can also use "if entity @p[nbt={}]"
execute positioned -630 62 348 if data entity @p[distance=..7] {Inventory:[{id:'minecraft:name_tag',tag:{display:{Name:'"substation"'}}}]} run say found player!
give @p name_tag{display:{Name:'"substation"'}}
I think this is the fix
this one worked great, thanks for helping revive my mess of code
execute positioned -630 62 348 if entity @p[distance=7] {Inventory:[{id:"minecraft:name_tag",tag:{display:{Name:"substation"}}}]} run help
syntax is wrong and command only seems to work if I simplify it and don't include the name. I had this down in 1.13 with the testfor command >.<
I just want the command block to output a redstone signal if the conditions are true, making a rail system switch lines, and I can't figure it out.
I copy paste, and make poorly edited commands
you might wanna use @p[distance=..7] which means 7 or closer if you mean exactly 7 this is an unresolved glitch. In that case you wanna use @p[distance=6..8] also im not sure you can just put "text" for a JSON string correct me if I'm wrong but minecraft stores it as '{"text":"substation"}' and the NBT tags need to be exactly the same on read.
Anyway I think this is the command that will work for you:
The JSON formatting is optional. You can use plain text but it has to be stringified (Name:"\"someName\"").
Command block engineer // Developer // #TeamTrees
In that case you should use
display:{Name:'"customName"'}
But I checked it and apparently it stores the display name tag for items exactly as you enter it.
Oh and you used "if entity @p..." which just chest if the entity exists instead of "if data entity @p <path>"
You can also use "if entity @p[nbt={}]"
I think this is the fix
The command will be able to detect the value but it won't be displayed in-game. The reason is that the value has to be stored as a string. And to be a string, it needs to have a pair of double-quotes around it. If you use Name:"stick", the game will store that value as stick. But if you use Name:"\"stick\"", the game will store that value as "stick" (which is the correct format). And you need to "escape" the inner pair of double quotes because the game can't store a string inside another string. I just wanted to explain that so anyone reading this knows why the backslashes are required.
Anyway, back to the original problem. The NBT data should be inside the nbt tag in the selector. Here is the correct version:
Also, I assumed that the nametag was renamed using an anvil so I changed the name format to '{"text":"substation"}' because that's the format anvils use. You can change it if you didn't use an anvil.
Command block engineer // Developer // #TeamTrees
this one worked great, thanks for helping revive my mess of code
heres how the thing works, lol
I copy paste, and make poorly edited commands
Cool system. You could limit the number of players that can use the system at the same time to prevent it from breaking. Sort of like a queue.
The minecarts can be stopped using:
But I have no idea how the queue would work lol.
Command block engineer // Developer // #TeamTrees
true, I think I honestly would just have to start messing with different types of queues and just get a feel for what doesn't break as often, lol
I copy paste, and make poorly edited commands