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
imported>Nixinova
 
SyncBot (talk | contribs)
Remove broken links to missing pages
Line 5: Line 5:
* 2 {{only|java|short=1}}
* 2 {{only|java|short=1}}
* 1 {{only|bedrock|short=1}}
* 1 {{only|bedrock|short=1}}
| others = [[Minecraft:Cheat]] only{{only|bedrock|short=1}}
| others = Cheat only{{only|bedrock|short=1}}
}}
}}


Gives a specified amount of a certain [[Minecraft:item]] to one or more [[Minecraft:player]]s.
Gives a specified amount of a certain [[Minecraft:item]] to one or more players.


== Usage ==
== Usage ==
Line 38: Line 38:


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


Line 48: Line 48:
{{Result table}}
{{Result table}}
{{Result table|The command is incomplete, or any argument is not specified correctly.|unparseable|unparseable}}
{{Result table|The command is incomplete, or any argument is not specified correctly.|unparseable|unparseable}}
{{Result table|<code>player: target</code> is a target selector that is not of [[Minecraft:Target_selectors#Player_type_and_single_type|player type]].|N/A|fail}}
{{Result table|<code>player: target</code> is a target selector that is not of player type.|N/A|fail}}
{{Result table|<code>amount: int</code> is not between 1 and 32767.|succeed}}
{{Result table|<code>amount: int</code> is not between 1 and 32767.|succeed}}
{{Result table|<code>data: int</code> is not between 0 and 32767.}}
{{Result table|<code>data: int</code> is not between 0 and 32767.}}
Line 69: Line 69:


== Examples ==  
== Examples ==  
* To give the nearest player a pig [[Minecraft:spawn egg]]:
* To give the nearest player a pig spawn egg:
** <code>/give @p pig_spawn_egg</code>
** <code>/give @p pig_spawn_egg</code>
* To give the nearest player a [[Minecraft:diamond sword]] with Lore that says "Example":
* To give the nearest player a diamond sword with Lore that says "Example":
** <code>/give @p diamond_sword[lore=["Example"]] 1</code>{{only|java}}
** <code>/give @p diamond_sword[lore=["Example"]] 1</code>{{only|java}}
* To give all players a potion that has the [[Minecraft:Night Vision]] effect:
* To give all players a potion that has the Night Vision effect:
** <code>/give @a potion[potion_contents={potion:"minecraft:night_vision"}] 1</code>{{only|java}}
** <code>/give @a potion[potion_contents={potion:"minecraft:night_vision"}] 1</code>{{only|java}}
** <code>/give @a potion 1 5</code>{{only|bedrock}}  
** <code>/give @a potion 1 5</code>{{only|bedrock}}  
* To give a random player a [[Minecraft:Sharpness]] X diamond sword:
* To give a random player a Sharpness X diamond sword:
** <code>/give @r diamond_sword[enchantments={"minecraft:sharpness":10}] 1</code>{{only|java}}
** <code>/give @r diamond_sword[enchantments={"minecraft:sharpness":10}] 1</code>{{only|java}}
* To give the player executing the command a [[Minecraft:block of diamond]] that can be placed on [[Minecraft:dirt]] and can break [[Minecraft:blocks of quartz]], even in Adventure mode.
* 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.
** <code>/give @s diamond_block[can_place_on={blocks:"dirt"},can_break={blocks:"quartz_block"}] 1</code>{{only|java}}
** <code>/give @s diamond_block[can_place_on={blocks:"dirt"},can_break={blocks:"quartz_block"}] 1</code>{{only|java}}
** <code><nowiki>/give @s diamond_block 1 0 {"minecraft:can_place_on":{"blocks":["dirt"]},"minecraft:can_destroy":{"blocks":["quartz_block"]}} </nowiki></code>{{only|bedrock}}
** <code><nowiki>/give @s diamond_block 1 0 {"minecraft:can_place_on":{"blocks":["dirt"]},"minecraft:can_destroy":{"blocks":["quartz_block"]}} </nowiki></code>{{only|bedrock}}
* To give all players a level 2 Wither Potion with [[Minecraft:Knockback]] X:
* To give all players a level 2 Wither Potion with Knockback X:
** <code>/give @a potion[enchantments={"minecraft:knockback":10},potion_contents={custom_effects:[{id:"minecraft:wither",amplifier:1,duration:3600}]}] 1</code>{{only|java}}
** <code>/give @a potion[enchantments={"minecraft:knockback":10},potion_contents={custom_effects:[{id:"minecraft:wither",amplifier:1,duration:3600}]}] 1</code>{{only|java}}
* To give the nearest player a diamond sword that is not dropped upon death:
* To give the nearest player a diamond sword that is not dropped upon death:
Line 87: Line 87:
* To give all players a stick that cannot be dropped or crafted with:
* To give all players a stick that cannot be dropped or crafted with:
** <code><nowiki>/give @a stick 1 0 {"item_lock":{"mode":"lock_in_inventory"}}</nowiki></code>{{only|bedrock}}
** <code><nowiki>/give @a stick 1 0 {"item_lock":{"mode":"lock_in_inventory"}}</nowiki></code>{{only|bedrock}}
* To give a random player a [[Minecraft:wooden shovel]] that cannot be moved from its slot, dropped, or crafted with:
* To give a random player a wooden shovel that cannot be moved from its slot, dropped, or crafted with:
** <code><nowiki>/give @r wooden_shovel 1 0 {"item_lock":{"mode":"lock_in_slot"}}</nowiki></code>{{only|bedrock}}
** <code><nowiki>/give @r wooden_shovel 1 0 {"item_lock":{"mode":"lock_in_slot"}}</nowiki></code>{{only|bedrock}}
* To give the nearest player a grass block that works like a [[Minecraft:pickaxe]]:
* To give the nearest player a grass block that works like a [[Minecraft:pickaxe]]:
** <code><nowiki>/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</nowiki></code>{{only|java}}
** <code><nowiki>/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</nowiki></code>{{only|java}}
* To give a random player an [[Minecraft:item frame]] that is invisible:
* To give a random player an item frame that is invisible:
** <code>/give @r minecraft:item_frame[minecraft:entity_data={id:item_frame,Invisible:1b}] 1</code>{{only|java}}
** <code>/give @r minecraft:item_frame[minecraft:entity_data={id:item_frame,Invisible:1b}] 1</code>{{only|java}}
*To give the nearest player a spawn egg that looks like a wolf spawn egg but spawns a cat:
*To give the nearest player a spawn egg that looks like a wolf spawn egg but spawns a cat:
Line 103: Line 103:
|{{HistoryLine|java alpha}}
|{{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 {{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 [[Minecraft:player]].}}
|The {{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 {{cmd|give|link=none}}.{{check version|not on page}}}}
|{{HistoryLine|java}}
|{{HistoryLine|java}}
Line 109: Line 109:
|{{HistoryLine||1.3.1|dev=12w16a|{{cmd|give|link=none}} is now usable in singleplayer.}}
|{{HistoryLine||1.3.1|dev=12w16a|{{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|{{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 [[Minecraft:Java Edition pre-flattening data values|data value]] as the fourth argument.}}
|{{HistoryLine||1.5|dev=13w04a|{{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 {{cd|dataTag}} argument to {{cmd|give|link=none}}.}}
|{{HistoryLine||1.8|dev=14w32a|{{cmd|give|link=none}} can no longer make 'illegal' stacks (such as 24 [[Minecraft:ender pearl]]s or 5 [[Minecraft:iron sword]]s).}}
|{{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.12|dev=17w16b|{{cmd|give|link=none}} now uses the {{cd|@s}} selector, for giving specifically yourself an item.}}
|{{HistoryLine||1.12|dev=17w16b|{{cmd|give|link=none}} now uses the {{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|{{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 [[Minecraft:data component]]s, therefore changing the syntax.}}
|{{HistoryLine||1.20.5|dev=24w09a|Replaced item NBT tag with data components, therefore changing the syntax.}}
}}
}}


Line 120: Line 120:
{{HistoryTable|{{HistoryLine|pocket alpha}}
{{HistoryTable|{{HistoryLine|pocket alpha}}
|{{HistoryLine||v0.16.0|dev=build 1|Added {{cmd|give|link=none}}.
|{{HistoryLine||v0.16.0|dev=build 1|Added {{cmd|give|link=none}}.
|The functionality is almost equivalent to the [[Minecraft:Java Edition 1.10|Java 1.10]] usage, except there is no support for [[Minecraft:data tag]]s and the [[Minecraft: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 {{cmd|give|link=none}}.}}
}}
}}


Line 132: Line 132:
{{Navbox commands}}
{{Navbox commands}}


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

Revision as of 15:44, 9 April 2026

Template:Redirect 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). Template:IN, this also summons a "fake" item entity, with its Template:Cd tag set to Template:Cd and its Template:Cd tag set to Template:Cd, 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. Template:IN, the item's Template:Cd tag is set to the target and its Template:Cd tag is set to Template:Cd so that it can be picked up only by that player at any time. Template:IN, 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. Template:IN, when dropping the item entity, the item using progress of the player is discarded. Template:IN, the "Use doors and switches" option (in the "Player Permission" screen) disables the player to drop any item entity, even caused by the Template:Cd command.

Syntax

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

Arguments

Template:Argument

Specifies the target(s) to give item(s) to.
Template:Arg desc

Template:Argument

Specifies the item to give.
Template:Arg desc

Template:Argument

Specifies the number of items to give. If not specified, defaults to 1.
Template:Arg desc Template:IN, it should be between 1 and 32767 (inclusive).

Template:El: Template:Argument

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.
Template:Arg desc It should be between 0 and 32767 (inclusive).

Template:El: Template:Argument

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).
Template:Arg desc

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

Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table

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

External links

Navigation

Template:Navbox commands

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