minecraftminecraft-commands

Why won't my setblock command which summons a chest put the items inside I told it too?


So I am making a Minecraft command with /setblock. It is supposed to put a 32K diamond sword in the first slot, and a 32K diamond axe on the second slot. Here is my command (it's ver big):

setblock ~ ~1 ~ chest{Items:[{id:"diamond_sword",slot:0,Count:1,tag:{Enchantments:[{id:"bane_of_arthropods",lvl:32768},{id:"fire_aspect",lvl:32768},{id:"knockback",lvl:32768},{id:"mending",lvl:32768},{id:"sharpness",lvl:32768},{id:"smite",lvl:32768},{id:"sweeping_edge",lvl:32768},{id:"unbreaking",lvl:32768}]}},{id:"diamond_axe",slot:1,Count:1,tag:{Enchantments:[{id:"bane_of_arthropods",lvl:32768},{id:"efficiency",lvl:32768},{id:"mending",lvl:32768},{id:"sharpness",lvl:32768},{id:"silk_touch",lvl:32768},{id:"smite",lvl:32768},{id:"unbreaking",lvl:32768}]}}]} replace

This however, only puts the 32K axe in the first slot, not the 32K sword in the first, and the 32K axe in the second. Please help!


Solution

  • You need a "b" after the slot number. Try the following:

    setblock ~ ~1 ~ minecraft:chest{Items:[{Slot:0b,id:"minecraft:diamond_sword",Count:1b,tag:{Enchantments:[{lvl:32768,id:"bane_of_arthropods"},{lvl:32768,id:"fire_aspect"},{lvl:32768,id:"knockback"},{lvl:32768,id:"mending"},{lvl:32768,id:"sharpness"},{lvl:32768,id:"smite"},{lvl:32768,id:"sweeping_edge"},{lvl:32768,id:"unbreaking"}]}},{Slot:1b,id:"minecraft:diamond_axe",Count:1b,tag:{Enchantments:[{lvl:32768,id:"bane_of_arthropods"},{lvl:32768,id:"efficiency"},{lvl:32768,id:"mending"},{lvl:32768,id:"sharpness"},{lvl:32768,id:"silk_touch"},{lvl:32768,id:"smite"},{lvl:32768,id:"unbreaking"}]}}]}
    

    Also consider posting on gaming.stackexchange.com in the future.