The Meaning of Life, the Universe, and Everything.
Join Date:
7/19/2013
Posts:
94
Minecraft:
TimmyCheeseburgr
Member Details
I was wanting to execute a command at all item frames with the specific tag "minecraft:boats". This is primarily used for clearing your inventory and you can specify tag/category. However, I tried to copy this over to a /execute command, but it does not work. Here is the command:
/execute as @e[type=minecraft:item_frame,distance=..3,nbt={Item:{id:"#minecraft:boats"}}] run say hi
If you replace the id with "minecraft:oak_boat," it would work, however, I want to make this work with all types of boats.
I know that I can copy and paste this command so it does it for each boat, but I was wanting to put the command into a written book and have it be one single command, without using functions.
Well the thing is that's impossible (And when I say this, I really know what I'm talking about)
The difference between a /clear and nbt{} selector is that the nbt{} selector searches precisely what you write in it, while the /clear can convert "#things" into "[thing1, thing2, thing3]" and stuff like that
For example, when you want to look for a player on ground, you can use this :
/execute if entity @a[nbt={OnGround:1b}]
However, if you forget the "b" after the value, the game could not find any player with the exactly-written "OnGround:1" tag.
This shows there is not any kind of translation in nbt{} selector (cause if they don't even support missing data type, they won't convert item tags neither)
With my current knowledge, the only trick I see for now is this :
-Store the number of #boats into a player's inventory using /clear with 0 count
-Copy the item frame's item into player's inventory
-Store again the number of #boats in player's inventory
-If the 2 numbers are different, that means the item frame contains a boat
I got into chiptune music composition.
You can listen to them on my Youtube channel : https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
The Meaning of Life, the Universe, and Everything.
Join Date:
7/19/2013
Posts:
94
Minecraft:
TimmyCheeseburgr
Member Details
Alright, well that is unfortunate. Thank you though for commenting! Looks like I am going to have to do the copy-paste the same command for each item...
I was wanting to execute a command at all item frames with the specific tag "minecraft:boats". This is primarily used for clearing your inventory and you can specify tag/category. However, I tried to copy this over to a /execute command, but it does not work. Here is the command:
/execute as @e[type=minecraft:item_frame,distance=..3,nbt={Item:{id:"#minecraft:boats"}}] run say hi
If you replace the id with "minecraft:oak_boat," it would work, however, I want to make this work with all types of boats.
I know that I can copy and paste this command so it does it for each boat, but I was wanting to put the command into a written book and have it be one single command, without using functions.
Is there a way to do this?
Well the thing is that's impossible (And when I say this, I really know what I'm talking about)
The difference between a /clear and nbt{} selector is that the nbt{} selector searches precisely what you write in it, while the /clear can convert "#things" into "[thing1, thing2, thing3]" and stuff like that
For example, when you want to look for a player on ground, you can use this :
/execute if entity @a[nbt={OnGround:1b}]
However, if you forget the "b" after the value, the game could not find any player with the exactly-written "OnGround:1" tag.
This shows there is not any kind of translation in nbt{} selector (cause if they don't even support missing data type, they won't convert item tags neither)
With my current knowledge, the only trick I see for now is this :
-Store the number of #boats into a player's inventory using /clear with 0 count
-Copy the item frame's item into player's inventory
-Store again the number of #boats in player's inventory
-If the 2 numbers are different, that means the item frame contains a boat
This is an... ugly way.
For this one, I'd give up on hardcoding
I got into chiptune music composition.
You can listen to them on my Youtube channel :
https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
Alright, well that is unfortunate. Thank you though for commenting! Looks like I am going to have to do the copy-paste the same command for each item...