2

Related: Can we please stop using block quotes for formatting Minecraft commands?

Can we please stop using inline code for full Minecraft commands? I notice a lot of people have been doing this, and you probably don't see it very much because I edit these a lot.

If I give you a command like this: /replaceitem entity @e[type=zombie,name="Hello I'm a zombie"] slot.weapon.mainhand 0 diamond_sword 1 0, it not only looks like trash but also wraps, a similar problem to the related question I mentioned earlier. I believe they should be formatted like this:

replaceitem entity @e[type=zombie,name="Hello I'm a zombie"] slot.weapon.mainhand 0 diamond_sword 1 0

Look! You can actually read it now! This is particularly confusing with Java NBT commands. Can we please do this? Most of the people who are typical answerers to command questions do this, but if you don't, this looks really bad ples never do this again I think you should change to this.

Here's how it's done:

It's either:

⏎
```
/a command
```
⏎

or:

⏎
␣␣␣␣a command
⏎

where represents a line feed and represents a space character.

  • What do you think about Java Edition, where commands can be rather long? Java Edition supports multiline to single line paste (line breaks and carriage returns are eliminated).
  • Also, what do you think about Bedrock Edition, where commands aren't really ever longer than the example command provided? Bedrock Edition does not support paste at all.

If you post a new answer, please try to address both of those issues above.

Notes

  • To be clear, I am only talking about full commands. For snippets like /tellraw and @e, inline code is not only preferred, but it is even weirder to use <pre> blocks for them.
  • Shift + Scroll does horizontal scroll.
10
  • 1
    I'm not familiar with Minecraft, so I'm curious: Can complex Minecraft commands be copy/paste into Minecraft as a multi-line paste or must it always be a single line? If it MUST be a single line then I agree with the rationale here. – Booga Roo May 9 at 10:58
  • 1
    @BoogaRoo Java does support this, however Bedrock edition doesn't support paste at all but they aren't nearly as complex and they're's no nesting. Java complex ones may be more up for debate but in terms of Bedrock they don't really get more complex than the example provided so I don't think there's a reason not to on the Bedrock side – Penguin May 10 at 2:14
  • 1
    I have altered the question a bit, and i know youre not really supposed to do that but it was very slight to hopefully more hit the question for specifics, if it really is that bad of a change someone can roll it back but I think its within reason – Penguin May 11 at 3:21
  • 2
    Look: I actually need to scroll to read it now. In case I want to retype this (SE open on a separate computer) I need to type the visible part, turn to the other computer, fiddle with the scrollbar, then find the point where I ended and type the rest. And if it's multiline, I need to scroll back to the beginning of the next line. – SF. May 11 at 8:27
  • @SF. but thats not what jnline code is fir, its in the name "inline" – Penguin May 11 at 15:49
  • @Penguin I couldn't care less what the intents of the designers of this site was originally. They've crammed so much useless junk onto the screen and made the actual content column so narrow that the code formatting results in less horizontal space than on a 60-column terminal. And while your sense of aesthetics may be offended by inline formatting, the actual usability of the site is damaged by the code formatting. In other words, you want us to switch from an unintended but fully functional feature to one that is intended and broken. – SF. May 11 at 16:27
  • @SF. I'm still not sure why you feel that code formatting is broken. What's wrong with scrolling? In most cases a scroll bar isnt even used, thats just for longer commands. Why should a short command ever use inline code? – Penguin May 11 at 20:18
  • @Sf. also even in the case of a longer command why not just add line breaks? – Penguin May 11 at 21:47
  • @ExpertCoder14 but that is explicitly said in the "Notes" section, how do I make it more clear? Im not trying to be smart I just dont know how to clarify that better, if you know how feel free to do it yourself if youd like – Penguin May 12 at 15:46
  • 1
    Does anyone have an opinion on points 1 and 2 as I feel like if that could be resolved it could help resolve other aspects involving the extremes. – Penguin May 14 at 22:30
