[1.13 guide] How to 'translate' 1.12 commands?

Discussion in 'General Minecraft Discussion' started by ShelLuser, Aug 17, 2018.

  1. Hi gang!

    It's been quite a while since I had the chance to spend some quality time on Minecraft, messing about on 1.13 as I write this. One of the things I enjoy very much about Minecraft is it's insane ability to tweak stuff; the stuff you can do with commands is sometimes honestly overwhelming.

    For example, one of my favorite home brewed gizmo's is a spawn egg that spawns a Llama which already has a few items on it: a pink carpet (which in itself has also been transformed into a special item) and it wears a chest which contains yet another special item:

    In case you're interested, this is the 1.12 command I used to create it. Keep in mind that you need to add this to a function (not a command block!) before it will fully work, this is mostly because of the strange characters I used to enforce all the colors:

    give @s minecraft:spawn_egg 1 0 {EntityTag:{id:"minecraft:llama",Tame:1,Temper:
    Count:1,tag:{display:{Name:"§aAya's cloth",Lore:["§3§ob/c Llamas are cool! ^.
    ^","§6§lSpecial Server Stuff","§b§l§oUnbreakable"]},ench:[{id:71,lvl:1}],Un
    play:{Name:"§a§lAyanamiKun's head",Lore:["§5§lStaff head","§6§lSpecial Ser
    ver Stuff","§4§oCursed!"]},ench:[{id:10,lvl:1}],HideFlags:1}}]},display:{Name:
    "§d§l§oLlamayamiKun",Lore:["§a§oAyanamiKun's pet","§6§lSpecial Server Stu
    As you probably know 1.13 has been released some time ago and one of the major changes it introduced was a complete rehaul of the command set. In other words: the command above doesn't work anymore. So let's fix that!

    Step 1: What exactly has changed?

    The first thing to determine are some of the things which have changed. For starters: in 1.12 every spawn egg is basically the same item ('minecraft:spawn_egg') with the major difference that it contains a few specific properties (see the command above: to spawn a Llama I had to set a specific EntityTag and specify minecraft:llama as the Id). In 1.13 every spawn is unique, to spawn a Llama I need: minecraft:llama_spawn_egg.

    The same applies to heads. In 1.12 all heads (skeleton, zombie, etc.) share the same id: 'minecraft:skull'. In 1.13 you get a player head by specifying it: 'minecraft:player_head'.

    Another very noticeable change is the location of the NBT section. In 1.12 a command roughly follows this pattern:

    <command> <parameter> <option(s)> <nbt>

    For example: /give @p diamond_sword 1 {Ench:[{id:34,lvl:1}]}

    In 1.13 however the NBT section is now usually specified right behind the item it addresses:

    Like so: /give @p diamond_sword{Enchantments:[{id:"minecraft:unbreaking",lvl:1}]}

    We can also immediately notice yet another change: instead of using numerical id's for the enchantment I had to write it all down.

    And another important issue: several name sections use strict JSON formatting in 1.13, this means that we can actually use color in names, even in vanilla!

    Of course there are also several details which haven't changed. Like properties such as HiddenFlags or Unbreaking for example.

    Step 2: Break down your problem into smaller parts

    The command I shared above is pretty big. Basically it generates 3 specific items combined:
    • An AyanamiKun head with special properties (colored names and a hidden enchantment).
    • A carpet with special properties (colored names and an some enchantments (also hidden ones)).
    • A llama spawn egg with special properties (colored name and a hidden enchantment).
      • It also spawns a Llama which has properties of its own: colored name, a chest with items and specific settings (like being tamed).
    So instead of trying to 'translate' that huge command at one go we're going to do something much smarter: we take one step at a time.

    Also important!

    Please note that breaking things down into smaller parts applies to everything, including the individual commands themselves. I'll demonstrate this in a moment as well.

    Step 2a: Getting a customized player head

    I want to get Aya's head, but it needs the following extra properties:
    • A renamed name with a green color, but no italic.
    • Colored lore.
    • A hidden enchantment: curse of vanishing (it was binding, but this is more fair).
    The good news is that we can do most of this stuff in vanilla, everything except the colored lore. So we'll save that part for when we'll put the finished command into a function. And about those color codes, I'm using the Minecraft wiki page on color codesto translate those.

    First I start with the head itself, this should be easy: /give @p player_head{SkullOwner:"AyanamiKun"}.

    Then we need a colored name (and some lore). For this we need to set up a display:{} section:
    display:{Name:"{\"text\":\"AyanamiKun's head\",\"color\":\"green\",\"bold\":true,\"italic\":false}",Lore:["Staff head","Special Server Stuff","Cursed!"]}
    Next is the enchantment (which I'll combine with the HideFlag property to keep things hidden). We need to set up an enchantments:[] section:
    If we then combine all of this we get the following:

    /give @p minecraft:player_head{SkullOwner:"AyanamiKun",display:{Name:"{\"text\":\"AyanamiKun's head\",\"color\":\"green\",\"bold\":true,\"italic\":false}",Lore:["Staff head","Special Server Stuff","Cursed!"]},Enchantments:[{id:"minecraft:vanishing_curse",lvl:1}],HideFlags:1}
    Note: this command can be used within a command block. In fact, that's exactly where I'm storing all the individual parts before I eventually combine the whole lot into a function.

    How to find out about the different enchantment names you may wonder? Easy: use the /enchant command. In 1.13 nearly everything can be found by command completion, including enchantment names.

    Step 2b: Getting a customized carpet

    This step is actually pretty much the same as the player head above. The main things we need to keep in mind is that we no longer need to specify the color of the carpet using the Damage property, instead we can just use: 'minecraft:pink_carpet'.


    /give @p minecraft:pink_carpet{display:{Name:"{\"text\":\"Aya's cloth\",\"color\":\"green\",\"italic\":false}",Lore:["b/c Llamas are cool! ^.^","Special Server Stuff","Unbreakable"]},Enchantments:[{id:"minecraft:vanishing_curse",lvl:1}],Unbreakable:true,HideFlags:4}
    Seems pretty casual, right?

    Step 2b: Getting the Llama spawn egg

    And now for the final part. Because I've already demonstrated how to set up colored names for an item itself I'll skip that part and instead only concentrate on the llama we're going to spawn. To set up properties for the entity which the spawn egg is going to summon you need to use the EntityTag:{} section (this hasn't changed much since 1.12).

    For the first step we'll set up the name and some properties, but nothing which includes the previous items just yet:

    /give @p llama_spawn_egg{EntityTag:{CustomName:"{\"text\":\"LlamayamiKun\",\"color\":\"light_purple\",\"bold\":true,\"italic\":false}",Tame:1,Temper:1,ChestedHorse:1,Variant:1,Strength:5},display:{Name:"{\"text\":\"LlamayamiKun egg\",\"color\":\"light_purple\",\"bold\":true}",Lore:["AyanamiKun's pet","Special Server Stuff"]},Enchantments:[{id:"minecraft:unbreaking",lvl:5}],HideFlags:1}
    So: we get a renamed llama spawn egg 'LlamayamiKun egg' (with colors and an hidden enchantment for the glimmering effect) and when you use it you'll spawn a white llama with a bold pink name ('LlamayamiKun') and some specific features (like having chests, being tame and having a strength of 5).

    As you can see: it has no carpet yet!

    Step 3: Combining all of our hard work!

    So now we finished all three of our needed commands, and we're ready to combine them into one so that we'll spawn a Llama with a carpet and Aya's head stored in its chest.

    Step 3a: Adding the carpet

    To specify what item a Llama is wearing you'll need to set the DecorItem property. We need to specify an id to identify the item and then we can use the tag:{} property to add more properties for that specific item. So: we can simply copy the NBT section from the carpet command above and paste it right into the tag:{} section.

    Step one, specify the carpet:

    DecorItem:{id:"minecraft:pink_carpet",tag:{display:{Name:"{\"text\":\"Aya's cloth\",\"color\":\"green\",\"italic\":false}",Lore:["b/c Llamas are cool! ^.^","Special Server Stuff","Unbreakable"]},Enchantments:[{id:"minecraft:vanishing_curse",lvl:1}],Unbreakable:true,HideFlags:4}
    Step two, copy it into our existing spawn egg command:

    /give @p llama_spawn_egg{EntityTag:{CustomName:"{\"text\":\"LlamayamiKun\",\"color\":\"light_purple\",\"bold\":true,\"italic\":false}",DecorItem:{id:"minecraft:pink_carpet",Count:1,tag:{display:{Name:"{\"text\":\"Aya's cloth\",\"color\":\"green\",\"italic\":false}",Lore:["b/c Llamas are cool! ^.^","Special Server Stuff","Unbreakable"]},Enchantments:[{id:"minecraft:vanishing_curse",lvl:1}],Unbreakable:true,HideFlags:4}},Tame:1,Temper:1,ChestedHorse:1,Variant:1,Strength:5},display:{Name:"{\"text\":\"LlamayamiKun egg\",\"color\":\"light_purple\",\"bold\":true}",Lore:["AyanamiKun's pet","Special Server Stuff"]},Enchantments:[{id:"minecraft:unbreaking",lvl:5}],HideFlags:1}
    Step 3b: Adding Aya's head

    Just like before, but this time we need to specify a list of items using the Items:[] section. We need to specify an id ('minecraft:player_head'), amount ('Count') and a slot number because I want the head to be placed in the middle of the chest ('Slot:9b'). And just like before we can use a tag:{} section to specify more properties of the head, and for that we'll once again copy & paste the NBT section which we set up earlier.

    Step one, specify the list:

    Items:[{id:"minecraft:player_head",Count:1,Slot:9b,tag:{SkullOwner:"AyanamiKun",display:{Name:"{\"text\":\"AyanamiKun's head\",\"color\":\"green\",\"bold\":true,\"italic\":false}",Lore:["Staff head","Special Server Stuff","Cursed!"]},Enchantments:[{id:"minecraft:vanishing_curse",lvl:1}],HideFlags:1}}]
    Step two, copy it into our previous spawn egg command (the one with the carpet):

    /give @p llama_spawn_egg{EntityTag:{CustomName:"{\"text\":\"LlamayamiKun\",\"color\":\"light_purple\",\"bold\":true,\"italic\":false}",DecorItem:{id:"minecraft:pink_carpet",Count:1,tag:{display:{Name:"{\"text\":\"Aya's cloth\",\"color\":\"green\",\"italic\":false}",Lore:["b/c Llamas are cool! ^.^","Special Server Stuff","Unbreakable"]},Enchantments:[{id:"minecraft:vanishing_curse",lvl:1}],Unbreakable:true,HideFlags:4}},Items:[{id:"minecraft:player_head",Count:1,Slot:9b,tag:{SkullOwner:"AyanamiKun",display:{Name:"{\"text\":\"AyanamiKun's head\",\"color\":\"green\",\"bold\":true,\"italic\":false}",Lore:["Staff head","Special Server Stuff","Cursed!"]},Enchantments:[{id:"minecraft:vanishing_curse",lvl:1}],HideFlags:1}}],Tame:1,Temper:1,ChestedHorse:1,Variant:1,Strength:5},display:{Name:"{\"text\":\"LlamayamiKun egg\",\"color\":\"light_purple\",\"bold\":true}",Lore:["AyanamiKun's pet","Special Server Stuff"]},Enchantments:[{id:"minecraft:unbreaking",lvl:5}],HideFlags:1}
    And we're almost done!

    Step 3c: Adding color to the Lore

    The only thing we need now is to add some color to the lore sections. Unfortunately this can't be done using vanilla commands, but luckily for us the trick with specifying color codes within the function still works. In case you're not familiar with it: §. First: alt-0194, then alt-21. This can be placed in front of some text within a function and it behaves just like on the Empire when you're using & to specify a color.

    But there's more... In order to use functions within 1.13 you're going to need to set up a datapack. Now, this tutorial is already pretty long so I won't be explaining that part here, I suggest you use the Minecraft wiki for that; this page about datapacks.

    Which brings us to the final command:
    give @s llama_spawn_egg{EntityTag:{CustomName:"{\"text\":\"LlamayamiKun\",\"color\":\"light_purple\",\"bold\":true,\"italic\":false}",DecorItem:{id:"minecraft:pink_carpet",Count:1,tag:{display:{Name:"{\"text\":\"Aya's cloth\",\"color\":\"green\",\"italic\":false}",Lore:["§3§ob/c Llamas are cool! ^.^","§6§lSpecial Server Stuff","Unbreakable"]},Enchantments:[{id:"minecraft:vanishing_curse",lvl:1}],Unbreakable:true,HideFlags:4}},Items:[{id:"minecraft:player_head",Count:1,Slot:9b,tag:{SkullOwner:"AyanamiKun",display:{Name:"{\"text\":\"AyanamiKun's head\",\"color\":\"green\",\"bold\":true,\"italic\":false}",Lore:["§5§lStaff head","§6§lSpecial Server Stuff","§4§oCursed!"]},Enchantments:[{id:"minecraft:vanishing_curse",lvl:1}],HideFlags:1}}],Tame:1,Temper:1,ChestedHorse:1,Variant:1,Strength:5},display:{Name:"{\"text\":\"LlamayamiKun egg\",\"color\":\"light_purple\",\"bold\":true}",Lore:["§a§oAyanamiKun's pet","§6§lSpecial Server Stuff"]},Enchantments:[{id:"minecraft:unbreaking",lvl:5}],HideFlags:1}
    Step 4: Showing off our work! (trying to) ;)

    So now that it finally works on 1.13 it's time to demonstrate all the hard work :)

    Oh dear... :confused:

    Hmm, maybe I could write a tutorial to explain all the work I had to do to make that work :D

    And there you have it!

    I hope this can be useful for some of you.