Minecraft Wiki
(ボットによる: 「uk:Командний блок」を追加、「pt:Bloco de comando」を変更)
(126.34.65.195 (トーク) による編集を Rostiger Bot による直前の版へ差し戻しました)
タグ: 巻き戻し
(他の1人の利用者による、間の1版が非表示)

2020年2月26日 (水) 12:51時点における版

テンプレート:BlockTileEntity

Duncan Geere Mojang avatar

あなたがマインクラフトのほとんどをサバイバルモードでしていて「まるでチートのようだ」と思ったなら、その通りです。そう、これがサバイバルモードでコマンドブロックが入手できない理由です。コマンドブロックは、クリエイティブモードやアドベンチャーモードのマップ製作者向けに特別に作成した機能です。Jebは、2012年7月のツイートでコマンドブロックの追加をアナウンスし、1.4.2(プリティー・スケアリー・アップデート)で、金床や植木鉢、ニンジン付きの棒とともにゲームに追加されました。

Duncan Geere[1]
Book and Quill
このページは翻訳途中です。 
あなたが内容を翻訳してみませんか?

コマンドブロック(英:Command Block)は、コマンドを実行することができるブロックである。サバイバルモードにおいてはチートなしでは入手できないため、主にマルチプレイサーバーやカスタムマップで使用される。

入手

コマンドブロックはクリエイティブインベントリから入手することはできず、ブロック選択操作、もしくは /give @s minecraft:command_block/setblock ~ ~ ~ minecraft:command_block のようなコマンドを使用することで入手できる。

他のブロックと同様に NBT データを保持することができ、CTRL を押しながらブロック選択を行うことで、コマンドブロックのコマンドや設定をコピーすることができる。これにより、コマンドの再入力をすることなく同じコマンドのコマンドブロックを別の場所に設置することができる。

コマンドブロックは、オペレーター権限のないプレイヤーはサバイバルモードでは破壊することができない。また、可燃性はなく、ピストンで移動させることもできない。さらに、岩盤と同じ爆発耐久値を持つ。

用途

コマンドブロックは、レッドストーン信号によって起動することでコマンドを実行できる。コマンドブロックはすべての権限を有するので、コマンドを使用できないプレイヤーが特定のコマンドを使用できるようにすることができる(例えば、/give を設定することで誰でも特定のアイテムを入手することができる)。

コマンドブロックには、自身によってどのチェーンコマンドブロックが起動され、また「条件付き」モードのコマンドブロックが実行されるかどうかを確認するための「向き」がある。[要改訳]

変更

Command Block GUI

コマンドブロックの GUI

コマンドブロックにコマンドを入力したり変更したりするには、コマンドブロックに対して使用操作をしてコマンドブロックの GUI(グラフィカルユーザーインターフェース)を開けばよい。GUI はクリエイティブモードかつ適切な権限を持つプレイヤーにのみ表示される。シングルプレイでは、コマンドブロックの編集にはチートを有効にしなければならない。マルチプレイでは、コマンドブロックの編集はクリエイティブモード、かつオペレーター権限を持つプレイヤーのみが行える。また、コマンドブロックを正しく動作させるには、server.properties ファイルの以下の値を設定する必要がある。

  • enable-command-blocktrue に設定する
  • op-permission-level2 以上に設定する(デフォルトは 4)
コンソールコマンド
コマンドは、上部のテキストエリアに入力することができる。入力できるコマンドの長さは32,500文字までだが、テキストエリアでは一度にこのわずかな部分しか表示できない。Tab ↹ キーを押すことで、コマンドの補完や候補の選択ができる。
コマンドブロックのコマンドには、チャットウィンドウでの入力のように先頭にスラッシュ(/)を付ける必要はないが、付けても問題はない。
コンソールコマンドのテキストエリアの下には、ターゲットセレクターの使用方法に関するヒントが記載されている。
前回の実行結果
下部のテキストエリアには、前回実行されたコマンドから出力されたメッセージ(成功/失敗)が表示される(初期は空欄)。このテキストは編集できない。
テキストエリアの右に表示されているボタンには、前回の実行結果の出力を記憶しておくかどうかを設定できる。O(デフォルト)が表示されている時は出力は記憶され、X が表示されている時は記憶されない。コマンドの実行中に出力を追跡しているコマンドブロックはブロック更新を引き起こし、同じチャンクを共有するコマンドの実行中に出力を追跡しているコマンドブロックが64個ある場合、64ブロックのため1つ以上のチャンク更新が発生する。1つのチャンクで更新すると、1つ以上のチャンクが更新される。チャンク更新の量が十分に大きい場合、チャンク更新を受信しているプレイヤーのfpsドロップが発生する可能性がある。これを回避するには、一時的なデバッグ目的を除き、すべてのコマンドブロックで出力を追跡しないようににすればよい。[要改訳]
インパルス/チェーン/リピート
「インパルス/チェーン/リピート」のボタンをクリックすると、コマンドブロックの種類を変更できる。デフォルトの状態は「インパルス」だが、デフォルト以外の状態のコマンドブロックも設置できる。コマンドブロックの種類を変更すると、色も変わる:
  • 「インパルス」に設定されたコマンドブロックは橙色である。レッドストーン信号により起動される度に、一度だけ実行される。
  • 「チェーン」に設定されたコマンドブロックは緑色である。コマンドブロックの処理が終了すると、そのコマンドブロックが指す方向に隣り合ったコマンドブロックが実行される。これは単に隣り合っているだけでなく、どれを指しているのかを検出するという点で、条件付きオプションとは異なる。隣り合うコマンドブロックの種類は、チェーンである必要はない。
  • 「リピート」に設定されたコマンドブロックは紫色である。レッドストーン信号により起動している間は、1ゲームティックごとにコマンドが実行される(ラグなしで秒間20回)。
条件付き/無条件
Command block textures

上: 「無条件」モードのコマンドブロック
下: 「条件付き」モードのコマンドブロック

「条件付き/無条件」のボタンをクリックすると、コマンドブロックの実行条件を変更できる。
  • 「条件付き」:条件付きモードのコマンドブロックは、その前のコマンドブロック(チェーンの方向にかかわらず、そのコマンドブロックの方向とは反対にあるコマンドブロック)の実行が成功した場合にのみ実行される。
  • 「無条件」(デフォルト):無条件モードのコマンドブロックは、(正しく起動していれば)その前のコマンドブロックの実行が失敗していたとしても実行される。
常時実行/動力が必要
「常時実行/動力が必要」のボタンをクリックすると、コマンドブロックの起動条件を変更できる。
  • 「動力が必要」(インパルス、およびリピートコマンドブロックのデフォルト):「動力が必要」に設定されたコマンドブロックは、コマンドの実行にレッドストーン信号によって起動する必要がある。
  • 「常時実行」(チェーンコマンドブロックのデフォルト):「常時実行」に設定されたコマンドブロックは、レッドストーン信号なしに起動することができる。
    • チェーンコマンドブロックは、チェーンした際にコマンドが実行される。
    • リピートコマンドブロックは、毎ゲームティックごと、すなわち秒間20回コマンドが実行される。
    • インパルスコマンドブロックは、一度だけ起動され、その後再び起動されない。
完了
「完了」ボタンをクリックするか、↵ Enter キーを押すと、コマンドが保存され、コマンドブロックの GUI が閉じる。
キャンセル
「キャンセル」ボタンをクリックするか、Esc キーを押すと、コマンドは保存されず、コマンドブロックの GUI が閉じる。

起動

コマンドブロックはレッドストーンの機械部品であり、以下の動力によって起動される。

Unlike all other redstone components except the note block, a command block can be activated every game tick (20 times per second, barring lag). However, if it's set to Needs Redstone, then activating it two game ticks in a row requires that it transition from powered to unpowered and back during the same tick (for example, with a setblock clock).

A command block in "Always Active" mode is always activated. The default state is "Needs Redstone", which means that it runs only when powered.

When activated, a command block will try to execute its command. depending on the command block's type:

  • a command block ("Impulse") will try to execute its command once
  • a chain command block ("Chain") will not try to execute its command until another command block facing it executes its own command
  • a repeating command block ("Repeat") will try to execute its command every game tick until no longer activated

連鎖実行

If any command block faces a chain command block (a command block in "Chain" mode) when activated, it will notify the chain command block to also attempt execution. The chain command block will only execute its command if activated and, if in "Conditional" mode, if the command block behind it executed successfully (behind in the sense of the direction it is facing, not in the sense of which command block chained to it). Whether or not the chain command block is activated or executes successfully, if it is facing another chain command block, it will notify it to attempt execution as well.

Chained command blocks execute in the same game tick in the order they are chained. Chained execution cannot be passed to a command block which has already executed in that game tick (loops execute only once).

出力

When activated, a command block can produce multiple types of output:

