I thought I'd just add the requirement of being in a RootVehicle and not be picky about which.
When entered in a command block, a failed result comes back when I'm sitting in the boat, and when I enter the command live in chat, it come back test passed count = 1 ?!?!?
I thought I'd just add the requirement of being in a RootVehicle and not be picky about which.
When entered in a command block, a failed result comes back when I'm sitting in the boat, and when I enter the command live in chat, it come back test passed count = 1 ?!?!?
Ah that's because you're using the @s selector which requires entity context (a reference to the entity). Command blocks do not have this. Because you've proven that RootVehicle exists, you just need to execute as the player entity
execute as @a[nbt={RootVehicle:{Entity:{id:"minecraft:minecart"}}}] run . . . . .
/execute as @a[nbt={RootVehicle:{Entity:{id:"minecraft:boat"}}}] run . . . . .
Not sure if these are the correct values, but you can check using
I used to use @p all the time until I discovered I could restrict even more to @s. So, since your first reply I have been trying different formats, and put @p in the command block out of sheer muscle memory, and it worked! So, now I combine boat/minecart detection with @p, with distance detection @s. a quite reasonable workaround.
Thank you for providing the means to detect a RootVehicle, even if it's not super precise; This is so close to what I want I consider it to be solved (like someone will be riding a minecart in the water, or a boat on my tracks!!!).
However, I have one last curiosity for you:
I cannot seem to get the detection working properly with the nbt tag: [nbt={ etc, etc}]
I have tried the boat and the minecart with and without quotation marks; and I even checked the nesting under data entity @s/@p and it is exactly as you listed in your respose: [nbt={RootVehicle:{Entity:{id:minecraft:minecart}}}]
Thank you so much for all the help you share with everyone !!
I used to use @p all the time until I discovered I could restrict even more to @s. So, since your first reply I have been trying different formats, and put @p in the command block out of sheer muscle memory, and it worked! So, now I combine boat/minecart detection with @p, with distance detection @s. a quite reasonable workaround.
Thank you for providing the means to detect a RootVehicle, even if it's not super precise; This is so close to what I want I consider it to be solved (like someone will be riding a minecart in the water, or a boat on my tracks!!!).
However, I have one last curiosity for you:
I cannot seem to get the detection working properly with the nbt tag: [nbt={ etc, etc}]
I have tried the boat and the minecart with and without quotation marks; and I even checked the nesting under data entity @s/@p and it is exactly as you listed in your respose: [nbt={RootVehicle:{Entity:{id:minecraft:minecart}}}]
Thank you so much for all the help you share with everyone !!
Note the selector tries to detect exactly what is listed in the nbt (so the format you see in data get). If you try the nbt above is word for word basically the same (including the quatation marks) and it still doesnt detect, try using an entity properties predicate
I tried uploading a screenshot, but keep getting an error message when I try to upload.
It looks to me like the path matches perfectly, but I'm a relative noob, I've only been using command blocks for a couple weeks.
Is there something I'm missing? I'm actually having trouble getting anything involving NBT to work at all.
Is there a better resource for syntax than digminecraft or fandom? Possibly specific to version? (1.16.5) I'm comfortable with programming languages, but cannot find detail in syntax and parameters without coming to forums. I'd rather do my homework than need to ask over the internet and wait and hope someone has the answers I'm looking for.
I appreciate your helpfulness very much, but with resources, I would not need so much help. Anywhere you can direct me?
I tried uploading a screenshot, but keep getting an error message when I try to upload.
It looks to me like the path matches perfectly, but I'm a relative noob, I've only been using command blocks for a couple weeks.
Is there something I'm missing? I'm actually having trouble getting anything involving NBT to work at all.
Is there a better resource for syntax than digminecraft or fandom? Possibly specific to version? (1.16.5) I'm comfortable with programming languages, but cannot find detail in syntax and parameters without coming to forums. I'd rather do my homework than need to ask over the internet and wait and hope someone has the answers I'm looking for.
I appreciate your helpfulness very much, but with resources, I would not need so much help. Anywhere you can direct me?
McStacker can help although it cannot detect rootvehicle and some other player specific nbt for some reason
I am trying to use command blocks to execute certain commands when I am in a boat; and a different set of commands if I am in a minecart.
I am using java 1.16.5, and all suggestions I can find are for older versions, and they all show as failed tests when I check the command block.
I am trying to be complicated (using in may areas so chunk loading presents issues), so the use of tags promises to be WAY TOO TEDIOUS.
The most promising attempt (with variations) was this one:
/execute if entity @s[nbt={RootVehicle:{Entity:{id:"minecraft:minecart"}}}] run . . . . .
/execute if entity @s[nbt={RootVehicle:{Entity:{id:"minecraft:boat"}}}] run . . . . .
/execute if entity @s[nbt={RootVehicle:{Entity:{id:boat}}}] run . . . . .
but it also returns a failed attempt result.
I am hoping there is a way to directly test if @s in in a cart or boat (separately).
Thanks Much for any help given (or clarification if this cannot be done)
Thom
I don't think rootvehicle is readable, just like how entity's id nbt isnt readable as well.
To test if there is a rootvehicle nbt use this while riding someth:
Okay, I got into a minecart and ran the command you gave me: Test passed, count = 1
Ran it in a boat, same thing Test passed, count = 1
On the ground: Test Failed
Does this mean I can access RootVehicle somehow?
Okay, strange experience to add:
I thought I'd just add the requirement of being in a RootVehicle and not be picky about which.
When entered in a command block, a failed result comes back when I'm sitting in the boat, and when I enter the command live in chat, it come back test passed count = 1 ?!?!?
Ah that's because you're using the @s selector which requires entity context (a reference to the entity). Command blocks do not have this. Because you've proven that RootVehicle exists, you just need to execute as the player entity
Not sure if these are the correct values, but you can check using
Hi Crazy Dave,
I used to use @p all the time until I discovered I could restrict even more to @s. So, since your first reply I have been trying different formats, and put @p in the command block out of sheer muscle memory, and it worked! So, now I combine boat/minecart detection with @p, with distance detection @s. a quite reasonable workaround.
Thank you for providing the means to detect a RootVehicle, even if it's not super precise; This is so close to what I want I consider it to be solved (like someone will be riding a minecart in the water, or a boat on my tracks!!!).
However, I have one last curiosity for you:
I cannot seem to get the detection working properly with the nbt tag: [nbt={ etc, etc}]
I have tried the boat and the minecart with and without quotation marks; and I even checked the nesting under data entity @s/@p and it is exactly as you listed in your respose: [nbt={RootVehicle:{Entity:{id:minecraft:minecart}}}]
Thank you so much for all the help you share with everyone !!
Note the selector tries to detect exactly what is listed in the nbt (so the format you see in data get). If you try the nbt above is word for word basically the same (including the quatation marks) and it still doesnt detect, try using an entity properties predicate
Thanks Crazy Dave!
I tried uploading a screenshot, but keep getting an error message when I try to upload.
It looks to me like the path matches perfectly, but I'm a relative noob, I've only been using command blocks for a couple weeks.
Is there something I'm missing? I'm actually having trouble getting anything involving NBT to work at all.
Is there a better resource for syntax than digminecraft or fandom? Possibly specific to version? (1.16.5) I'm comfortable with programming languages, but cannot find detail in syntax and parameters without coming to forums. I'd rather do my homework than need to ask over the internet and wait and hope someone has the answers I'm looking for.
I appreciate your helpfulness very much, but with resources, I would not need so much help. Anywhere you can direct me?
McStacker can help although it cannot detect rootvehicle and some other player specific nbt for some reason