Commands/give

From Minecraft Wiki
Jump to: navigation, search
give
Restrictions

Operator

First introduced

1.3.1 (12w16a)
PE Alpha 0.16.0 (PE Alpha 0.16.0 build 1)

Gives an item to a player.

Syntax
  • Java Edition
give <player> <item> [amount] [data] [dataTag]
  • Pocket Edition
give <player: target> <itemName: string> [amount: int] [data: int] [components: components]
Arguments
player (PE: player: target)
Specifies the target to give item(s) to. Must be a player name or target selector.
item (PE: itemName: string)
Specifies the item to give. Must be a valid item id (for example, minecraft:iron_shovel), or block id for which items exist. Numerical ids are unsupported.
amount (PE: amount: int) (optional)
Specifies the number of items to give. Must be between 1 and 64 (inclusive), but can be 64 even when that's more than one stack. If not specified, defaults to 1.
Item-specific stacking restrictions are ignored, for example: /give @p minecraft:iron_sword 5 will give a stack of 5 iron swords, though normally the iron sword is restricted to stacks of 1. The minimum of 1 and the maximum of 64 still apply.
data (PE: data: int) (optional)
Specifies the item data of the given item(s). Must be an integer between -2,147,483,648 and 2,147,483,647 (inclusive, without the commas), but values which are invalid for the specified item id revert to 0. If not specified, defaults to 0.
dataTag (optional)[Java Edition only]
Specifies the data tag of the given item(s). Must be a compound NBT tag (for example, {display:{Name:Fred}})
"components" (optional)[Bedrock Edition only]
Like DataTags but only supports CanPlaceOn and CanDestroy functions (for example, give @p iron_shovel 1 0 {"minecraft:can_destroy":{"blocks":["grass"]}})
Result
Fails if the arguments are not specified correctly, or if player fails to resolve to one or more online players.
On success, summons the specified item(s) at the location(s) of the target(s). If player resolves to multiple targets, each receives the specified number of items. If there is room in the player's inventory, or the player is in creative mode, the item entity summoned is "fake", with its PickupDelay tag set to 32767 and its Age tag set to 5999, which would normally make it impossible to pick up the item, and have it despawn within a tick. If the player's inventory is full and they are not in creative mode, the item entity's Owner tag is set to the target and its PickupDelay tag set to 0 so that it can only be picked up by that player until within 10 seconds of it despawning, at which time other players may pick it up. [1]
Examples
To summon 30 blocks of spruce wood planks at John's location with Lore that says "Wooden planks":
give John minecraft:planks 30 1 {display:{Lore:["Wooden planks"]}}
To summon a potion at John's location which has the Night Vision effect:
give John potion 1 0 {Potion:"minecraft:night_vision"}
To give a Sharpness V Diamond Sword ("id" parameter taken from Enchanting/ID):
give John diamond_sword 1 0 {ench:[{id:16,lvl:5}]}
To give Block of Diamond that can be placed on dirt and can break quartz block that can be done in adventure mode.
give John minecraft:diamond_block 1 0 {CanPlaceOn:["minecraft:dirt"],CanDestroy:["minecraft:quartz_block"]}
See also
/summon — summon any entity at any location