Redstone Comparator
A command block can power a redstone comparator facing away from it (possibly separated by a block) with a signal strength specific to the last executed command (for example, the number of players affected by the command).
The signal strength always reflects the last command executed, even after the command block is deactivated.
Message
The output message describes the success or failure of the executed command, and may be written to multiple destinations:
Previous Output: The output message is always written to the "Previous Output" text pane of the command block GUI.
Chat: The output message is written to the chat text in singleplayer mode, or broadcast to all other ops in multiplayer mode, unless it has been suppressed with /gamerule commandBlockOutput false. Some commands may write additional text to the chat as their normal function which won't be suppressed (for example, the /say command will write a message to the chat of all players), separate from the output message. Chat messages which would usually be prefaced by a player's name (such as from the /me, /say and /tell commands) use @ as the player name. If the command block had been named in an anvil before placement, that name will be used instead.
Logs: The output message is written to multiplayer server logs unless it has been suppressed with /gamerule logAdminCommands false.
Command Stats
Command blocks can post various success results to scoreboard objectives, including:
  • SuccessCount: the number of successes (previously also available by redstone comparator output, but not limited to 15)
  • AffectedBlocks: the number of blocks that were altered
  • AffectedEntities: the number of entities that were altered (including players)
  • AffectedItems: the number of items that were altered
  • QueryResult: value returned by command
The objectives to be used can be specified by running the /stats command or by modifying the command block's NBT data directly with the /blockdata command.

備考

The following commands cannot be used in a command block: /ban, /banlist, /ban-ip, /debug, /deop, /kick, /op, /pardon, /pardon-ip, /publish, /save-all, /save-off, /save-on, /stop, and /whitelist (i.e., /debug, /publish, and all of the multiplayer-only commands except /list).

