I'm trying to make a custom crafting system, but I'm not sure how to test for blocks within a radius of players, not command blocks. Specifically, I'm attempting to test if there is a dropper within ten blocks of a player at any given time and any given place in the world. Is there a way to do this?

  • Is there something that you've tried already? Have you looked through the wiki to see if that can help you? You'll find that people are generally more willing to help someone who has shown some effort to try and solve their problem first.
    – MBraedley
    Commented Jun 24, 2015 at 0:05
  • Look into the execute command. It might help. Commented Jun 24, 2015 at 1:37
  • 1
    I've been trying several different formats with the execute command. I've tried several approaches of what is basically execute @a ~ ~ ~ /testforblock [r=radius] dropper 1 but testforblock doesn't allow the use of entity tags and execute @a[r=radius] executes within a radius of the cmd block, not the player.
    – vex
    Commented Jun 24, 2015 at 2:05
  • Let's say you want to kill them if they go near the dropper. Could you use this command? /execute @e[type=dropper] ~ ~ ~ kill @a[r=10]
    – Nick B.
    Commented Jun 24, 2015 at 13:35
  • @NickB. Droppers aren't entities, so that doesn't work.
    – vex
    Commented Jun 24, 2015 at 14:04

2 Answers 2


This can be done via the /fill command within /execute.

/execute @a ~ ~ ~ fill ~10 ~10 ~10 ~-10 ~-10 ~-10 pumpkin 0 replace dropper 1

/execute @a ~ ~ ~ fill ~10 ~10 ~10 ~-10 ~-10 ~-10 dropper 1 replace pumpkin 0

You don't have to use a pumpkin, any unused block will do. Put these two commands separately on a fill clock and run a comparator out from either of the two command blocks with the commands in them. Whenever any player is within 10 blocks (including diagonals, unfortunately) of a dropper with the data value of 1 (was that facing down? I can't remember), the comparator will turn on. Whenever they move out of range, it will turn off. That's currently the closest you can get to what you asked.

  • That destroy items in the dropper and prevents from open it
    – l4m2
    Commented May 12, 2018 at 20:41
  • @l4m2 That is correct, but to this day I am still aware of a better solution besides checking every block manually.
    – LyricLy
    Commented May 13, 2018 at 7:15

Here's another idea:

If the droppers are not crafted by the player himself, you could simply spawn an armor stand at every dropper and then use /execute @p[...] ~ ~ ~ /testfor @e[type=ArmorStand,...]

If the player can craft the droppers, you could replace every dropper in the player's inventory with an armor stand named "Dropper" and all the attributes you want. When it is placed, it automatically executes the setblock command to spawn the dropper. The armor stands should be invisible of course.

You can also do nested execute commands to avoid the problem with the command block's radius.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .