I made a custom crafter in Minecraft 1.10.2. I want to obtain it by throwing a dropper and crafting table on the ground together. Everything is OK, but if I throw a dropper and a crafting table really far away from each other (crafting table 50 blocks away from dropper), it still runs. That's not ok. So, how to test if 2 item are nearby one to another in Minecraft?
-
Why are you in 1.10.2?– Fabian RölingCommented Jun 13, 2019 at 8:25
-
1Fabian Röling i'm making map on that version– I Like FishCommented Jun 13, 2019 at 8:28
-
But why? Almost nobody plays it anymore and people will have to downgrade to play it, which involves creating a new launcher profile, choosing a different .minecraft folder (because downgrades in the same .minecraft folder are not supported and often cause issues), changing all controls, video and audio settings again and and so on, then later deleting all of that again. There's no downside to playing in 1.12.2 instead, it has all features of 1.10.2 and more, also a lot of bug fixes.– Fabian RölingCommented Jun 13, 2019 at 10:26
-
@FabianRöling that's ok with me– I Like FishCommented Jun 13, 2019 at 14:01
1 Answer
I suggest you have a testfor
command that tests if both a dropper and a crafting table are on the ground.
What I suggest you do is run an execute
command at either of the two items, and test of the other item is nearby:
/execute @e[<firstItem>] ~ ~ ~ testfor @e[<secondItem>,r=<distance>]
As you can see, I added r=
to test only for entities in a certain radius (if you need the items to be 3 blocks or closer to each other, type r=3
, and so on.). You can then put the command into a command block and lead a comparator out of it that would execute the command for custom crafting.
Because you already had half the thing working, I figured out you already found out a method of testing for specific items. An example can be found here, just in case.
-
thanks you very much for fixing my bad english and helping my problem Commented Jun 13, 2019 at 8:26
-
I suggest not using
testfor
at all, you don't ever need it. Just useexecute
. Commented Jun 13, 2019 at 8:26 -
-
-
3@FabianRöling /execute at @e[type=item,bla=bla] at @e[type=item,limit=1,bla=bla] only works in 1.13+ Commented Jun 13, 2019 at 14:54