9

I believe that this should be left up to discretion of the editors. Look at the following examples:

When I see:
Use /tellraw instead of /say.
I think:
Perfect.
When I see:
Here is my full command:
give @s minecraft:diamond_sword{display:{Name:"Awesome Sword"}}
I think:
Perfect.
When I see:
Here is my full command:

give @s minecraft:diamond_sword{display:{Name:"Awesome Sword"}}

I think:
That looks a little weird. I'll change it to preformatted text.

For small commands, like:

Your use of @e is wrong, it should be @a.

Inline code is highly preferred here.

When a full command is provided, preformatted text is better.

But, (and this is a big "but"):

When I see:
Here is my full command:
summon falling_block ~ ~1 ~ {Time:1,BlockState:{Name:redstone_block},Passengers:[{id:armor_stand,Health:0,Passengers:[{id:falling_block,Time:1,BlockState:{Name:activator_rail},Passengers:[{id:command_block_minecart,Command:'gamerule commandBlockOutput false'},{id:command_block_minecart,Command:'data merge block ~ ~-2 ~ {auto:0}'},{id:command_block_minecart,Command:'fill ~3 ~-1 ~2 ~8 ~6 ~-2 gray_stained_glass hollow'},{id:command_block_minecart,Command:'fill ~3 ~-1 ~2 ~8 ~-1 ~-2 smooth_stone_slab[type=top]'},{id:command_block_minecart,Command:'playsound block.piston.extend ambient @a'},{id:command_block_minecart,Command:'fill ~3 ~6 ~2 ~8 ~6 ~-2 smooth_stone_slab[type=bottom]'},{id:command_block_minecart,Command:'setblock ~4 ~ ~-1 repeating_command_block[facing=east]{Command:"tag @e[nbt={OnGround:1b,Item:{id:\\"iron_block\\",Count:4b}}] add irondoor1"}'},{id:command_block_minecart,Command:'data merge block ~4 ~ ~-1 {auto:1b}'},{id:command_block_minecart,Command:'setblock ~5 ~ ~-1 chain_command_block[facing=east]{Command:"tag @e[nbt={OnGround:1b,Item:{id:\\"sticky_piston\\",Count:2b}}] add irondoor2"}'},{id:command_block_minecart,Command:'data merge block ~5 ~ ~-1 {auto:1b}'},{id:command_block_minecart,Command:'setblock ~6 ~ ~-1 chain_command_block[facing=east]{Command:"execute at @e[tag=irondoor1] as @e[tag=irondoor2,distance=..1] run summon item ~ ~ ~ {Tags:[\\"itemkill1\\",\\"IronDoorSpawn\\"],PickupDelay:20,Item:{id:\\"minecraft:stray_spawn_egg\\",Count:1b,tag:{display:{Name:\\"{\\"text\\":\\"2 x 2 Iron Door\\"}\\"},HideFlags:1,EntityTag:{id:\\"minecraft:silverfish\\",NoAI:1b,NoGravity:1b,PersistenceRequired:1b,Silent:1b,Health:0}}}}"}'},{id:command_block_minecart,Command:'data merge block ~6 ~ ~-1 {auto:1b}'},{id:command_block_minecart,Command:'setblock ~ ~1 ~ command_block{auto:1,Command:"fill ~ ~ ~ ~ ~-2 ~ air"}'},{id:command_block_minecart,Command:'kill @e[type=command_block_minecart,distance=..1]'}]}]}]}
I think:
JUST PLAIN ANNOYING!!!

If your command gets so long that it would be annoying to scroll through it to find errors, a preformatted text block is just plain annoying. I know inline code wraps, but better that than scroll through it to find errors. So, I would prefer this:

Here is my full command:summon falling_block ~ ~1 ~ {Time:1,BlockState:{Name:redstone_block},Passengers:[{id:armor_stand,Health:0,Passengers:[{id:falling_block,Time:1,BlockState:{Name:activator_rail},Passengers:[{id:command_block_minecart,Command:'gamerule commandBlockOutput false'},{id:command_block_minecart,Command:'data merge block ~ ~-2 ~ {auto:0}'},{id:command_block_minecart,Command:'fill ~3 ~-1 ~2 ~8 ~6 ~-2 gray_stained_glass hollow'},{id:command_block_minecart,Command:'fill ~3 ~-1 ~2 ~8 ~-1 ~-2 smooth_stone_slab[type=top]'},{id:command_block_minecart,Command:'playsound block.piston.extend ambient @a'},{id:command_block_minecart,Command:'fill ~3 ~6 ~2 ~8 ~6 ~-2 smooth_stone_slab[type=bottom]'},{id:command_block_minecart,Command:'setblock ~4 ~ ~-1 repeating_command_block[facing=east]{Command:"tag @e[nbt={OnGround:1b,Item:{id:\\"iron_block\\",Count:4b}}] add irondoor1"}'},{id:command_block_minecart,Command:'data merge block ~4 ~ ~-1 {auto:1b}'},{id:command_block_minecart,Command:'setblock ~5 ~ ~-1 chain_command_block[facing=east]{Command:"tag @e[nbt={OnGround:1b,Item:{id:\\"sticky_piston\\",Count:2b}}] add irondoor2"}'},{id:command_block_minecart,Command:'data merge block ~5 ~ ~-1 {auto:1b}'},{id:command_block_minecart,Command:'setblock ~6 ~ ~-1 chain_command_block[facing=east]{Command:"execute at @e[tag=irondoor1] as @e[tag=irondoor2,distance=..1] run summon item ~ ~ ~ {Tags:[\\"itemkill1\\",\\"IronDoorSpawn\\"],PickupDelay:20,Item:{id:\\"minecraft:stray_spawn_egg\\",Count:1b,tag:{display:{Name:\\"{\\"text\\":\\"2 x 2 Iron Door\\"}\\"},HideFlags:1,EntityTag:{id:\\"minecraft:silverfish\\",NoAI:1b,NoGravity:1b,PersistenceRequired:1b,Silent:1b,Health:0}}}}"}'},{id:command_block_minecart,Command:'data merge block ~6 ~ ~-1 {auto:1b}'},{id:command_block_minecart,Command:'setblock ~ ~1 ~ command_block{auto:1,Command:"fill ~ ~ ~ ~ ~-2 ~ air"}'},{id:command_block_minecart,Command:'kill @e[type=command_block_minecart,distance=..1]'}]}]}]}

but I do agree that this still has its downsides.

In fact, here's something that is even better. Organize your NBT in a very perfect way:

Here is my full command:
summon falling_block ~ ~1 ~
{
  Time: 1,
  BlockState: {
    Name: "redstone_block"
  },
  Passengers: [
    {
      id: "armor_stand",
      Health: 0,
      Passengers:[
        {
          id: falling_block, Time:1, BlockState: {Name:activator_rail},
          Passengers:[
            {id:command_block_minecart,Command:'gamerule commandBlockOutput false'},
            {id:command_block_minecart,Command:'data merge block ~ ~-2 ~ {auto:0}'},
            {id:command_block_minecart,Command:'fill ~3 ~-1 ~2 ~8 ~6 ~-2 gray_stained_glass hollow'},
            {id:command_block_minecart,Command:'fill ~3 ~-1 ~2 ~8 ~-1 ~-2 smooth_stone_slab[type=top]'},
            {id:command_block_minecart,Command:'playsound block.piston.extend ambient @a'},
            {id:command_block_minecart,Command:'fill ~3 ~6 ~2 ~8 ~6 ~-2 smooth_stone_slab[type=bottom]'},
            {id:command_block_minecart,Command:'setblock ~4 ~ ~-1 repeating_command_block[facing=east]{Command:"tag @e[nbt={OnGround:1b,Item:{id:\\"iron_block\\",Count:4b}}] add irondoor1"}'},
            {id:command_block_minecart,Command:'data merge block ~4 ~ ~-1 {auto:1b}'},
            {id:command_block_minecart,Command:'setblock ~5 ~ ~-1 chain_command_block[facing=east]{Command:"tag @e[nbt={OnGround:1b,Item:{id:\\"sticky_piston\\",Count:2b}}] add irondoor2"}'},
            {id:command_block_minecart,Command:'data merge block ~5 ~ ~-1 {auto:1b}'},
            {id:command_block_minecart,Command:'setblock ~6 ~ ~-1 chain_command_block[facing=east]{Command:"execute at @e[tag=irondoor1] as @e[tag=irondoor2,distance=..1] run summon item ~ ~ ~ {Tags:[\\"itemkill1\\",\\"IronDoorSpawn\\"],PickupDelay:20,Item:{id:\\"minecraft:stray_spawn_egg\\",Count:1b,tag:{display:{Name:\\"{\\"text\\":\\"2 x 2 Iron Door\\"}\\"},HideFlags:1,EntityTag:{id:\\"minecraft:silverfish\\",NoAI:1b,NoGravity:1b,PersistenceRequired:1b,Silent:1b,Health:0}}}}"}'},
            {id:command_block_minecart,Command:'data merge block ~6 ~ ~-1 {auto:1b}'},
            {id:command_block_minecart,Command:'setblock ~ ~1 ~ command_block{auto:1,Command:"fill ~ ~ ~ ~ ~-2 ~ air"}'},
            {id:command_block_minecart,Command:'kill @e[type=command_block_minecart,distance=..1]'}
          ]
        }
      ]
    }
  ]
}
That was my full NBT data, and each of those passengers is one command block minecart. Now, here is the NBT of the command block minecart I need help with, and here is each individual layer:
# NBT of command block Minecart

{
  id: "command_block_minecart",
  Command:'<A>'
}

# A: Command in the command block minecart

setblock ~6 ~ ~-1 chain_command_block[facing=east]{Command:"<B>"}

# B: Command in the chain command block:

execute at @e[tag=irondoor1] as @e[tag=irondoor2,distance=..1] run summon item ~ ~ ~ {Tags:["itemkill1","IronDoorSpawn"],PickupDelay:20,Item:{id:"minecraft:stray_spawn_egg",Count:1b,tag:{display:{Name:"<D>"},HideFlags:1,EntityTag:{id:"minecraft:silverfish",NoAI:1b,NoGravity:1b,PersistenceRequired:1b,Silent:1b,Health:0}}}}

# C: JSON text for the item name

{"text":"2 x 2 Iron Door"}

What escape sequence do I need to put on the quotation marks in C, so that I can nest C inside B, and B inside A?

10
  • 2
    First one: I should have specified, I agree; Second and third: i agree, fourth: I agree, fifth: I def disagree! I'll edit it to show how bad it looks. There. How does that not look bad? (no offense to you of course) – Penguin May 8 at 18:05
  • 4
    @Penguin I don't care if it looks ugly. I just don't want to have to scroll through an awful mess like that. I'd prefer that extra long commands should wrap, not scroll, and an inline code is the only way to do that. – ExpertCoder14 May 8 at 18:47
  • 1
    @Penguin Hey, it's been a few hours, I just want to check in to see if you have anything else to say on that. I've replied but you haven't responded to it yet. I would like to hear your side of the story, because your silence so far makes me feel like you still disagree, and I would like to learn more about that. If you want, we can continue this discussion in the Minecraft Talk chatroom, but I don't want to oblige to anything yet. – ExpertCoder14 May 9 at 5:15
  • 1
    I still disagree because it makes you have to scroll a lot and go past the page. However, I don't think that really matters. How often does that even come up? When I wrote this question, I was more referring to a normal full command. I think I've maybe seen an answer like that once and all in all the cases where it shows up is so minimal that I think in the case of that last one whoever is posting could pick if they really wanted to. I'm more talking about stuff like in my question's example because I think this is a rather extreme case – Penguin May 9 at 7:43
  • 1
    @Penguin I added one last paragraph at the end of my answer. Do you agree with it? – ExpertCoder14 May 10 at 19:44
  • 1
    yes, and Im pretty sure this could just be done automatically with something like JSON lint. I doubt anyone is hand-typing commands that long for an answers, so I think that that person should be left to do something of that sort. So are we in agreement then that in Bedrock Edition there is no reason to ever use inline code formatting? Even can_place_ons etc. aren't even close to that long – Penguin May 11 at 3:19
  • 1
    @Penguin Wait this whole discussion was only about BE the whole time? Does that mean all those JE examples I listed are invalid? – ExpertCoder14 May 11 at 3:44
  • no no its about both – Penguin May 11 at 15:47
  • @Penguin After thinking long and hard, see the bottom blockquote. This, in my opinion, is as good as it'll get. – ExpertCoder14 Jun 27 at 3:52
  • I like that last one, yes :) – Penguin Jun 27 at 19:58
