2

Originally asked as the second question of Why is the /enchant command giving me an error when I go outside the normal level bounds?:

Also, is there a way to get stacked armor pieces and stacked tools using commands? I'm on an aternos server, so it might be hard to find wherever that file is to edit the world, but I don't wanna have to do that. Can you use commands?

2 Answers 2

6

Although the /give command enforces stacking restrictions, you can work around them by manually summoning item entities using the /summon command. For example, the following command will summon a stack of 64 diamond pickaxes, which will remain stacked to 64 when you pick them up.

/summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:diamond_pickaxe",Count:64b}}

The Count value can be anything from 1 to 64 (stacks bigger than 64 are automatically split up into stacks of 64 when you pick up the item).

Note that this has some surprising results. For example, if you mine with a stack of tools, and use one tool up fully, then you are left with a stack of undamaged tools one fewer in quantity, but if you split the stack into two stacks, both retain their damage value.

1
  • that observation with splitting vs. consumption was extra helpful. I think the splitting behavior might be a leftover from when item types were differentiated by metadata numbers, whereas the other behavior has no reason to destroy the whole stack when a decrement operation just "makes sense"? I'm kind of curious what the code looks like and if it acts the same way before and after The Flattening... Sep 23, 2021 at 15:21
-1

You can also use: /replaceitem entity @p slot.hotbar.1 64 It’s untested though

1
  • Hi Matthew! I Do you mean you didn't test it? If that's the case, why post it as an answer?
    – Joachim
    Jun 28, 2021 at 6:04

You must log in to answer this question.

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