/give
/give| Permission level required |
|
|---|---|
| Restrictions |
Cheat only |
{
"title": "<code>/give</code>",
"rows": [
{
"field": "\n* 2 <sup class=\"noprint nowrap Inline-Template \" title=\"\">[<i><span title=\"This statement only applies to Java Edition\">(link to Java Edition article, displayed as JE) only</span></i>]</sup>\n* 1 <sup class=\"noprint nowrap Inline-Template \" title=\"\">[<i><span title=\"This statement only applies to Bedrock Edition\">(link to Bedrock Edition article, displayed as BE) only</span></i>]</sup>",
"label": "(link to Permission level article, displayed as Permission level<br>required)"
},
{
"field": "(link to Options article, displayed as Cheat) only<sup class=\"noprint nowrap Inline-Template \" title=\"\">[<i><span title=\"This statement only applies to Bedrock Edition\">(link to Bedrock Edition article, displayed as BE) only</span></i>]</sup>",
"label": "(link to Commands#Restrictions article, displayed as Restrictions)"
}
],
"invimages": [],
"images": []
}
Gives a specified amount of a certain item to one or more players.
Usage
Gives the specified item(s) to the target(s). If <targets> or player: target resolves to multiple targets, each receives the specified number of items.
If there is enough room in the player's inventory, or the player is in creative mode, gives the specified item(s). In Java Edition, this also summons a "fake" item entity, with its PickupDelay tag set to 32767 and its Age tag set to 5999, which would make it impossible to be picked up, and have it despawn within one tick.
If there is not enough room in the player's inventory, and the player is not in creative mode, gives the specified item(s) until the inventory is full, and summons the rest items as a item entity dropped by the player. In Java Edition, the item's Owner tag is set to the target and its PickupDelay tag is set to 0 so that it can be picked up only by that player at any time. In Bedrock Edition, the item entity is dropped by the player as normal, having a 10-tick pickup delay and being able to be picked up by any entity. In Bedrock Edition, when dropping the item entity, the item using progress of the player is discarded. In Bedrock Edition, the "Use doors and switches" option (in the "Player Permission" screen) disables the player to drop any item entity, even caused by the /give command.
Syntax
- Java Edition
give <targets> <item> [<count>]
- Bedrock Edition
give <player: target> <itemName: Item> [amount: int] [data: int] [components: json]
Arguments
JE: <targets>: entity
BE: player: target: CommandSelector<Player>
- Specifies the target(s) to give item(s) to.
- Must be a player name, a target selector or a UUID. And the target selector must/should be of player type. In Bedrock Edition, the target selector should be of player type.
JE: <item>: item_stack
BE: itemName: Item: enum
- Specifies the item to give.
- In Java Edition, it must be in the format of
item_id[data_components], in which[data_components]can be omitted when they are not needed. See minecraft:item_stack for details. In Bedrock Edition, it must be an item id or a block id for which the item form exist.
JE: <count>: integer
BE: amount: int: int
- Specifies the number of items to give. If not specified, defaults to
1. - Must be a [Int]32-bit integer number (from -2147483648 (-231) to 2147483647 (231-1) ). In Java Edition, it must be between 1 and 2147483647 (inclusive). In Bedrock Edition, it should be between 1 and 32767 (inclusive).
- Specifies the item data value of the given item(s). Values that are invalid for the specified item id revert to 0. If not specified, defaults to 0.
- Must be a [Int]32-bit integer number (from -2147483648 (-231) to 2147483647 (231-1) ). It should be between 0 and 32767 (inclusive).
BE: components: json: Json::Value
- Specifies the item components of the given item(s). Like data tags but supports only
minecraft:can_place_on,minecraft:can_destroy,minecraft:item_lock, andminecraft:keep_on_deathfunctions (see #Examples). - It must be a JSON [NBT Compound / JSON Object]Object.
Result
| Command | Trigger | Java Edition | Bedrock Edition |
|---|---|---|---|
| Any | The command is incomplete, or any argument is not specified correctly. | Unparseable | Unparseable |
player: target is a target selector that is not of player type. | N/A | Failed | |
amount: int is not between 1 and 32767. | |||
data: int is not between 0 and 32767. | |||
components: json is not an item components. | |||
<targets> or player: target fails to resolve to one or more online players. | Failed | ||
<item> or itemName: item is an ungivable item. | |||
<count> is larger than 100 stack worth items. | N/A | ||
| Otherwise | Successful | ||
Output
| Command | Edition | Situation | Success Count | /execute store success ... | /execute store result ... |
|---|---|---|---|---|---|
| Any | Java Edition | On fail | 0 | 0 | N/A |
| On success | 1 | 1 | the number of targeted players | ||
| Bedrock Edition | On fail | 0 | N/A | N/A | |
| On success | the number of players who are given item(s) | N/A | N/A |
Examples
- To give the nearest player a pig spawn egg:
/give @p pig_spawn_egg
- To give the nearest player a diamond sword with Lore that says "A legendary weapon":
/give @p diamond_sword[lore=["A legendary weapon"]] 1
- To give all players a potion that has the Night Vision effect:
/give @a potion[potion_contents={potion:"minecraft:night_vision"}] 1/give @a potion 1 5
- To give a random player a Sharpness X diamond sword:
/give @r diamond_sword[enchantments={"minecraft:sharpness":10}] 1
- To give the player executing the command a block of diamond that can be placed on dirt and can break quartz blocks, even in adventure mode.
/give @p diamond_block[can_place_on={blocks:"dirt"},can_break={blocks:"quartz_block"}] 1/give @s diamond_block 1 0 {"minecraft:can_place_on":{"blocks":["dirt"]},"minecraft:can_destroy":{"blocks":["quartz_block"]}}
- To give all players a level 2 Wither Potion with Knockback X:
/give @a potion[enchantments={"minecraft:knockback":10},potion_contents={custom_effects:[{id:"minecraft:wither",amplifier:1,duration:3600}]}] 1
- To give the nearest player a diamond sword that is not dropped upon death:
/give @p diamond_sword 1 0 {"keep_on_death":{}}
- To give all players a stick that cannot be dropped or crafted with:
/give @a stick 1 0 {"item_lock":{"mode":"lock_in_inventory"}}
- To give a random player a wooden shovel that cannot be moved from its slot, dropped, or crafted with:
/give @r wooden_shovel 1 0 {"item_lock":{"mode":"lock_in_slot"}}
- To give the nearest player a grass block that works like a pickaxe:
/give @p grass_block[max_stack_size=1,max_damage=100,damage=0,tool={default_mining_speed:2,damage_per_block:1,rules:[{blocks:"#mineable/pickaxe",speed:8,correct_for_drops:true}]}] 1
- To give a random player an item frame that is invisible:
/give @r minecraft:item_frame[minecraft:entity_data={id:item_frame,Invisible:1b}] 1
History
| Java Edition Alpha | |||||||
|---|---|---|---|---|---|---|---|
| v1.0.15 | (Alpha server 0.1.0) Added /give.
| ||||||
The /give command always gives exactly one of the specified item (by numeric ID) to the specified player. | |||||||
| v1.0.16_01 | Added count argument to /give. | ||||||
| Java Edition | |||||||
| 1.0.0 | Beta 1.9 Prerelease 4 | Added damage value argument to /give. | |||||
| 1.3.1 | 12w16a | /give is now usable in singleplayer. | |||||
| 1.4.2 | 12w38a | /give now gives items directly to the player instead of dropping them from the player. | |||||
| 1.5 | 13w04a | /give now accepts data value as the fourth argument. | |||||
| 1.7.2 | 13w36a | Added dataTag argument to /give. | |||||
| 1.8 | 14w32a | /give can no longer make 'illegal' stacks (such as 24 ender pearls or 5 iron swords). | |||||
| 1.12 | 17w16b | /give now uses the @s selector, for giving specifically yourself an item. | |||||
| 1.17 | 21w10a | /give can now only give up to 100 stacks worth of items at a time. | |||||
| 1.20.5 | 24w09a | Replaced item NBT tag with data components, therefore changing the syntax. | |||||
| Pocket Edition Alpha | |||||||
| v0.16.0 | build 1 | Added /give.
| |||||
The functionality is almost equivalent to the Java 1.10 usage, except there is no support for data tags and the player target is optional in /give. | |||||||
See also
/summon– summon any entity at any location