The following commands are usable but with limited functionality (their output only displays in the command block's Previous Output pane rather than being displayed in the chat): /help, /seed, /list, /scoreboard objectives, /scoreboard players, and /scoreboard teams list.

The following commands use the command block's name (defaults to @) in their output: /me, /say, and /tell.

イースターエッグ

Running "Searge" as the command in the command block without a preceding "/" will now set the previous output to "#itzlipofutzli". Additionally, if /help is run via command block, it gives various messages prefixed with "Searge says: ".

技術的情報

ID

名前 ID名 ブロックID もしくはアイテムID
コマンドブロック minecraft:command_block 137
リピートコマンドブロック minecraft:repeating_command_block 210
チェインコマンドブロック minecraft:chain_command_block 211

データ値

データ値」も参照

In Bedrock Edition, a command block's block data specifies whether the command block is currently activated.

ビット
0x1
0x2
0x4

コマンドブロックの向きを指定する:

  • 0: 下向き
  • 1: 上向き
  • 2: 北向き
  • 3: 南向き
  • 4: 西向き
  • 5: 東向き

6と7は未使用だが、コマンドブロックは下向きおよび上向きになる。

0x8 条件付きであるかどうか
DV 詳細
0 下向き
1 上向き
2 北向き
3 南向き
4 西向き
5 東向き
8 下向き、条件付き
9 上向き、条件付き
10 北向き、条件付き
11 南向き、条件付き
12 西向き、条件付き
13 東向き、条件付き

ブロック状態

ブロック状態」も参照
名前 デフォルト値 取り得る値 説明
conditionalfalsetrue
false
条件付きの場合、trueになる
facingnorthnorth
south
east
west
up
down
コマンドブロックの向き

ブロックエンティティ

A command block has a block entity associated with it that holds additional data about the block. The block's block entity ID is command_block.

  • ブロックエンティティデータ
    • すべてのブロックエンティティに共通するタグ
    •  CustomName: 任意で可能。/say/tellなどのコマンドを使用する場合、名前は通常「@」で置き換えられる。
    •  Command: サーバーに送信するコマンド
    •  SuccessCount: このコマンドブロックに接続されたレッドストーンコンパレーターによって出力されるアナログ信号の強度。コマンドブロックがレッドストーン信号でオンにあった場合にのみ更新される
    •  LastOutput: コマンドブロックによって表示された出力の最後の行。gamerule commandBlockOutputがfalseでも保存される。右クリックするとブロックのGUIに表示され、出力が表示された際のタイムスタンプが含まれる
    •  TrackOutput: 1 / 0 (true/false) - LastOutputを保存するかどうか。GUIの「前回の実行結果」欄の近くのボタンをクリックして切り替えられる。ボタンの題名は現在の状態を示す:"O"はtrue, "X"はfalse
    •  powered: 1 / 0 (true/false) - コマンドブロックにレッドストーン信号が入力されているかどうか。
    •  auto: 1 / 0 (true/false) - レッドストーン信号を入力せずにコマンドを実行できる
    •  conditionMet: 1 / 0 (true/false) - 条件付きコマンドブロックが最後に起動された際に条件が満たされていたかどうか。条件付きコマンドブロックでない場合はtrue
    •  UpdateLastExecution: 1 / 0 (true/false) - デフォルトはtrue。falseに設定すると1つのティックで同じコマンドブロックのループを複数回実行できる
    •  LastExecution: チェーンコマンドブロックが最後に実行されたティックを保存する

歴史

Java Edition
2012年7月27日Jeb began tweeting of a new block he had created to start expanding Adventure mode. He began posting pictures, ideas and hints of what the block will be able to do.
2012年7月31日During Notch's AMA he hinted the block may be in 1.4.
1.4.212w32aImpulse Command Block Revision 1 Added command block.
1.513w03aCommand block success can now power a redstone comparator.
13w04aCommand blocks renamed with an anvil now use their name instead of @ in the chat.
1.6.113w19aCommand blocks are no longer mineable in survival.
Command blocks are now no longer damaged by explosions, except by Blue wither skulls.
1.7.213w37aA bar that shows the previous output of command blocks has now been added.
The character limit when inserting a command in a command block has now been increased from 256 to 16,369. Using a third-party editor allows the player to reach 32,767 characters.
1.814w07aDispensers will now place command blocks, instead of shooting them out.
14w20aThe in-game character limit of 16,369 has now been removed, allowing access to the full 32,767 characters.
14w27aAdded CommandStats NBT tag.
1.8.6Dispensers will now no longer place command blocks.[2]
1.915w33aCharacter limit for command blocks is now 32,500 instead of 32,767.
15w34aChain Command Block Revision 1 Repeating Command Block Revision 1 Added the chain command block and the repeating command block.
Added block facing for command blocks.
Impulse Command Block Revision 2 Command block textures have now been updated.
15w34bAdded Conditional mode within command blocks.
Added tab completion support within command blocks.
15w35aImpulse Command Block Chain Command Block Repeating Command Block Updated texture of all three command blocks.
Added Always active and needs redstone options for command blocks.
Added auto NBT tag to control redstone options within command blocks.
When command blocks are set to conditional, the back of the arrow texture is curved.
15w36aPlayers are now unable to use commands, such as /give, within command blocks.
Players, who unable to use commands, can now no longer place command blocks.
15w36dEach command block type will now appear with different colors on maps.
16w02aRunning /help in a command block will now randomly use one of various different humorous phrases as the previous output.
16w04aRunning "Searge" as the command in the command block without a preceding "/" will now set the previous output to "#itzlipofutzli".
1.1116w32aThe block entity ID is changed from Control to command_block.
1.1217w16aChains of command blocks will no longer schedule their commands to be run in the next tick. Instead, they will now execute all in the same tick they are read. This allows later blocks in a chain to be modified via earlier blocks, allowing techniques like branching and looping, all in the same tick.
Added maxCommandChainLength game rule to control the max length of such a chain.
17w17aAdded UpdateLastExecution and LastExecution NBT tags, which control the tracking of which tick a chain command block was last executed in.
pre6Tab-completing command names in command blocks will now no longer add a / prefix.
1.1317w47aPrior to The Flattening, the numeral IDs for the command block, repeating command block, and chain command block were 137, 210, and 211, respectively.
pre1The player can now tab-complete in command blocks again.
開発中のJava Edition
1.1418w47bファイル:Impulse Command Block TextureUpdate.pngファイル:Repeating Command Block TextureUpdate.png Changed the texture of impulse and repeating command blocks.
Pocket Edition
1.0.5build 1Impulse Command Block Chain Command Block Repeating Command Block Added all types of command blocks.
開発中のBedrock Edition
1.8beta 1.8.0.8Command blocks will now have a default name of ! instead of @.
Legacy Console Edition
TU19CU7 1.12 Patch 1Impulse Command Block Revision 1 Added command blocks.
Command blocks do not have any functionality.

ギャラリー

問題点

「コマンドブロック」に関する問題点は、バグトラッカーにて管理されている。問題点の報告はそちらで行ってほしい。

脚注