Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Minecraft:Commands/give: Difference between revisions

From SAS Gaming Wiki
SyncBot (talk | contribs)
Remove broken links to missing pages
SyncBot (talk | contribs)
Fix template calls: add MC/ prefix
 
Line 1: Line 1:
{{Redirect|Give|the option in the teacher menu|Teacher Menu#Give}}
{{MC/Redirect|Give|the option in the teacher menu|Teacher Menu#Give}}
{{Infobox command
{{Infobox command
| name = give
| name = give
Line 13: Line 13:
Gives the specified item(s) to the target(s). If <code><targets></code> or <code>player: target</code> resolves to multiple targets, each receives the specified number of items.
Gives the specified item(s) to the target(s). If <code><targets></code> or <code>player: target</code> 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}}, this also summons a "fake" [[Minecraft:Item (entity)|item entity]], with its {{cd|PickupDelay}} tag set to {{cd|32767}} and its {{cd|Age}} tag set to {{cd|5999}}, which would make it impossible to be picked up, and have it despawn within one tick.
If there is enough room in the player's inventory, or the player is in creative mode, gives the specified item(s). {{MC/In|java}}, this also summons a "fake" [[Minecraft:Item (entity)|item entity]], with its {{MC/Cd|PickupDelay}} tag set to {{MC/Cd|32767}} and its {{MC/Cd|Age}} tag set to {{MC/Cd|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 [[Minecraft:Item (entity)|item entity]] dropped by the player. {{IN|java}}, the item's {{cd|Owner}} tag is set to the target and its {{cd|PickupDelay}} tag is set to {{cd|0}} so that it can be picked up only by that player at any time. {{IN|bedrock}}, 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}}, when dropping the item entity, the item using progress of the player is discarded. {{IN|bedrock}}, the "Use doors and switches" option (in the "Player Permission" screen) disables the player to drop any item entity, even caused by the {{cd|/give}} command.
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 [[Minecraft:Item (entity)|item entity]] dropped by the player. {{MC/In|java}}, the item's {{MC/Cd|Owner}} tag is set to the target and its {{MC/Cd|PickupDelay}} tag is set to {{MC/Cd|0}} so that it can be picked up only by that player at any time. {{MC/In|bedrock}}, 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. {{MC/In|bedrock}}, when dropping the item entity, the item using progress of the player is discarded. {{MC/In|bedrock}}, the "Use doors and switches" option (in the "Player Permission" screen) disables the player to drop any item entity, even caused by the {{MC/Cd|/give}} command.


== Syntax ==
== Syntax ==
Line 25: Line 25:


== Arguments ==
== Arguments ==
{{argument|targets|entity|player: target|CommandSelector<Player>}}
{{MC/Argument|targets|entity|player: target|CommandSelector<Player>}}
: Specifies the target(s) to give item(s) to.
: Specifies the target(s) to give item(s) to.
: {{arg desc|je=entity|amount=multiple|type=players|be=player}}
: {{MC/Arg desc|je=entity|amount=multiple|type=players|be=player}}


{{argument|item|item_stack|itemName: Item|enum}}
{{MC/Argument|item|item_stack|itemName: Item|enum}}
: Specifies the item to give.
: Specifies the item to give.
: {{arg desc|je=item_stack|be=CommandItem}}
: {{MC/Arg desc|je=item_stack|be=CommandItem}}


{{argument|count|integer|amount: int|int}}
{{MC/Argument|count|integer|amount: int|int}}
:Specifies the number of items to give. If not specified, defaults to <code>1</code>.
:Specifies the number of items to give. If not specified, defaults to <code>1</code>.
: {{arg desc|je=integer|be=int|min=1}} {{IN|bedrock}}, it should be between 1 and 32767 (inclusive).
: {{MC/Arg desc|je=integer|be=int|min=1}} {{MC/In|bedrock}}, it should be between 1 and 32767 (inclusive).


{{el|be|short=1}}: {{argument|be=1|data: int|int}}  
{{MC/El|be|short=1}}: {{MC/Argument|be=1|data: int|int}}  
: 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.
: 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.
: {{arg desc|be=int}} It should be between 0 and 32767 (inclusive).<!-- do not put 16-bit integer as it redundant -->
: {{MC/Arg desc|be=int}} It should be between 0 and 32767 (inclusive).<!-- do not put 16-bit integer as it redundant -->


{{el|be|short=1}}: {{argument|be=1|components: json|Json::Value}}  
{{MC/El|be|short=1}}: {{MC/Argument|be=1|components: json|Json::Value}}  
: Specifies the [[Minecraft:item components]] of the given item(s). Like data tags but supports only <code>minecraft:can_place_on</code>, <code>minecraft:can_destroy</code>, <code>minecraft:item_lock</code>, and <code>minecraft:keep_on_death</code> functions (see [[#Examples]]).
: Specifies the [[Minecraft:item components]] of the given item(s). Like data tags but supports only <code>minecraft:can_place_on</code>, <code>minecraft:can_destroy</code>, <code>minecraft:item_lock</code>, and <code>minecraft:keep_on_death</code> functions (see [[#Examples]]).
: {{arg desc|be=Json::Value}}
: {{MC/Arg desc|be=Json::Value}}


== Result ==
== Result ==
Line 61: Line 61:


== Output ==
== Output ==
{{Output table}}
{{MC/Output table}}
{{Output table|edition=je|On fail|0|0}}
{{MC/Output table|edition=je|On fail|0|0}}
{{Output table|On success|1|1|the number of targeted players}}
{{MC/Output table|On success|1|1|the number of targeted players}}
{{Output table|edition=be|On fail|0}}
{{MC/Output table|edition=be|On fail|0}}
{{Output table|On success|the number of players who are given item(s)}}
{{MC/Output table|On success|the number of players who are given item(s)}}
{{Output table}}
{{MC/Output table}}


== Examples ==  
== Examples ==  
Line 101: Line 101:
=== ''Java Edition'' ===
=== ''Java Edition'' ===
{{HistoryTable
{{HistoryTable
|{{HistoryLine|java alpha}}
|{{MC/HistoryLine|java alpha}}
|{{HistoryLine||v1.0.15|dev=server 0.1.0|Added {{cmd|give|link=none}}.  
|{{HistoryLine||v1.0.15|dev=server 0.1.0|Added {{MC/Cmd|give|link=none}}.  
|The {{cmd|give|link=none}} [[Minecraft:commands|command]] always gives exactly one of the specified [[Minecraft:item]] (by numeric ID) to the specified player.}}
|The {{MC/Cmd|give|link=none}} [[Minecraft:commands|command]] always gives exactly one of the specified [[Minecraft:item]] (by numeric ID) to the specified player.}}
|{{HistoryLine||v1.0.16_01|Added count argument to {{cmd|give|link=none}}.{{check version|not on page}}}}
|{{HistoryLine||v1.0.16_01|Added count argument to {{MC/Cmd|give|link=none}}.{{check version|not on page}}}}
|{{HistoryLine|java}}
|{{MC/HistoryLine|java}}
|{{HistoryLine||1.0.0|dev=Beta 1.9 Prerelease 4|Added {{cd|damage}} value argument to {{cmd|give|link=none}}.}}
|{{HistoryLine||1.0.0|dev=Beta 1.9 Prerelease 4|Added {{MC/Cd|damage}} value argument to {{MC/Cmd|give|link=none}}.}}
|{{HistoryLine||1.3.1|dev=12w16a|{{cmd|give|link=none}} is now usable in singleplayer.}}
|{{HistoryLine||1.3.1|dev=12w16a|{{MC/Cmd|give|link=none}} is now usable in singleplayer.}}
|{{HistoryLine||1.4.2|dev=12w38a|{{cmd|give|link=none}} now gives items directly to the player instead of dropping them from the player.}}
|{{HistoryLine||1.4.2|dev=12w38a|{{MC/Cmd|give|link=none}} now gives items directly to the player instead of dropping them from the player.}}
|{{HistoryLine||1.5|dev=13w04a|{{cmd|give|link=none}} now accepts data value as the fourth argument.}}
|{{HistoryLine||1.5|dev=13w04a|{{MC/Cmd|give|link=none}} now accepts data value as the fourth argument.}}
|{{HistoryLine||1.7.2|dev=13w36a|Added {{cd|dataTag}} argument to {{cmd|give|link=none}}.}}
|{{HistoryLine||1.7.2|dev=13w36a|Added {{MC/Cd|dataTag}} argument to {{MC/Cmd|give|link=none}}.}}
|{{HistoryLine||1.8|dev=14w32a|{{cmd|give|link=none}} can no longer make 'illegal' stacks (such as 24 ender pearls or 5 iron swords).}}
|{{HistoryLine||1.8|dev=14w32a|{{MC/Cmd|give|link=none}} can no longer make 'illegal' stacks (such as 24 ender pearls or 5 iron swords).}}
|{{HistoryLine||1.12|dev=17w16b|{{cmd|give|link=none}} now uses the {{cd|@s}} selector, for giving specifically yourself an item.}}
|{{HistoryLine||1.12|dev=17w16b|{{MC/Cmd|give|link=none}} now uses the {{MC/Cd|@s}} selector, for giving specifically yourself an item.}}
|{{HistoryLine||1.17|dev=21w10a|{{cmd|give|link=none}} can now only give up to 100 stacks worth of items at a time.}}
|{{HistoryLine||1.17|dev=21w10a|{{MC/Cmd|give|link=none}} can now only give up to 100 stacks worth of items at a time.}}
|{{HistoryLine||1.20.5|dev=24w09a|Replaced item NBT tag with data components, therefore changing the syntax.}}
|{{MC/HistoryLine||1.20.5|dev=24w09a|Replaced item NBT tag with data components, therefore changing the syntax.}}
}}
}}


=== ''Bedrock Edition'' ===
=== ''Bedrock Edition'' ===
{{HistoryTable|{{HistoryLine|pocket alpha}}
{{HistoryTable|{{MC/HistoryLine|pocket alpha}}
|{{HistoryLine||v0.16.0|dev=build 1|Added {{cmd|give|link=none}}.
|{{HistoryLine||v0.16.0|dev=build 1|Added {{MC/Cmd|give|link=none}}.
|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 {{cmd|give|link=none}}.}}
|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 {{MC/Cmd|give|link=none}}.}}
}}
}}


== See also ==
== See also ==
* {{cmd|summon}} – summon any entity at any location
* {{MC/Cmd|summon}} – summon any entity at any location


== External links ==
== External links ==
Line 130: Line 130:


== Navigation ==
== Navigation ==
{{Navbox commands}}
{{MC/Navbox commands}}


de:Befehl/give
de:Befehl/give

Latest revision as of 20:11, 9 April 2026

Template:Hatnote Template:Infobox command

Gives a specified amount of a certain Minecraft: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 Template:Editions, this also summons a "fake" item entity, with its

  1. REDIRECT Template:Code

Template:Redr tag set to

  1. REDIRECT Template:Code

Template:Redr and its

  1. REDIRECT Template:Code

Template:Redr tag set to

  1. REDIRECT Template:Code

Template:Redr, 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 Template:Editions, the item's

  1. REDIRECT Template:Code

Template:Redr tag is set to the target and its

  1. REDIRECT Template:Code

Template:Redr tag is set to

  1. REDIRECT Template:Code

Template:Redr so that it can be picked up only by that player at any time. in Template:Editions, 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 Template:Editions, when dropping the item entity, the item using progress of the player is discarded. in Template:Editions, the "Use doors and switches" option (in the "Player Permission" screen) disables the player to drop any item entity, even caused by the

  1. REDIRECT Template:Code

Template:Redr command.

Syntax

  • Java Edition
give <targets> <item> [<count>]
  • Bedrock Edition
give <player: target> <itemName: Item> [amount: int] [data: int] [components: json]

Arguments

Template:El<targets>: entity
Template:El: player: target: CommandSelector<Player>

Specifies the target(s) to give item(s) to.
{{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe| Template:IN,}}{{#vardefine:je-arg|entity}}{{#vardefine:be-arg|entity}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}

Template:El<item>: item_stack
Template:El: itemName: Item: enum

Specifies the item to give.
{{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe| Template:IN,}}{{#vardefine:je-arg|item_stack}}{{#vardefine:be-arg|item_be}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}

Template:El<count>: integer
Template:El: amount: int: int

Specifies the number of items to give. If not specified, defaults to 1.
{{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe| Template:IN,}}{{#vardefine:je-arg|integer}}{{#vardefine:be-arg|integer}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}} in Template:Editions, it should be between 1 and 32767 (inclusive).
  1. REDIRECT Template:Edition

Template:Rcat: data: int: int

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.
{{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|integer}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}} It should be between 0 and 32767 (inclusive).
  1. REDIRECT Template:Edition

Template:Rcat: components: json: Json::Value

Specifies the Minecraft:item components of the given item(s). Like data tags but supports only minecraft:can_place_on, minecraft:can_destroy, minecraft:item_lock, and minecraft:keep_on_death functions (see #Examples).
{{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|component}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}

Result

Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table

Template:Notelist

Output

{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-table-lines|-2}}{{#vardefine:output-table-lines-now|}}{{#vardefine:command-num-now|}}{{#vardefine:command-line-now|}}{{#vardefine:commands-num|}}{{#vardefine:output-edition-num-now|}}{{#vardefine:output-edition-line-now|}}{{#vardefine:output-editions-num|}}{{#vardefine:je-outputs-dis|}}

{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On fail}}{{#vardefine:output1-{{#var:output-table-lines}}|0}}{{#vardefine:output2-{{#var:output-table-lines}}|0}}{{#vardefine:output3-{{#var:output-table-lines}}|N/A}}{{#vardefine:command-row-{{#var:commands-num}}|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-editions-num|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-edition-{{#var:output-editions-num}}|je}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|1}} {{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On success}}{{#vardefine:output1-{{#var:output-table-lines}}|1}}{{#vardefine:output2-{{#var:output-table-lines}}|1}}{{#vardefine:output3-{{#var:output-table-lines}}|the number of targeted players}}{{#vardefine:command-row-{{#var:commands-num}}|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|Expression error: Unrecognized punctuation character "{".}} {{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On fail}}{{#vardefine:output1-{{#var:output-table-lines}}|0}}{{#vardefine:output2-{{#var:output-table-lines}}|N/A}}{{#vardefine:output3-{{#var:output-table-lines}}|N/A}}{{#vardefine:command-row-{{#var:commands-num}}|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-editions-num|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-edition-{{#var:output-editions-num}}|be}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|1}} {{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On success}}{{#vardefine:output1-{{#var:output-table-lines}}|the number of players who are given item(s)}}{{#vardefine:output2-{{#var:output-table-lines}}|N/A}}{{#vardefine:output3-{{#var:output-table-lines}}|N/A}}{{#vardefine:command-row-{{#var:commands-num}}|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|Expression error: Unrecognized punctuation character "{".}}

{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-table-lines|-2}}{{#vardefine:output-table-lines-now|}}{{#vardefine:command-num-now|}}{{#vardefine:command-line-now|}}{{#vardefine:commands-num|}}{{#vardefine:output-edition-num-now|}}{{#vardefine:output-edition-line-now|}}{{#vardefine:output-editions-num|}}{{#vardefine:je-outputs-dis|}}

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 "Example":
  • To give all players a potion that has the Night Vision effect:
  • To give a random player a Sharpness X diamond sword:
    • /give @r diamond_sword[enchantments={"minecraft:sharpness":10}] 1Template:Only
  • To give the player executing the command a block of diamond that can be placed on Minecraft:dirt and can break blocks of quartz, even in Adventure mode.
    • /give @s diamond_block[can_place_on={blocks:"dirt"},can_break={blocks:"quartz_block"}] 1Template:Only
    • /give @s diamond_block 1 0 {"minecraft:can_place_on":{"blocks":["dirt"]},"minecraft:can_destroy":{"blocks":["quartz_block"]}} Template:Only
  • 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}]}] 1Template:Only
  • To give the nearest player a diamond sword that is not dropped upon 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"}}Template:Only
  • 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"}}Template:Only
  • To give the nearest player a grass block that works like a Minecraft: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}]}] 1Template:Only
  • To give a random player an item frame that is invisible:
    • /give @r minecraft:item_frame[minecraft:entity_data={id:item_frame,Invisible:1b}] 1Template:Only
  • To give the nearest player a spawn egg that looks like a wolf spawn egg but spawns a cat:
    • /give @p minecraft:wolf_spawn_egg[entity_data={id:"minecraft:cat"}] Template:Only
  • To give the nearest player 36 stacks of 64 totems each:
    • /give @s minecraft:totem_of_undying[max_stack_size=64] 2304 Template:Only

History

Java Edition

Template:HistoryTable

Bedrock Edition

Template:HistoryTable

See also

  1. REDIRECT Template:Command

Template:Redr – summon any entity at any location

External links

Navigation

All editions
Removed
Template:El only
Debug
Removed
Template:Els only
Template:El only
Removed
Template:El only
Removed
Template:Els only
Removed
Joke
Related

de:Befehl/give es:Comandos/give fr:commandes/give ja:コマンド/give pt:Comandos/give ru:Команды консоли/give uk:Команди консолі/give zh:命令/give