I have a way to execute at a block, but it is just not working. I am trying to make an ore scanner that activates when you hold an item named "Scanner" in your hand. I have the "activate when holding item" part done. Italics are optional or changeable commands. COMMANDS: Not working part: execute @p ~ ~ ~ /fill ~5 ~5 ~5 ~-5 ~-5 ~-5 minecraft:command_block 0 replace minecraft:iron_ore 0 {auto:1b,Command:"/summon shulker ~ ~ ~ {CustomName:\"Scanned\",NoGravity:1b,AttachFace:0,Color:15b,Invulnerable:1,PersistenceRequired:1,NoAI:1,Silent:1,Glowing:1b}}

execute @e[name=Scanned,type=shulker] ~ ~ ~ setblock iron_ore ~ ~ ~ kill @e[name=Scanned,type=shulker]

Use to execute command execute @e[name=Scanned,type=shulker] ~ ~ ~ COMMAND HERE

  • How does this not work? Do you get an error or something? – Frank May 18 '17 at 23:21
  • I get an error that says "could not execute command as player" – HERECOMESTHEMONEY May 19 '17 at 18:45
  • your Command:" " tag is never closed, meaning it's missing its second quotation mark. }"} – Plagiatus May 20 '17 at 9:03
  • @Plagiatus I just tried that, but it did not work. – HERECOMESTHEMONEY May 20 '17 at 14:31
  • okay now I know the problem. – Plagiatus May 20 '17 at 17:31

First of all:
you're missing a " to close the Command:"" tag.

The next problem is this:

The syntax (wiki for reference) for the fill/replace is

fill <x1> <y1> <z1> <x2> <y2> <z2> <block> <dataValue|state> replace [replaceTileName] [replaceDataValue]

There is no [dataTag] for the block to fill in there, it's not supported with the replace argument.

The non-replace syntax is this:

fill <x1> <y1> <z1> <x2> <y2> <z2> <block> [dataValue|state] [oldBlockHandling] [dataTag]

that means you have to work around that if you want to use fill/replace with a dataTag, for example like this:

  • filling the areas air blocks with something you never need, like structure_voids,
  • then replace the iron_ore blocks with air and
  • then set the commandblock with fill/keep to replace all the air blocks.
  • last, remove the placeholder blocks
  • That was laggy. But still did not work. The only way I see it could not work is executing, because the command is too long. – HERECOMESTHEMONEY May 20 '17 at 23:57
  • too long? commandblocks have a limit of 35.000 characters, i doubt this command will get too long anytime soon. – Plagiatus May 21 '17 at 0:46
  • No, like the player executing a very long command due to the execute command. – HERECOMESTHEMONEY May 21 '17 at 13:08
  • it doesn't work like that. the moment it's run from a commandblock, even with execute on a player, the commandblock-rules apply and not the chat rules. make sure you actually run this in a commandblock. also, if that were the case, you'd get errors in the output. do you get any errors in the output? – Plagiatus May 22 '17 at 7:39
  • I just had the replace iron ore with air command backwards. It works perfectly now that I flipped it back around. – HERECOMESTHEMONEY May 22 '17 at 19:14

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.