コマンドブロック

提供: Minecraft Wiki
Command Blockから転送)
移動先: 案内検索
この記事の内容は翻訳されていません。
あなたが内容を翻訳してみませんか?
コマンドブロック
Command Blocks.gif
コマンドブロック
種類

ブロックエンティティ

落下

しない

透過

しない

発光

しない

爆発耐久力

18,000,000

硬さ

-1

回収道具

なし

再生可

不可能

スタック可

可能(64)

可燃

しない

初登場

1.4.2 (12w32a)

ドロップ

自身

ブロックエンティティID

Control

データ値

dec: 137 hex: 89 bin: 10001001

名前

コマンドブロック

Jeb twitter.jpg ― レッドストーン信号によってコマンドを実行できるのがこのブロックです。
適切なコマンドがあれば、色々なことをスクリプト的に実行できるのです。
コマンドブロックをアナウンスするJeb[1]

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

入手[編集 | ソースを編集]

コマンドブロックは、ピックブロックコントロールを使用するか、/give @p minecraft:command_block.などのさまざまなコマンドを使用して取得することができる。

ピックブロック+ctrlを使用すると、NBTデータを格納できる他のブロックと同様に、コマンドブロック内のコマンドとオプションがコピーされ。これにより、データを内部に再入力することなく他の場所に配置することがでる。

コマンドブロックはクリエイティブインベントリでは使用でず、サバイバルモードでは破壊できない。また、可燃性ではなく、岩盤と同じ爆発耐性を持つ。コマンドブロックはピストンで動かすことができない。

使用法[編集 | ソースを編集]

コマンド」 および 「チュートリアル/コマンドブロック」も参照

コマンドブロックは、レッドストーン信号起動することでコマンドを実行できる。コマンドブロックは常に管理する権限を持っているため、コマンドを使用できないプレイヤーが特定のコマンドを使用できるようにすることができる。

コマンドブロックは、どちらのチェーンコマンドブロックが起動されるかを決定する向き(「向いている」)と、「条件付き」モードのコマンドブロックが実行されるかどうかをチェックするブロックとを有する。

Modification[編集 | ソースを編集]

Command block GUI.

To enter or modify the command in a command block, use the Use Item control on the command block to open the command block GUI (graphical user interface). The GUI will only open if the player is in creative mode, and has the proper permissions. In singleplayer, cheats must be enabled to edit command blocks. In multiplayer, command blocks can only be edited successfully by operators in creative mode, and for command blocks to work at all the following values must be set in the server.properties file:

  • enable-command-block must be set to true
  • op-permission-level must be set to 2 or above (default is 4)
Console Command
Commands can be entered in the top text pane. The text limit for commands in a command block is 32,500 characters, but the text pane can only show a small portion of this amount at a time. Press Tab ↹ to complete words or cycle through options.
Commands in a command block do not need to be prefixed with the forward slash (/) as they do in the chat window, but using it will still work.
Below the console command text pane are some reminder tips about how to use target selectors.
Previous Output
The bottom text pane displays the output message (success or failure) of the last executed command (initially blank). Its text is not editable.
A button to the right of the Previous Output text pane specifies whether the last output should be stored and displayed. It shows O (the default) when the output should be stored and X when the output should not be stored. A command block that's tracking its output while executing its command will cause a block update, and when you have 64 of those command blocks tracking their output while executing their command sharing the same chunk, it will then cause 1 or more chunk updates because 64 block updates in 1 chunk will cause one or more chunk updates. If the amount of chunk updates is high enough, then it can cause fps drops for players if they receiving the chunk updates. To avoid this, simply have all of your command blocks not track their output at all. The track output option should only be used temporarily for debugging purposes.
Impulse/Chain/Repeat
Click the "Impulse/Chain/Repeat" button to change the command block's type. The default state is "Impulse", but non-default command blocks can be placed. The command block also changes color when changing its command block type:
  • "Impulse" command blocks are orange. These are the 'standard' command blocks, which function exactly like their previous incarnations, executing once every time they are activated.
  • "Chain" command blocks are green. These execute only after the command block pointing to it is processed. This differs from the Conditional option in that it detects what is pointing to it, instead of simply behind it. The command blocks pointing to it also don't need to be chain command blocks themselves to trigger the chain.
  • "Repeat" command blocks are purple. These will execute their commands once per tick as long as they are activated, reducing the importance of redstone clock devices.
Conditional/Unconditional
Top: Command blocks in "Unconditional" mode. Bottom: Command blocks in "Conditional" mode.
Click the "Conditional/Unconditional" button to change the command block's conditional behavior:
  • "Conditional": A command block in conditional mode will only execute its command after the command block behind it has executed successfully.("behind it" in the sense of opposite to the direction the command block is facing, regardless of chain direction or even if chaining is occurring).
  • "Unconditional" (default): A command block in unconditional mode will execute its command (if activated correctly) even if there's a command block behind it that didn't execute its command successfully.
