How would I give an item to a specific slot? I want to avoid /replaceitem because I want the items to stack. In the map I am making, I /replaceitem a single arrow every few seconds, but I want to have the max they can hold 2 arrows instead of 1.

If I were to do this, I would assume this creates a problem where they would just be able to rack up more than two arrows if they didn't use them before they get another. How do I get around this?

  • I'm not quite understanding your first question; it sounds like you want to both be able to set an item into a specific slot but also not do that at the same time. If you wanted items to stack automatically with other items in the inventory regardless of what slot they're in, /give does this already. If you wanted to restrict the items to a specific slot as defined by you, then /replaceitem does this. Are you asking how to group together all of an item in the player's inventory into a single stack and then move it to a specific slot?
    – Skylinerw
    Jan 12 '17 at 12:19

I'm not exactly sure what you mean by "if I were to do this," but if I'm understanding you correctly, use /replaceitem for the first arrow and /give for the second. The second arrow will automatically stack with the first. Then, assuming the arrows are still in the same inventory slot, the next time /replaceitem runs it will replace the stack of two arrows with a single arrow, keeping players from saving up extras.

Of course, people could rack up arrows by moving them to a different inventory slot between command runs, but then, if I understand your system, that's also possible the way you have it implemented now.

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.