編集の要約なし |
|||
(9人の利用者による、間の11版が非表示) | |||
1行目: | 1行目: | ||
+ | {{exclusive|Bedrock|Education}} |
||
− | {{:コマンド/infobox |
||
+ | {{outdated|edition=java|このコマンドは、[[Java Edition 1.17]]で {{cmd|item}} コマンドに置き換えられました。}} |
||
⚫ | |||
+ | {{Infobox command |
||
− | |op |
||
⚫ | |||
− | |1.8|14w26a |
||
+ | |oplevel = 1 |
||
− | |PE 1.0.5|PE 1.0.5 build 1 |
||
+ | |others=[[設定|チート]]限定 |
||
}} |
}} |
||
+ | [[ブロック]]([[チェスト]]や[[かまど]]など)やエンティティ(プレイヤーまたはMob)のインベントリにある[[アイテム]]を、指定されたアイテムで置き換える。 |
||
⚫ | |||
− | ブロックやエンティティの[[インベントリ]]を指定アイテムで置き換える。インベントリを持つ[[ブロック]]は[[チェスト]]や[[かまど]]や[[タル]]、[[エンティティ]]は[[プレイヤー]]や [[Mob]]などである。<!--Replaces items in the inventories of blocks (chest, furnaces, etc.) or entities (players or mobs) with the given item(s).--> |
||
⚫ | |||
⚫ | |||
+ | : <code>replaceitem block <position: x y z> slot.container <slotId: int> <oldItemHandling: ReplaceMode> <itemName: Item> [amount: int] [data: int] [components: json]</code> |
||
+ | : <code>replaceitem entity <target: target> <slotType: EntityEquipmentSlot> <slotId: int> <oldItemHandling: ReplaceMode> <itemName: Item> [amount: int] [data: int] [components: json]</code> |
||
⚫ | |||
⚫ | |||
+ | {{argument|position: x y z|CommandPosition}} |
||
+ | : アイテムを置き換えるブロックの位置を指定する。 |
||
+ | : {{arg desc|be=CommandPosition}} |
||
− | * '''Java Edition''' |
||
− | : <code>/replaceitem block <x> <y> <z> <スロット> <アイテム> [個数] [データ] [データタグ]</code> |
||
− | : <code>/replaceitem entity <対象> <スロット> <アイテム> [個数] [データ] [データタグ]</code> |
||
+ | {{argument|target: target|CommandSelector<Actor>}} |
||
− | * '''Bedrock Edition''' |
||
+ | : アイテムを置き換える1つ以上のエンティティを指定する。 |
||
⚫ | |||
+ | : {{arg desc|amount=multiple|type=entities|be=actor}} |
||
⚫ | |||
⚫ | |||
+ | {{argument|be=1|slotType: EntityEquipmentSlot}}、<code>slot.container</code> および {{argument|slotId: int|int}} |
||
− | : x y z (BE: ''position: x y z'')(<code>/replaceitem block</code> の時) |
||
+ | : アイテムを置き換えるインベントリのスロットを指定する。有効な値は、ブロックとエンティティのどちらを置き換えるかによって異なる。 |
||
− | :: アイテムを置き換えたいブロックの場所を指定する。[[#チルダ表記法|チルダ表記法]]で、コマンドを実行した場所に対する相対座標を指定することもできる。<!--Specifies the position of the block to be modified. May use [[#Tilde notation|tilde notation]] to specify a position relative to the command's execution.--> |
||
+ | : <code>slotId: int</code> は {{arg desc|be=int}}また、値は-2,147,483,648以上2,147,483,647以下で指定する。 |
||
+ | : '''ブロックの場合:'''<code>slot.container <slotId: int></code> で指定する。<slotId: int>は、スロットを指す数字に置き換える。 |
||
− | : 対象 (BE: ''target: target'')(<code>/replaceitem entity</code> の時) |
||
+ | ::* [[チェスト]]、[[ディスペンサー]]、[[ドロッパー]]、[[ホッパー]]、および[[トラップチェスト]]は、左上のスロットを0として、横方向、縦方向の順に数字が大きくなる。つまり、例えばチェストの一番上の段のスロット番号は、左から右に向かって順に0から8となっている。ラージチェストは、2つの通常チェストとして扱われる。 |
||
− | :: アイテムを置き換えたいエンティティの場所を指定する。[[#ターゲットセレクター|ターゲットセレクター]]かプレイヤー名で指定する。<!--Specifies one or more entities to modify. Must be a player name or [[#Target selectors|target selector]].--> |
||
+ | ::* [[醸造台]]は、下のスロットが左から右に向かって順に0から2、上のスロットが3、燃料スロットが4となっている。 |
||
+ | ::* [[かまど]]は、入力スロットが0、燃料スロットが1、出力スロットが2となっている。 |
||
+ | : '''エンティティの場合:'''以下のいずれかを指定する。スロットIDは、スロットを指す数字に置き換える。 |
||
⚫ | |||
− | : スロット (BE: ''slotType'' and ''slotId'') |
||
− | :: 置き換えたいインベントリのスロットを指定する。有効なスロットは。対象のブロックかエンティティのインベントリが置き換えられているかどうかに依存する。<!--Specifies the inventory slot to be modified. Valid values depend on whether a block or an entity is being modified.--> |
||
− | |||
− | :: ブロックの場合、<code>slot.container.''slot_number''</code> となる。''slot_number'' は指定した数字に置き換えられる。<!--For blocks, must be <code>slot.container.''slot_number''</code> where ''slot_number'' is replaced with a number specifying the slot.--> |
||
− | ::* [[チェスト]]、[[ディスペンサー]]、[[ドロッパー]]、[[ホッパー]]、そして[[トラップチェスト]] |
||
− | ::: 左上を0として横方向に振られ、一番右に到達したら次の行の一番左にいく。ラージチェストはシングルチェスト2つ分として扱われる。<!--[[Chest]]s, [[dispenser]]s, [[dropper]]s, [[hopper]]s, and [[trapped chest]]s are numbered 0 for the top-left slot and then increase first horizontally, then vertically (so, for example, a chest's top row slots are numbered 0 to 8 from left to right). Double chests and double trapped chests are treated as two single container blocks.--> |
||
− | ::* [[醸造台]] |
||
− | ::: 下のスロットの一番左から0、1、2と振られ、最後に上のスロットに3が振られる。ブレイズパウダーの描かれた燃料スロットは4になる。<!--A [[brewing stand]]'s bottom slots are numbered 0 to 2 from left to right, its top slot is 3 and the fuel slot is 4.--> |
||
− | ::* [[かまど]] |
||
− | ::: 入力スロットが0、燃料スロットが1、出力スロットが2になる。<!--A [[furnace]]'s slots are numbered 0 for the input slot, 1 for the fuel slot, and 2 for the output slot.--> |
||
− | ::[[植木鉢]]や[[ジュークボックス]]といったブロックは、アイテムを保持することはできるがインベントリを持たず、{{cmd|blockdata}} コマンドでのみアイテムの変更ができる。<!--Other blocks which hold items but don't have inventory GUIs ([[flower pot]]s and [[jukebox]]es) can only be changed with {{cmd|blockdata}}.--> |
||
− | |||
− | :: エンティティの場合、有効なスロット名は下の表を見てほしい。<!--For entities, must be one of the following, where ''slot_number'' is replaced with a number specifying the slot:--> |
||
− | |||
⚫ | |||
!スロット |
!スロット |
||
!スロット番号 |
!スロット番号 |
||
!制限 |
!制限 |
||
|- |
|- |
||
− | |<code>slot.armor.chest</code> |
+ | |<code>slot.armor.chest <slotId: int></code> |
+ | |任意の番号 |
||
⚫ | |||
− | |rowspan=6|[[防具立て]]、 |
+ | |rowspan=6|[[防具立て]]、[[Mob]]、 [プレイヤー]]のみ(ただし、すべてのMobがアイテムを表示したり使用したりするわけではない) |
|- |
|- |
||
− | |<code>slot.armor.feet</code> |
+ | |<code>slot.armor.feet <slotId: int></code> |
+ | |任意の番号 |
||
− | | |
||
|- |
|- |
||
− | |<code>slot.armor.head</code> |
+ | |<code>slot.armor.head <slotId: int></code> |
+ | |任意の番号 |
||
− | | |
||
|- |
|- |
||
− | |<code>slot.armor.legs</code> |
+ | |<code>slot.armor.legs <slotId: int></code> |
+ | |任意の番号 |
||
− | | |
||
|- |
|- |
||
− | |<code>slot.weapon.mainhand</code> |
+ | |<code>slot.weapon.mainhand <slotId: int></code> |
+ | |任意の番号 |
||
− | | |
||
|- |
|- |
||
− | |<code>slot.weapon.offhand</code> |
+ | |<code>slot.weapon.offhand <slotId: int></code> |
+ | |任意の番号 |
||
− | | |
||
|- |
|- |
||
− | |<code>slot. |
+ | |<code>slot.container <slotId: int></code> |
− | |align="center"| |
+ | |align="center"|0–53 |
+ | |[[プレイヤー]]、[[トロッコ]]のみ |
||
⚫ | |||
⚫ | |||
⚫ | |||
|rowspan=3|[[プレイヤー]]のみ |
|rowspan=3|[[プレイヤー]]のみ |
||
|- |
|- |
||
− | |<code>slot.hotbar |
+ | |<code>slot.hotbar <slotId: int></code> |
− | |align="center"| |
+ | |align="center"|0–8 |
|- |
|- |
||
− | |<code>slot.inventory |
+ | |<code>slot.inventory <slotId: int></code> |
− | |align="center"| |
+ | |align="center"|0–26 |
|- |
|- |
||
− | |<code>slot |
+ | |<code>slot.saddle <slotId: int></code> |
+ | |任意の番号 |
||
− | | |
||
− | |[[ウマ]]、ロバ、ラバのみ |
+ | |[[ウマ]]、ロバ、ラバのみ。<code><item></code> または <code>itemName: Item</code> は、[[鞍]]でなければならない |
|- |
|- |
||
− | |<code>slot. |
+ | |<code>slot.armor <slotId: int></code> |
+ | |任意の番号{{only|bedrock}} |
||
− | | |
||
⚫ | |||
− | |ロバとラバのみで、<アイテム> は[[チェスト]]に限る。 |
||
|- |
|- |
||
− | |<code>slot. |
+ | |<code>slot.chest <slotId: int></code> |
+ | |align="center"|0–14 |
||
− | | |
||
⚫ | |||
⚫ | |||
|- |
|- |
||
− | |<code>slot. |
+ | |<code>slot.inventory <slotId: int></code> |
− | |align="center"| |
+ | |align="center"|0–7 |
⚫ | |||
− | |- |
||
⚫ | |||
⚫ | |||
|[[村人]]のみ |
|[[村人]]のみ |
||
|} |
|} |
||
− | :: [[額縁]]に飾られたアイテムは{{cmd|entitydata}}コマンドでのみ変更できる。<!--The inventory of an [[item frame]] can only be changed with {{cmd|entitydata}}.--> |
||
− | : アイテム (BE: ''itemName: string'') |
||
− | :: 置き換え先のアイテムを ID で指定する。金の剣なら <code>minecraft:golden_sword</code> というように記述する。アイテムID については[[データ値#アイテムID|ここ]]を参照。{{cmd|give}} コマンドで与えられるものであればブロックを指定することもできる。ブロックID については[[データ値#ブロックID|データ値]]のページを参照。<!--Specifies the item to be placed in the block or entity's inventory slot. Must be an [[Data values#Item IDs|item id]], or a [[Data values#Block IDs|block id]] for which an item exists (for example, <code>minecraft:golden_sword</code>).--> |
||
+ | {{argument|itemName: Item|CommandItem}} |
||
− | : 個数 (BE: ''amount: int'')(省略可能) |
||
+ | : ブロックまたはエンティティのインベントリスロットに置き換えるアイテムを指定する。 |
||
− | :: 置き換え先のアイテムの個数を指定する。1~64の範囲内である必要がある。省略した場合、1が指定されたものとして扱われる。<!--Specifies the number of items to be placed in the block or entity's inventory slot. Must be between 1 and 64 (inclusive), even for items with a smaller stack size.--> |
||
+ | |||
+ | |||
+ | {{argument|amount: int|int}} |
||
+ | : ブロックまたはエンティティのインベントリスロットに置き換えるアイテムの個数を指定する。 |
||
+ | : {{arg desc|be=int}}また、値は1以上64以下で指定する。 |
||
+ | |||
+ | |||
+ | {{argument|be=1|data: int|int}} |
||
+ | : ブロックまたはエンティティのインベントリスロットに置き換えるアイテムのデータ値を指定する。有効でない値が指定された場合や、値が指定されなかった場合は0となる。 |
||
+ | : {{arg desc|be=int}}また、値は-2,147,483,648以上2,147,483,647以下で指定する。 |
||
− | : データ値 (BE: ''data: int'') (省略可能) |
||
− | :: 置き換え先のアイテムのデータ値を指定する。-2147483648~2147483647 の範囲内である必要があり、有効な値でない場合や指定しなかった場合は0になる。<!--Specifies the item data for the item(s) to be placed in the block or entity's inventory slot. 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 will default to 0. If not specified, defaults to 0.--> |
||
+ | {{argument|be=1|components: json|Json::Value}} |
||
− | : データタグ(省略可能){{only|java}} |
||
+ | : [[アイテムコンポーネント]]を指定する。データタグに似ているが、<code>minecraft:can_place_on</code>、<code>minecraft:can_place_on</code>、<code>minecraft:can_destroy</code>、<code>minecraft:item_lock</code>、および <code>minecraft:keep_on_death</code> の関数のみ有効である。(詳細は[[コマンド/give#使用例]]を参照) |
||
− | :: 置き換え先のアイテムの[[#データタグ|データタグ]]を指定する。[[NBT]] の配列 (Compound) の形式にする必要があり、<code>{display:{Name:Fred}}</code> というように記述する。<!--Specifies the [[#Data tag|data tag]] for the item(s) to be placed in the block or entity's inventory slot. Must be a compound [[NBT tag]] (for example, <code>{display:{Name:Fred}}</code>).--> |
||
+ | : {{arg desc|be=Json::Value}} |
||
⚫ | |||
+ | {{argument|be=1|oldItemHandling: ReplaceMode}} |
||
− | : <!--Fails if the arguments are not specified correctly, if the specified block is not a container, if ''selector'' fails to resolve to one or more entities (named players must be online), or if none of the targeted entities have the specified slot (for example, zombies don't have <code>slot.horse.armor</code>).-->次の場合、このコマンドは失敗する。 |
||
+ | : 以下のいずれかを指定する。 |
||
− | :* 引数が正しくない。 |
||
+ | :: <code>destroy</code> - 指定されたスロットの既存のアイテムを無視してアイテムを直接置き換える。 |
||
− | :* ブロックがインベントリを持っていない。 |
||
+ | :: <code>keep</code> - 指定されたスロットに既にアイテムが存在している場合はアイテムを置き換えない。 |
||
− | :* 対象が見つからない。 |
||
− | :* ゾンビに対して <code>slot.horse.armor</code> を指定したときなど、対象のエンティティが指定したインベントリを持っていない |
||
⚫ | |||
− | : 成功すると、指定したスロットのアイテムが置き換わる。既にアイテムが存在していた場合、そのアイテムは失われる。<!--On success, replaces the items in the specified slot with the specified items (previous items in that slot are lost) wherever possible.--> |
||
+ | {{Result table|onlybe=1}} |
||
⚫ | |||
+ | {{Result table|引数が正しく指定されていない場合|unparseable|fail}}<!-- |
||
+ | {{Result table|<code><count></code> exceeds the stack limit of the specified item|fail|success}}--> |
||
+ | {{Result table|cmd=/replaceitem block ...|指定されたブロックがコンテナではない場合||fail}} |
||
+ | {{Result table|指定されたブロックに指定されたスロットが存在しない場合}} |
||
+ | {{Result table|cmd=/replaceitem entity ...|<code><targets></code> または <code>target: target</code> で指定されたターゲットが見つからない場合(プレイヤーの場合はオンラインである必要がある)}} |
||
+ | {{Result table|対象のエンティティが以下のいずれかの条件を1つ以上満たしている場合: |
||
+ | * 指定されたスロットが存在しない場合(例えば、ソンビはスロット <code>horse.armor</code> を持たない) |
||
+ | * 指定されたアイテムを指定されたスロットに設定できない場合(例えば、プレイヤーの防具スロットには石を設定できない)}} |
||
+ | {{Result table|cmd=/replaceitem ... keep|置き換えモードが <code>keep</code> の場合に、指定されたスロットにアイテムが存在する場合|N/A}} |
||
+ | {{Result table|cmd=|succeed|指定されたスロットが指定されたアイテムで置き換えられる(それまでにスロットに存在したアイテムは消失する)}} |
||
+ | {{Result table}} |
||
+ | == 出力 == |
||
− | : シングルチェストの一番右下にマツの苗木を4個入れる。<!--To replace the items in the bottom-right slot of a single chest one block above with four spruce saplings:--> |
||
⚫ | |||
+ | {{Output table}} |
||
− | : ホットバーの一番右にマツの苗木を4個入れる。<!--To replace the items in the rightmost hotbar slot of the nearest player with four spruce saplings:--> |
||
+ | {{Output table|edition=be|失敗字|0}} |
||
⚫ | |||
+ | {{Output table|cmd=/replaceitem block ...|成功時|1}} |
||
+ | {{Output table|cmd=/replaceitem entity ...|成功時|アイテムが正しく置き換えられたエンティティの数}} |
||
+ | {{Output table}} |
||
⚫ | |||
− | : スライムブロックを被る。 |
||
+ | * 2ブロック頭上にあるチェストの右下のスロットを、4個のマツの苗木に置き換える: |
||
− | :: <code>/replaceitem entity @p slot.armor.head minecraft:slime</code> |
||
⚫ | |||
+ | * 最も近いプレイヤーのホットバーの一番右のスロットを、4個のマツの苗木に置き換える: |
||
⚫ | |||
+ | == 歴史 == |
||
− | ;参照 |
||
+ | {{History|java}} |
||
+ | {{History||1.8|snap=14w26a|{{cmd|replaceitem|link=none}} が追加された。}} |
||
+ | {{History||1.14|snap=18w43a|{{cmd|replaceitem|link=none}} が[[額縁]]に対して使用できるようになった。}} |
||
+ | {{History||1.17|snap=20w46a|{{cmd|replaceitem|link=none}} が削除され、{{cmd|item replace}} に置き換えられた。}} |
||
+ | {{History|pocket}} |
||
⚫ | |||
+ | {{History||1.0.5|snap=alpha 1.0.5.0|{{cmd|replaceitem|link=none}} が追加された。}} |
||
− | : {{cmd|entitydata}} — こちらのコマンドも Mob のインベントリのアイテムを置き換えられる。更に、防具のドロップ率を変更することもできる。 |
||
+ | {{History||1.1.0|snap=alpha 1.1.0.0|{{cmd|replaceitem|link=none}} で関数 <code>CanPlaceOn</code> および <code>CanDestroy</code> が利用できるようになった。}} |
||
⚫ | |||
+ | {{History|bedrock}} |
||
+ | {{History||1.16.0|snap=beta 1.16.0.55|{{cmd|replaceitem|link=none}} にdestroyとkeepのオプションが追加された。}} |
||
+ | {{History|foot}} |
||
+ | == 関連項目 == |
||
+ | * {{cmd|item}} — {{el|je}}での同等のコマンド |
||
⚫ | |||
⚫ | |||
− | <!-- please retain double newline above for section differentiation --> |
||
{{Commands}} |
{{Commands}} |
||
+ | [[de:Befehl/replaceitem]] |
||
[[en:Commands/replaceitem]] |
[[en:Commands/replaceitem]] |
||
[[ru:Команды консоли/replaceitem]] |
[[ru:Команды консоли/replaceitem]] |
||
+ | [[pt:Comandos/replaceitem]] |
||
[[uk:Команди консолі/replaceitem]] |
[[uk:Команди консолі/replaceitem]] |
||
+ | [[zh:命令/replaceitem]] |
2021年9月26日 (日) 11:55時点における最新版
この項目はBedrock Edition、およびMinecraft Education限定の要素です。
このページでは、 Java Editionの古いバージョンに存在する要素について説明しています。
このコマンドは、Java Edition 1.17で
/item
コマンドに置き換えられました。ブロック(チェストやかまどなど)やエンティティ(プレイヤーまたはMob)のインベントリにあるアイテムを、指定されたアイテムで置き換える。
構文
replaceitem block <position: x y z> slot.container <slotId: int> <itemName: Item> [amount: int] [data: int] [components: json]
replaceitem entity <target: target> <slotType: EntityEquipmentSlot> <slotId: int> <itemName: Item> [amount: int] [data: int] [components: json]
replaceitem block <position: x y z> slot.container <slotId: int> <oldItemHandling: ReplaceMode> <itemName: Item> [amount: int] [data: int] [components: json]
replaceitem entity <target: target> <slotType: EntityEquipmentSlot> <slotId: int> <oldItemHandling: ReplaceMode> <itemName: Item> [amount: int] [data: int] [components: json]
引数
<position: x y z>
:CommandPosition
- アイテムを置き換えるブロックの位置を指定する。
- <x>、<y>、<z>の各値は、浮動小数点数またはチルダ・キャレット表記法で表記された3次元座標を指定する。
<target: target>
:CommandSelector<Actor>
- アイテムを置き換える1つ以上のエンティティを指定する。
- プレイヤー名またはターゲットセレクターで指定する。
slotType: EntityEquipmentSlot
、slot.container
および <slotId: int>
:int
- アイテムを置き換えるインベントリのスロットを指定する。有効な値は、ブロックとエンティティのどちらを置き換えるかによって異なる。
slotId: int
は 32ビットの整数値で指定する。また、値は-2,147,483,648以上2,147,483,647以下で指定する。
- ブロックの場合:
slot.container <slotId: int>
で指定する。<slotId: int>は、スロットを指す数字に置き換える。 - エンティティの場合:以下のいずれかを指定する。スロットIDは、スロットを指す数字に置き換える。
スロット スロット番号 制限 slot.armor.chest <slotId: int>
任意の番号 防具立て、Mob、 [プレイヤー]]のみ(ただし、すべてのMobがアイテムを表示したり使用したりするわけではない) slot.armor.feet <slotId: int>
任意の番号 slot.armor.head <slotId: int>
任意の番号 slot.armor.legs <slotId: int>
任意の番号 slot.weapon.mainhand <slotId: int>
任意の番号 slot.weapon.offhand <slotId: int>
任意の番号 slot.container <slotId: int>
0–53 プレイヤー、トロッコのみ slot.enderchest <slotId: int>
0–26 プレイヤーのみ slot.hotbar <slotId: int>
0–8 slot.inventory <slotId: int>
0–26 slot.saddle <slotId: int>
任意の番号 ウマ、ロバ、ラバのみ。 <item>
またはitemName: Item
は、鞍でなければならないslot.armor <slotId: int>
任意の番号[Bedrock Edition限定] ウマ、ラマのみ。 <item>
またはitemName: Item
は、ウマの場合は馬鎧、ラマの場合はカーペットでなければならないslot.chest <slotId: int>
0–14 チェストを装備したロバとラバのみ slot.inventory <slotId: int>
0–7 村人のみ
<itemName: Item>
:CommandItem
- ブロックまたはエンティティのインベントリスロットに置き換えるアイテムを指定する。
<amount: int>
:int
- ブロックまたはエンティティのインベントリスロットに置き換えるアイテムの個数を指定する。
- 32ビットの整数値で指定する。また、値は1以上64以下で指定する。
data: int
:int
- ブロックまたはエンティティのインベントリスロットに置き換えるアイテムのデータ値を指定する。有効でない値が指定された場合や、値が指定されなかった場合は0となる。
- 32ビットの整数値で指定する。また、値は-2,147,483,648以上2,147,483,647以下で指定する。
components: json
:Json::Value
- アイテムコンポーネントを指定する。データタグに似ているが、
minecraft:can_place_on
、minecraft:can_place_on
、minecraft:can_destroy
、minecraft:item_lock
、およびminecraft:keep_on_death
の関数のみ有効である。(詳細はコマンド/give#使用例を参照) - JSON オブジェクトで指定する。
oldItemHandling: ReplaceMode
- 以下のいずれかを指定する。
destroy
- 指定されたスロットの既存のアイテムを無視してアイテムを直接置き換える。keep
- 指定されたスロットに既にアイテムが存在している場合はアイテムを置き換えない。
結果
コマンド | トリガー | Bedrock Edition |
---|---|---|
任意 | 引数が正しく指定されていない場合 | 失敗 |
/replaceitem block ... | 指定されたブロックがコンテナではない場合 | 失敗 |
指定されたブロックに指定されたスロットが存在しない場合 | ||
/replaceitem entity ... | <targets> または target: target で指定されたターゲットが見つからない場合(プレイヤーの場合はオンラインである必要がある) | |
対象のエンティティが以下のいずれかの条件を1つ以上満たしている場合:
| ||
/replaceitem ... keep | 置き換えモードが keep の場合に、指定されたスロットにアイテムが存在する場合 | |
任意 | 成功時 | 指定されたスロットが指定されたアイテムで置き換えられる(それまでにスロットに存在したアイテムは消失する) |
出力
コマンド | エディション | 状況 | 成功回数 | /execute store success ... | /execute store result ... |
---|---|---|---|---|---|
任意 | Bedrock Edition | 失敗字 | 0 | N/A | N/A |
/replaceitem block ... | 成功時 | 1 | N/A | N/A | |
/replaceitem entity ... | 成功時 | アイテムが正しく置き換えられたエンティティの数 | N/A | N/A |
使用例
- 2ブロック頭上にあるチェストの右下のスロットを、4個のマツの苗木に置き換える:
replaceitem block ~ ~2 ~ slot.container 26 sapling 4 1
- 最も近いプレイヤーのホットバーの一番右のスロットを、4個のマツの苗木に置き換える:
replaceitem entity @p slot.hotbar 8 sapling 4 1
歴史
Java Edition | |||||
---|---|---|---|---|---|
1.8 | 14w26a | /replaceitem が追加された。 | |||
1.14 | 18w43a | /replaceitem が額縁に対して使用できるようになった。 | |||
1.17 | 20w46a | /replaceitem が削除され、/item replace に置き換えられた。 | |||
Pocket Edition | |||||
1.0.5 | alpha 1.0.5.0 | /replaceitem が追加された。 | |||
1.1.0 | alpha 1.1.0.0 | /replaceitem で関数 CanPlaceOn および CanDestroy が利用できるようになった。 | |||
Bedrock Edition | |||||
1.16.0 | beta 1.16.0.55 | /replaceitem にdestroyとkeepのオプションが追加された。 |
関連項目
/item
— Java Editionでの同等のコマンド/give
— インベントリスロットを指定せず、また他のアイテムを置き換えることなく、プレイヤーにアイテムを与えることができるコマンド/setfixedinvslot
(廃止) — Mobのインベントリのスロットを置き換えることができるコマンド