1

Help me! Commandblock

TyFun312 4/18/18 11:49 am history
212
4/20/2018 6:41 pm
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.
Posted by
TyFun312
Level 1 : New Miner
0

  Have something to say?

JoinSign in

4

SUPERIONtheKnight
04/20/2018 6:41 pm
Level 30 : Artisan System
history
Clock Commands
scoreboard players tag @e[type=minecraft:item,tag=Stone] remove Stone
scoreboard players tag @e[type=minecraft:item,tag=!Stone] add Stone {Item:{id:"minecraft:stone"}}
scoreboard players tag @a[tag=InvStone] remove InvStone
scoreboard 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
1
Isz
04/18/2018 2:20 pm
Level 48 : Master Architect
what do you want to do after comparing them? Test if they're the same item?
1
ShelLuser
04/18/2018 1:17 pm
Level 61 : High Grandmaster System
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.
1
TyFun312
04/18/2018 2:14 pm
Level 1 : New Miner
OK. Thanks!
1

Welcome