I'm playing minecraft, doing some random stuff in my server.

I was creating an automatic builder, to avoid having to build blocks, so that I could just walk, and it would build.

What I did was create a pulse-clock connected to a commandblock having:

execute @p ~ ~ ~ setblock ~ ~ ~ dirt

I was wondering how I would make that "dirt" into whatever item I was holding in hand, or at a specific slot in my inventory as setblock ~ ~ ~ {slot:0b} doesn't seem to work.


On another note, how can I make the commandblock to work inside a range, and/or coordinates, as in execute @p[x=~10,y=~,z=~15,r=5] ~ ~ ~ setblock ~ ~-1 ~ dirt

Thanks in advance.

  • 2
    What you're asking is impractical at best. You would need one command block for every block type, at the very minimum.
    – MBraedley
    Apr 8 '15 at 21:23
  • What I'm asking for is to make the game read what you have in your inventory, instead of putting a statick block like dirt. Is there any way around it? (And can I read a trigger (scoreboard) to activate and deactivate the setblock, using a comparator+repeater?)
    – mazunki
    Apr 8 '15 at 21:28
  • No, I'm telling you that can't be done. At least not currently. As for the second question in your comment, ask a new question about that.
    – MBraedley
    Apr 8 '15 at 21:31
  • Would other methods of selecting the block (rather than having it selected in your hotbar) be good enough for your purpose?
    – SirBenet
    Apr 9 '15 at 11:50
  • That's a good idea, hadn't thought about it. But the whole idea was to "build faster in creative mode". I guess I could maybe use the ID of a dummy-score, executing a command. (I wish /powertool was added to vanilla minecraft, I really hate all these long commands ... and for users it would be great (Yeah, I know, add a command block, but it's not the same. xD))
    – mazunki
    Apr 10 '15 at 10:57

No, this is impossible unless you want to add command blocks for every block type.

  • I said "impossible unless". Also, besides time, it would contribute a significant amount of lag. Apr 9 '15 at 23:51
  • Put that in your post :) Use the edit button.
    – aytimothy
    Jul 17 '15 at 7:17

You would have to add a command blocks comparator setup for each block, which is already a pain to do for just one item. To have the command block work inside of a range, use the fill command instead, ex

/fill ~1 ~-1 ~1 ~-1 ~-1 ~-1 dirt

will give a 3x3 area of dirt beneath you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.