I'm hungary, sorry for wrong sentences.
So, I will make a system with command blocks. The system is compare two item. One item on the ground one item on your MainHand(SelectedItem) and... How? (When it's possible.)
I try: "/execute @e[type=item,tag=compare] ~ ~ ~ testfor @a[r=5] {SelectedItem:@s}"
but is doesn't work.
So, I will make a system with command blocks. The system is compare two item. One item on the ground one item on your MainHand(SelectedItem) and... How? (When it's possible.)
I try: "/execute @e[type=item,tag=compare] ~ ~ ~ testfor @a[r=5] {SelectedItem:@s}"
but is doesn't work.
4
Clock Commandsscoreboard players tag @e[type=minecraft:item,tag=Stone] remove Stonescoreboard players tag @e[type=minecraft:item,tag=!Stone] add Stone {Item:{id:"minecraft:stone"}}scoreboard players tag @a[tag=InvStone] remove InvStonescoreboard players tag @a[tag=!InvStone] add InvStone {"SelectedItem":{id:"minecraft:stone"}}execute @e[type=minecraft:item,tag=Stone] ~ ~ ~ testfor @a[tag=InvStone,r=5]I hope that this is what you were needing? The commands are for 1.12.2.
~SUPERIONtheKnight
what do you want to do after comparing them? Test if they're the same item?
I don't think this is currently possible. The problem is that both items are completely different. The item on the ground is an entity of type Item ("minecraft:item") whereas the stuff in your hand is a regular item, for example minecraft:coal.
So your last test command would basically compare minecraft:item (entity) against the stuff in your hand, which is never going to be the same.
Also: SelectedItem is a compound, so you'd need: SelectedItem:{}, for example: /testfor @a {SelectedItem:{id:"minecraft:coal"}}
I'm not sure from mind but I think 1.13 might be able to pull this off through use of the /data command.
So your last test command would basically compare minecraft:item (entity) against the stuff in your hand, which is never going to be the same.
Also: SelectedItem is a compound, so you'd need: SelectedItem:{}, for example: /testfor @a {SelectedItem:{id:"minecraft:coal"}}
I'm not sure from mind but I think 1.13 might be able to pull this off through use of the /data command.
OK. Thanks!
