I would like to use command blocks to swap the contents of two specific inventory slots dynamically, while retaining the item, data value, and stack size. I know it is possible to set a slot to contain a specific item, but I am unsure as to whether or not it is possible to switch them (without a ridiculous amount of command blocks, accounting for every possible item in the game). Is this possible?

  • Can you detect what is in a slot and store it in a scoreboard? Spoiler: Haven't used cmds in a while – rivermont - Will B. Jul 10 '16 at 1:44
  • @rivermont-WillB. Not that I know of. – 2Cubed Jul 10 '16 at 1:54
  • I'll go and investigate, do you have a limit on how many command blocks you are willing to use? – flare servers Jun 27 '18 at 14:49

You can use a mod to do it. For example, hotbarswapper. It involves no command blocks just if you want to use it on a real server like Hypixel or Mineplex you will most likely be banned for "unauthorized mods." By holding Ctrl and scrolling, you can swap the bars in your inventory, up or down.


I can't remember whether the 10th hotbar slot came up in 1.9 or 1.10, but if you are running one of those you can press F (or your set button) to toggle the blocks in your hand and the 10th slot.

  • 1
    This works, but it's not what I'm asking for. I want to do this for any two slots using a command block, as indicated by the minecraft-commands tag. – 2Cubed Jul 15 '16 at 4:28
  • BTW, it's 1.9. I haven't played MC since the 1.9 betas, and I remember being amazed at the 10th slot and the new arrows (and shulkers). – NoOneIsHere Apr 2 '17 at 17:00
  • it was 1.9, along with shields and attack speeds. – Diriector_Doc Oct 19 '17 at 16:19

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.