1
Replying to the last comment as answer to make full advantage of the formatting.  First off, unless the cut is halfway through a letter you're likely to miss there even is more to the command - the tail will just be invisible with no clear clue it's even there. 
Next, just loaded this answer on my Linux netbook and there's no scrollbar. The only way to access the rest is through dragging a selection. 
Next - imagine you're trying to read a book through a slit that only shows half the page width. It would be absolutely infuriating. 

And to answer - you ask why should a short command ever be inline? Well, let's discuss the differences between commands enabling communication between users, like

/say

, its variant

/me

, the family of

/tell

, including its shortcut

/w

, the special variant

/tellraw

and the variant

/msg

never mind the removed

/broadcast

and of course

/teammsg

alias

/tm

and potentially

/title

and

/titeraw                                                                        combined with /execute as target_player run

. Still in mood to discuss them? Or maybe there are situations where putting them inline would be preferable?

Edit: regarding the last comment about line breaks. Let's say someone had the base griefed - lava poured all over. The user has access to commands and asks for a command to remove all that lava. Tell me the difference between /fill ~ ~ ~ ~30 ~30 ~30 minecraft:air replace minecraft:lava versus

/fill ~ ~ ~ ~30 ~30 ~30 minecraft:air 
replace minecraft:lava

in particular, when copy-pasting the commands.

7
  • the last point: the second one looks better, the second point: okay? i dont see a problem, as for the first point if ppl on SO can figure out how to scroll I think we can too. We can use line breaks as you said last – Penguin May 11 at 23:09
  • Also ever heard of shift + scroll? – Penguin May 11 at 23:10
  • Also do pls read my note that i had already written in the center about portions of commands – Penguin May 11 at 23:19
  • @Penguin The last point, if you didn't realize, the base looks better in case of the first one. The second one will first indiscriminately erase everything and then loudly announce to all players that "replace minecraft:lava" – SF. May 11 at 23:50
  • it won't though, in terms of a command block. In terms of extremely long commands (max chat length is 256) that's completely okay, although you do have a fine point. Do you have a response to my other points then? Most of the body of this was already addressed in my question, but you didn't read it, misunderstood, etc. im not sure which – Penguin May 12 at 1:03
  • @Penguin In terms of commands as typed/pasted by the player into command line, as is the obvious usage pattern for the presented scenario, it will. Regarding shift-scroll, I didn't know until your post. So, should we add a help balloon to all the code fields for all these who don't know? And as for the "portion of one" - would it really change my example if I replaced all the /say with /say Hi or /tell Bob Hi ? – SF. May 12 at 11:18
  • yes it does because of the context surrounding it. The one command is meant to be a full and possibly explained command while the other one is just an incomplete portion. This does matter for both emphasis purposes and it looks a lot better – Penguin May 12 at 15:47

You must log in to answer this question.

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