Always Active/Needs Redstone
Click the "Always Active/Needs Redstone" button to change the command block's activation requirements:
  • "Needs Redstone" (the default for impulse and repeat command blocks): A command block in the "Needs Redstone" setting must be activated with redstone in order to execute its command.
  • "Always Active" (the default for chain command blocks): The command block is always active even without redstone activation (chain command blocks will execute their command when chained, repeating command blocks will execute their command every game tick (20 times every second), and impulse command blocks activate once then cannot be activated again).
Done
Click the "Done" button or ↵ Enter to save the command and leave the command block GUI.
Cancel
Click the "Cancel" button or Esc to leave the command block GUI without saving any changes.

Activation[編集 | ソースを編集]

Command blocks are redstone mechanisms and can be activated by:

  • An adjacent active power component: for example, a redstone torch (except that a redstone torch will not activate a command block it is attached to), a block of redstone, a daylight sensor, a button etc.
  • An adjacent powered block (for example, an opaque block with an active redstone torch under it)
  • A powered redstone comparator or redstone repeater facing the mechanism component
  • Powered redstone dust configured to point at the command block (or on top of it) or directionless; a command block is not activated by adjacent powered redstone dust which is configured to point away from it.

In addition, when a command block is cloned by a command to a powered location, the new command block will only execute its command if the original has never been activated (visible in the F3 debug screen as "triggered").

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, 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

Chained execution[編集 | ソースを編集]

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).

Output[編集 | ソースを編集]

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.

Notes[編集 | ソースを編集]

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.

Easter eggs[編集 | ソースを編集]

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: ".

Data values[編集 | ソースを編集]

A command block has an ID name of minecraft:command_block and is further defined by its block data and block entity. A command block also has a block state which is expected to replace the functionality of block data in a future version.

ID[編集 | ソースを編集]

A command block's ID determines its mode:

コマンドブロック/ID

Block data[編集 | ソースを編集]

Data values」も参照

A command block's block data specifies whether the command block is currently activated.

コマンドブロック/DV

Block entity[編集 | ソースを編集]

Block entity format」も参照

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.

コマンドブロック/BE

Block state[編集 | ソースを編集]

Block states」も参照

コマンドブロック/BS

Video[編集 | ソースを編集]

コマンドブロック/video

History[編集 | ソースを編集]

Commands#History」も参照
正式版
27 July 2012 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.
31 July 2012 During Notch's AMA he hinted the block may be in 1.4.
1.4.2 12w32a Command Block.png Added command block.
1.5 13w03a Command block success can now power a redstone comparator.
13w04a Command blocks renamed with an anvil now use their name instead of @ in the chat.
1.6.1 13w19a Command blocks are no longer mineable in Survival, and are also not damaged by explosions except by Blue Wither Skulls.
1.7.2 13w37a Added a bar that shows the previous output.
Increased the character limit from 256 to 16,369 when inserting a command in-game. Using a third-party editor allows you to reach 32,767 characters.
1.8 14w07a Dispensers now place command blocks, instead of shooting it out.
14w20a Removed the in-game character limit of 16,369, allowing access to the full 32,767 characters.
14w27a Added CommandStats NBT tag.
1.8.6 Dispensers no longer place command blocks.[2]
1.9 15w33a Character limit is now 32,500 instead of 32,767
15w34a 32px32px Added Chain Command Block and Repeating Command Block.
Added block facing.
32px Updated block textures.
15w34b Added Conditional mode.
Added tab completion support.
15w35a Impulse Command Block.pngChain Command Block.pngRepeating Command Block.png Updated texture of all three command blocks
Added Always active and needs redstone options. Added auto NBT tag to control this.
When set to conditional, the back of the arrow texture is curved.
15w36a Players unable to use commands such as /give can no longer place command blocks.
15w36d Each command block type now appears with different colors on maps.
16w02a Running /help in a command block will now randomly use one of various different humorous phrases as the previous output.
16w04a Running "Searge" as the command in the command block without a preceding "/" will now set the previous output to "#itzlipofutzli".
1.11 16w32a The block entity ID is changed from Control to command_block.
開発中
1.12 17w16a Chains of command blocks no longer schedule their commands to be run in the next tick, they 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.
Pocket Edition
1.0.5 build 1 Added all types of command blocks.

Issues[編集 | ソースを編集]

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

脚注[編集 | ソースを編集]

  1. https://twitter.com/jeb_/status/228829830731427840
  2. https://bugs.mojang.com/browse/MC-80671?focusedCommentId=228546&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-228546