Updated:
1. Stack ender pearls to 64
/give @s minecraft:ender_pearl[max_stack_size=64] 64
max_stack_size goes from 1 to 99, so snowballs and eggs can stack past 16.
2. One per slot
/give @s minecraft:diamond[max_stack_size=1] 5
Each diamond takes its own slot, handy for one-per-player items.
3. Stackable swords
/give @s minecraft:diamond_sword[!max_damage,max_stack_size=16] 16
Items with durability cannot stack. A ! before a component name removes it, so the sword loses durability, never breaks and can stack.
4. A tool that breaks after five uses
/give @s minecraft:diamond_pickaxe[max_damage=5]
5. Hand out a worn item
/give @s minecraft:diamond_sword[damage=1500]
A diamond sword has 1561 durability, so this one has about 61 uses left. Use unbreakable={} for the opposite (strongest sword).
6. Stack potions and totems
/give @s minecraft:potion[potion_contents={potion:"minecraft:healing"},max_stack_size=16] 16
/give @s minecraft:totem_of_undying[max_stack_size=8] 8
Potions and totems have no durability, so max_stack_size alone lets them stack. See the potion give command and the totem command.
7. Change the item in your hand
/item modify entity @s weapon.mainhand {function:"minecraft:set_components",components:{"minecraft:max_stack_size":64}}
Instead of giving a new item, this sets the stack size of the item in your main hand to 64. Useful for items you already have (Java 1.20.5+).
8. 1.20.4 and older
/give @s minecraft:diamond_sword{Damage:1500}
Only the damage could be set; stack size and max durability could not (NBT vs components).
Troubleshooting
- Error on max_stack_size: damageable items must stay at 1 unless you add
!max_damage. - Over 99: 99 is the cap.
- Bedrock: not supported.
Check your command
The Command Error Doctor checks common syntax mistakes in your browser.